[Various] Minor general source cleanup
This commit is contained in:
parent
c1b6fc2a97
commit
9bf21e63d1
9 changed files with 18 additions and 18 deletions
|
@ -1,7 +1,7 @@
|
|||
const { releaseChannel } = require('./utils/buildInfo');
|
||||
const settings = require('./appSettings').getSettings();
|
||||
|
||||
const titleCase = (s) => s[0].toUpperCase() + s.slice(1);
|
||||
const titleCase = s => s[0].toUpperCase() + s.slice(1);
|
||||
|
||||
const appNameSuffix = releaseChannel === 'stable' ? '' : titleCase(releaseChannel);
|
||||
const APP_NAME = 'Discord' + appNameSuffix;
|
||||
|
|
|
@ -21,9 +21,9 @@ module.exports = async () => { // (Try) update asar
|
|||
const downloadSuccess = await new Promise((res) => {
|
||||
const file = fs.createWriteStream(downloadPath);
|
||||
|
||||
let writeError = false;
|
||||
file.on('error', err => {
|
||||
log('AsarUpdate', 'Failed to write', err);
|
||||
let writeError;
|
||||
file.on('error', e => {
|
||||
log('AsarUpdate', 'Failed to write', e);
|
||||
file.close();
|
||||
|
||||
writeError = true;
|
||||
|
|
|
@ -9,7 +9,7 @@ module.exports = () => {
|
|||
|
||||
const installDir = paths.getInstallPath();
|
||||
|
||||
const nextRes = join(installDir, fs.readdirSync(installDir).reverse().find((x) => x.startsWith('app-1')), 'resources');
|
||||
const nextRes = join(installDir, fs.readdirSync(installDir).reverse().find(x => x.startsWith('app-1')), 'resources');
|
||||
const next = join(nextRes, 'app.asar');
|
||||
const backup = join(nextRes, 'app.asar.backup');
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Stub (Darwin)
|
||||
exports.install = (c) => c();
|
||||
exports.update = (c) => c();
|
||||
exports.uninstall = (c) => c();
|
||||
exports.isInstalled = (c) => c(false);
|
||||
exports.install = c => c();
|
||||
exports.update = c => c();
|
||||
exports.uninstall = c => c();
|
||||
exports.isInstalled = c => c(false);
|
|
@ -32,7 +32,7 @@ const open = exports.open = () => {
|
|||
settings.save(); // Ensure saving
|
||||
});
|
||||
|
||||
ipcMain.on('cg', (e) => {
|
||||
ipcMain.on('cg', e => {
|
||||
e.returnValue = config;
|
||||
});
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only)
|
|||
add('installing-module-progress', progressCallback(installs));
|
||||
|
||||
|
||||
add('update-manually', (e) => {
|
||||
add('update-manually', e => {
|
||||
splashState.newVersion = e.newVersion;
|
||||
sendState('update-manually');
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@ const events = require('events');
|
|||
|
||||
const { get } = require('request');
|
||||
|
||||
const vParse = (s) => s.split('.').map((x) => parseInt(x));
|
||||
const vParse = s => s.split('.').map(x => parseInt(x));
|
||||
const vNewer = (a, b) => a.some((x, i) => x === b[i] ? undefined : (x > b[i]));
|
||||
|
||||
class HostLinux extends events.EventEmitter {
|
||||
|
|
|
@ -80,7 +80,7 @@ exports.init = (endpoint, _settings, { releaseChannel, version }) => {
|
|||
|
||||
hostUpdater.on('update-not-available', hostPassed);
|
||||
|
||||
hostUpdater.on('update-manually', (v) => {
|
||||
hostUpdater.on('update-manually', v => {
|
||||
log('Modules', 'Host manual');
|
||||
checking = false;
|
||||
|
||||
|
@ -260,7 +260,7 @@ const installModule = async (name, ver, path) => {
|
|||
|
||||
let hasError;
|
||||
|
||||
const handleErr = (e) => {
|
||||
const handleErr = e => {
|
||||
if (hasError) return;
|
||||
hasError = true;
|
||||
|
||||
|
@ -276,7 +276,7 @@ const installModule = async (name, ver, path) => {
|
|||
const total = await new Promise((res) => {
|
||||
const p = execFile('unzip', ['-l', path]);
|
||||
|
||||
p.stdout.on('data', (x) => {
|
||||
p.stdout.on('data', x => {
|
||||
const m = x.toString().match(/([0-9]+) files/);
|
||||
if (m) res(parseInt(m[1]));
|
||||
});
|
||||
|
@ -300,8 +300,8 @@ const installModule = async (name, ver, path) => {
|
|||
proc.stderr.on('data', handleErr);
|
||||
|
||||
let cur = 0;
|
||||
proc.stdout.on('data', (x) => x.toString().split('\n').forEach((x) => {
|
||||
if (!x.includes('inflating')) return;
|
||||
proc.stdout.on('data', x => x.toString().split('\n').forEach(y => {
|
||||
if (!y.includes('inflating')) return;
|
||||
|
||||
cur++;
|
||||
const progress = Math.min(100, Math.floor(cur / total * 100));
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
// For Module Updater: get root path for all modules in globalPaths
|
||||
|
||||
const g = require('module').globalPaths;
|
||||
module.exports = (n, e = '') => require(require('path').join(g.find((x) => x.includes(n)) ?? g[0], n, e));
|
||||
module.exports = (n, e = '') => require(require('path').join(g.find(x => x.includes(n)) ?? g[0], n, e));
|
Loading…
Reference in a new issue