From 2bc4785d4790c23fb1730cdd7e5b415a68b029b3 Mon Sep 17 00:00:00 2001 From: QuiteAFancyEmerald Date: Thu, 12 Nov 2020 03:26:09 +0000 Subject: [PATCH] Updated Alloy Proxy --- .gitignore | 1 + app.js | 20 ++++++++++++--- config.json | 3 +-- public/expr/surf.js | 14 +++++----- charinsert.js => src/charinsert.js | 0 src/util.js | 41 ------------------------------ 6 files changed, 25 insertions(+), 54 deletions(-) rename charinsert.js => src/charinsert.js (100%) delete mode 100644 src/util.js diff --git a/.gitignore b/.gitignore index dfe87f7c..c9e988c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .gitpod.yml +package-lock.json diff --git a/app.js b/app.js index 2b072666..a372a6cf 100644 --- a/app.js +++ b/app.js @@ -5,6 +5,7 @@ const express = require('express'), + alloy = require('alloyproxy'), app = express(), http = require('http'), fs = require('fs'), @@ -14,11 +15,20 @@ const const config = JSON.parse(fs.readFileSync('./config.json', { encoding: 'utf8' })); + +const server = http.createServer(app); -let server; +//Local Alloy Proxy +const unblocker = new alloy({ + prefix: '/fetch/', + request: [], + response: [], + injection: true, +}); -server = http.createServer(app); -server.listen(process.env.PORT || config.port); +app.use(unblocker.app); + +unblocker.ws(server); app.post('/', async(req, res) => { switch (req.url) { @@ -30,4 +40,6 @@ app.post('/', async(req, res) => { //Querystrings app.get('/', async(req, res, t) => res.send(fs.readFileSync(path.join(__dirname, 'public', 'pages,index.html,info.html,archive,archive,hidden.html'.split(',')['/,/?in,/?fg,/?rr,/?j'.split(',').indexOf(req.url) + 1], ',surf.html,f.html,run.html,frames,redirects3,proxnav5,nav7'.replace(/,[^,]+/g, e => ([] + e.match(/\D+/)).repeat(+e.match(/\d+/) + 1)).split(',')[t = 'z,fg,rr,k,dd,n,yh,ym,a,b,y,e,d,p,c,f,g,h,i,m,t,x'.split(',').indexOf(req.url.slice(2)) + 1], (t = ',,,,krunker,discordprox,chatbox,ythub,ytmobile,alloy,node,youtube,pydodge,discordhub,pmprox,credits,flash,gtools,games5,icons,gba,terms,bookmarklets'.split(',')[t]) && t + '.html'), 'utf8'))); -app.use(char_insert.static(path.join(__dirname, 'public'))); \ No newline at end of file +app.use(char_insert.static(path.join(__dirname, 'public'))); + +server.listen(process.env.PORT || config.port); \ No newline at end of file diff --git a/config.json b/config.json index 67524245..494f9c59 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,3 @@ { - "port": "8080", - "ssl": false + "port": "8080" } \ No newline at end of file diff --git a/public/expr/surf.js b/public/expr/surf.js index 3e4693c5..4a2d3d98 100644 --- a/public/expr/surf.js +++ b/public/expr/surf.js @@ -12,7 +12,7 @@ $('al').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(url) - frame.src = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + frame.src = "https://" + domain + "/fetch/" + origin; frame.style['visibility'] = "visible"; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; @@ -23,7 +23,7 @@ $('albp').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(url) - window.location.href = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + window.location.href = "https://" + domain + "/fetch/" + origin; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; }; @@ -107,7 +107,7 @@ $('ytbtn').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(yt) - frame.src = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + frame.src = "https://" + domain + "/fetch/" + origin; frame.style['visibility'] = "visible"; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; @@ -118,7 +118,7 @@ $('ytbtnm').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(yt) - frame.src = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + frame.src = "https://" + domain + "/fetch/" + origin; frame.style['visibility'] = "visible"; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; @@ -129,7 +129,7 @@ $('ytbp').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(yt) - window.location.href = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + window.location.href = "https://" + domain + "/fetch/" + origin; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; }; @@ -140,7 +140,7 @@ $('dbtn').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(d) - frame.src = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + frame.src = "https://" + domain + "/fetch/" + origin; frame.style['visibility'] = "visible"; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; @@ -151,7 +151,7 @@ $('dbp').onclick = function() { var det = document.domain; var domain = det.replace('www.', '').split(/[/?#]/)[0]; const origin = btoa(d) - window.location.href = "https://cdn." + domain + "/fetch/utils/?url=" + origin; + window.location.href = "https://" + domain + "/fetch/" + origin; document.cookie = 'oldsmobile=badcar; expires=' + (Date.now() + 259200) + '; SameSite=Lax; domain=.' + auth + '; path=/; Secure;'; return false; }; diff --git a/charinsert.js b/src/charinsert.js similarity index 100% rename from charinsert.js rename to src/charinsert.js diff --git a/src/util.js b/src/util.js deleted file mode 100644 index 5324ca4e..00000000 --- a/src/util.js +++ /dev/null @@ -1,41 +0,0 @@ -var GameboyJS; -(function (GameboyJS) { -"use strict"; - -// Utility functions -var Util = { - // Add to the first argument the properties of all other arguments - extend: function(target /*, source1, source2, etc. */) { - var sources = Array.prototype.slice.call(arguments); - for (var i in sources) { - var source = sources[i]; - for (var name in source) { - target[name] = source[name]; - } - } - - return target; - }, - testFlag: function(p, cc) { - var test=1; - var mask=0x10; - if (cc=='NZ'||cc=='NC') test=0; - if (cc=='NZ'||cc=='Z') mask=0x80; - return (test && p.r.F&mask) || (!test && !(p.r.F&mask)); - }, - getRegAddr: function(p, r1, r2) {return Util.makeword(p.r[r1], p.r[r2]);}, - - // make a 16 bits word from 2 bytes - makeword: function(b1, b2) {return (b1 << 8) + b2;}, - - // return the integer signed value of a given byte - getSignedValue: function(v) {return v & 0x80 ? v-256 : v;}, - - // extract a bit from a byte - readBit: function(byte, index) { - return (byte >> index) & 1; - } -}; - -GameboyJS.Util = Util; -}(GameboyJS || (GameboyJS = {})));