|
|
|
@ -131,7 +131,7 @@ async function promptManualPathCompletion (action) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!discordAppPath || !(await confirmExistAndHasPermissions(discordAppPath))) {
|
|
|
|
|
error(`${release}'s app directory couldn't be located and ${responses.action}ion has been cancelled.`);
|
|
|
|
|
error(`${release}'s app directory couldn't be located and ${action}ion has been cancelled.`);
|
|
|
|
|
return promptForRestartOrExit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -179,8 +179,7 @@ async function getDiscordAppPath () {
|
|
|
|
|
* Get the latest version's folder. Then find and return the app directory path.
|
|
|
|
|
*/
|
|
|
|
|
const latestVersionDirectory = discordDirectory.filter(path => path.startsWith('app-')).sort().reverse()[0];
|
|
|
|
|
const discordAppPath = join(discordPath, latestVersionDirectory, 'resources', 'app');
|
|
|
|
|
return discordAppPath;
|
|
|
|
|
return join(discordPath, latestVersionDirectory, 'resources', 'app');
|
|
|
|
|
/**
|
|
|
|
|
* Mac
|
|
|
|
|
*/
|
|
|
|
@ -192,8 +191,7 @@ async function getDiscordAppPath () {
|
|
|
|
|
return promptManualPathCompletion('inject');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const discordAppPath = join(discordPath, 'Contents', 'Resources', 'app');
|
|
|
|
|
return discordAppPath;
|
|
|
|
|
return join(discordPath, 'Contents', 'Resources', 'app');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -228,14 +226,12 @@ async function getDiscordAppPath () {
|
|
|
|
|
return promptManualPathCompletion('inject');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const discordAppPath = join(discordPath, 'resources', 'app');
|
|
|
|
|
return discordAppPath;
|
|
|
|
|
return join(discordPath, 'resources', 'app');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const discordPath = discordProcess[4].split('/');
|
|
|
|
|
discordPath.splice(discordPath.length - 1, 1);
|
|
|
|
|
const discordAppPath = join('/', ...discordPath, 'resources', 'app');
|
|
|
|
|
return discordAppPath;
|
|
|
|
|
return join('/', ...discordPath, 'resources', 'app');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -245,13 +241,13 @@ async function getDiscordAppPath () {
|
|
|
|
|
*/
|
|
|
|
|
function installDependencies () {
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
const command = spawn('npm', [ 'install', '--only=production', '--silent' ], { cwd: join(__dirname, '..', '..', '..'), stdio: 'inherit', shell: true });
|
|
|
|
|
command.on('close', () => {
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
command.on('error', err => {
|
|
|
|
|
reject(err);
|
|
|
|
|
const command = spawn('npm', [ 'install', '--only=production', '--silent' ], {
|
|
|
|
|
cwd: join(__dirname, '..', '..', '..'),
|
|
|
|
|
stdio: 'inherit',
|
|
|
|
|
shell: true
|
|
|
|
|
});
|
|
|
|
|
command.on('close', () => resolve());
|
|
|
|
|
command.on('error', err => reject(err));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -471,8 +467,7 @@ async function startInjectionProcess () {
|
|
|
|
|
choices: wrapChoicesInColor([
|
|
|
|
|
'Discord Stable',
|
|
|
|
|
'Discord PTB',
|
|
|
|
|
'Discord Canary',
|
|
|
|
|
'Discord Development'
|
|
|
|
|
'Discord Canary'
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -484,8 +479,7 @@ async function startInjectionProcess () {
|
|
|
|
|
choices: wrapChoicesInColor([
|
|
|
|
|
'Discord Stable',
|
|
|
|
|
'Discord PTB',
|
|
|
|
|
'Discord Canary',
|
|
|
|
|
'Discord Development'
|
|
|
|
|
'Discord Canary'
|
|
|
|
|
])
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -497,8 +491,7 @@ async function startInjectionProcess () {
|
|
|
|
|
choices: wrapChoicesInColor([
|
|
|
|
|
'Discord Stable',
|
|
|
|
|
'Discord PTB',
|
|
|
|
|
'Discord Canary',
|
|
|
|
|
'Discord Development'
|
|
|
|
|
'Discord Canary'
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
]);
|
|
|
|
@ -519,9 +512,6 @@ async function startInjectionProcess () {
|
|
|
|
|
case release.includes('Canary'):
|
|
|
|
|
release = 'Discord Canary';
|
|
|
|
|
break;
|
|
|
|
|
case release.includes('Development'):
|
|
|
|
|
release = 'Discord Development';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (true) {
|
|
|
|
|
case action.includes('Inject'):
|
|
|
|
|