Skip to content

Commit

Permalink
code cleanup + troubleshooting tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
NoobishSVK committed Feb 3, 2023
1 parent ccae672 commit 6256cbe
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 31 deletions.
16 changes: 16 additions & 0 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 💻 Troubleshooting
Having issues? Here you can find the most common issues and a way to get rid of them.

## Errors inside the app

**Q: I can't see my specs on Discord**
A: Check your **Activity Privacy** in your Discord app.

**Q: I am getting a timeout error**
A: Try to restart both Discord and DiscordSpecsRP.

**Q: My specs are incorrect, what do I do?**
A: You can either edit the values.js file or contact us with your HW specs and we will try to do our best to fix it in the next release.

## Other errors
Getting other errors? Please post them in the Issues tab and we will try to resolve them together.
14 changes: 10 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,20 @@ const appVersion = "1.1.4";

const cpuPromise = new Promise((resolve, reject) => {
si.cpu(function(data) {
cpuModel = Object.entries(replaceValues).reduce((acc, [key, value]) => acc.replace(key, value), data.brand);
cpuFrequency = Object.entries(replaceValues).reduce((acc, [key, value]) => acc.replace(key, value), data.speedMax.toFixed(1));
cpuModel = Object.entries(replaceValues)
.reduce((acc, [key, value]) => acc.replace(key, value), data.brand);

cpuFrequency = Object.entries(replaceValues)
.reduce((acc, [key, value]) => acc.replace(key, value), data.speedMax.toFixed(1));

resolve(data.manufacturer + " " +cpuModel + " @ " + cpuFrequency + " GHz");
});
});

const gpuPromise = new Promise((resolve, reject) => {
si.graphics(function(data) {
resolve(Object.entries(replaceValues).reduce((acc, [key, value]) => acc.replace(key, value), data.controllers[0].model));
resolve(Object.entries(replaceValues)
.reduce((acc, [key, value]) => acc.replace(key, value), data.controllers[0].model));
});
});

Expand All @@ -54,7 +59,8 @@ const ramPromise = new Promise((resolve, reject) => {

const osPromise = new Promise((resolve, reject) => {
si.osInfo(function(data) {
resolve(data.distro + data.arch.replace('x86', '[32-bit]')
resolve(data.distro + data.arch
.replace('x86', '[32-bit]')
.replace('x64', ' [64-bit]')
.replace('arm64', ' [ARM 64-bit]'));
});
Expand Down
27 changes: 0 additions & 27 deletions values.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,6 @@ const replaceValues = {
'Graphics': '',
'& Display': '',
'AMD': '',
// Motherboards
'Apple': '',
'Micro-Star': 'MSi',
'ASUSTeK': 'ASUS',
'COMPUTER INC.': '',
'Gigabyte Technology Co., Ltd.': 'Gigabyte',
'MSi International Co., Ltd': 'MSi',
// Drives
'Samsung': '',
'SAMSUNG': '',
'KINGSTON': '',
'WDC': '',
'ATA Device': '',
'USB Device': '',
'SanDisk': '',
'SANDISK': '',
'APPLE': '',
// Network adapters
'Gigabit': '',
'Ethernet':'',
'Controller':'',
'Connection': '',
'PCIe': '',
'Family': '',
'Network': '',
'Wireless': '',
'Version': ''
};

module.exports = replaceValues;

0 comments on commit 6256cbe

Please sign in to comment.