dotfiles/vesktop/vencordDist/vencordDesktopPreload.js.map
2024-03-22 12:55:56 -05:00

8 lines
9.2 KiB
Plaintext

{
"version": 3,
"sources": ["../src/shared/debounce.ts", "../src/preload.ts", "../src/VencordNative.ts"],
"sourcesContent": ["/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\n/**\n * Returns a new function that will call the wrapped function\n * after the specified delay. If the function is called again\n * within the delay, the timer will be reset.\n * @param func The function to wrap\n * @param delay The delay in milliseconds\n */\nexport function debounce<T extends Function>(func: T, delay = 300): T {\n let timeout: NodeJS.Timeout;\n return function (...args: any[]) {\n clearTimeout(timeout);\n timeout = setTimeout(() => { func(...args); }, delay);\n } as any;\n}\n", "/*\n * Vencord, a modification for Discord's desktop app\n * Copyright (c) 2022 Vendicated and contributors\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <https://www.gnu.org/licenses/>.\n*/\n\nimport { debounce } from \"@shared/debounce\";\nimport { contextBridge, webFrame } from \"electron\";\nimport { readFileSync, watch } from \"fs\";\nimport { join } from \"path\";\n\nimport VencordNative from \"./VencordNative\";\n\ncontextBridge.exposeInMainWorld(\"VencordNative\", VencordNative);\n\n// Discord\nif (location.protocol !== \"data:\") {\n // #region cssInsert\n const rendererCss = join(__dirname, IS_VESKTOP ? \"vencordDesktopRenderer.css\" : \"renderer.css\");\n\n const style = document.createElement(\"style\");\n style.id = \"vencord-css-core\";\n style.textContent = readFileSync(rendererCss, \"utf-8\");\n\n if (document.readyState === \"complete\") {\n document.documentElement.appendChild(style);\n } else {\n document.addEventListener(\"DOMContentLoaded\", () => document.documentElement.appendChild(style), {\n once: true\n });\n }\n\n if (IS_DEV) {\n // persistent means keep process running if watcher is the only thing still running\n // which we obviously don't want\n watch(rendererCss, { persistent: false }, () => {\n document.getElementById(\"vencord-css-core\")!.textContent = readFileSync(rendererCss, \"utf-8\");\n });\n }\n // #endregion\n\n if (IS_DISCORD_DESKTOP) {\n webFrame.executeJavaScript(readFileSync(join(__dirname, \"renderer.js\"), \"utf-8\"));\n require(process.env.DISCORD_PRELOAD!);\n }\n} // Monaco popout\nelse {\n contextBridge.exposeInMainWorld(\"setCss\", debounce(VencordNative.quickCss.set));\n contextBridge.exposeInMainWorld(\"getCurrentCss\", VencordNative.quickCss.get);\n // shrug\n contextBridge.exposeInMainWorld(\"getTheme\", () => \"vs-dark\");\n}\n", "/*\n * Vencord, a Discord client mod\n * Copyright (c) 2023 Vendicated and contributors\n * SPDX-License-Identifier: GPL-3.0-or-later\n */\n\nimport { PluginIpcMappings } from \"@main/ipcPlugins\";\nimport type { UserThemeHeader } from \"@main/themes\";\nimport { IpcEvents } from \"@shared/IpcEvents\";\nimport { IpcRes } from \"@utils/types\";\nimport type { Settings } from \"api/Settings\";\nimport { ipcRenderer } from \"electron\";\n\nfunction invoke<T = any>(event: IpcEvents, ...args: any[]) {\n return ipcRenderer.invoke(event, ...args) as Promise<T>;\n}\n\nexport function sendSync<T = any>(event: IpcEvents, ...args: any[]) {\n return ipcRenderer.sendSync(event, ...args) as T;\n}\n\nconst PluginHelpers = {} as Record<string, Record<string, (...args: any[]) => Promise<any>>>;\nconst pluginIpcMap = sendSync<PluginIpcMappings>(IpcEvents.GET_PLUGIN_IPC_METHOD_MAP);\n\nfor (const [plugin, methods] of Object.entries(pluginIpcMap)) {\n const map = PluginHelpers[plugin] = {};\n for (const [methodName, method] of Object.entries(methods)) {\n map[methodName] = (...args: any[]) => invoke(method as IpcEvents, ...args);\n }\n}\n\nexport default {\n themes: {\n uploadTheme: (fileName: string, fileData: string) => invoke<void>(IpcEvents.UPLOAD_THEME, fileName, fileData),\n deleteTheme: (fileName: string) => invoke<void>(IpcEvents.DELETE_THEME, fileName),\n getThemesDir: () => invoke<string>(IpcEvents.GET_THEMES_DIR),\n getThemesList: () => invoke<Array<UserThemeHeader>>(IpcEvents.GET_THEMES_LIST),\n getThemeData: (fileName: string) => invoke<string | undefined>(IpcEvents.GET_THEME_DATA, fileName),\n getSystemValues: () => invoke<Record<string, string>>(IpcEvents.GET_THEME_SYSTEM_VALUES),\n },\n\n updater: {\n getUpdates: () => invoke<IpcRes<Record<\"hash\" | \"author\" | \"message\", string>[]>>(IpcEvents.GET_UPDATES),\n update: () => invoke<IpcRes<boolean>>(IpcEvents.UPDATE),\n rebuild: () => invoke<IpcRes<boolean>>(IpcEvents.BUILD),\n getRepo: () => invoke<IpcRes<string>>(IpcEvents.GET_REPO),\n },\n\n settings: {\n get: () => sendSync<Settings>(IpcEvents.GET_SETTINGS),\n set: (settings: Settings, pathToNotify?: string) => invoke<void>(IpcEvents.SET_SETTINGS, settings, pathToNotify),\n getSettingsDir: () => invoke<string>(IpcEvents.GET_SETTINGS_DIR),\n },\n\n quickCss: {\n get: () => invoke<string>(IpcEvents.GET_QUICK_CSS),\n set: (css: string) => invoke<void>(IpcEvents.SET_QUICK_CSS, css),\n\n addChangeListener(cb: (newCss: string) => void) {\n ipcRenderer.on(IpcEvents.QUICK_CSS_UPDATE, (_, css) => cb(css));\n },\n\n addThemeChangeListener(cb: () => void) {\n ipcRenderer.on(IpcEvents.THEME_UPDATE, () => cb());\n },\n\n openFile: () => invoke<void>(IpcEvents.OPEN_QUICKCSS),\n openEditor: () => invoke<void>(IpcEvents.OPEN_MONACO_EDITOR),\n },\n\n native: {\n getVersions: () => process.versions as Partial<NodeJS.ProcessVersions>,\n openExternal: (url: string) => invoke<void>(IpcEvents.OPEN_EXTERNAL, url)\n },\n\n pluginHelpers: PluginHelpers\n};\n"],
"mappings": ";;;;aAyBO,SAASA,EAA6BC,EAASC,EAAQ,IAAQ,CAClE,IAAIC,EACJ,OAAO,YAAaC,EAAa,CAC7B,aAAaD,CAAO,EACpBA,EAAU,WAAW,IAAM,CAAEF,EAAK,GAAGG,CAAI,CAAG,EAAGF,CAAK,CACxD,CACJ,CCZA,IAAAG,EAAwC,oBACxCC,EAAoC,cACpCC,EAAqB,gBCVrB,IAAAC,EAA4B,oBAE5B,SAASC,EAAgBC,KAAqBC,EAAa,CACvD,OAAO,cAAY,OAAOD,EAAO,GAAGC,CAAI,CAC5C,CAEO,SAASC,EAAkBF,KAAqBC,EAAa,CAChE,OAAO,cAAY,SAASD,EAAO,GAAGC,CAAI,CAC9C,CAEA,IAAME,EAAgB,CAAC,EACjBC,EAAeF,gCAA+D,EAEpF,OAAW,CAACG,EAAQC,CAAO,IAAK,OAAO,QAAQF,CAAY,EAAG,CAC1D,IAAMG,EAAMJ,EAAcE,GAAU,CAAC,EACrC,OAAW,CAACG,EAAYC,CAAM,IAAK,OAAO,QAAQH,CAAO,EACrDC,EAAIC,GAAc,IAAIP,IAAgBF,EAAOU,EAAqB,GAAGR,CAAI,CAEjF,CAEA,IAAOS,EAAQ,CACX,OAAQ,CACJ,YAAa,CAACC,EAAkBC,IAAqBb,uBAAqCY,EAAUC,CAAQ,EAC5G,YAAcD,GAAqBZ,uBAAqCY,CAAQ,EAChF,aAAc,IAAMZ,uBAAuC,EAC3D,cAAe,IAAMA,wBAAwD,EAC7E,aAAeY,GAAqBZ,wBAAqDY,CAAQ,EACjG,gBAAiB,IAAMZ,+BAAgE,CAC3F,EAEA,QAAS,CACL,WAAY,IAAMA,qBAAqF,EACvG,OAAQ,IAAMA,iBAAwC,EACtD,QAAS,IAAMA,gBAAuC,EACtD,QAAS,IAAMA,kBAAyC,CAC5D,EAEA,SAAU,CACN,IAAK,IAAMG,sBAAyC,EACpD,IAAK,CAACW,EAAoBC,IAA0Bf,uBAAqCc,EAAUC,CAAY,EAC/G,eAAgB,IAAMf,yBAAyC,CACnE,EAEA,SAAU,CACN,IAAK,IAAMA,sBAAsC,EACjD,IAAMgB,GAAgBhB,uBAAsCgB,CAAG,EAE/D,kBAAkBC,EAA8B,CAC5C,cAAY,2BAA+B,CAACC,EAAGF,IAAQC,EAAGD,CAAG,CAAC,CAClE,EAEA,uBAAuBC,EAAgB,CACnC,cAAY,wBAA2B,IAAMA,EAAG,CAAC,CACrD,EAEA,SAAU,IAAMjB,uBAAoC,EACpD,WAAY,IAAMA,2BAAyC,CAC/D,EAEA,OAAQ,CACJ,YAAa,IAAM,QAAQ,SAC3B,aAAemB,GAAgBnB,wBAAsCmB,CAAG,CAC5E,EAEA,cAAef,CACnB,EDnDA,gBAAc,kBAAkB,gBAAiBgB,CAAa,EAG9D,GAAI,SAAS,WAAa,QAAS,CAE/B,IAAMC,KAAc,QAAK,UAAwB,4BAA6C,EAExFC,EAAQ,SAAS,cAAc,OAAO,EAC5CA,EAAM,GAAK,mBACXA,EAAM,eAAc,gBAAaD,EAAa,OAAO,EAEjD,SAAS,aAAe,WACxB,SAAS,gBAAgB,YAAYC,CAAK,EAE1C,SAAS,iBAAiB,mBAAoB,IAAM,SAAS,gBAAgB,YAAYA,CAAK,EAAG,CAC7F,KAAM,EACV,CAAC,CAgBT,MAEI,gBAAc,kBAAkB,SAAUC,EAASH,EAAc,SAAS,GAAG,CAAC,EAC9E,gBAAc,kBAAkB,gBAAiBA,EAAc,SAAS,GAAG,EAE3E,gBAAc,kBAAkB,WAAY,IAAM,SAAS",
"names": ["debounce", "func", "delay", "timeout", "args", "import_electron", "import_fs", "import_path", "import_electron", "invoke", "event", "args", "sendSync", "PluginHelpers", "pluginIpcMap", "plugin", "methods", "map", "methodName", "method", "VencordNative_default", "fileName", "fileData", "settings", "pathToNotify", "css", "cb", "_", "url", "VencordNative_default", "rendererCss", "style", "debounce"]
}