maskable icon, webp

This commit is contained in:
creeper123123321 2021-09-26 12:44:01 -03:00
parent 396dcb4024
commit 171c00a148
6 changed files with 40 additions and 44 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -10,9 +10,8 @@
<meta content="VIAaaS" property="og:title"> <meta content="VIAaaS" property="og:title">
<meta content="VIAaaS - ViaVersion as a Service - Standalone ViaVersion Proxy" property="og:description"> <meta content="VIAaaS - ViaVersion as a Service - Standalone ViaVersion Proxy" property="og:description">
<meta content="game" property="og:type"> <meta content="game" property="og:type">
<meta content="logo.png" <meta content="img/logo.webp" property="og:image">
property="og:image"> <link href="img/logo.webp" rel="icon">
<link href="logo.png" rel="icon">
<link rel="manifest" href="manifest.json"> <link rel="manifest" href="manifest.json">
<meta content="default-src 'self'; <meta content="default-src 'self';
style-src 'self' https://cdnjs.cloudflare.com/; style-src 'self' https://cdnjs.cloudflare.com/;
@ -25,12 +24,12 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
<meta content="#0468a1" name="theme-color"> <meta content="#0468a1" name="theme-color">
<!-- https://www.srihash.org/ --> <!-- https://www.srihash.org/ -->
<link class="css_async" disabled rel="stylesheet" <link class="async-css" rel="preload" as="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.0/css/bootstrap.min.css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.1/css/bootstrap.min.css"
integrity="sha512-F7WyTLiiiPqvu2pGumDR15med0MDkUIo5VTVyyfECR5DZmCnDhti9q5VID02ItWjq6fvDfMaBaDl2J3WdL1uxA==" integrity="sha512-6KY5s6UI5J7SVYuZB4S/CZMyPylqyyNZco376NM2Z8Sb8OxEdp02e1jkKk/wZxIEmjQ6DRCEBhni+gpr9c4tvA=="
crossorigin="anonymous" referrerpolicy="no-referrer"/> crossorigin="anonymous" referrerpolicy="no-referrer"/>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.1.0/js/bootstrap.bundle.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.1/js/bootstrap.min.js"
integrity="sha512-PqRelaJGXVuQ81N6wjUrRQelCDR7z8RvKGiR9SbSxKHPIt15eJDmIVv9EJgwq0XvgylszsjzvQ0+VyI2WtIshQ==" integrity="sha512-ewfXo9Gq53e1q1+WDTjaHAGZ8UvCWq0eXONhwDuIoaH8xz2r96uoAYaQCm1oQhnBfRXrvJztNXFsTloJfgbL5Q=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.43/polyfill.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.43/polyfill.min.js"
integrity="sha512-lvWiOP+aMKHllm4THsjzNleVuGOh0WGniJ3lgu/nvCbex1LlaQSxySUjAu/LTJw9FhnSL/PVYoQcckg1Q03+fQ==" integrity="sha512-lvWiOP+aMKHllm4THsjzNleVuGOh0WGniJ3lgu/nvCbex1LlaQSxySUjAu/LTJw9FhnSL/PVYoQcckg1Q03+fQ=="
@ -44,13 +43,13 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
<script defer crossorigin="anonymous" <script defer crossorigin="anonymous"
integrity="sha512-UNM1njAgOFUa74Z0bADwAq8gbTcqZC8Ej4xPSzpnh0l6KMevwvkBvbldF9uR++qKeJ+MOZHRjV1HZjoRvjDfNQ==" integrity="sha512-UNM1njAgOFUa74Z0bADwAq8gbTcqZC8Ej4xPSzpnh0l6KMevwvkBvbldF9uR++qKeJ+MOZHRjV1HZjoRvjDfNQ=="
src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js"></script> src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.3.2/uuid.min.js"></script>
<script defer src="https://alcdn.msauth.net/browser/2.15.0/js/msal-browser.min.js" <script defer src="https://alcdn.msauth.net/browser/2.17.0/js/msal-browser.min.js"
integrity="sha384-/weuqUPkC0P9JxnstihEV1GHdWrheU9Qo3MbdTuxxKJM8l/cSTE5zGP5VBIM4TZN" integrity="sha384-nPvMTGGQIdPr+oK09URmAR99LAk9PEVLJE+RJfjIH/QADFbVgGlF9tFdVbgSYC+c"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script defer src="js/config.js"></script> <script defer src="js/config.js"></script>
<script defer src="js/page.js"></script> <script defer src="js/page.js"></script>
<link rel="prefetch" href="js/worker.js" as="worker"> <link rel="preload" href="js/worker.js" as="worker">
<link rel="prefetch" href="sw.js" as="serviceworker"> <link rel="preload" href="sw.js" as="serviceworker">
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-2"> <nav class="navbar navbar-expand-md navbar-dark bg-dark mb-2">
@ -154,7 +153,7 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- Design somewhat stolen/inspired from Gnome --> <!-- Design somewhat stolen/inspired from Gnome -->
<img src="logo.png" <img loading="lazy" src="img/logo.webp"
class="mx-auto d-block" alt="VIAaaS logo" width="150"> class="mx-auto d-block" alt="VIAaaS logo" width="150">
<div class="text-center mb-3"> <div class="text-center mb-3">
<h5>ViaVersion as a Service</h5> <h5>ViaVersion as a Service</h5>
@ -169,22 +168,16 @@ script-src 'self' https://*.cloudflare.com/ https://alcdn.msauth.net/ https://*.
<div> <div>
<p>VIAaaS is free software: you can redistribute it and/or modify it under the terms of the GNU <p>VIAaaS is free software: you can redistribute it and/or modify it under the terms of the GNU
Affero General Public License as published by the Free Software Foundation, either version 3 of Affero General Public License as published by the Free Software Foundation, either version 3 of
the the License, or (at your option) any later version.</p>
License,
or (at your option) any later version.</p>
<p>VIAaaS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without <p>VIAaaS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero Affero General Public License for more details.</p>
General
Public License for more details.</p>
<p>You should have received a copy of the GNU Affero General Public License along with this program. <p>You should have received a copy of the GNU Affero General Public License along with this program.
If If not, see <a href="https://gnu.org/licenses">https://gnu.org/licenses/</a>.</p>
not, see <a href="https://gnu.org/licenses">https://gnu.org/licenses/</a>.</p>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" href="https://github.com/ViaVersion/VIAaaS/" role="button">Source <a class="btn btn-secondary" href="https://github.com/ViaVersion/VIAaaS/" role="button">Source Code</a>
Code</a>
<button class="btn btn-primary" data-bs-dismiss="modal" type="button">Close</button> <button class="btn btn-primary" data-bs-dismiss="modal" type="button">Close</button>
</div> </div>
</div> </div>

View File

@ -16,7 +16,6 @@ $(() => {
} }
if (mcauth_code != null) { if (mcauth_code != null) {
history.replaceState(null, null, "#"); history.replaceState(null, null, "#");
renderActions();
} }
}); });
@ -40,21 +39,18 @@ $(() => {
}); });
$(() => { $(() => {
if (navigator.serviceWorker) { if (navigator.serviceWorker) {
navigator.serviceWorker.register("sw.js") navigator.serviceWorker.register("sw.js").then(() => swCacheFiles());
.then(() => swCacheFiles());
} }
}) })
window.addEventListener('beforeinstallprompt', e => e.preventDefault()); window.addEventListener('beforeinstallprompt', e => e.preventDefault());
$(() => { $(() => {
$(".css_async").attr("disabled", null); $(".async-css").attr("rel", "stylesheet");
$("form").on("submit", e => e.preventDefault()); $("form").on("submit", e => e.preventDefault());
$("a[href='javascript:']").on("click", e => e.preventDefault()); $("a[href='javascript:']").on("click", e => e.preventDefault());
ohNo(); cors_proxy_txt.value = getCorsProxy();
cors_proxy_txt.value = getCorsProxy()
ws_url_txt.value = getWsUrl(); ws_url_txt.value = getWsUrl();
$("#form_add_mc").on("submit", () => loginMc($("#email").val(), $("#password").val())); $("#form_add_mc").on("submit", () => loginMc($("#email").val(), $("#password").val()));
@ -62,19 +58,22 @@ $(() => {
$("#form_ws_url").on("submit", () => setWsUrl($("#ws-url").val())); $("#form_ws_url").on("submit", () => setWsUrl($("#ws-url").val()));
$("#form_cors_proxy").on("submit", () => setCorsProxy($("#cors-proxy").val())); $("#form_cors_proxy").on("submit", () => setCorsProxy($("#cors-proxy").val()));
ohNo();
refreshAccountList(); refreshAccountList();
setInterval(refreshCorsStatus, 10 * 60 * 1000); // Heroku auto sleeps in 30 min setInterval(refreshCorsStatus, 10 * 60 * 1000); // Heroku auto sleeps in 30 min
refreshCorsStatus(); refreshCorsStatus();
resetHtml(); resetHtml();
connect();
}); });
$(() => {
connect();
})
function swCacheFiles() { function swCacheFiles() {
navigator.serviceWorker.ready.then(ready => ready.active.postMessage({ navigator.serviceWorker.ready.then(ready => ready.active.postMessage({
action: "cache", action: "cache",
urls: performance.getEntriesByType("resource") urls: performance.getEntriesByType("resource").map(it => it.name)
.map(it => it.name)
})); // https://stackoverflow.com/questions/46830493/is-there-any-way-to-cache-all-files-of-defined-folder-path-in-service-worker })); // https://stackoverflow.com/questions/46830493/is-there-any-way-to-cache-all-files-of-defined-folder-path-in-service-worker
} }
@ -95,7 +94,7 @@ function refreshCorsStatus() {
function addMcAccountToList(account) { function addMcAccountToList(account) {
let line = $(`<li class='input-group d-flex'> let line = $(`<li class='input-group d-flex'>
<span class='input-group-text'><img width=24 class='mc-head'/></span> <span class='input-group-text'><img loading="lazy" width=24 class='mc-head'/></span>
<span class='form-control mc-user'></span> <span class='form-control mc-user'></span>
<a class='btn btn-danger mc-remove' href='javascript:'>Logout</a> <a class='btn btn-danger mc-remove' href='javascript:'>Logout</a>
</li>`); </li>`);
@ -182,7 +181,7 @@ function addAction(text, onClick) {
} }
function addListeningList(user, token) { function addListeningList(user, token) {
let line = $("<p><img width=24 class='head'/> <span class='username'></span> <a href='javascript:'>Unlisten</a></p>"); let line = $("<p><img loading='lazy' width=24 class='head'/> <span class='username'></span> <a href='javascript:'>Unlisten</a></p>");
line.find(".username").text(user); line.find(".username").text(user);
line.find("a").on("click", () => { line.find("a").on("click", () => {
removeToken(token); removeToken(token);
@ -251,7 +250,11 @@ function ohNo() {
console.log("time seems synchronized"); console.log("time seems synchronized");
} }
}) })
try {!BroadcastChannel} catch(e) {addToast("Unsupported browser", "This browser doesn't support required APIs");} try {
!BroadcastChannel
} catch (e) {
addToast("Unsupported browser", "This browser doesn't support required APIs");
}
new Date().getDay() === 3 && console.log("it's snapshot day 🐸 my dudes"); new Date().getDay() === 3 && console.log("it's snapshot day 🐸 my dudes");
new Date().getDate() === 1 && new Date().getMonth() === 3 && addToast("WARNING", "Your ViaVersion has expired, please renew it at https://viaversion.com/ for $99"); new Date().getDate() === 1 && new Date().getMonth() === 3 && addToast("WARNING", "Your ViaVersion has expired, please renew it at https://viaversion.com/ for $99");
} catch (e) { } catch (e) {
@ -288,8 +291,7 @@ function filterNot(array, item) {
// Notification // Notification
let notificationCallbacks = {}; let notificationCallbacks = {};
$(() => { $(() => {
new BroadcastChannel("viaaas-notification") new BroadcastChannel("viaaas-notification").addEventListener("message", handleSWMsg);
.addEventListener("message", handleSWMsg);
}) })
function handleSWMsg(event) { function handleSWMsg(event) {
@ -303,7 +305,7 @@ function handleSWMsg(event) {
function authNotification(msg, yes, no) { function authNotification(msg, yes, no) {
if (!navigator.serviceWorker || Notification.permission !== "granted") { if (!navigator.serviceWorker || Notification.permission !== "granted") {
if (addToast("Allow auth impersonation?", msg, yes, no)); addToast("Allow auth impersonation?", msg, yes, no);
return; return;
} }
let tag = uuid.v4(); let tag = uuid.v4();
@ -488,7 +490,7 @@ class MicrosoftAccount extends McAccount {
if (!msAccount) return; if (!msAccount) return;
const logoutRequest = {account: msAccount}; const logoutRequest = {account: msAccount};
myMSALObj.logout(logoutRequest); myMSALObj.logoutPopup(logoutRequest);
} }
refresh() { refresh() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

View File

@ -2,9 +2,10 @@
"short_name": "VIAaaS", "short_name": "VIAaaS",
"name": "VIAaaS - ViaVersion as a Service", "name": "VIAaaS - ViaVersion as a Service",
"icons": [{ "icons": [{
"src": "./logo.png", "src": "./img/maskable_icon.webp",
"sizes": "600x600", "sizes": "857x857",
"type": "image/png" "type": "image/png",
"purpose": "any maskable"
}], }],
"start_url": "./index.html", "start_url": "./index.html",
"background_color": "#3367D6", "background_color": "#3367D6",