browser-vm commited on
Commit
ee33590
·
1 Parent(s): bf46f5e

add other files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .env.defaults +2 -0
  2. .eslintignore +3 -0
  3. .eslintrc.cjs +47 -0
  4. .gitignore +8 -0
  5. .gitmodules +3 -0
  6. .prettierignore +3 -0
  7. .vscode/settings.json +11 -0
  8. middleware/Masqr/index.js +73 -0
  9. middleware/catchErrors.js +11 -0
  10. public/favicon.svg +37 -0
  11. public/flash/instantiateFlash.js +33 -0
  12. public/game.css +73 -0
  13. public/icons/canvas.png +0 -0
  14. public/icons/classlink.png +0 -0
  15. public/icons/classroom.png +0 -0
  16. public/icons/clever.jpg +0 -0
  17. public/icons/drive.png +0 -0
  18. public/icons/edgenuity.png +0 -0
  19. public/icons/google.png +0 -0
  20. public/icons/schoology.webp +0 -0
  21. public/icons/youtube.png +0 -0
  22. public/iframe.css +11 -0
  23. public/img/checkmark.svg +3 -0
  24. public/img/games/fullscreen.svg +4 -0
  25. public/img/games/pin-outline.svg +3 -0
  26. public/img/games/pin.svg +3 -0
  27. public/img/nav/backwards.svg +5 -0
  28. public/img/nav/close.svg +3 -0
  29. public/img/nav/forwards.svg +5 -0
  30. public/img/nav/reload.svg +3 -0
  31. public/img/nav/share.svg +15 -0
  32. public/img/search.svg +3 -0
  33. public/marketplace/adblock/banner.png +0 -0
  34. public/marketplace/adblock/icon.png +0 -0
  35. public/marketplace/adblock/index.js +0 -0
  36. public/marketplace/atom-one-dark/logo.png +0 -0
  37. public/marketplace/atom-one-dark/theme.css +9 -0
  38. public/marketplace/dracula-theme/logo.svg +56 -0
  39. public/marketplace/dracula-theme/theme.css +9 -0
  40. public/marketplace/eruda/banner.png +0 -0
  41. public/marketplace/eruda/eruda.js +0 -0
  42. public/marketplace/nord-theme/logo.png +0 -0
  43. public/marketplace/nord-theme/theme.css +9 -0
  44. public/marketplace/oled-theme/theme.css +9 -0
  45. public/marketplace/oled-theme/theme.png +0 -0
  46. public/marketplace/scriptInjector/index.js +1 -0
  47. public/marketplace/synthwave84/logo.png +0 -0
  48. public/marketplace/synthwave84/theme.css +9 -0
  49. public/robots-allow.txt +3 -0
  50. public/robots-deny.txt +2 -0
.env.defaults ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ MASQR_ENABLED=false
2
+ PORT=3000
.eslintignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ node_modules/
2
+ dist/
3
+ public/
.eslintrc.cjs ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ env: {
3
+ node: true,
4
+ es2022: true,
5
+ browser: true,
6
+ },
7
+ extends: ["eslint:recommended", "plugin:astro/recommended"],
8
+ parserOptions: {
9
+ ecmaVersion: "latest",
10
+ sourceType: "module",
11
+ },
12
+ rules: {
13
+ "no-unused-vars": "error",
14
+ "no-undef": "off",
15
+ "prefer-const": "error",
16
+ "no-case-declarations": "off",
17
+ },
18
+ ignorePatterns: ["env.d.ts", "middleware/", "public/"],
19
+ overrides: [
20
+ {
21
+ files: ["*.astro"],
22
+ parser: "astro-eslint-parser",
23
+ parserOptions: {
24
+ parser: "@typescript-eslint/parser",
25
+ extraFileExtensions: [".astro"],
26
+ },
27
+ },
28
+ {
29
+ files: ["*.ts", "*.tsx"],
30
+ parser: "@typescript-eslint/parser",
31
+ parserOptions: {
32
+ project: "./tsconfig.json",
33
+ },
34
+ plugins: ["@typescript-eslint"],
35
+ extends: ["plugin:@typescript-eslint/recommended"],
36
+ rules: {
37
+ "@typescript-eslint/no-explicit-any": "off",
38
+ },
39
+ },
40
+ {
41
+ // Define the configuration for `<script>` tag.
42
+ // Script in `<script>` is assigned a virtual file name with the `.js` extension.
43
+ files: ["**/*.astro/*.js", "*.astro/*.js"],
44
+ parser: "@typescript-eslint/parser",
45
+ },
46
+ ],
47
+ };
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # build output
2
+ dist/
3
+ .astro/
4
+ node_modules/
5
+ npm-debug.log*
6
+ .env
7
+ public/games/**
8
+ exempt_masqr.txt
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "public/games"]
2
+ path = public/games
3
+ url = https://github.com/wearrrrr/alu-games
.prettierignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ dist
2
+ node_modules
3
+ public
.vscode/settings.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "search.exclude": {
3
+ "/public/games/**": true
4
+ },
5
+ "files.exclude": {
6
+ "**/*.rpyc": true,
7
+ "**/*.rpa": true,
8
+ "**/*.rpymc": true,
9
+ "**/cache/": true
10
+ }
11
+ }
middleware/Masqr/index.js ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from "path";
2
+ import fs from "fs";
3
+
4
+ export async function masqrCheck(config) {
5
+ return async (req, res, next) => {
6
+ try {
7
+ const loadedHtmlFile = fs.readFileSync(process.cwd() + "/" + config.htmlFile, "utf8");
8
+ if (config.whitelist.includes(req.hostname)) {
9
+ next();
10
+ return;
11
+ }
12
+ const authheader = req.headers.authorization;
13
+
14
+ if (!req.cookies) {
15
+ // Send an error
16
+ return res.send("Request failed!");
17
+ }
18
+
19
+ if (req.cookies.authcheck) {
20
+ next();
21
+ return;
22
+ }
23
+ if (!authheader) {
24
+ res.setHeader("WWW-Authenticate", "Basic");
25
+ res.status(401);
26
+ MasqrFail(req, res, loadedHtmlFile);
27
+ return;
28
+ }
29
+ // If we are at this point, then the request should be a valid masqr request, and we are going to check the license server
30
+ const auth = Buffer.from(authheader.split(" ")[1], "base64").toString().split(":");
31
+ const pass = auth[1];
32
+ const licenseCheck = (await (await fetch(config.licenseServer + pass + "&host=" + req.headers.host)).json())["status"];
33
+ if (licenseCheck === "License valid") {
34
+ // Authenticated, set cookie for a year
35
+ res.cookie("authcheck", "true", {
36
+ expires: new Date(Date.now() + 365 * 24 * 60 * 60 * 1000),
37
+ });
38
+ res.send(`<script>window.location.href = window.location.href</script>`); // fun hack to make the browser refresh and remove the auth params from the URL
39
+ return;
40
+ } else {
41
+ res.setHeader("WWW-Authenticate", "Basic");
42
+ res.status(401);
43
+ MasqrFail(req, res, loadedHtmlFile);
44
+ return;
45
+ }
46
+ } catch (err) {
47
+ console.error(err);
48
+ res.status(500);
49
+ res.send("Internal server error");
50
+ return;
51
+ }
52
+ };
53
+ }
54
+ async function MasqrFail(req, res, failureFile) {
55
+ if (!req.headers.host) {
56
+ return;
57
+ }
58
+ const unsafeSuffix = req.headers.host + ".html";
59
+ const safeSuffix = path.normalize(unsafeSuffix).replace(/^(\.\.(\/|\\|$))+/, "");
60
+ const safeJoin = path.join(process.cwd() + "/Masqrd", safeSuffix);
61
+ try {
62
+ await fs.promises.access(safeJoin); // man do I wish this was an if-then instead of a "exception on fail"
63
+ const failureFileLocal = await fs.promises.readFile(safeJoin, "utf8");
64
+ res.setHeader("Content-Type", "text/html");
65
+ res.send(failureFileLocal);
66
+ return;
67
+ } catch (e) {
68
+ res.setHeader("Content-Type", "text/html");
69
+ res.status(401);
70
+ res.send(failureFile);
71
+ return;
72
+ }
73
+ }
middleware/catchErrors.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import chalk from "chalk";
2
+
3
+ process.on("uncaughtException", (err) => {
4
+ console.log(chalk.bold.red(`[Alu] Caught error!\n${err.stack}`));
5
+ process.exit(1);
6
+ });
7
+
8
+ process.on("uncaughtExceptionMonitor", (err) => {
9
+ console.log(chalk.bold.red(`[Alu] Caught error!\n${err.stack}`));
10
+ process.exit(1);
11
+ });
public/favicon.svg ADDED
public/flash/instantiateFlash.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const id = window.location.pathname.split("/").pop();
2
+ if (id && RufflePlayer) {
3
+ document.title = `Flash Game - ${id}`;
4
+ window.addEventListener("load", loadRuffle);
5
+ } else {
6
+ document.querySelector("#loader").classList.add("hidden");
7
+ document.querySelector("#error").classList.remove("hidden");
8
+ }
9
+
10
+ function loadRuffle() {
11
+ const ruffle = RufflePlayer.newest().createPlayer();
12
+ ruffle.config = {
13
+ splashScreen: false,
14
+ unmuteOverlay: "hidden",
15
+ autoplay: "on",
16
+ contextMenu: "on",
17
+ showSwfDownload: false
18
+ };
19
+ ruffle.style.width = "100%";
20
+ ruffle.style.height = "100%";
21
+ const gameContainer = document.querySelector("#gameContainer");
22
+ if (gameContainer != null) {
23
+ gameContainer.appendChild(ruffle);
24
+ }
25
+ ruffle.load(`/games/flash/${id}.swf`).then(() => {
26
+ let loader = document.querySelector("#loader");
27
+ loader.classList.remove("loading");
28
+ loader.classList.add("hidden");
29
+ document.querySelector("#gameContainer").classList.remove("hidden");
30
+ });
31
+ // Stop the event listener, saves miniscule amount of memory
32
+ window.removeEventListener("load", loadRuffle);
33
+ }
public/game.css ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .vertical {
2
+ height: 70vh !important;
3
+ width: 30% !important;
4
+ aspect-ratio: auto !important;
5
+ }
6
+ #main-content {
7
+ margin-top: 2rem;
8
+ }
9
+ .game-container {
10
+ display: flex;
11
+ align-items: center;
12
+ flex-direction: column;
13
+ overflow: hidden;
14
+ background: var(--dropdown-background-color);
15
+ width: 80%;
16
+ margin: 0 auto;
17
+ margin-bottom: 4rem;
18
+ border-radius: 15px;
19
+ }
20
+ #game-frame {
21
+ aspect-ratio: 16 / 8;
22
+ height: 80vh;
23
+ width: 1350px;
24
+ border: 0;
25
+ }
26
+
27
+ .flash-frame {
28
+ width: 1024px !important;
29
+ height: 576px !important;
30
+ }
31
+
32
+ .game-info {
33
+ display: flex;
34
+ flex-direction: column;
35
+ gap: 1rem;
36
+ background-color: var(--background-highlight);
37
+ width: 100%;
38
+ padding: 1rem;
39
+ padding-top: 0;
40
+ }
41
+ .game-info-top {
42
+ display: flex;
43
+ justify-content: space-between;
44
+ margin-top: 0.5rem;
45
+ }
46
+ .icn {
47
+ width: 32px;
48
+ height: 32px;
49
+ cursor: pointer;
50
+ }
51
+ .game-info-left {
52
+ display: flex;
53
+ gap: 10px;
54
+ justify-content: center;
55
+ align-items: center;
56
+ height: 48px;
57
+ }
58
+ .game-title {
59
+ font-weight: bold;
60
+ font-size: 20px;
61
+ }
62
+
63
+ .game-img {
64
+ width: 48px;
65
+ height: 48px;
66
+ border-radius: 50%;
67
+ border: 3px solid var(--accent-color-brighter);
68
+ box-shadow: 0px 0px 20px 5px var(--accent-color-brighter);
69
+ }
70
+
71
+ .game-desc {
72
+ margin: 0;
73
+ }
public/icons/canvas.png ADDED
public/icons/classlink.png ADDED
public/icons/classroom.png ADDED
public/icons/clever.jpg ADDED
public/icons/drive.png ADDED
public/icons/edgenuity.png ADDED
public/icons/google.png ADDED
public/icons/schoology.webp ADDED
public/icons/youtube.png ADDED
public/iframe.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* CSS for about:blank iframes */
2
+
3
+ body {
4
+ margin: 0;
5
+ }
6
+
7
+ iframe {
8
+ width: 100%;
9
+ height: 100%;
10
+ border: none;
11
+ }
public/img/checkmark.svg ADDED
public/img/games/fullscreen.svg ADDED
public/img/games/pin-outline.svg ADDED
public/img/games/pin.svg ADDED
public/img/nav/backwards.svg ADDED
public/img/nav/close.svg ADDED
public/img/nav/forwards.svg ADDED
public/img/nav/reload.svg ADDED
public/img/nav/share.svg ADDED
public/img/search.svg ADDED
public/marketplace/adblock/banner.png ADDED
public/marketplace/adblock/icon.png ADDED
public/marketplace/adblock/index.js ADDED
The diff for this file is too large to render. See raw diff
 
public/marketplace/atom-one-dark/logo.png ADDED
public/marketplace/atom-one-dark/theme.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-theme="atom-one-dark"] {
2
+ --background-color: #1e2127;
3
+ --background-highlight: #434952;
4
+ --accent-color: #3a3f4b;
5
+ --accent-color-brighter: #4b515f;
6
+ --text-color: #abb2bf;
7
+ --text-color-accent: #989eaa;
8
+ --dropdown-background-color: #30353f;
9
+ }
public/marketplace/dracula-theme/logo.svg ADDED
public/marketplace/dracula-theme/theme.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-theme="dracula"] {
2
+ --background-color: #282a36;
3
+ --background-highlight: #44475a;
4
+ --accent-color: #4e5268;
5
+ --accent-color-brighter: #2d2f3c;
6
+ --text-color: #f8f8f2;
7
+ --text-color-accent: #dddddd;
8
+ --dropdown-background-color: #343b52;
9
+ }
public/marketplace/eruda/banner.png ADDED
public/marketplace/eruda/eruda.js ADDED
The diff for this file is too large to render. See raw diff
 
public/marketplace/nord-theme/logo.png ADDED
public/marketplace/nord-theme/theme.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-theme="nord"] {
2
+ --background-color: #2e3440;
3
+ --background-highlight: #3b4252;
4
+ --accent-color: #434c5e;
5
+ --accent-color-brighter: #4c566a;
6
+ --text-color: #f8f8f2;
7
+ --text-color-accent: #dddddd;
8
+ --dropdown-background-color: #3b4252;
9
+ }
public/marketplace/oled-theme/theme.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-theme="oled"] {
2
+ --background-color: #000;
3
+ --background-highlight: #111;
4
+ --accent-color: rgb(30 0 79);
5
+ --accent-color-brighter: rgb(60 0 155);
6
+ --text-color: #fff;
7
+ --text-color-accent: #dddddd;
8
+ --dropdown-background-color: #1a1a1a;
9
+ }
public/marketplace/oled-theme/theme.png ADDED
public/marketplace/scriptInjector/index.js ADDED
@@ -0,0 +1 @@
 
 
1
+ (()=>{async function i(e){let o=e.request.url,s=e.workerware.config;if(o.includes(self.__uv$config.prefix)){let r=self.__uv$config.decodeUrl(e.request.url.split(self.__uv$config.prefix)[1]);if(r==e.workerware.config.injectURL){console.log(`Injecting script into ${r}!`),console.log(s.injectURls);let n=(await e.uvResponse.text()).replace("</head>",`<script src="${s.injectURLs[0]}"><\/script><link rel="stylesheet" href="${s.injectURLs[1]}"></head>`);return new Response(n,{status:e.uvResponse.status,statusText:e.uvResponse.statusText,headers:e.uvResponse.headers})}return e.uvResponse}}self.scriptInjector={inject:i};})();
public/marketplace/synthwave84/logo.png ADDED
public/marketplace/synthwave84/theme.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [data-theme="synthwave84"] {
2
+ --background-color: #2a203a;
3
+ --background-highlight: #2e2342;
4
+ --accent-color: #1e1629;
5
+ --accent-color-brighter: #3e2e53;
6
+ --text-color: #c0bdc4;
7
+ --text-color-accent: #dddddd;
8
+ --dropdown-background-color: #231a30;
9
+ }
public/robots-allow.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ User-agent: *
2
+ Allow: *
3
+ Sitemap: https://aluu.xyz/sitemap-index.xml
public/robots-deny.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ User-agent: *
2
+ Disallow: *