Compare commits

...

10 Commits

Author SHA1 Message Date
Cynthia Foxwell 88dbbdb77f update pluginsrepo, adds update check button 2018-05-22 13:50:02 -06:00
Cynthia Foxwell fdb93d6e2b fix settingsapi since pr removed a lot of thiings 2018-05-22 13:43:14 -06:00
Cynthia Foxwell c4f6fb3fcc guess its good enough to release 2018-05-22 11:30:58 -06:00
Cynthia Foxwell 94240c98fb re-remove unused old func and add =null to pos 2018-05-21 20:27:12 -06:00
Cynthia Foxwell 21075e78d2
Merge pull request #1 from BlockBuilder57/patch-1
Add positions to sections and comment out test section
2018-05-21 20:23:34 -06:00
BlockBuilder57 2b690432db
Add positions to sections and comment out test section
Now you can just put elements wherever you feel like. Also, that test section is good but it being in by default is a bit unwieldy.
2018-05-21 20:01:15 -05:00
Cynthia Foxwell 882e43f939 fix sailboat once again cause i cant code lol fml 2018-05-21 17:53:19 -06:00
Cynthia Foxwell ebd0cbf4b0 fix sailboat so pluginsrepo can parse it correctly 2018-05-21 16:57:08 -06:00
Cynthia Foxwell c121a9c773 fix settingsapi + initial work on pluginsrepo 2018-05-21 15:58:29 -06:00
Cynthia Foxwell 96fa1502ba update and add new plugins 2018-05-21 11:02:05 -06:00
12 changed files with 549 additions and 90 deletions

14
plugins.txt Normal file
View File

@ -0,0 +1,14 @@
beautifuldiscord.js
charcount.js
dblclickedit.js
fixmentions.js
glsandbox.js
guildcount.js
imgxis.js
localstorage.js
notifsound.js
osutyping.js
sailboat.js
settingsapi.js
silenttyping.js
spotifyspoof.js

View File

@ -6,7 +6,7 @@ exports.manifest = {
exports.start = function(){
document.addEventListener("dblclick", ev => {
let target = ev.target;
if(target.className.includes("markup")) {
if(target && target.className && target.className.includes("markup")) {
let msg = target;
let opt = msg.parentNode.querySelector(".btn-option");
opt.click();

View File

@ -1,13 +1,14 @@
exportsexports = {
exports = {
manifest: {
author: "Cynosphere, Adryd",
name: "Mentions Fixer",
description: "See hidden channel mentions and remove #deleted-channel."
description: "See hidden channel mentions and remove #deleted-channel.",
replacements: [
{signature:'/t\\.type===(.+)\\.ChannelTypes\\.GUILD_TEXT&&(.+)\\.default\\.can\\((.+)\\.Permissions\\.VIEW_CHANNEL,n,t\\)/',payload:'true'},
{signature:/"#deleted-channel"/g,payload:'"<#"+e[1]+">"'},
{signature:'/"@deleted-role"/',payload:'"<@&"+e[1]+">"'},
{signature:'/guildId:null!=t\\?t\\.guild_id:null,/',payload:'guildId:null!=t.guild_id?t.guild_id:"@me",'}
]
},
replacements: {
'/t\\.type===(.+)\\.ChannelTypes\\.GUILD_TEXT&&(.+)\\.default\\.can\\((.+)\\.Permissions\\.VIEW_CHANNEL,n,t\\)/':'true',
'/"#deleted-channel"/':'"<#"+e[1]+">"',
'/"@deleted-role"/':'"<@&"+e[1]+">"',
'/guildId:null!=t\\?t\\.guild_id:null,/':'guildId:null!=t.guild_id?t.guild_id:"@me",'
}
}

97
plugins/glsandbox.js Normal file
View File

@ -0,0 +1,97 @@
shwatcher = null, shtag = null, setupShaders = function (n) {
var e = fs.readFileSync(n, "utf-8");
null === shtag && (shtag = document.createElement("script").modify(x=>x.type ="x-shader/x-vertex").withId('shaderCode'), document.head.appendChild(shtag)), shtag.innerHTML = e, null === shwatcher && (shwatcher = fs.watch(n, {
encoding: "utf-8"
}, function (e, w) {
if ("change" === e) {
var i = fs.readFileSync(n, "utf-8");
shtag.innerHTML = i
compile();
}
}))
};
exports = {
manifest: {
author: "Cynosphere",
name: "GLSandboxBG",
description: "GL shaders as a background",
},
start: function(){
createElement('script')
.modify(x=>{
x.type = 'text/javascript';
x.src = 'https://rawgit.com/Cynosphere/42aec2ef76646dc52cff435cc5447f48/raw/36c3c45abee126f8550d3f3fc039b3136ab92c90/glsandbox.js?_='+Date.now();
})
.appendTo(document.head);
createElement('script')
.withId('surfaceVertexShader')
.modify(x=>x.type = 'x-shader/x-vertex')
.withContents(`attribute vec3 position;
attribute vec2 surfacePosAttrib;
varying vec2 surfacePosition;
void main() {
surfacePosition = surfacePosAttrib;
gl_Position = vec4( position, 1.0 );
}`)
.appendTo(document.head);
createElement('script')
.withId('fragmentShader')
.modify(x=>x.type = 'x-shader/x-vertex')
.withContents(`#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 resolution;
uniform sampler2D texture;
void main() {
vec2 uv = gl_FragCoord.xy / resolution.xy;
gl_FragColor = texture2D( texture, uv );
}`)
.appendTo(document.head);
createElement('script')
.withId('vertexShader')
.modify(x=>x.type = 'x-shader/x-vertex')
.withContents(`attribute vec3 position;
void main() {
gl_Position = vec4( position, 1.0 );
}`)
.appendTo(document.head);
createElement('canvas')
.withId("glsandbox")
.modify(x=>{
x.style.height = "100%";
x.style.width = "100%";
x.style.top = 0;
x.style.left = 0;
x.style.position = "absolute";
x.style["z-index"] = 0;
})
.appendTo($('[class^="app-"]'));
$(".app").modify(x=>x.style['z-index']=1);
if(!$api.localStorage.get('glsbbg_firstrun')){
console.log("%c[GLSandboxBG] ","font-weight:bold;background: linear-gradient(to bottom right, #c080ff, #ff80c0);-webkit-background-clip: text;-webkit-text-fill-color: transparent;",`To edit the shader, edit the file located in \`${$api.data}shader.frag\``);
console.log("%c[GLSandboxBG] ","font-weight:bold;background: linear-gradient(to bottom right, #c080ff, #ff80c0);-webkit-background-clip: text;-webkit-text-fill-color: transparent;","If the file doesn't exist, just create it.");
$api.localStorage.set('glsbbg_firstrun',true);
}
if (fs.existsSync($api.data + 'shader.frag'))
setupShaders($api.data + 'shader.frag');
document.addEventListener("ep-ready",_=>{
setTimeout(_=>{
initGLSB();
if (gl) animate();
},500);
});
}
}

View File

@ -91,9 +91,7 @@ exports.start = function(){
function onImageOpen(element) {
let wrap = document.querySelector('div[class*="imageWrapper-"]');
const openOrig = document.querySelectorAll(
'div a[class^="downloadLink-"]'
)[0];
const openOrig = document.querySelectorAll('div a[class*="downloadLink-"]')[0];
openOrig.style.display = "none";
const origLink = openOrig.getAttribute("href");
var menuColors = 10; // how many color buttons to show in the menu
@ -142,11 +140,11 @@ exports.start = function(){
function fixElem(elemToFix) {
if (electron.process.platform == "win32" || electron.process.platform == "darwin") {
menu.style.zIndex = 3003;
menu.style.top = "22px";
menu.style.top = $('[class*="typeWindows-"]').clientHeight+"px";
menu.style.position = "absolute";
menu.style.left = 0;
elemToFix.style.top = "22px";
elemToFix.style.height = "calc(100vh - 22px)";
elemToFix.style.top = $('[class*="typeWindows-"]').clientHeight+"px";
elemToFix.style.height = `calc(100vh - ${$('[class*="typeWindows-"]').clientHeight}px)`;
} else {
elemToFix.style.height = "100vh";
elemToFix.style.top = 0;

View File

@ -2,9 +2,9 @@ exports = {
manifest: {
author: "Cynosphere",
name: "Restore Local Storage",
description: "Restore window.localStorage."
},
replacements: {
'try{delete window.localStorage}catch(e){}':''
description: "Restore window.localStorage.",
replacements: [
{signature:'try{delete window.localStorage}catch(e){}',payload:''}
]
}
}

View File

@ -1,4 +1,4 @@
exportsexports = {
exports = {
manifest: {
author: "Cynosphere, janeptrv",
name: "osu! Typing",
@ -7,9 +7,9 @@ exportsexports = {
start: function(){
var sounds = [];
for (var i = 1; i < 4; i++) {
sounds.push(new Audio(`https://github.com/janeptrv/sounds/blob/master/osu_typing_click${i}.wav?raw=true`));
sounds.push(new Audio(`https://raw.githubusercontent.com/janeptrv/sounds/master/osu_typing_click${i}.wav`));
}
const backspace = new Audio("https://github.com/janeptrv/sounds/blob/master/osu_typing_erase.wav?raw=true");
const backspace = new Audio("https://raw.githubusercontent.com/janeptrv/sounds/master/osu_typing_erase.wav");
var keys = {};
function typingSound(ev) {

View File

@ -1,13 +1,15 @@
exports.manifest = {
author: "Adryd, BlockBuilder57, Cynosphere",
name: "Sailboat",
description: "Login as bot accounts."
}
exports.replacements = {
'/i.default.Store.pauseEmittingChanges\\(\\),t.user.bot/':'false',
'/.\\._reset\\(!0,1e3,"Disconnect requested by user"\\)/':'console.log("delightfully devilish seymour")',
'/\\.experiments;v={},t\\.forEach/':'.experiments;if(t==undefined) return;v={},t.forEach',
'/CONNECTION_OPEN:function\\(e\\){f=e\\.connected/':'CONNECTION_OPEN:function(e){if(e.connectedAccounts==undefined) return; f=e.connected',
'/function S\\(e\\){var t=arguments/':'function S(e){if(e==undefined) return; var t=arguments',
'totalUnavailableGuilds,n=[];':'totalUnavailableGuilds,n=[];if(e.readState==undefined) return;'
exports = {
manifest:{
author: "Adryd, BlockBuilder57, Cynosphere",
name: "Sailboat",
description: "Login as bot accounts.",
replacements: [
{signature:'/i.default.Store.pauseEmittingChanges\\(\\),t.user.bot/',payload:'false'},
{signature:'/.\\._reset\\(!0,1e3,"Disconnect requested by user"\\)/',payload:'console.log("delightfully devilish seymour")'},
{signature:'/\\.experiments;v={},t\\.forEach/',payload:'.experiments;if(t==undefined) return;v={},t.forEach'},
{signature:'/CONNECTION_OPEN:function\\(e\\){f=e\\.connected/',payload:'CONNECTION_OPEN:function(e){if(e.connectedAccounts==undefined) return; f=e.connected'},
{signature:'/function S\\(e\\){var t=arguments/',payload:'function S(e){if(e==undefined) return; var t=arguments'},
{signature:'totalUnavailableGuilds,n=[];',payload:'totalUnavailableGuilds,n=[];if(e.readState==undefined) return;'}
]
}
}

View File

@ -1,76 +1,59 @@
//Stolen from StackOverflow :^)
let convertToText = function(obj) {
var string = [];
if (obj == undefined) {
return String(obj);
} else if (typeof(obj) == "object" && (obj.join == undefined)) {
for (prop in obj) {
if (obj.hasOwnProperty(prop))
string.push(prop + ": " + convertToText(obj[prop]));
};
return "{" + string.join(",") + "}";
} else if (typeof(obj) == "object" && !(obj.join == undefined)) {
for(prop in obj) {
string.push(convertToText(obj[prop]));
}
return "[" + string.join(",") + "]";
} else if (typeof(obj) == "function") {
string.push(obj.toString())
} else {
string.push(JSON.stringify(obj))
}
return string.join(",");
}
exports = {
manifest: {
author: "Cynosphere, BlockBuilder57",
name: "Settings API",
description: "Hijack the settings menu in any way you feel."
},
replacements: {
'/function z\\(\\){return\\[{(.+)}]}/':'window.$settingsapi={sections:[{$1}]};function z(){return window.$settingsapi.sections;}',
description: "Hijack the settings menu in any way you feel.",
replacements: [
{
signature:/section:"logout",onClick:function\(\){(.)\.default\.push\(function\((.)\){return (.)\.createElement\((.)\.default,(.)\((.+),(.)\),(.)\((.)\.default,{size:(.)\.default\.Sizes\.MEDIUM,color:(.)\.default\.Colors\.PRIMARY},void 0,((.)\.default\.Messages\.USER_SETTINGS_CONFIRM_LOGOUT)\)\)}\)}/,
payload:'section:"logout",onClick:window.__fancyDialog=function(data=$6,txt=$12){$1.default.push(function($2){return $3.createElement($4.default,$5(data,$7),$8($9.default,{size:$10.default.Sizes.MEDIUM,color:$11.default.Colors.PRIMARY},void 0,txt))})}'
},
{signature:'/function (.)\\(\\){return\\[{(.+)}]}/',payload:'window.$settingsapi={sections:[{$2}]};function $1(){return window.$settingsapi.sections;}'}
]
},
start: function(){
var buttons = $api.util.findFuncExports('button-', 'colorBlack');
var checkboxes = $api.util.findFuncExports('checkboxEnabled');
var misc = $api.util.findFuncExports('statusRed-', 'inputDefault');
var misc2 = $api.util.findFuncExports('multiInputField');
var misc3 = $api.util.findFuncExports('formText-','formText');
var headers = $api.util.findFuncExports('h5-', 'h5');
var dividers = wc.findFunc('divider-')[0].exports;
var panels = wc.findFunc('flexChild-')[0].exports;
var panels2 = $api.util.findFuncExports('errorMessage-', 'inputWrapper');
let sections = window.$settingsapi.sections;
let dialog = window.__fancyDialog;
delete window.__fancyDialog;
window.$settingsapi = {
sections: sections,
ourSections: [],
_callbacks: {},
_panels: {},
addSection: function(name,label,callback,color){
addSection: function(name,label,color=null,callback,pos=null){
let data = {};
data.section = name || `SAPI_${Math.floor(Math.random()*10000)}`;
data.label = label;
data.color = color || undefined;
data.color = color;
data.element = $api.util.findConstructor('FormSection', 'FormSection').FormSection;
$settingsapi.ourSections.push(data);
$settingsapi.sections.splice($settingsapi.sections.length-4,0,data);
$settingsapi.sections.splice(pos ? pos : $settingsapi.sections.length-4,0,data);
$settingsapi._callbacks[name] = callback;
},
exportSections: function(){
let out = "";
for(i in $settingsapi._sections){
out = out + convertToText($settingsapi._sections[i]);
}
return out;
addDivider: function(){
$settingsapi.ourSections.push({section:"DIVIDER"});
$settingsapi.sections.splice($settingsapi.sections.length-4,0,{section:"DIVIDER"});
},
addHeader: function(label){
$settingsapi.ourSections.push({section:"HEADER",label:label});
$settingsapi.sections.splice($settingsapi.sections.length-4,0,{section:"HEADER",label:label});
},
fancyDialog: dialog,
//All of these allow us to use Discord's elements.
elements: {
createVerticalPanel: function() {
@ -141,7 +124,7 @@ exports = {
)
.withText(text);
},
createInput: function(v) {
createInput: function(v, p) {
return createElement("input")
.withClass(
misc.inputDefault,
@ -149,7 +132,8 @@ exports = {
misc.size16,
'epMargin'
)
.modify(x => x.value = v)
.modify(x => x.value = v ? v : "")
.modify(x => x.placeholder = p ? p : "")
},
updateSwitch: function(s, w) {
if (s.checked) {
@ -181,23 +165,54 @@ exports = {
.modify(x => x.type = 'checkbox')
.modify(x => x.checked = i)
.modify(x => x.onchange = () => {
updateSwitch(s, w);
$settingsapi.elements.updateSwitch(s, w);
c(s.checked);
})
)
$settingsapi.elements.updateSwitch(s, w);
return w;
},
internal:{
panels:panels,
panels2:panels2,
buttons:buttons,
checkboxes:checkboxes,
misc:misc,
misc2:misc2,
misc3:misc3,
headers:headers,
dividers:dividers
}
}
}
//Example settings tab
/*$settingsapi.addSection("TESTING","test owo",function(pnl){
$settingsapi.elements.createH2("Hello World!").appendTo(pnl);
/*$settingsapi.addDivider();
$settingsapi.addHeader("Element Testing");
$settingsapi.addSection("TESTING","Element Test Page",null,function(pnl){
let em = $settingsapi.elements;
em.createH2("Hello World! Heading 2").appendTo(pnl);
em.createH5("Hello World! Heading 5").appendTo(pnl);
em.createButton("Button!").appendTo(pnl);
em.createWarnButton("Warning Button!").appendTo(pnl);
em.createDangerButton("Danger Button!").appendTo(pnl);
em.createInput("","Input Box!").appendTo(pnl);
em.createSwitch().appendTo(pnl);
let v = em.createVerticalPanel().appendTo(pnl);
let h = em.createHorizontalPanel().appendTo(pnl);
em.createH2("Vertical Panel!").appendTo(v);
em.createButton("Beep Boop").appendTo(v);
em.createH2("Horizontal Panel!").appendTo(h);
em.createButton("Boop Beep").appendTo(h);
});*/
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION", function(e){
if ($settingsapi._panels[e.section]) $settingsapi._panels[e.section].remove();
function setupSettings(e){
for(let i in $settingsapi._panels){
$settingsapi._panels[i].remove();
}
for(let i in $settingsapi.ourSections){
let data = $settingsapi.ourSections[i];
@ -212,6 +227,9 @@ exports = {
$settingsapi._callbacks[data.section]($settingsapi._panels[data.section]);
}
}
});
}
$api.events.hook("USER_SETTINGS_MODAL_SET_SECTION",setupSettings);
$api.events.hook("USER_SETTINGS_MODAL_INIT",e=>setTimeout(_=>setupSettings(e),200));
}
}
}

20
plugins/silenttyping.js Normal file
View File

@ -0,0 +1,20 @@
window._silenttyping = false;
exports = {
manifest: {
author:"Cynosphere",
name:"SilentTyping",
description:"Toggleable typing indicators. Toggle with Ctrl+F12",
replacements:[
{signature:/sendTyping:function\((.)\){(.*)}/,payload:"sendTyping:function($1){if(window._silenttyping) return;$2}"}
]
},
start:function(){
document.addEventListener("keydown", function(ev) {
if (ev.ctrlKey && ev.key == "F12") {
window._silenttyping = !window._silenttyping;
$api.ui.fakeMsg(`Your typing indicator is now ${window._silenttyping ? "dis" : "en"}abled`);
}
});
}
}

View File

@ -2,9 +2,9 @@ exports = {
manifest: {
author: "Cynosphere",
name: "Spotify Premium Spoof",
description: "Spoofs premium check and allows listen along without premium."
},
replacements: {
'r.isPremium=n':'r.isPremium=true'
description: "Spoofs premium check and allows listen along without premium.",
replacements: [
{signature:'r.isPremium=n',payload:'r.isPremium=true'}
]
}
}

View File

@ -3,6 +3,315 @@ Plugins Repo Plugin for EndPwn
Made by Cynthia (Cynosphere)
*/
exports.start = function(){
//TODO: All of this
var baseurl = "https://raw.githubusercontent.com/Cynosphere/EndPwnPlugins/master/plugins/";
var internal = {
print: function (str) {
console.log(`%c[PluginsRepo]%c ` + str, 'font-weight:bold;color:#c8f', '');
}
}
exports = {
manifest: {
author: "Cynosphere",
name: "Plugins Repo",
description: "Download plugins.",
_version: 2
},
getInfo: async function(plugin){
var exports = {};
evaluate(await (await fetch(baseurl+plugin+'?_=' + Date.now())).text(), exports);
window._prPluginStore[plugin.replace(".js","")] = exports;
return {id:plugin.replace(".js",""),data:exports.manifest};
},
updateCheck:async function(){
internal.print("Checking for updates...");
var pr = {};
evaluate(await (await fetch(baseurl.replace("plugins/","pluginsrepo.js")+'?_=' + Date.now())).text(), pr);
if(pr && pr.manifest && pr.manifest._version && pr.manifest._version > this.manifest._version){
internal.print("Update avaliable");
$settingsapi.fancyDialog({
header: 'Plugins Repo: Update',
confirmText: 'Yes', cancelText: 'No',
onConfirm: async () => {
fs.writeFileSync($api.data + '/plugins/pluginsrepo.js', await (await fetch(baseurl.replace("plugins/","pluginsrepo.js")+'?_=' + Date.now())).text());
electron.getCurrentWindow().loadURL(window.location.href);
}
},'Plugins Repo has an update, would you like to restart for it to be installed?');
}else{
internal.print("No update avaliable.");
internal.print("Checking plugins for updates...");
internal.print("Fetching plugins...");
window._prTimeout = Date.now()+120;
let plugins = await (await fetch('https://raw.githubusercontent.com/Cynosphere/EndPwnPlugins/master/plugins.txt?_=' + Date.now())).text();
plugins=plugins.split("\n");
var updated = [];
var toUpdate = {};
for(x in plugins){
var d = await this.getInfo(plugins[x]);
var id = d.id;
var data = d.data;
var info = {};
info.name = data.name ? data.name : (id ? id : "<unnamed plugin???>");
info.description = data.description ? data.description : "Manifest is missing for this plugin.";
info.author = data.author ? data.author : "Unknown";
info.loadAfter = data.loadAfter ? data.loadAfter : [];
info.priority = data.priority ? data.priority : 0;
info.replacements = data.replacements ? data.replacements : [];
if(fs.existsSync(`${$api.data}/plugins/${id}.js`)){
var p = fs.readFileSync(`${$api.data}/plugins/${id}.js`).toString().replace(/\r\n/g,"\n").trim();
var np = await (await fetch(baseurl+id+'.js?_=' + Date.now())).text();
np=np.trim();
if(p !== np){
internal.print(`Update found for ${info.name} (${id}).`);
toUpdate[id] = np;
updated.push(`${info.name} (${id})`);
}
}else{
internal.print(`Skipping ${info.name} (${id}), not installed.`);
}
}
}
if(updated.length > 0){
$settingsapi.fancyDialog({
header: 'Plugins Repo: Updated Plugins',
confirmText: 'Yes',
cancelText: 'No',
onConfirm: async () => {
Object.keys(toUpdate).forEach(x=>{
fs.writeFileSync(`${$api.data}/plugins/${x}.js`,toUpdate[x]);
internal.print(`Wrote plugin: ${x}`);
});
internal.print(`Reloading!`);
electron.getCurrentWindow().loadURL(window.location.href);
}
},`The following plugins need to update: ${updated.join(", ")}. Would you like to restart for these plugins to be updated?`,);
}
},
init:async function(){
if(!window.$settingsapi){
internal.print("Asking to install Settings API");
$api.ui.showDialog({
title: 'Plugins Repo: Settings API Installed',
body: 'Settings API was not found, would you like to restart for it to be installed?',
confirmText: 'Yes', cancelText: 'No',
onConfirm: async () => {
fs.writeFileSync($api.data + '/plugins/settingsapi.js', await (await fetch(baseurl+'settingsapi.js?_=' + Date.now())).text());
electron.getCurrentWindow().loadURL(window.location.href);
}
});
return;
}
let em = $settingsapi.elements;
let int = em.internal;
window._prPluginStore = {}
window._prTimeout = 0;
var setupInfo = function(id,data){
var info = {};
info.name = data.name ? data.name : (id ? id : "<unnamed plugin???>");
info.description = data.description ? data.description : "Manifest is missing for this plugin.";
info.author = data.author ? data.author : "Unknown";
info.loadAfter = data.loadAfter ? data.loadAfter : [];
info.priority = data.priority ? data.priority : 0;
info.replacements = data.replacements ? data.replacements : [];
var cont = em.createVerticalPanel();
var head = em.createHorizontalPanel()
.appendTo(cont);
var title = createElement("h3")
.withClass(
int.headers.h3,
int.headers.title,
int.headers.size16,
int.headers.height20,
int.headers.defaultColor
)
.withText(info.name)
.appendTo(head);
em.createH5('By '+info.author)
.appendTo(title);
em.createButton("Download")
.modify(x=>{
if(fs.existsSync(`${$api.data}/plugins/${id}.js`)){
x.disabled = true;
x.className = `${x.className} ${int.buttons.disabled}`;
}else{
x.onclick = async _ => {
internal.print("Downloading Plugin: "+id);
fs.writeFileSync(`${$api.data}/plugins/${id}.js`, await (await fetch(baseurl+id+'.js?_=' + Date.now())).text());
x.disabled = true;
x.className = `${x.className} ${int.buttons.disabled}`;
if(window._prDialogSeen) return;
$api.ui.showDialog({
title: 'New Plugin Installed',
body: 'Would you like to refresh for this plugin to take effect?\nIf you want to get more plugins, click no.',
minorText: 'This message will only show once per session.',
confirmText: 'Yes', cancelText: 'No',
onConfirm: () => {
electron.getCurrentWindow().loadURL(window.location.href);
}
});
window._prDialogSeen = true;
}
}
})
.appendTo(head);
createElement("div")
.withClass(
int.misc3.description,
int.misc3.formText,
int.misc3.modeDefault
)
.withText(info.description)
.appendTo(cont);
var body = em.createHorizontalPanel()
.appendTo(cont);
createElement("div")
.withClass(
int.misc3.description,
int.misc3.formText,
int.misc3.modeDefault
)
.withText(`Replacements: ${info.replacements.length}`)
.appendTo(body);
/*createElement("div")
.withClass(
int.misc3.description,
int.misc3.formText,
int.misc3.modeDefault
)
.modify(x=>x.style.marginLeft = "8px")
.withText(`Priority: ${info.priority}`)
.appendTo(body);
createElement("div")
.withClass(
int.misc3.description,
int.misc3.formText,
int.misc3.modeDefault
)
.modify(x=>x.style.marginLeft = "8px")
.withText(info.loadAfter.length > 0 ? `Depends on: ${info.loadAfter.join(", ")}` : "No dependencies")
.appendTo(body);*/
createElement("div")
.withClass(em.internal.dividers.divider)
.appendTo(cont);
return cont;
}
var settingsPage = async function(pnl){
em.createH2("Plugins Repo")
.appendTo(pnl);
let loading = createElement("div")
.withClass(
int.misc3.description,
int.misc3.formText,
int.misc3.modeDefault
)
.withText(`Loading, please wait...`)
.appendTo(pnl);
var btns = em.createHorizontalPanel()
.appendTo(pnl);
em.createButton("Reload list")
.modify(async x=>{
x.className = `${x.className} ${int.buttons.colorGreen}`;
x.onclick=async ()=>{
if(Date.now() < window._prTimeout){
em.createH5(`Ratelimited, try again in ${Math.floor(window._prTimeout-Date.now())}s.`)
.modify(y=>setTimeout(_=>{y.parentNode.removeChild(y)},2000))
.appendTo(btns);
return;
}
list.purge();
window._prPluginStore = {};
window._prTimeout = Date.now()+120;
internal.print("Fetching plugins...");
let plugins = await (await fetch('https://raw.githubusercontent.com/Cynosphere/EndPwnPlugins/master/plugins.txt?_=' + Date.now())).text();
plugins=plugins.split("\n");
for(x in plugins){
var info = await exports.getInfo(plugins[x]);
setupInfo(info.id,info.data)
.appendTo(list);
}
}
})
.appendTo(btns);
em.createButton("Check for updates")
.modify(async x=>{
x.className = `${x.className} ${int.buttons.colorYellow}`;
x.onclick=async ()=>{
if(Date.now() < window._prTimeout){
em.createH5(`Ratelimited, try again in ${Math.floor(window._prTimeout-Date.now())}s.`)
.modify(y=>setTimeout(_=>{y.parentNode.removeChild(y)},2000))
.appendTo(btns);
return;
}
exports.updateCheck();
}
})
.appendTo(btns);
var list = em.createVerticalPanel()
.appendTo(pnl);
if(Object.keys(_prPluginStore).length <= 0){
internal.print("Fetching plugins...");
window._prTimeout = Date.now()+120;
let plugins = await (await fetch('https://raw.githubusercontent.com/Cynosphere/EndPwnPlugins/master/plugins.txt?_=' + Date.now())).text();
plugins=plugins.split("\n");
loading.modify(x=>x.parentNode.removeChild(x));
for(x in plugins){
var info = await this.getInfo(plugins[x]);
setupInfo(info.id,info.data)
.appendTo(list);
}
}else{
loading.modify(x=>x.parentNode.removeChild(x));
Object.keys(_prPluginStore).forEach(x=>{
info = {id:x,data:_prPluginStore[x].manifest}
setupInfo(info.id,info.data)
.appendTo(list);
});
}
}
$settingsapi.addSection("PluginsRepo","Plugins Repo",null,settingsPage);
},
start:function(){
this.updateCheck();
setTimeout(this.init,200);
}
}