hopefully fix reinjection and make discord path tracking language agnostic

pull/98/head
delta 2 years ago
parent 523739c3f2
commit 6186d01319

@ -1,91 +0,0 @@
{
"editor.tabSize": 2,
"editor.wordWrap": "on",
"todo-tree.regex.regex" : "((//|#|<!--|;|\\*)\\s*($TAGS)|^\\s*- \\[ \\])",
"todo-tree.general.tags": [
"@bug",
"@deprecated",
"@docs",
"@experimental",
"@i18n",
"@note",
"@test",
"@todo",
"@warning"
],
"todo-tree.highlights.defaultHighlight": {
"gutterIcon": true
},
"todo-tree.highlights.customHighlight": {
"@bug": {
"icon": "bug",
"foreground": "#e87000",
"background": "#e87000",
"opacity": 0
},
"@deprecated": {
"icon": "hubot",
"foreground": "#dad24e",
"background": "#dad24e",
"opacity": 0
},
"@docs": {
"icon": "book",
"foreground": "#00d5ff",
"background": "#00d5ff",
"opacity": 0
},
"@experimental": {
"icon": "beaker",
"foreground": "#456aff",
"background": "#456aff",
"opacity": 0
},
"@i18n": {
"icon": "globe",
"foreground": "#46d6af",
"background": "#46d6af",
"opacity": 0
},
"@note": {
"icon": "pencil",
"foreground": "#7842ff",
"background": "#7842ff",
"opacity": 0
},
"@test": {
"icon": "gear",
"foreground": "#ec0ddf",
"background": "#ec0ddf",
"opacity": 0
},
"@todo": {
"icon": "checklist",
"foreground": "#34eb52",
"background": "#34eb52",
"opacity": 0
},
"@warning": {
"icon": "alert",
"foreground": "#da4e4e",
"background": "#da4e4e",
"opacity": 0
}
},
"eslint.codeActionsOnSave.mode": "problems",
"debug.showBreakpointsInOverviewRuler": true,
"editor.rulers": [
{
"column": 90,
"color": "#ffffff08"
}
],
"search.exclude": {
"**/.cache": true,
"**/node_modules": true,
"**/package-lock.json": true
},
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.alwaysShowStatus": true
}

File diff suppressed because one or more lines are too long

3
package-lock.json generated

@ -48,7 +48,8 @@
"remark-gfm": "^1.0.0",
"sass": "^1.42.1",
"sucrase": "^3.20.1",
"tinycolor2": "^1.4.2"
"tinycolor2": "^1.4.2",
"which": "^2.0.2"
},
"devDependencies": {
"chalk": "4.1.2",

@ -96,7 +96,8 @@
"remark-gfm": "^1.0.0",
"sass": "^1.42.1",
"sucrase": "^3.20.1",
"tinycolor2": "^1.4.2"
"tinycolor2": "^1.4.2",
"which": "^2.0.2"
},
"devDependencies": {
"chalk": "4.1.2",

@ -1,13 +1,10 @@
/* eslint-disable no-undef */
const { existsSync, promises: { writeFile, mkdir, access, readdir, rm } } = require('fs');
const { exec: _exec, spawn } = require('child_process');
const { join, posix, sep } = require('path');
const { existsSync, promises: { writeFile, mkdir, access, readdir, rm, realpath } } = require('fs');
const { spawn } = require('child_process');
const { join, posix, sep, dirname } = require('path');
const { prompt } = require('inquirer');
const { promisify } = require('util');
const chalk = require('chalk');
const { platform } = require('os');
const exec = promisify(_exec);
const which = require("which");
let release;
@ -128,10 +125,10 @@ async function promptManualPathCompletion (action) {
} else if (process.platform === 'darwin') {
discordAppPath = join(discordPath, 'Contents', 'Resources', 'app');
} else {
discordAppPath = join(discordPath, 'resources');
discordAppPath = dirname(await realpath(await which(release)));
if (confirmExistAndHasPermissions(discordAppPath)) {
mkdir(discordAppPath);
if (!existsSync(join(discordAppPath, 'app'))) {
mkdir(join(discordAppPath, 'app'));
}
}
@ -202,14 +199,16 @@ async function getDiscordAppPath () {
*/
// eslint-disable-next-line no-else-return
} else {
const discordPath = join('/opt', `${release}`, 'resources');
const discordPath = dirname(await realpath(await which(release)));
if (!discordPath || !(await confirmExistAndHasPermissions(discordPath))) {
error(`Unfortunately, the ${release} directory couldn't be located or you don't have enough permissions to access it.`);
return promptManualPathCompletion('inject');
}
mkdir(join(discordPath, 'app'));
if (!existsSync(join(discordPath, 'app'))) {
mkdir(join(discordPath, 'app'));
}
return join(discordPath, 'app');
}
@ -223,7 +222,7 @@ async function getDiscordAppPath () {
function installDependencies () {
return new Promise((resolve, reject) => {
const command = spawn('npm', [ 'install', '--only=production', '--silent' ], {
cwd: join(__dirname, '..', '..', '..'),
cwd: join(__dirname, '..'),
stdio: 'inherit',
shell: true
});
@ -284,7 +283,7 @@ async function ensureDependencies () {
return info('Dependencies are up-to-date!');
} catch (err) {
error(`An error occured while installing the dependencies:\n${err.message}`);
return process.exit(0);
return process.exit(70);
}
}
@ -409,7 +408,7 @@ async function startInjectionProcess () {
if (process.platform !== 'win32' || process.platform !== 'darwin') {
if (process.getuid() !== 0) {
error(`Vizality installer must be run as root on unix-like systems\nPlease rerun the installer with this command: ${chalk.reset()}node setup:sudo`);
process.exit(77);
process.exit(73);
}
}
@ -419,7 +418,7 @@ async function startInjectionProcess () {
if (process.platform === 'win32') {
if (__dirname.toLowerCase().split(sep).join(posix.sep).includes('/windows/system32')) {
error('It seems Vizality is installed in your System 32 directory. This can create issues and bloat your Windows installation. Please move your Vizality installation to a different directory.');
return process.exit(0);
return process.exit(75);
}
}
@ -429,7 +428,7 @@ async function startInjectionProcess () {
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
if (NODE_MAJOR_VERSION < 14) {
error(`It looks like you're on an outdated version of Node.js. Vizality requires you to run at least Node v14 or later. You can download a newer version here: https://nodejs.org`);
return process.exit(0);
return process.exit(69);
}
/**
@ -494,24 +493,24 @@ async function startInjectionProcess () {
*/
switch (true) {
case release.includes('Stable'):
if (process.platform === 'win32' || process.platform === "darwin") {
if (process.platform === 'win32' || process.platform === 'darwin') {
release = 'Discord';
} else {
release = 'discord'
release = 'discord';
}
break;
case release.includes('PTB'):
if (process.platform === 'win32' || process.platform === "darwin") {
if (process.platform === 'win32' || process.platform === 'darwin') {
release = 'Discord PTB';
} else {
release = 'discord-ptb'
release = 'discord-ptb';
}
break;
case release.includes('Canary'):
if (process.platform === 'win32' || process.platform === "darwin") {
if (process.platform === 'win32' || process.platform === 'darwin') {
release = 'Discord Canary';
} else {
release = 'discord-canary'
release = 'discord-canary';
}
break;
}

Loading…
Cancel
Save