Skip to content

Commit

Permalink
Add stable 0.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
WorriedArrow committed Nov 28, 2022
1 parent 41658d2 commit 12bd922
Show file tree
Hide file tree
Showing 4 changed files with 648 additions and 0 deletions.
46 changes: 46 additions & 0 deletions index.js
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.");
});
Loading

0 comments on commit 12bd922

Please sign in to comment.