Add a mechanism for flash games to be loaded in the games page, and add a couple

This commit is contained in:
wearrrrr 2024-07-23 01:46:20 -05:00
parent 0a4a32974f
commit 213c729a70
22 changed files with 2174 additions and 2060 deletions

View file

@ -23,8 +23,8 @@ export default defineConfig({
vite: {
server: {
watch: {
usePolling: true
}
}
}
usePolling: true,
},
},
},
});

View file

@ -16,7 +16,7 @@ import dotenv from "dotenv";
import cookieParser from "cookie-parser";
import wisp from "wisp-server-node";
import { masqrCheck } from "./masqr.js";
import { handler as ssrHandler } from './dist/server/entry.mjs';
import { handler as ssrHandler } from "./dist/server/entry.mjs";
dotenv.config();

176
package-lock.json generated
View file

@ -9,14 +9,14 @@
"version": "0.0.1",
"dependencies": {
"@astrojs/node": "^8.2.5",
"@astrojs/partytown": "^2.1.1",
"@astrojs/sitemap": "^3.1.4",
"@mercuryworkshop/bare-as-module3": "^2.2.2",
"@mercuryworkshop/bare-mux": "^2.0.1",
"@mercuryworkshop/bare-mux": "^2.0.2",
"@mercuryworkshop/epoxy-transport": "^2.1.3",
"@mercuryworkshop/libcurl-transport": "^1.3.6",
"@titaniumnetwork-dev/ultraviolet": "^3.2.2",
"@tomphttp/bare-server-node": "^2.0.3",
"@types/node": "^20.14.10",
"astro": "^4.7.0",
"chalk": "^5.3.0",
"compression": "^1.7.4",
@ -25,10 +25,10 @@
"express": "^4.19.2",
"notyf": "^3.10.0",
"rammerhead": "https://github.com/NebulaServices/rammerhead/releases/download/rammerhead-1.2.41-nebula.8/rammerhead-1.2.41-nebula.7.tgz",
"urlpattern-polyfill": "^10.0.0",
"wisp-server-node": "^1.1.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.24.1",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "^8.57.0",
@ -111,16 +111,6 @@
"astro": "^4.2.0"
}
},
"node_modules/@astrojs/partytown": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@astrojs/partytown/-/partytown-2.1.1.tgz",
"integrity": "sha512-KvecQuGGgrDrdTjC5awmtoQXqJFinChfeizKBJyr7F5EGQPx62xq8SIWkcXamLr5xZyNw0lryKeLtIzbxRH/zw==",
"license": "MIT",
"dependencies": {
"@builder.io/partytown": "^0.10.2",
"mrmime": "^2.0.0"
}
},
"node_modules/@astrojs/prism": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@astrojs/prism/-/prism-3.1.0.tgz",
@ -222,43 +212,6 @@
"semver": "bin/semver.js"
}
},
"node_modules/@babel/eslint-parser": {
"version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.24.7.tgz",
"integrity": "sha512-SO5E3bVxDuxyNxM5agFv480YA2HO6ohZbGxbazZdIk3KQOPOGVNw6q78I9/lbviIf95eq6tPozeYnJLbjnC8IA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1",
"eslint-visitor-keys": "^2.1.0",
"semver": "^6.3.1"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || >=14.0.0"
},
"peerDependencies": {
"@babel/core": "^7.11.0",
"eslint": "^7.5.0 || ^8.0.0 || ^9.0.0"
}
},
"node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
"integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/@babel/eslint-parser/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"dev": true,
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/@babel/generator": {
"version": "7.24.7",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz",
@ -578,18 +531,6 @@
"node": ">=6.9.0"
}
},
"node_modules/@builder.io/partytown": {
"version": "0.10.2",
"resolved": "https://registry.npmjs.org/@builder.io/partytown/-/partytown-0.10.2.tgz",
"integrity": "sha512-A9U+4PREWcS+CCYzKGIPovtGB/PBgnH/8oQyCE6Nr9drDJk6cMPpLQIEajpGPmG9tYF7N3FkRvhXm/AS9+0iKg==",
"license": "MIT",
"bin": {
"partytown": "bin/partytown.cjs"
},
"engines": {
"node": ">=18.0.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz",
@ -1608,9 +1549,9 @@
}
},
"node_modules/@mercuryworkshop/bare-mux": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/bare-mux/-/bare-mux-2.0.1.tgz",
"integrity": "sha512-94YThllV9sWSb5hzIDg+U0JSNfFdkvOq6j5wwV1OON3izZhrKSsdDOkaywS5WP6HE/jm0/0ZYaYixbf8u3kjYg=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@mercuryworkshop/bare-mux/-/bare-mux-2.0.2.tgz",
"integrity": "sha512-1rnqFfI29VXi3jrMbkotHV+NnafJ3tpTIuH3Ov/BtVAfZMNGcsCRr3dwEKRWc+mDb0tWdNWC0PnZghgfAlbr+A=="
},
"node_modules/@mercuryworkshop/epoxy-tls": {
"version": "2.0.6-1",
@ -1643,37 +1584,6 @@
"rollup-plugin-typescript2": "^0.36.0"
}
},
"node_modules/@nicolo-ribaudo/eslint-scope-5-internals": {
"version": "5.1.1-v1",
"resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz",
"integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==",
"dev": true,
"dependencies": {
"eslint-scope": "5.1.1"
}
},
"node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
"integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==",
"dev": true,
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^4.1.1"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/estraverse": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",
"integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",
"dev": true,
"engines": {
"node": ">=4.0"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -2125,9 +2035,9 @@
}
},
"node_modules/@types/node": {
"version": "20.11.16",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.16.tgz",
"integrity": "sha512-gKb0enTmRCzXSSUJDq6/sPcqrfCv2mkkG6Jt/clpn5eiCbKTY+SgZUxo+p8ZKMof5dCp9vHQUAB7wOUTod22wQ==",
"version": "20.14.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.11.tgz",
"integrity": "sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==",
"dependencies": {
"undici-types": "~5.26.4"
}
@ -3045,11 +2955,11 @@
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dependencies": {
"fill-range": "^7.0.1"
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
@ -4574,9 +4484,9 @@
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dependencies": {
"to-regex-range": "^5.0.1"
},
@ -5426,10 +5336,23 @@
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
},
"node_modules/ip": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.0.tgz",
"integrity": "sha512-WKa+XuLG1A1R0UWhl2+1XQSi+fZWMsYKffMZTTYsiZaUD8k2yDAj5atimTUD2TZkyCkNEeYE5NhFZmupOGtjYQ==",
"node_modules/ip-address": {
"version": "9.0.5",
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
"optional": true,
"dependencies": {
"jsbn": "1.1.0",
"sprintf-js": "^1.1.3"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/ip-address/node_modules/sprintf-js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
"optional": true
},
"node_modules/ipaddr.js": {
@ -5654,6 +5577,12 @@
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/jsbn": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
"optional": true
},
"node_modules/jsesc": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
@ -8766,16 +8695,16 @@
}
},
"node_modules/socks": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
"optional": true,
"dependencies": {
"ip": "^2.0.0",
"ip-address": "^9.0.5",
"smart-buffer": "^4.2.0"
},
"engines": {
"node": ">= 10.13.0",
"node": ">= 10.0.0",
"npm": ">= 3.0.0"
}
},
@ -9063,9 +8992,9 @@
}
},
"node_modules/tar": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz",
"integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==",
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
"dependencies": {
"chownr": "^2.0.0",
"fs-minipass": "^2.0.0",
@ -9658,6 +9587,11 @@
"integrity": "sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==",
"deprecated": "Please see https://github.com/lydell/urix#deprecated"
},
"node_modules/urlpattern-polyfill": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz",
"integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg=="
},
"node_modules/utf-8-validate": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz",
@ -10011,9 +9945,9 @@
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/ws": {
"version": "8.16.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz",
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==",
"version": "8.18.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
"engines": {
"node": ">=10.0.0"
},

View file

@ -17,7 +17,7 @@
"@mercuryworkshop/bare-mux": "^2.0.2",
"@mercuryworkshop/epoxy-transport": "^2.1.3",
"@mercuryworkshop/libcurl-transport": "^1.3.6",
"@titaniumnetwork-dev/ultraviolet": "^3.2.2",
"@titaniumnetwork-dev/ultraviolet": "^3.2.5",
"@tomphttp/bare-server-node": "^2.0.3",
"@types/node": "^20.14.10",
"astro": "^4.7.0",

3725
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,26 @@
const id = window.location.pathname.split("/").pop();
id && RufflePlayer ? window.addEventListener("load", ()=>{
const e = RufflePlayer.newest().createPlayer();
e.config = {
preloader: !1,
splashScreen: !1,
unmuteOverlay: "hidden",
autoplay: "on",
contextMenu: !1,
showSwfDownload: !1
},
e.style.width = "100%",
e.style.height = "100%";
const a = document.querySelector("#gameContainer");
a == null || a.appendChild(e),
e.load(`/games/flash/${id}.swf`).then(()=>{
document.querySelector("#loader").classList.add("hidden"),
document.querySelector("#gameContainer").classList.remove("hidden")
}
).catch(o=>{
console.log(o)
}
)
}
) : (document.querySelector("#loader").classList.add("hidden"),
document.querySelector("#error").classList.remove("hidden"));

@ -1 +1 @@
Subproject commit 2beae2ca136865d7a78ce42fea0f590c24371a1f
Subproject commit 98c48fe6bf57706348442ac5b963055fa0e3599f

View file

@ -0,0 +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};})();

View file

@ -0,0 +1,10 @@
// async function applyCSS() {
// let vencordCSS = await fetch("https://raw.githubusercontent.com/Vencord/builds/main/browser.css")
// let cssLink = document.createElement("style");
// cssLink.innerHTML = await vencordCSS.text();
// document.head.appendChild(cssLink)
// }
// applyCSS();
// document.head.appendChild(document.createElement("script")).src = "https://raw.githubusercontent.com/Vencord/builds/main/browser.js";

View file

@ -2,9 +2,19 @@ importScripts("/uv/uv.bundle.js", "/uv.config.js", "/workerware/workerware.js");
importScripts( __uv$config.sw);
const ww = new WorkerWare({
debug: true,
debug: false,
});
self.__uv$config.inject = [{
host: "discord.com",
html: `
<script src="https://raw.githubusercontent.com/Vencord/builds/main/browser.js"></script>
<link rel="stylesheet" href="https://raw.githubusercontent.com/Vencord/builds/main/browser.css">
`,
injectTo: "head",
}];
function loadExtensionScripts() {
try {
let db = indexedDB.open("AluDB", 1);

View file

@ -73,11 +73,13 @@ class WorkerWare {
event.workerware = {
config: middlewares[i].configuration || {},
};
if (!middlewares[i].explicitCall) {
let res = await middlewares[i].function(event);
if (this._opt.timing) console.timeEnd(middlewares[i].name);
returnList.push(res);
}
}
}
return returnList;
};
return fn;
@ -97,11 +99,29 @@ class WorkerWare {
Run a single middleware by ID.
This assumes that the user knows what they're doing, and is running the middleware on an event that it's supposed to run on.
*/
runMW(id, event) {
runMW(name, event) {
const middlewares = this._middlewares;
if (this._opt.debug) dbg("Running middleware:", id);
if (middlewares.includes(id)) {
return middlewares[id](event);
if (this._opt.debug) dbg("Running middleware:", name);
// if (middlewares.includes(name)) {
// return middlewares[name](event);
// } else {
// throw new WWError("Middleware not found!");
// }
let didCall = false;
for (let i = 0; i < middlewares.length; i++) {
if (middlewares[i].name == name) {
didCall = true;
event.workerware = {
config: middlewares[i].configuration || {},
}
if (this._opt.timing) console.time(middlewares[i].name);
let call = middlewares[i].function(event);
if (this._opt.timing) console.timeEnd(middlewares[i].name);
return call;
}
}
if (!didCall) {
throw new WWError("Middleware not found!");
}
}
// type middlewareManifest = {
@ -136,6 +156,11 @@ class WorkerWare {
return {
error: "Invalid event type! Must be one of the following: " + validEvents.join(", "),
};
if (middleware.explicitCall && typeof middleware.explicitCall !== "boolean") {
return {
error: "middleware.explicitCall must be typeof boolean",
};
}
return {
error: undefined,
};

View file

@ -2,6 +2,7 @@
import { TransportMgr, initTransport } from "./ts/TransportManager";
import "notyf/notyf.min.css";
import { Notyf } from "notyf";
import { loadIDB, GetStore } from "./ts/IDBManager";
let form = document.querySelector("form");
let input = document.querySelector("input");
@ -51,8 +52,43 @@
return window.__uv$config.decodeUrl(frame.contentWindow!.location.href.split("/service/")[1]);
}
async function loadPageExtensions() {
try {
let iframe = document.getElementById("proxy-frame") as HTMLIFrameElement;
let db = loadIDB("AluDB", 1);
db.onsuccess = () => {
let store = GetStore("InstalledExtensions", "readonly");
let request = store.getAll();
request.onsuccess = () => {
let extensions = request.result;
extensions.forEach((extension: IExtensionMetadata) => {
// Eval the extension script inside of the iframe
if (!(extension.type == "page")) return;
if (extension.pages && extension.pages.length > 0) {
// Check if the current URL matches the extension's URL
extension.pages.forEach((url) => {
console.log(url);
console.log(iframe.contentWindow!.__uv$location.host);
if (iframe.contentWindow!.__uv$location.host.includes(url)) {
let script = extension.script;
let scriptElement = document.createElement("script");
scriptElement.src = script;
scriptElement.type = "module";
iframe.contentDocument!.head.appendChild(scriptElement);
}
});
}
});
};
};
} catch (err) {
console.error(`Failed load extension scripts: ${err}`);
}
}
async function loadContent() {
await initTransport();
await loadPageExtensions();
// The setTimeout is because service workers are a little silly and can take a while longer to register despite .then being called, which causes a bug on the first load.
setTimeout(async () => {
let openWith = localStorage.getItem("alu__selectedOpenWith");
@ -122,30 +158,6 @@
iframe.classList.add("active");
}
// function loadExtensionScripts() {
// try {
// let db = indexedDB.open("AluDB", 1);
// db.onsuccess = () => {
// let transaction = db.result.transaction("InstalledExtensions", "readonly");
// let store = transaction.objectStore("InstalledExtensions");
// let request = store.getAll();
// request.onsuccess = () => {
// let extensions = request.result;
// extensions.forEach((extension: any) => {
// // Eval the extension script inside of the iframe
// if (extension.serviceWorkerExtension) return;
// if (iframe.contentWindow) {
// console.log(`Evaluating extension "${extension.title}" inside of the iframe.`);
// (iframe.contentWindow as any).eval(atob(extension.script));
// }
// });
// };
// };
// } catch (err) {
// console.error(`Failed load extension scripts: ${err}`);
// }
// }
function iframeLoad() {
loadingContent.style.opacity = "0";
iframe.style.opacity = "1";
@ -281,6 +293,7 @@
let UVURL = getUVProxyURL(iframe);
if (proxiedFavicon.src == `${window.location.origin}/custom-favicon?url=${UVURL}`) return;
proxiedFavicon.src = `/custom-favicon?url=${UVURL}`;
loadPageExtensions();
}
}
}

View file

@ -1,17 +1,4 @@
import { BareMuxConnection } from "@mercuryworkshop/bare-mux";
declare global {
interface Window {
__uv$config: {
prefix: string;
encodeUrl: (url: string) => string;
decodeUrl: (url: string) => string;
};
loadFormContent: Function | null;
loadSelectedTransport: Function | null;
loadedThemeAtob: string;
idb: IDBDatabase;
}
}
type transportConfig =
| {

View file

@ -79,7 +79,11 @@ Array.from(installButtons).forEach((btn) => {
async function getMarketplaceObj(slug: string): Promise<IExtensionMetadata> {
const manifest = extManifest[slug];
if (manifest.type === "page") {
return manifest;
} else {
manifest.scriptCopy = btoa(await fetch(manifest.script).then((res) => res.text()));
}
return manifest;
}

View file

@ -5,6 +5,12 @@
"image": "/games/2048/logo.png",
"slug": "2048"
},
"achievement-unlocked": {
"name": "Achievement Unlocked",
"image": "/games/flash/img/achievement-unlocked.webp",
"slug": "achievement-unlocked",
"flash": true
},
"adofai": {
"name": "A Dance of Fire and Ice",
"description": "A Dance of Fire and Ice is a strict rhythm game. Keep your focus as you guide two orbiting planets along a winding path without breaking their perfect equilibrium. Press on every beat of the music to move in a line. Every pattern has its own rhythm to it. It can get difficult. This game is purely based on rhythm, so use your ears more than your sight.",
@ -27,6 +33,24 @@
"image": "/games/basketball-stars/logo.png",
"slug": "basketball-stars"
},
"binding-of-isaac": {
"name": "The Binding of Isaac",
"image": "/games/flash/img/binding-of-isaac.png",
"slug": "binding-of-isaac",
"flash": true
},
"bloons-tower-defense-2": {
"name": "Bloons Tower Defense 2",
"image": "/games/flash/img/bloons-tower-defense-2.webp",
"slug": "bloons-tower-defense-2",
"flash": true
},
"bloons-tower-defense-4": {
"name": "Bloons Tower Defense 4",
"image": "/games/flash/img/bloons-tower-defense-4.jpg",
"slug": "bloons-tower-defense-4",
"flash": true
},
"cannon-basketball-4": {
"name": "Cannon Basketball 4",
"image": "/games/cannon-basketball-4/logo.png",
@ -260,6 +284,12 @@
"slug": "tunnelrush",
"unity": true
},
"unfairmario": {
"name": "Unfair Mario",
"image": "/games/flash/img/unfairmario.jpg",
"slug": "unfairmario",
"flash": true
},
"ul6": {
"name": "Ultima 6",
"image": "/games/ul6/logo.png",

View file

@ -2,13 +2,22 @@
"dev.wearr.adblock": {
"title": "Alu Adblocker",
"description": "Alu Adblocker is the best adblocker for web proxy services. Blocking up to 97% of all trackers and ads.",
"version": "0.0.1",
"version": "0.1.0",
"image": "/marketplace/adblock/adblock.png",
"script": "/marketplace/adblock/index.js",
"type": "serviceWorker",
"entryNamespace": "adblockExt",
"entryFunc": "filterRequest"
},
"dev.wearr.vencord": {
"title": "Vencord",
"description": "Vencord is the cutest client mod for Discord, it's incredibly user friendly and easy to use",
"version": "DevBuild 80b493d",
"image": "/marketplace/vencord/vencord.png",
"script": "/marketplace/vencord/vencord.js",
"pages": ["discord.com"],
"type": "page"
},
"dev.wearr.oled-theme": {
"title": "OLED Theme",
"description": "A beautiful OLED theme for Alu.",

View file

@ -88,7 +88,14 @@ const { title, optionalPreloads } = Astro.props;
color: var(--text-color);
}
h1, h2, h3, h4, h5, h6, p, span {
h1,
h2,
h3,
h4,
h5,
h6,
p,
span {
color: var(--text-color);
}

View file

@ -21,20 +21,23 @@ let gameData = isValidGameKey(game) ? gamesList[game] : null;
if (!gameData) {
return Astro.redirect("/en/games/");
}
---
<Layout title="Game">
<div id="main-content">
<div class="game-container">
{gameData.unity ?
<iframe scrolling="no" src=`/unity/${gameData.slug}` title={gameData.name} id="game-frame"/> :
<iframe scrolling="no" src=`/games/${gameData.slug}` title={gameData.name} id="game-frame"/>
{
gameData.unity ? (
<iframe scrolling="no" src={`/game/unity/${gameData.slug}`} title={gameData.name} id="game-frame" />
) : gameData.flash ? (
<iframe scrolling="no" src={`/game/flash/${gameData.slug}`} title={gameData.name} id="game-frame" />
) : <iframe scrolling="no" src={`/games/${gameData.slug}`} title={gameData.name} id="game-frame" />
}
<div class="game-info">
<div class="game-info-top">
<p class="game-title">{gameData.name}</p>
<img src="/img/games/fullscreen.svg" alt="Fullscreen" id="game-fullscreen" class="icn">
<img src="/img/games/fullscreen.svg" alt="Fullscreen" id="game-fullscreen" class="icn" />
</div>
<div class="game-info-bottom">
<p class="game-desc">{gameData.description}</p>
@ -100,12 +103,12 @@ if (!gameData) {
iframe.addEventListener("click", () => {
iframe.contentWindow?.focus();
})
});
document.addEventListener("astro:after-swap", () => {
let iframe = document.getElementById("game-frame") as HTMLIFrameElement;
iframe?.contentWindow?.focus();
})
});
let fullscreen = document.getElementById("game-fullscreen") as HTMLImageElement;

View file

@ -2,14 +2,15 @@
export const prerender = false;
---
<!DOCTYPE html>
<!doctype html>
<html lang="en" class="w-full h-full">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unity Content</title>
<script is:inline src="/unity/UnityLoader.js"></script>
<script is:inline src="/unity/instantiateUnity.js"></script>
<title>Radon Games</title>
<script src="https://cdn.jsdelivr.net/npm/@ruffle-rs/ruffle@0.1.0-nightly.2024.7.23/ruffle.min.js" is:inline></script>
<script type="module" src="/flash/instantiateFlash.js" is:inline defer></script>
<link rel="stylesheet" href="/unity/index.css">
</head>
<body class="w-full h-full bg-slate-800 text-slate-200">
@ -43,7 +44,7 @@ export const prerender = false;
<div
class="w-full h-full flex items-center justify-center flex-col gap-5"
>
<img src="/favicon.svg" class="w-10" />
<img src="logo.png" class="w-10" />
<p>An error occurred.</p>
<p class="underline cursor-pointer" onclick="location.reload()">
Refresh
@ -51,5 +52,6 @@ export const prerender = false;
</div>
</div>
<div id="gameContainer" class="w-full h-full hidden bg-white"></div>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c1241717689176015" integrity="sha512-ZpsOmlRQV6y907TI0dKBHq9Md29nnaEIPlkf84rnaERnq6zvWvPUqr2ft8M1aS28oN72PdrCzSjY4U6VaAw1EQ==" data-cf-beacon='{"rayId":"8a78f4d95f1f61cf","version":"2024.7.0","r":1,"token":"cf313dfff389483fae99876f60faccea","serverTiming":{"name":{"cfL4":true}}}' crossorigin="anonymous"></script>
</body>
</html>

View file

@ -0,0 +1,32 @@
---
export const prerender = false;
---
<!doctype html>
<html lang="en" class="w-full h-full">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Unity Content</title>
<script is:inline src="/unity/UnityLoader.js"></script>
<script is:inline src="/unity/instantiateUnity.js"></script>
<link rel="stylesheet" href="/unity/index.css" />
</head>
<body class="w-full h-full bg-slate-800 text-slate-200">
<div id="loader" class="w-full h-full flex items-center justify-center flex-col gap-5">
<img src="/favicon.svg" class="w-10" />
<svg class="animate-spin h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>
<div class="h-full w-full hidden" id="error">
<div class="w-full h-full flex items-center justify-center flex-col gap-5">
<img src="/favicon.svg" class="w-10" />
<p>An error occurred.</p>
<p class="underline cursor-pointer" onclick="location.reload()">Refresh</p>
</div>
</div>
<div id="gameContainer" class="w-full h-full hidden bg-white"></div>
</body>
</html>

32
src/types.d.ts vendored
View file

@ -1,3 +1,19 @@
interface Window {
__uv$config: {
prefix: string;
encodeUrl: (url: string) => string;
decodeUrl: (url: string) => string;
};
__uv$location: Location;
loadFormContent: Function | null;
loadSelectedTransport: Function | null;
loadedThemeAtob: string;
idb: IDBDatabase;
URLPattern: URLPattern | null;
// Why is this not already on Window?
eval(string): void;
}
type ExtType = "serviceWorker" | "theme" | "page";
type Extension = {
@ -9,7 +25,7 @@ type Extension = {
/*
- title: The title of the extension
- description: A description of the extension
- version: The version of the extension (semver)
- version: The version of the extension
- script: The script URL to be downloaded and saved into scriptCopy
- entryNamespace: The namespace of the entry function for serviceWorker extensions
- entryFunc: The name of the entry function for serviceWorker extensions
@ -23,6 +39,7 @@ interface IExtensionMetadata {
version: string;
image: string;
script: string;
pages?: string[];
entryNamespace?: string;
entryFunc?: string;
scriptCopy?: string;
@ -39,12 +56,13 @@ type InstallReturn = {
};
type GameMetadata = {
name: string,
description?: string,
image: string,
slug: string,
unity?: boolean
}
name: string;
description?: string;
image: string;
slug: string;
unity?: boolean;
flash?: boolean;
};
type GameList = {
[key: string]: GameMetadata;

View file

@ -6,7 +6,7 @@
"paths": {
"@components/*": ["src/components/*"],
"@i18n/*": ["src/i18n/*"],
"@json/*": ["src/json/*"],
"@json/*": ["src/json/*"]
}
}
}