mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 19:40:02 -04:00
Some Updates
This commit is contained in:
parent
823205a70d
commit
608881debc
256 changed files with 1658 additions and 32348 deletions
128
app.js
128
app.js
|
@ -1,102 +1,86 @@
|
|||
/* -----------------------------------------------
|
||||
* Authors: QuiteAFancyEmerald, YÖCTDÖNALD'S, BinBashBanana (OlyB), SexyDuceDuce
|
||||
* Additional help from Divide
|
||||
* Authors: QuiteAFancyEmerald, BinBashBanana (OlyB), YÖCTDÖNALD'S
|
||||
* Additional help from Divide and SexyDuceDuce
|
||||
* MIT license: http://opensource.org/licenses/MIT
|
||||
* ----------------------------------------------- */
|
||||
const
|
||||
char_insert = require('./src/charinsert.js'),
|
||||
alloy = require('./src/alloyproxy'),
|
||||
path = require('path'),
|
||||
config = require('./config.json'),
|
||||
fs = require('fs'),
|
||||
http = require('http'),
|
||||
express = require('express'),
|
||||
app = express(),
|
||||
port = process.env.PORT || config.port,
|
||||
server = http.createServer(app);
|
||||
char_insert = require('./src/charinsert.js'),
|
||||
path = require('path'),
|
||||
config = require('./config.json'),
|
||||
fs = require('fs'),
|
||||
http = require('http'),
|
||||
express = require('express'),
|
||||
app = express(),
|
||||
port = process.env.PORT || config.port,
|
||||
server = http.createServer(app);
|
||||
|
||||
btoa = (str) => {
|
||||
return new Buffer.from(str).toString('base64');
|
||||
return new Buffer.from(str).toString('base64');
|
||||
}
|
||||
|
||||
atob = (str) => {
|
||||
return new Buffer.from(str, 'base64').toString('utf-8');
|
||||
return new Buffer.from(str, 'base64').toString('utf-8');
|
||||
}
|
||||
|
||||
const text404 = fs.readFileSync(path.normalize(__dirname + '/views/404.html'), 'utf8'),
|
||||
siteIndex = 'index.html',
|
||||
pages = {
|
||||
/* Main */
|
||||
'in': 'info.html',
|
||||
'faq': 'faq.html',
|
||||
'status': 'status.html',
|
||||
'j': 'hidden.html',
|
||||
's': 'pages/frame.html',
|
||||
'z': 'pages/surf.html',
|
||||
'c': 'pages/nav/credits.html',
|
||||
'x': 'pages/nav/bookmarklets.html',
|
||||
'i': 'pages/nav/icons.html',
|
||||
't': 'pages/nav/terms.html',
|
||||
/* Games */
|
||||
'g': 'pages/nav/gtools.html',
|
||||
'h': 'pages/nav/games5.html',
|
||||
'el': 'pages/nav/emulators.html',
|
||||
'f': 'pages/nav/flash.html',
|
||||
/* Proxies */
|
||||
'a': 'pages/proxnav/alloy.html',
|
||||
'w': 'pages/proxnav/womginx.html',
|
||||
'p': 'pages/proxnav/pmprox.html',
|
||||
'e': 'pages/proxnav/pydodge.html',
|
||||
'y': 'pages/proxnav/youtube.html',
|
||||
'd': 'pages/proxnav/discordhub.html',
|
||||
/* Ruffle and Webretro */
|
||||
'fg': 'archive/gfiles/flash/index.html',
|
||||
'eg': 'archive/gfiles/rarch/index.html'
|
||||
},
|
||||
/* Randomize Keywords */
|
||||
cookingInserts = [
|
||||
"This is a cool example cooking sentence.",
|
||||
"I wish I could boil hot water. Try to fill this sentence with a lot of cooking related keywords."
|
||||
],
|
||||
vegetables = ['Beet', 'Potato'],
|
||||
charrandom = ['­','‌'];
|
||||
const text404 = fs.readFileSync(path.normalize(__dirname + '/views/404.html'), 'utf8'),
|
||||
siteIndex = 'index.html',
|
||||
pages = {
|
||||
/* Main */
|
||||
'in': 'info.html',
|
||||
'faq': 'faq.html',
|
||||
'j': 'hidden.html',
|
||||
's': 'pages/frame.html',
|
||||
'z': 'pages/surf.html',
|
||||
'c': 'pages/nav/credits.html',
|
||||
'x': 'pages/nav/bookmarklets.html',
|
||||
'i': 'pages/nav/icons.html',
|
||||
't': 'pages/nav/terms.html',
|
||||
/* Games */
|
||||
'g': 'pages/nav/gtools.html',
|
||||
'h': 'pages/nav/games5.html',
|
||||
'el': 'pages/nav/emulators.html',
|
||||
'f': 'pages/nav/flash.html',
|
||||
/* Proxies */
|
||||
'a': 'pages/proxnav/alloy.html',
|
||||
'w': 'pages/proxnav/womginx.html',
|
||||
'p': 'pages/proxnav/pmprox.html',
|
||||
'e': 'pages/proxnav/pydodge.html',
|
||||
'y': 'pages/proxnav/youtube.html',
|
||||
'd': 'pages/proxnav/discordhub.html',
|
||||
/* Ruffle and Webretro */
|
||||
'fg': 'archive/gfiles/flash/index.html',
|
||||
'eg': 'archive/gfiles/rarch/index.html'
|
||||
},
|
||||
/* Randomize Keywords */
|
||||
cookingInserts = [
|
||||
"This is a cool example cooking sentence.",
|
||||
"I wish I could boil hot water. Try to fill this sentence with a lot of cooking related keywords."
|
||||
],
|
||||
vegetables = ['Beet', 'Potato'],
|
||||
charrandom = ['­', '‌'];
|
||||
|
||||
function randomListItem(lis) {
|
||||
return lis[Math.floor(Math.random() * lis.length)];
|
||||
return lis[Math.floor(Math.random() * lis.length)];
|
||||
}
|
||||
|
||||
function insertCharset(str) {
|
||||
return str.replace(/­|​|<wbr>/g, randomListItem(charrandom));
|
||||
return str.replace(/­|​|<wbr>/g, randomListItem(charrandom));
|
||||
}
|
||||
|
||||
function insertCooking(str) {
|
||||
return str.replace(/<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->/g, '<span style="display: none;" data-cooking="' + randomListItem(vegetables) + '" data-ingredients="' + randomListItem(vegetables) + '">' + randomListItem(cookingInserts) + '</span>');
|
||||
return str.replace(/<!-- IMPORTANT-HUCOOKINGINSERT-DONOTDELETE -->/g, '<span style="display: none;" data-cooking="' + randomListItem(vegetables) + '" data-ingredients="' + randomListItem(vegetables) + '">' + randomListItem(cookingInserts) + '</span>');
|
||||
}
|
||||
|
||||
function tryReadFile(file) {
|
||||
return fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : text404;
|
||||
return fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : text404;
|
||||
}
|
||||
|
||||
// Local Alloy Proxy
|
||||
const localAlloy = new alloy({
|
||||
prefix: '/fetch/',
|
||||
error: (proxy) => { proxy.res.send(tryReadFile(path.normalize(__dirname + '/views/error.html')).replace('%ERR%', proxy.error.info.message.replace(/<|>/g, ''))); },
|
||||
request: [],
|
||||
response: [],
|
||||
injection: true
|
||||
});
|
||||
|
||||
app.use(localAlloy.app);
|
||||
localAlloy.ws(server);
|
||||
|
||||
// Querystring navigation
|
||||
/* Querystring Navigation */
|
||||
app.get('/', async(req, res) => res.send(insertCooking(insertCharset(tryReadFile(path.normalize(__dirname + '/views/' + (['/', '/?'].includes(req.url) ? siteIndex : pages[Object.keys(req.query)[0]])))))));
|
||||
|
||||
// Static files served
|
||||
/* Static Files Served */
|
||||
app.use(char_insert.static(path.normalize(__dirname + '/views')));
|
||||
|
||||
// 404 Page
|
||||
app.use((req, res) => res.status(404, res.send(insertCooking(text404))));
|
||||
|
||||
server.listen(port);
|
||||
console.log('Public distribution of Holy Unblocker available on port ' + port + '!');
|
||||
console.log('Public distribution of Holy Unblocker available on port ' + port + '!');
|
Loading…
Add table
Add a link
Reference in a new issue