fix text wrap, change typescript source dir

This commit is contained in:
creeper123123321 2023-04-01 12:09:10 -03:00
parent 64cb615cfe
commit ef166f3113
8 changed files with 106 additions and 24 deletions

View File

@ -0,0 +1 @@
This is code compiled manually by tsc, the sources are in /src/main/typescript

View File

@ -1,7 +1,7 @@
"use strict";
// See https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration
// You'll need to add the page as a Redirect URL to Azure as a Single Page Application
// noinspection ES6ConvertVarToLetConst - TODO fix this
// Azure Client ID
const azureClientId = "a370fff9-7648-4dbf-b96e-2b4f8d539ac2";
// Origins that we'll not use https://viaversion.github.io/VIAaaS/ as redirect URL
@ -11,4 +11,5 @@ const whitelistedOrigin = [
// Default CORS Proxy config
var defaultCorsProxy = "https://cors.re.yt.nom.br/";
// Default instance suffix, in format "viaaas.example.com[:25565]", null to use the page hostname;
var defaultInstanceSuffix = null;
var defaultInstanceSuffix = null;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vdHlwZXNjcmlwdC9qcy9jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLG9HQUFvRztBQUNwRyxzRkFBc0Y7QUFDdEYsdURBQXVEO0FBRXZELGtCQUFrQjtBQUNsQixNQUFNLGFBQWEsR0FBVyxzQ0FBc0MsQ0FBQztBQUNyRSxrRkFBa0Y7QUFDbEYsTUFBTSxpQkFBaUIsR0FBYTtJQUNoQywwQkFBMEI7Q0FDN0IsQ0FBQztBQUNGLDRCQUE0QjtBQUM1QixJQUFJLGdCQUFnQixHQUFrQiw0QkFBNEIsQ0FBQztBQUNuRSxrR0FBa0c7QUFDbEcsSUFBSSxxQkFBcUIsR0FBa0IsSUFBSSxDQUFDIn0=

File diff suppressed because one or more lines are too long

View File

@ -1,48 +1,44 @@
"use strict";
importScripts("https://cdnjs.cloudflare.com/ajax/libs/js-sha512/0.8.0/sha512.min.js");
let pending = [];
self.addEventListener("message", e => {
if (e.data.action === "listen_pow") startPoW(e);
if (e.data.action === "cancel") removePending(e.data.id);
if (e.data.action === "listen_pow")
startPoW(e);
if (e.data.action === "cancel")
removePending(e.data.id);
});
function removePending(id) {
pending = pending.filter(it => it !== id);
}
function startPoW(e) {
pending.push(e.data.id);
listenPoW(e);
}
function isPending(id) {
return pending.includes(id);
}
function listenPoW(e) {
let user = e.data.user;
let msg = null;
let endTime = Date.now() + 1000;
do {
if (!isPending(e.data.id)) return; // cancelled
if (!isPending(e.data.id))
return; // cancelled
msg = JSON.stringify({
action: "offline_login",
username: user,
date: Date.now() - e.data.deltaTime,
rand: Math.random()
});
if (Date.now() >= endTime) {
setTimeout(() => listenPoW(e));
return;
}
} while (!sha512(msg).startsWith("00000"));
setTimeout(() => {
if (!isPending(e.data.id)) return;
postMessage({id: e.data.id, action: "completed_pow", msg: msg});
})
}
if (!isPending(e.data.id))
return;
postMessage({ id: e.data.id, action: "completed_pow", msg: msg });
});
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vdHlwZXNjcmlwdC9qcy93b3JrZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsWUFBWSxDQUFDO0FBQ2IsYUFBYSxDQUFDLHNFQUFzRSxDQUFDLENBQUM7QUFFdEYsSUFBSSxPQUFPLEdBQUcsRUFBRSxDQUFDO0FBRWpCLElBQUksQ0FBQyxnQkFBZ0IsQ0FBQyxTQUFTLEVBQUUsQ0FBQyxDQUFDLEVBQUU7SUFDakMsSUFBSSxDQUFDLENBQUMsSUFBSSxDQUFDLE1BQU0sS0FBSyxZQUFZO1FBQUUsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ2hELElBQUksQ0FBQyxDQUFDLElBQUksQ0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UFDLElBQUksQ0FBQyxTQUFTO1lBQ25DLElBQUksRUFBRSxJQUFJLENBQUMsTUFBTSxFQUFFO1NBQ3RCLENBQUMsQ0FBQztRQUVILElBQUksSUFBSSxDQUFDLEdBQUcsRUFBRSxJQUFJLE9BQU8sRUFBRTtZQUN2QixVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDL0IsT0FBTztTQUNWO0tBQ0osUUFBUSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLEVBQUU7SUFFM0MsVUFBVSxDQUFDLEdBQUcsRUFBRTtRQUNaLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7WUFBRSxPQUFPO1FBQ2xDLFdBQVcsQ0FBQyxFQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsSUFBSSxDQUFDLEVBQUUsRUFBRSxNQUFNLEVBQUUsZUFBZSxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUMsQ0FBQyxDQUFDO0lBQ3BFLENBQUMsQ0FBQyxDQUFBO0FBQ04sQ0FBQyJ9

View File

@ -0,0 +1,14 @@
// See https://docs.microsoft.com/en-us/azure/active-directory/develop/scenario-spa-app-registration
// You'll need to add the page as a Redirect URL to Azure as a Single Page Application
// noinspection ES6ConvertVarToLetConst - TODO fix this
// Azure Client ID
const azureClientId: string = "a370fff9-7648-4dbf-b96e-2b4f8d539ac2";
// Origins that we'll not use https://viaversion.github.io/VIAaaS/ as redirect URL
const whitelistedOrigin: string[] = [
"https://via.re.yt.nom.br"
];
// Default CORS Proxy config
var defaultCorsProxy: string | null = "https://cors.re.yt.nom.br/";
// Default instance suffix, in format "viaaas.example.com[:25565]", null to use the page hostname;
var defaultInstanceSuffix: string | null = null;

View File

@ -1,4 +1,4 @@
/// <reference path='config.js' />
/// <reference path='config.ts' />
// Note that some APIs only work on HTTPS
// Minecraft.id
@ -256,7 +256,7 @@ function addToast(title: string, msg: string, yes: (() => void) | null = null, n
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
<pre class="txt"></pre>
<pre class="txt text-wrap"></pre>
<div class="btns mt-2 pt-2 border-top"></div>
</div>
</div>`);

View File

@ -0,0 +1,48 @@
"use strict";
importScripts("https://cdnjs.cloudflare.com/ajax/libs/js-sha512/0.8.0/sha512.min.js");
let pending = [];
self.addEventListener("message", e => {
if (e.data.action === "listen_pow") startPoW(e);
if (e.data.action === "cancel") removePending(e.data.id);
});
function removePending(id) {
pending = pending.filter(it => it !== id);
}
function startPoW(e) {
pending.push(e.data.id);
listenPoW(e);
}
function isPending(id) {
return pending.includes(id);
}
function listenPoW(e) {
let user = e.data.user;
let msg = null;
let endTime = Date.now() + 1000;
do {
if (!isPending(e.data.id)) return; // cancelled
msg = JSON.stringify({
action: "offline_login",
username: user,
date: Date.now() - e.data.deltaTime,
rand: Math.random()
});
if (Date.now() >= endTime) {
setTimeout(() => listenPoW(e));
return;
}
} while (!sha512(msg).startsWith("00000"));
setTimeout(() => {
if (!isPending(e.data.id)) return;
postMessage({id: e.data.id, action: "completed_pow", msg: msg});
})
}

View File

@ -11,11 +11,15 @@
"noImplicitOverride": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"removeComments": true,
"removeComments": false,
"alwaysStrict": true,
"strict": true
"strict": true,
"allowJs": true,
"inlineSourceMap": true,
"outDir": "src/main/resources/web/js"
},
"include": [
"js/**.ts"
"src/main/typescript/js/**.ts",
"src/main/typescript/js/**.js"
]
}