16 lines
23 KiB
JavaScript
16 lines
23 KiB
JavaScript
|
// Vencord 96126fa
|
||
|
// Standalone: true
|
||
|
// Platform: Universal
|
||
|
// Updater disabled: false
|
||
|
"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="96126fa"});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(`
|
||
|
const original = Audio.prototype.play;
|
||
|
Audio.prototype.play = function() {
|
||
|
this.volume = ${i.volume/100||.1};
|
||
|
return original.apply(this, arguments);
|
||
|
}
|
||
|
`)}})})});var Ge={};Ye(Ge,{resolveRedirect:()=>ot});u();var un=require("https"),at=/^https:\/\/(spotify\.link|s\.team)\/.+$/;function fn(e){return new Promise((n,t)=>{let r=(0,un.request)(new URL(e),{method:"HEAD"},i=>{n(i.headers.location?fn(i.headers.location):e)});r.on("error",t),r.end()})}async function ot(e,n){return at.test(n)?fn(n):n}var ze={};Ye(ze,{readRecording:()=>st});u();var ln=require("electron"),hn=require("fs/promises"),ae=require("path");async function st(e,n){n=(0,ae.normalize)(n);let t=(0,ae.basename)(n),r=(0,ae.normalize)(ln.app.getPath("userData")+"/");if(console.log(t,r,n),t!=="recording.ogg"||!n.startsWith(r))return null;try{let i=await(0,hn.readFile)(n);return new Uint8Array(i.buffer)}catch{return null}}var gn={FixSpotifyEmbeds:cn,OpenInApp:Ge,VoiceMessages:ze};var pn={};for(let[e,n]of Object.entries(gn)){let t=Object.entries(n);if(!t.length)continue;let r=pn[e]={};for(let[i,o]of t){let a=`VencordPluginNative_${e}_${i}`;ke.ipcMain.handle(a,o),r[i]=a}}ke.ipcMain.on("VencordGetPluginIpcMethodMap",e=>{e.returnValue=pn});u();le();u();var oe=class{constructor(n=1/0){this.maxSize=n}queue=[];promise;next(){let n=this.queue.shift();n?this.promise=Promise.resolve().then(n).finally(()=>this.next()):this.promise=void 0}run(){this.promise||this.next()}push(n){this.size>=this.maxSize&&this.queue.shift(),this.queue.push(n),this.run()}unshift(n){this.size>=this.maxSize&&this.queue.pop(),this.queue.unshift(n),this.run()}get size(){return this.queue.length}};var v=require("electron"),Y=require("fs"),R=require("fs/promises"),b=require("path");u();var vn="PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KICAgIDxoZWFkPgogICAgICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04IiAvPgogICAgICAgIDx0aXRsZT5WZW5jb3JkIFF1aWNrQ1NTIEVkaXRvcjwvdGl0bGU+CiAgICAgICAgPGxpbmsKICAgICAgICAgICAgcmVsPSJzdHlsZXNoZWV0IgogICAgICAgICAgICBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb25hY28tZWRpdG9yLzAuNDAuMC9taW4vdnMvZWRpdG9yL2VkaXRvci5tYWluLm1pbi5jc3MiCiAgICAgICAgICAgIGludGVncml0eT0ic2hhNTEyLU1Pb1EwMmg4MGhrbGNjZkxyWEZZa0N6RytXVmpPUmZsT3A5WnA4ZGx0aWFSUCszNUxZbk80TEtPa2xSNjRvTUdmR2dKRExPOFdKcGtNMW81Z1pYWVpRPT0iCiAgICAgICAgICAgIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiCiAgICAgICAgICAgIHJlZmVycmVycG9saWN5PSJuby1yZWZlcnJlciIKICAgICAgICAvPgogICAgICAgIDxzdHlsZT4KICAgICAgICAgICAgaHRtbCwKICAgICAgICAgICAgYm9keSwKICAgICAgICAgICAgI2NvbnRhaW5lciB7CiAgICAgICAgICAgICAgICBwb3NpdGlvbjogYWJzb2x1dGU7CiAgICAgICAgICAgICAgICBsZWZ0OiAwOwogICAgICAgICAgICAgICAgdG9wOiAwOwogICAgICAgICAgICAgICAgd2lkdGg6IDEwMCU7CiAgICAgICAgICAgICAgICBoZWlnaHQ6IDEwMCU7CiAgICAgICAgICAgICAgICBtYXJnaW46IDA7CiAgICAgICAgICAgICAgICBwYWRkaW5nOiAwOwogICAgICAgICAgICAgICAgb3ZlcmZsb3c6IGhpZGRlbjsKICAgICAgICAgICAgfQogICAgICAgIDwvc3R5bGU+CiAgICA8L2hlYWQ+CgogICAgPGJvZHk+CiAgICAgICAgPGRpdiBpZD0iY29udGFpbmVyIj48L2Rpdj4KICAgICAgICA8c2NyaXB0CiAgICAgICAgICAgIHNyYz0iaHR0cHM6Ly9jZG5qcy5jbG91ZGZsYXJlLmNvbS9hamF4L2xpYnMvbW9uYWNvLWVkaXRvci8wLjQwLjAvbWluL3ZzL2xvYWRlci5taW4uanMiCiAgICAgICAgICAgIGludGVncml0eT0ic2hhNTEyLVF6TXBYZUNQY2lBSFA0d2JZbFYyUFlnclFjYUVrRFFVanprUFU0eG5qeVZTRDlUMzYvdWRhbXh0TkJxYjRxSzQvYk1RTVBaOGF5ckJlOWhyR2RCRmpRPT0iCiAgICAgICAgICAgIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiCiAgICAgICAgICAgIHJlZmVycmVycG9saWN5PSJuby1yZWZlcnJlciIKICAgICAgICA+PC9zY3JpcHQ+CgogICAgICAgIDxzY3JpcHQ+CiAgICAgICAgICAgIHJlcXVpcmUuY29uZmlnKHsKICAgICAgICAgICAgICAgIHBhdGhzOiB7CiAgICAgICAgICAgICAgICAgICAgdnM6ICJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9tb25hY28tZWRpdG9yLzAuNDAuMC9taW4vdnMiLAogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgfSk7CgogICAgICAgICAgICByZXF1aXJlKFsidnMvZWRpdG9yL2VkaXRvci5tYWluIl0sICgpID0+IHsKICAgICAgICAgICAgICAgIGdldEN1cnJlbnRDc3MoKS50aGVuKChjc3MpID0+IHsKICAgICAgICAgICAgICAgICAgICB2YXIgZWRpdG9yID0gbW9uYWNvLmVkaXRvci5jcmVhdGUoCiAgICAgICAgICAgICAgICAgICAgICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJjb250YWluZXIiKSwKICAgICAgICAgICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGNzcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxhbmd1YWdlOiAiY3NzIiwKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZW1lOiBnZXRUaGVtZSgpLAogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgKTsKICAgICAgICAgICAgICAgICAgICBl
|
||
|
`).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
|
||
|
//# sourceURL=VencordDesktopMain
|
||
|
//# sourceMappingURL=vencord://vencordDesktopMain.js.map
|
||
|
/*! For license information please see vencordDesktopMain.js.LEGAL.txt */
|