From 0f6896bb9905bf64eea303f74603da0afc587939 Mon Sep 17 00:00:00 2001
From: Russell2259 <84256826+Russell2259@users.noreply.github.com>
Date: Mon, 4 Dec 2023 21:29:37 -0700
Subject: [PATCH] sync
---
config.js | 2 +-
pages/404.html | 15 +++++++----
server/utils/rewriter.js | 12 +++++----
static/apps.html | 4 +++
static/assets/css/main.css | 48 +----------------------------------
static/assets/css/nav.css | 1 +
static/assets/css/view.css | 29 +++++++++++++++++++++
static/cheats.html | 4 +++
static/games.html | 4 +++
static/index.html | 2 ++
static/privacy.html | 4 ++-
static/search.html | 4 +++
static/tos.html | 38 +++++++++++++++-------------
static/view.html | 28 ++++++++------------
templates/development.html | 4 +--
templates/navbar.html | 52 +-------------------------------------
templates/sidebar.html | 49 +++++++++++++++++++++++++++++++++++
17 files changed, 153 insertions(+), 147 deletions(-)
create mode 100644 static/assets/css/view.css
create mode 100644 templates/sidebar.html
diff --git a/config.js b/config.js
index bcd0056..57c1a30 100644
--- a/config.js
+++ b/config.js
@@ -3,5 +3,5 @@ export default {
mode: 'dev',
minify: true,
assetScrambling: true,
- allowDangerousTemplateInsert: false
+ allowDangerousTemplateInsert: true
};
\ No newline at end of file
diff --git a/pages/404.html b/pages/404.html
index f868356..3024870 100644
--- a/pages/404.html
+++ b/pages/404.html
@@ -2,16 +2,19 @@
-
404
@@ -19,11 +22,13 @@
Looks you found a page that does not exist! Try checking your url for spelling mistakes.
- Or, you can report it in our
discord server.
+ Or, you can report it in our
discord server.
+
+
\ No newline at end of file
diff --git a/server/utils/rewriter.js b/server/utils/rewriter.js
index 24acf77..45dc292 100644
--- a/server/utils/rewriter.js
+++ b/server/utils/rewriter.js
@@ -50,7 +50,7 @@ const html = (data) => {
for (let i = 0; i < dom.window.document.documentElement.querySelectorAll('script').length; i++) {
const script = dom.window.document.documentElement.querySelectorAll('script')[i];
- if (script.src.startsWith('/') && !script.src.startsWith('//')) script.setAttribute('src', `/asset/${TokenManager.generate('asset', 20000, {
+ if (script.src.startsWith('/') && !script.src.startsWith('//') && fs.existsSync(path.join(__dirname, '../static', script.src))) script.setAttribute('src', `/asset/${TokenManager.generate('asset', 20000, {
asset: path.join(__dirname, '../static', script.src),
type: 'application/javascript'
}).token}`);
@@ -59,7 +59,7 @@ const html = (data) => {
for (let i = 0; i < dom.window.document.documentElement.querySelectorAll('link[rel="stylesheet"]').length; i++) {
const css = dom.window.document.documentElement.querySelectorAll('link[rel="stylesheet"]')[i];
- if (css.href.startsWith('/') && !css.href.startsWith('//')) css.setAttribute('href', `/asset/${TokenManager.generate('asset', 20000, {
+ if (css.href.startsWith('/') && !css.href.startsWith('//') && fs.existsSync(path.join(__dirname, '../static', css.href))) css.setAttribute('href', `/asset/${TokenManager.generate('asset', 20000, {
asset: path.join(__dirname, '../static', css.href),
type: 'text/css'
}).token}`);
@@ -68,7 +68,7 @@ const html = (data) => {
for (let i = 0; i < dom.window.document.documentElement.querySelectorAll('img').length; i++) {
const img = dom.window.document.documentElement.querySelectorAll('img')[i];
- if (img.src.startsWith('/') && !img.src.startsWith('//')) img.setAttribute('src', `/asset/${TokenManager.generate('asset', 20000, {
+ if (img.src.startsWith('/') && !img.src.startsWith('//') && fs.existsSync(path.join(__dirname, '../static', img.src))) img.setAttribute('src', `/asset/${TokenManager.generate('asset', 20000, {
asset: path.join(__dirname, '../static', img.src),
type: mime.getType(path.join(__dirname, '../static', img.src))
}).token}`);
@@ -96,7 +96,8 @@ const javascript = (data) => {
.map(data => data.split(';')[0]
.replaceAll('\'', '')
.replaceAll('`', '')
- .replaceAll('"', ''));
+ .replaceAll('"', ''))
+ .filter(data => fs.existsSync(path.join(__dirname, '../templates', data + '.javascript')));
let javascript = String(data);
@@ -150,7 +151,8 @@ const css = (data) => {
else return false;
}
} else return false;
- });
+ })
+ .filter(data => fs.existsSync(path.join(__dirname, '../templates', data + mime.getExtension(data))));
let css = String(data);
diff --git a/static/apps.html b/static/apps.html
index 3dd1d7b..963ca2d 100644
--- a/static/apps.html
+++ b/static/apps.html
@@ -13,6 +13,7 @@
+