Comparing version 1.0.6 to 1.0.7
@@ -0,7 +1,9 @@ | ||
import { Discord } from "./Discord"; | ||
import * as Downloader from "./ModDownloader"; | ||
import * as Database from "./database"; | ||
import * as Downloader from "./ModDownloader"; | ||
import { Discord } from "./Discord"; | ||
export declare class ModHook { | ||
jsTemplateLocation: string; | ||
readonly discord: Discord; | ||
readonly downloader: typeof Downloader; | ||
constructor(jsTemplateLocation?: string); | ||
getProfiles(): Promise<Database.Profile[]>; | ||
@@ -8,0 +10,0 @@ getProfile(id: string): Promise<Database.Profile>; |
@@ -25,12 +25,20 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ModHook = void 0; | ||
const util = __importStar(require("./util")); | ||
const Database = __importStar(require("./database")); | ||
const path_1 = __importDefault(require("path")); | ||
const Discord_1 = require("./Discord"); | ||
const LibModHook = __importStar(require("./LibModHook")); | ||
const Downloader = __importStar(require("./ModDownloader")); | ||
const Discord_1 = require("./Discord"); | ||
const Database = __importStar(require("./database")); | ||
const util = __importStar(require("./util")); | ||
class ModHook { | ||
jsTemplateLocation; | ||
discord = new Discord_1.Discord(); | ||
downloader = Downloader; | ||
constructor(jsTemplateLocation = path_1.default.resolve(__dirname, "../resource.template.js")) { | ||
this.jsTemplateLocation = jsTemplateLocation; | ||
} | ||
getProfiles() { | ||
@@ -44,3 +52,3 @@ return Database.getProfiles(); | ||
const profile = await Database.addProfile(options); | ||
await util.buildProfile(profile.id); | ||
await util.buildProfile(profile.id, this.jsTemplateLocation); | ||
return profile; | ||
@@ -50,3 +58,3 @@ } | ||
await Database.updateProfile(profile); | ||
await util.buildProfile(profile.id); | ||
await util.buildProfile(profile.id, this.jsTemplateLocation); | ||
return profile; | ||
@@ -60,3 +68,3 @@ } | ||
if (rebuild) | ||
await util.buildProfile(profile.id); | ||
await util.buildProfile(profile.id, this.jsTemplateLocation); | ||
LibModHook.hookDiscord({ | ||
@@ -63,0 +71,0 @@ pathToDiscordExecutable: discordPath, |
import * as Database from './database'; | ||
export declare const getProfileDist: (id: string) => string; | ||
export declare function makeTemplateHeader(profile: Database.Profile): string; | ||
export declare function buildProfile(id: string): Promise<void>; | ||
export declare function buildProfile(id: string, jsTemplateLocation: string): Promise<void>; |
@@ -34,3 +34,2 @@ "use strict"; | ||
const Database = __importStar(require("./database")); | ||
const jsTemplatePath = path_1.default.resolve(__dirname, '../resource.template.js'); | ||
const profileDist = ensureDir(path_1.default.resolve('profiles')); | ||
@@ -64,3 +63,3 @@ const profileTmpDir = ensureDir(path_1.default.resolve('tmp')); | ||
} | ||
async function buildProfile(id) { | ||
async function buildProfile(id, jsTemplateLocation) { | ||
const profile = await Database.getProfile(id); | ||
@@ -77,3 +76,3 @@ const tmpDir = getTmpDir(profile.name); | ||
fs_1.default.writeFileSync(path_1.default.resolve(tmpDir, 'package.json'), JSON.stringify({ name: "Discord", main: "index.js" })); | ||
const template = fs_1.default.readFileSync(jsTemplatePath, 'utf8'); | ||
const template = fs_1.default.readFileSync(jsTemplateLocation, 'utf8'); | ||
fs_1.default.writeFileSync(path_1.default.resolve(tmpDir, 'index.js'), makeTemplateHeader(profile) + template); | ||
@@ -80,0 +79,0 @@ // Create the ASAR |
{ | ||
"name": "modhook", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Memory Injection of Mods for Discord", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
101030
484