diff --git a/main.js b/main.js index 0b97d8d..c07a9df 100644 --- a/main.js +++ b/main.js @@ -41,7 +41,7 @@ function createWindow() { var appIcon = new Tray(iconformat); mainWindow.webContents.userAgent = - "Mozilla/5.0 (X12; FreeBSD x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.15 Chrome/83.0.4103.122 Electron/9.3.5 Safari/537.36"; //fake useragent mainWindow.loadFile("index.html"); mainWindow.focus(); mainWindow.webContents.on("new-window", function (e, url) { diff --git a/package-lock.json b/package-lock.json index ad38f14..101821d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,11 @@ { - "name": "armcord", + "name": "ArmCord", "version": "2.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { + "name": "ArmCord", "version": "2.5.0", "license": "MIT", "dependencies": { diff --git a/settings.json b/settings.json index 6765a73..c791259 100644 --- a/settings.json +++ b/settings.json @@ -1,3 +1,3 @@ { - "channel": "foss" + "channel": "stable" } \ No newline at end of file diff --git a/utils/plugins/duckmod/.github/FUNDING.yml b/utils/plugins/duckmod/.github/FUNDING.yml new file mode 100644 index 0000000..87da9df --- /dev/null +++ b/utils/plugins/duckmod/.github/FUNDING.yml @@ -0,0 +1 @@ +github: CanadaHonk diff --git a/utils/plugins/duckmod/.gitignore b/utils/plugins/duckmod/.gitignore new file mode 100644 index 0000000..44ce34d --- /dev/null +++ b/utils/plugins/duckmod/.gitignore @@ -0,0 +1 @@ +web-ext-artifacts diff --git a/utils/plugins/goosemod/LICENSE b/utils/plugins/duckmod/LICENSE similarity index 96% rename from utils/plugins/goosemod/LICENSE rename to utils/plugins/duckmod/LICENSE index 7d37c87..12635df 100644 --- a/utils/plugins/goosemod/LICENSE +++ b/utils/plugins/duckmod/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 AAGaming00 +Copyright (c) 2021 GooseMod Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/utils/plugins/duckmod/README.md b/utils/plugins/duckmod/README.md new file mode 100644 index 0000000..9d5816f --- /dev/null +++ b/utils/plugins/duckmod/README.md @@ -0,0 +1,17 @@ +

+ + + +GooseMod for Web +

+ +

+Get GooseMod for Web for Firefox +Get GooseMod for Web for Chromium +

+ +*** + +

+A light, secure, and easy to use Discord mod; now in your browser. +

diff --git a/utils/plugins/duckmod/background.js b/utils/plugins/duckmod/background.js new file mode 100644 index 0000000..c450a8f --- /dev/null +++ b/utils/plugins/duckmod/background.js @@ -0,0 +1,32 @@ +const cspAllowAll = [ + 'connect-src', + 'style-src', + 'img-src', + 'font-src' +]; + +chrome.webRequest.onHeadersReceived.addListener(({ responseHeaders, url }) => { + let csp = responseHeaders.find((x) => x.name === 'content-security-policy'); + + if (csp) { + for (let p of cspAllowAll) { + csp.value = csp.value.replace(`${p}`, `${p} * blob: data:`); // * does not include data: URIs + } + + // Fix Discord's broken CSP which disallows unsafe-inline due to having a nonce (which they don't even use?) + csp.value = csp.value.replace(/'nonce-.*?' /, ''); + } + + return { + responseHeaders + }; +}, + + { + urls: [ + '*://*.discord.com/*' + ] + }, + + ['blocking', 'responseHeaders'] +); diff --git a/utils/plugins/duckmod/content.js b/utils/plugins/duckmod/content.js new file mode 100644 index 0000000..a6b3016 --- /dev/null +++ b/utils/plugins/duckmod/content.js @@ -0,0 +1,49 @@ +const inject = async () => { + console.log('[GooseMod for Web] Injecting...'); + + // Re-define localStorage as Discord removes it + function getLocalStoragePropertyDescriptor() { + const frame = document.createElement('frame'); + frame.src = 'about:blank'; + + document.body.appendChild(frame); + + let r = Object.getOwnPropertyDescriptor(frame.contentWindow, 'localStorage'); + + frame.remove(); + + return r; + } + + Object.defineProperty(window, 'localStorage', getLocalStoragePropertyDescriptor()); + + console.log('[GooseMod for Web] Redefined localStorage'); + + const branchURLs = { + 'release': 'https://api.goosemod.com/inject.js', + 'dev': 'https://updates.goosemod.com/guapi/goosemod/dev' + }; + + const branch = localStorage.getItem('goosemodUntetheredBranch') || 'release'; + + console.log('[GooseMod for Web] Branch =', branch); + console.log('[GooseMod for Web] JS Url =', branchURLs[branch]); + + const js = await (await fetch(branchURLs[branch])).text(); // JSON.parse(localStorage.getItem('goosemodCoreJSCache')); + + const el = document.createElement('script'); + + el.appendChild(document.createTextNode(js)); + + document.body.appendChild(el); + + console.log('[GooseMod for Web] Injected fetched JS'); +}; + +// Delay actual injection to fix FF issues + +let el = document.createElement('script'); + +el.appendChild(document.createTextNode(`(${inject.toString()})()`)); + +document.body.appendChild(el); \ No newline at end of file diff --git a/utils/plugins/duckmod/icons/128.png b/utils/plugins/duckmod/icons/128.png new file mode 100644 index 0000000..f705203 Binary files /dev/null and b/utils/plugins/duckmod/icons/128.png differ diff --git a/utils/plugins/duckmod/icons/48.png b/utils/plugins/duckmod/icons/48.png new file mode 100644 index 0000000..98739b8 Binary files /dev/null and b/utils/plugins/duckmod/icons/48.png differ diff --git a/utils/plugins/duckmod/icons/96.png b/utils/plugins/duckmod/icons/96.png new file mode 100644 index 0000000..1d3a3b0 Binary files /dev/null and b/utils/plugins/duckmod/icons/96.png differ diff --git a/utils/plugins/duckmod/manifest.json b/utils/plugins/duckmod/manifest.json new file mode 100644 index 0000000..55820d3 --- /dev/null +++ b/utils/plugins/duckmod/manifest.json @@ -0,0 +1,42 @@ +{ + "name": "GooseMod for Web", + "description": "A light, secure, and easy to use Discord mod; now in your browser.", + + "version": "1.1.0", + + "author": "GooseMod Team", + "homepage_url": "https://goosemod.com", + + "icons": { + "48": "icons/48.png", + "96": "icons/96.png", + "128": "icons/128.png" + }, + + "background": { + "scripts": [ + "background.js" + ] + }, + + "content_scripts": [ + { + "matches": ["*://*.discord.com/*"], + "js": ["content.js"] + } + ], + + "permissions": [ + "webRequest", + "webRequestBlocking", + "*://*.discord.com/*" + ], + + "manifest_version": 2, + + "browser_specific_settings": { + "gecko": { + "id": "invalid@goosemod.com" + } + } +} diff --git a/utils/plugins/goosemod/CSP.js b/utils/plugins/goosemod/CSP.js deleted file mode 100644 index 19dc3d5..0000000 --- a/utils/plugins/goosemod/CSP.js +++ /dev/null @@ -1,21 +0,0 @@ -chrome.webRequest.onHeadersReceived.addListener((h) => { - h.responseHeaders.forEach((e, i) => { - if (e.name.toLowerCase() === 'content-security-policy') { - e.value = '' - } - }) - return {responseHeaders: h.responseHeaders} -}, {urls: ["*://*.discord.com/*"]}, -['blocking', 'responseHeaders'] -) - -const corsAllowUrls = [ - 'https://github.com/GooseMod/GooseMod/releases/download/dev/index.js', - 'https://github-releases.githubusercontent.com/' - ]; - -if (corsAllowUrls.some((x) => url.startsWith(x))) { - responseHeaders['access-control-allow-origin'] = ['*']; - } -//psst stolen from https://raw.githubusercontent.com/Goose-Nest/GooseUpdate/main/branches/goosemod/patch.js -//dont tell anyone :troll: diff --git a/utils/plugins/goosemod/gm.js b/utils/plugins/goosemod/gm.js deleted file mode 100644 index 6c2049e..0000000 --- a/utils/plugins/goosemod/gm.js +++ /dev/null @@ -1,5 +0,0 @@ -const scr = document.createElement('script'); - -scr.src = 'https://goosemod-api.netlify.app/untethered/untetheredInject.js'; - -document.head.appendChild(scr); \ No newline at end of file diff --git a/utils/plugins/goosemod/manifest.json b/utils/plugins/goosemod/manifest.json deleted file mode 100644 index f073a57..0000000 --- a/utils/plugins/goosemod/manifest.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "GooseMod", - "version": "1.0", - "author": "AAGaming00", - "description": "Loads GooseMod, a discord client modification", - "background": { - "scripts": [ - "CSP.js" - ] - }, - "content_scripts": [ - { - "matches": ["*://*.discord.com/*"], - "js": ["gm.js"] - } - ], - "permissions": [ - "webRequest", - "webRequestBlocking", - "*://*.discord.com/*" - ], - "manifest_version": 2 -} \ No newline at end of file