-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41658d2
commit 12bd922
Showing
4 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { readFileSync, writeFileSync } = require("fs"); | ||
const { homedir, platform } = require("os"); | ||
const { join } = require("path"); | ||
const terser = require("terser"); | ||
|
||
let channel = ""; | ||
|
||
if(process.argv.length > 2) { | ||
switch (process.argv[2]) { | ||
case "stable": | ||
channel = ""; | ||
case "ptb": | ||
channel = "ptb"; | ||
case "canary": | ||
channel = "canary"; | ||
case "dev": | ||
channel = "development"; | ||
case "development": | ||
channel = "development"; | ||
default: | ||
channel = ""; | ||
} | ||
} | ||
|
||
let settingsJson; | ||
if(platform == 'win32') { | ||
settingsJson = join(homedir(), 'AppData', 'Roaming', `discord${channel}`, 'settings.json'); | ||
} else if(platform == 'linux') { | ||
settingsJson = join(homedir(), '.config', `discord${channel}`, 'settings.json'); | ||
} else if(platform == 'darwin') { | ||
settingsJson = join(homedir(), 'Library', 'Application Support', `discord${channel}`, 'settings.json'); | ||
} | ||
|
||
let data = JSON.parse(readFileSync(settingsJson).toString()); | ||
console.time("minify"); | ||
terser.minify(readFileSync(join(__dirname, "openloader.js")).toString(), { | ||
keep_classnames: true, | ||
keep_fnames: true, | ||
}).then(minified => { | ||
minified = minified.code; | ||
console.timeEnd("minify"); | ||
data.openasar.js = minified; | ||
console.log(data); | ||
writeFileSync(settingsJson, JSON.stringify(data, undefined, "\t")); | ||
console.log("Done! You can now restart your Discord client.\nFully restart it by right clicking it in the system tray and clicking Quit."); | ||
}); |
Oops, something went wrong.