2023-12-04 14:19:08 -06:00
|
|
|
"use strict";var Yn=Object.create;var Te=Object.defineProperty;var Xn=Object.getOwnPropertyDescriptor;var Jn=Object.getOwnPropertyNames;var Qn=Object.getPrototypeOf,qn=Object.prototype.hasOwnProperty;var O=(e,n)=>()=>(e&&(n=e(e=0)),n);var Ye=(e,n)=>{for(var t in n)Te(e,t,{get:n[t],enumerable:!0})},$n=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of Jn(n))!qn.call(e,i)&&i!==t&&Te(e,i,{get:()=>n[i],enumerable:!(r=Xn(n,i))||r.enumerable});return e};var et=(e,n,t)=>(t=e!=null?Yn(Qn(e)):{},$n(n||!e||!e.__esModule?Te(t,"default",{value:e,enumerable:!0}):t,e));var u=O(()=>{"use strict"});var te,xe=O(()=>{u();te="6573c47"});var B,Ee=O(()=>{u();B="Vendicated/Vencord"});var Xe,Je=O(()=>{"use strict";u();xe();Ee();Xe=`Vencord/${te}${B?` (https://github.com/${B})`:""}`});var le=O(()=>{"use strict";u()});function H(e,n={}){return new Promise((t,r)=>{Qe.default.get(e,n,i=>{let{statusCode:o,statusMessage:a,headers:s}=i;if(o>=400)return void r(`${o}: ${a} - ${e}`);if(o>=300)return void t(H(s.location,n));let c=[];i.on("error",r),i.on("data",f=>c.push(f)),i.once("end",()=>t(Buffer.concat(c)))})})}var Qe,De=O(()=>{"use strict";u();Qe=et(require("https"))});function re(e){return async function(){try{return{ok:!0,value:await e(...arguments)}}catch(n){return{ok:!1,error:n instanceof Error?{...n}:n}}}}var qe,$e=O(()=>{"use strict";u();qe=["vencordDesktopMain.js","vencordDesktopPreload.js","vencordDesktopRenderer.js","vencordDesktopRenderer.css"]});var it={};async function rn(e){return H(nt+e,{headers:{Accept:"application/vnd.github+json","User-Agent":Xe}})}async function tt(){if(!await an())return[];let n=await rn(`/compare/${te}...HEAD`);return JSON.parse(n.toString("utf-8")).commits.map(r=>({hash:r.sha.slice(0,7),author:r.author.login,message:r.commit.message}))}async function an(){let e=await rn("/releases/latest"),n=JSON.parse(e.toString());return n.name.slice(n.name.lastIndexOf(" ")+1)===te?!1:(n.assets.forEach(({name:r,browser_download_url:i})=>{qe.some(o=>r.startsWith(o))&&Re.push([r,i])}),!0)}async function rt(){return await Promise.all(Re.map(async([e,n])=>(0,nn.writeFile)((0,tn.join)(__dirname,e),await H(n)))),Re=[],!0}var ie,nn,tn,nt,Re,on=O(()=>{"use strict";u();Je();le();ie=require("electron"),nn=require("fs/promises"),tn=require("path");xe();Ee();De();$e();nt=`https://api.github.com/repos/${B}`,Re=[];ie.ipcMain.handle("VencordGetRepo",re(()=>`https://github.com/${B}`));ie.ipcMain.handle("VencordGetUpdates",re(tt));ie.ipcMain.handle("VencordUpdate",re(an));ie.ipcMain.handle("VencordBuild",re(rt))});u();var Z=require("electron"),Bn=require("path");u();u();Promise.resolve().then(()=>on());u();le();var ke=require("electron");u();var cn={};u();var sn=require("electron");sn.app.on("browser-window-created",(e,n)=>{n.webContents.on("frame-created",(t,{frame:r})=>{r.once("dom-ready",()=>{if(r.url.startsWith("https://open.spotify.com/embed/")){let i=he().plugins?.FixSpotifyEmbeds;if(!i?.enabled)return;r.executeJavaScript(`
|
2023-12-04 14:19:08 -06:00
|
|
|
`).replace(ut,"@");return r[i]=o.trim(),delete r[""],Pe(n,r)}u();var dn=require("electron"),_=require("path"),ge=process.env.VENCORD_USER_DATA_DIR??(process.env.DISCORD_USER_DATA_DIR?(0,_.join)(process.env.DISCORD_USER_DATA_DIR,"..","VencordData"):(0,_.join)(dn.app.getPath("userData"),"..","Vencord")),se=(0,_.join)(ge,"settings"),L=(0,_.join)(ge,"themes"),pe=(0,_.join)(se,"quickCss.css"),Ue=(0,_.join)(se,"settings.json"),An=["https:","http:","steam:","spotify:","com.epicgames.launcher:"];u();var Cn=require("electron");function yn(e){e.webContents.setWindowOpenHandler(({url:n})=>{switch(n){case"about:blank":case"https://discord.com/popout":case"https://ptb.discord.com/popout":case"https://canary.discord.com/popout":return{action:"allow"}}try{var{protocol:t}=new URL(n)}catch{return{action:"deny"}}switch(t){case"http:":case"https:":case"mailto:":case"steam:":case"spotify:":Cn.shell.openExternal(n)}return{action:"deny"}})}(0,Y.mkdirSync)(se,{recursive:!0});(0,Y.mkdirSync)(L,{recursive:!0});function Oe(e,n){let t=(0,b.normalize)(e),r=(0,b.join)(e,n),i=(0,b.normalize)(r);return i.startsWith(t)?i:null}function ft(){return(0,R.readFile)(pe,"utf-8").catch(()=>"")}async function lt(){let e=await(0,R.readdir)(L).catch(()=>[]),n=[];for(let t of e){if(!t.endsWith(".css"))continue;let r=await wn(t).then(mn).catch(()=>null);r!=null&&n.push(In(r,t))}return n}function wn(e){e=e.replace(/\?v=\d+$/,"");let n=Oe(L,e);return n?(0,R.readFile)(n,"utf-8"):Promise.reject(`Unsafe path ${e}`)}function Sn(){try{return(0,Y.readFileSync)(Ue,"utf-8")}catch{return"{}"}}function he(){try{return JSON.parse(Sn())}catch{return{}}}v.ipcMain.handle("VencordOpenQuickCss",()=>v.shell.openPath(pe));v.ipcMain.handle("VencordOpenExternal",(e,n)=>{try{var{protocol:t}=new URL(n)}catch{throw"Malformed URL"}if(!An.includes(t))throw"Disallowed protocol.";v.shell.openExternal(n)});var ht=new oe,gt=new oe;v.ipcMain.handle("VencordGetQuickCss",()=>ft());v.ipcMain.handle("VencordSetQuickCss",(e,n)=>ht.push(()=>(0,R.writeFile)(pe,n)));v.ipcMain.handle("VencordGetThemesDir",()=>L);v.ipcMain.handle("VencordGetThemesList",()=>lt());v.ipcMain.handle("VencordGetThemeData",(e,n)=>wn(n));v.ipcMain.handle("VencordGetThemeSystemValues",()=>({"os-accent-color":`#${v.systemPreferences.getAccentColor?.()||""}`}));v.ipcMain.handle("VencordGetSettingsDir",()=>se);v.ipcMain.on("VencordGetSettings",e=>e.returnValue=Sn());v.ipcMain.handle("VencordSetSettings",(e,n)=>{gt.push(()=>(0,R.writeFile)(Ue,n))});v.ipcMain.handle("VencordOpenMonacoEditor",async()=>{let e=new v.BrowserWindow({title:"Vencord QuickCSS Editor",autoHideMenuBar:!0,darkTheme:!0,webPreferences:{preload:(0,b.join)(__dirname,"vencordDesktopPreload.js"),contextIsolation:!0,nodeIntegration:!1,sandbox:!1}});yn(e),await e.loadURL(`data:text/html;base64,${vn}`)});u();var Fn=require("electron");u();var En=require("module"),pt=(0,En.createRequire)("/"),me,vt=";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{me=pt("worker_threads").Worker}catch{}var mt=me?function(e,n,t,r,i){var o=!1,a=new me(e+vt,{eval:!0}).on("error",function(s){return i(s,null)}).on("message",function(s){return i(null,s)}).on("exit",function(s){s&&!o&&i(new Error("exited with code "+s),null)});return a.postMessage(t,r),a.terminate=function(){return o=!0,me.prototype.terminate.call(a)},a}:function(e,n,t,r,i){setImmediate(function(){return i(new Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null)});var o=function(){};return{terminate:o,postMessage:o}},A=Uint8Array,V=Uint16Array,Me=Uint32Array,_e=new A([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Le=new A([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Dn=new A([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rn=function(e,n){for(var t=new V(31),r=0;r<31;++r)t[r]=n+=1<<e[r-1];for(var i=new Me(t[30]),r=1;r<30;++r)for(var o=t[r];o<t[r+1];++o)i[o]=o-t[r]<<5|r;re
|