update deps, address generator

This commit is contained in:
creeper123123321 2022-09-03 12:03:34 -03:00
parent 51727a4e15
commit a14adff1fc
6 changed files with 226 additions and 75 deletions

88
package-lock.json generated
View File

@ -16,30 +16,30 @@
} }
}, },
"node_modules/@azure/msal-browser": { "node_modules/@azure/msal-browser": {
"version": "2.27.0", "version": "2.28.1",
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-2.27.0.tgz", "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-2.28.1.tgz",
"integrity": "sha512-PyATq2WvK+x32waRqqikym8wvn939iO9UhpFqhLwitNrfLa3PHUgJuuI9oLSQOS3/UzjYb8aqN+XzchU3n/ZuQ==", "integrity": "sha512-5uAfwpNGBSRzBGTSS+5l4Zw6msPV7bEmq99n0U3n/N++iTcha+nIp1QujxTPuOLHmTNCeySdMx9qzGqWuy22zQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@azure/msal-common": "^7.1.0" "@azure/msal-common": "^7.3.0"
}, },
"engines": { "engines": {
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/@azure/msal-common": { "node_modules/@azure/msal-common": {
"version": "7.1.0", "version": "7.3.0",
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-7.1.0.tgz", "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-7.3.0.tgz",
"integrity": "sha512-WyfqE5mY/rggjqvq0Q5DxLnA33KSb0vfsUjxa95rycFknI03L5GPYI4HTU9D+g0PL5TtsQGnV3xzAGq9BFCVJQ==", "integrity": "sha512-revxB3z+QLjwAtU1d04nC1voFr+i3LfqTpUfgrWZVqKh/sSgg0mZZUvw4vKVWB57qtL95sul06G+TfdFZny1Xw==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/@popperjs/core": { "node_modules/@popperjs/core": {
"version": "2.11.5", "version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==", "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"dev": true, "dev": true,
"funding": { "funding": {
"type": "opencollective", "type": "opencollective",
@ -47,9 +47,9 @@
} }
}, },
"node_modules/@types/bootstrap": { "node_modules/@types/bootstrap": {
"version": "5.1.12", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.1.12.tgz", "resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.2.3.tgz",
"integrity": "sha512-pSS5BGEgepwzdbsBGswBWFmgrnYpp7c4UfuYe1FJWwkrcjm/JVwfG4gBkOYtd92Otd3RdJK0ByBWMkBROfLEPw==", "integrity": "sha512-r2SE9NYaaI7B/jJk8gqRtXzlhgFL6dlXBResJkCbQa8ept619WeiOIO4zBQxdmUFzkKNWLK5ZOyYGI3QZoaqbQ==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@popperjs/core": "^2.9.2" "@popperjs/core": "^2.9.2"
@ -77,22 +77,28 @@
"dev": true "dev": true
}, },
"node_modules/bootstrap": { "node_modules/bootstrap": {
"version": "5.1.3", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.0.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==", "integrity": "sha512-qlnS9GL6YZE6Wnef46GxGv1UpGGzAwO0aPL1yOjzDIJpeApeMvqV24iL+pjr2kU4dduoBA9fINKWKgMToobx9A==",
"dev": true, "dev": true,
"funding": { "funding": [
{
"type": "github",
"url": "https://github.com/sponsors/twbs"
},
{
"type": "opencollective", "type": "opencollective",
"url": "https://opencollective.com/bootstrap" "url": "https://opencollective.com/bootstrap"
}, }
],
"peerDependencies": { "peerDependencies": {
"@popperjs/core": "^2.10.2" "@popperjs/core": "^2.11.5"
} }
}, },
"node_modules/jquery": { "node_modules/jquery": {
"version": "3.6.0", "version": "3.6.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==",
"dev": true "dev": true
}, },
"node_modules/uuid": { "node_modules/uuid": {
@ -107,30 +113,30 @@
}, },
"dependencies": { "dependencies": {
"@azure/msal-browser": { "@azure/msal-browser": {
"version": "2.27.0", "version": "2.28.1",
"resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-2.27.0.tgz", "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-2.28.1.tgz",
"integrity": "sha512-PyATq2WvK+x32waRqqikym8wvn939iO9UhpFqhLwitNrfLa3PHUgJuuI9oLSQOS3/UzjYb8aqN+XzchU3n/ZuQ==", "integrity": "sha512-5uAfwpNGBSRzBGTSS+5l4Zw6msPV7bEmq99n0U3n/N++iTcha+nIp1QujxTPuOLHmTNCeySdMx9qzGqWuy22zQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@azure/msal-common": "^7.1.0" "@azure/msal-common": "^7.3.0"
} }
}, },
"@azure/msal-common": { "@azure/msal-common": {
"version": "7.1.0", "version": "7.3.0",
"resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-7.1.0.tgz", "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-7.3.0.tgz",
"integrity": "sha512-WyfqE5mY/rggjqvq0Q5DxLnA33KSb0vfsUjxa95rycFknI03L5GPYI4HTU9D+g0PL5TtsQGnV3xzAGq9BFCVJQ==", "integrity": "sha512-revxB3z+QLjwAtU1d04nC1voFr+i3LfqTpUfgrWZVqKh/sSgg0mZZUvw4vKVWB57qtL95sul06G+TfdFZny1Xw==",
"dev": true "dev": true
}, },
"@popperjs/core": { "@popperjs/core": {
"version": "2.11.5", "version": "2.11.6",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.5.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz",
"integrity": "sha512-9X2obfABZuDVLCgPK9aX0a/x4jaOEweTTWE2+9sr0Qqqevj2Uv5XorvusThmc9XGYpS9yI+fhh8RTafBtGposw==", "integrity": "sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==",
"dev": true "dev": true
}, },
"@types/bootstrap": { "@types/bootstrap": {
"version": "5.1.12", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.1.12.tgz", "resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.2.3.tgz",
"integrity": "sha512-pSS5BGEgepwzdbsBGswBWFmgrnYpp7c4UfuYe1FJWwkrcjm/JVwfG4gBkOYtd92Otd3RdJK0ByBWMkBROfLEPw==", "integrity": "sha512-r2SE9NYaaI7B/jJk8gqRtXzlhgFL6dlXBResJkCbQa8ept619WeiOIO4zBQxdmUFzkKNWLK5ZOyYGI3QZoaqbQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@popperjs/core": "^2.9.2" "@popperjs/core": "^2.9.2"
@ -158,16 +164,16 @@
"dev": true "dev": true
}, },
"bootstrap": { "bootstrap": {
"version": "5.1.3", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.1.3.tgz", "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.2.0.tgz",
"integrity": "sha512-fcQztozJ8jToQWXxVuEyXWW+dSo8AiXWKwiSSrKWsRB/Qt+Ewwza+JWoLKiTuQLaEPhdNAJ7+Dosc9DOIqNy7Q==", "integrity": "sha512-qlnS9GL6YZE6Wnef46GxGv1UpGGzAwO0aPL1yOjzDIJpeApeMvqV24iL+pjr2kU4dduoBA9fINKWKgMToobx9A==",
"dev": true, "dev": true,
"requires": {} "requires": {}
}, },
"jquery": { "jquery": {
"version": "3.6.0", "version": "3.6.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.1.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==", "integrity": "sha512-opJeO4nCucVnsjiXOE+/PcCgYw9Gwpvs/a6B1LL/lQhwWwpbVEVYDZ1FokFr8PRc7ghYlrFPuyHuiiDNTQxmcw==",
"dev": true "dev": true
}, },
"uuid": { "uuid": {

View File

@ -26,24 +26,24 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"
<!-- https://www.srihash.org/ --> <!-- https://www.srihash.org/ -->
<link class="async-css" rel="preload" as="style" <link class="async-css" rel="preload" as="style"
href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.min.css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/css/bootstrap.min.css"
integrity="sha512-GQGU0fMMi238uA+a/bdWJfpUGKUkBdgfFdgBm72SUQ6BeyWjoY/ton0tEjH+OSH9iP4Dfh+7HM0I9f5eR0L/4w==" integrity="sha512-XWTTruHZEYJsxV3W/lSXG1n3Q39YIWOstqvmFsdNEEQfHoZ6vm6E9GK2OrF6DSJSpIbRbi+Nn0WDPID9O7xB2Q=="
crossorigin="anonymous" referrerpolicy="no-referrer"/> crossorigin="anonymous" referrerpolicy="no-referrer"/>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/js/bootstrap.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.0/js/bootstrap.bundle.min.js"
integrity="sha512-OvBgP9A2JBgiRad/mM36mkzXSXaJE9BEIENnVEmeZdITvwT09xnxLtT4twkCa8m/loMbPHsvPl0T8lRGVBwjlQ==" integrity="sha512-9GacT4119eY3AcosfWtHMsT5JyZudrexyEVzTBWV3viP/YfB9e2pEy3N7WXL3SV6ASXpTU0vzzSxsbfsuUH4sQ=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Safari workaround --> <!-- Safari workaround -->
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/HTML5Notification/3.0.0/Notification.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/HTML5Notification/3.0.0/Notification.min.js"
integrity="sha512-gx0m7Qoum1Bb0KrP6AEZSt0e+o2xMEyStAz2TNGXGqR4HSVgPveWFQdtE06FRvJmmp8HdkJklOLYiV3aZN6tQg==" integrity="sha512-gx0m7Qoum1Bb0KrP6AEZSt0e+o2xMEyStAz2TNGXGqR4HSVgPveWFQdtE06FRvJmmp8HdkJklOLYiV3aZN6tQg=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.slim.min.js" <script defer src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js"
integrity="sha512-6ORWJX/LrnSjBzwefdNUyLCMTIsGoNP6NftMy2UAm1JBm6PRZCO1d7OHBStWpVFZLO+RerTvqX/Z9mBFfCJZ4A==" integrity="sha512-aVKKRRi/Q/YV+4mjoKBsE4x3H+BkegoM/em46NNlCqNTmUYADjBbeNefNxYV7giUp0VxICtqdrbqU7iVaeZNXA=="
crossorigin="anonymous"></script> crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<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.27.0/js/msal-browser.min.js" <script defer src="https://alcdn.msauth.net/browser/2.28.1/js/msal-browser.min.js"
integrity="sha384-IlUQkOwOI6mWk8GNIWu8hpPE1sasxSg3gGjZo0dncq6IhHsTlH51mp5mhFYS5po1" integrity="sha384-ei8xVSyFPTuRnbO1sdYy5qJT6Kd9neBfVG8AjZySEwdMG1GhCThbceSqxJnx0Ci3"
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>
@ -110,33 +110,88 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"
</button> </button>
</div> </div>
<hr> <hr>
<p>Connecting to backend server:</p> <p>Connecting to server:</p>
<div id="connect"> <div id="connect">
<form class="input-group mb-3 row g-3 justify-content-md-center"> <form class="input-group mb-3 row g-3 justify-content-md-center" id="address_info_form">
<div class="col-md-4"> <div class="col-md-3">
<input id="connect_address" type="text" class="form-control" placeholder="Address:Port" <input id="connect_address" type="text" class="form-control" placeholder="Address:Port"
aria-label="Address and Port"> aria-label="Address and Port">
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group">
<span class="input-group-text"><abbr title="Version">v</abbr></span>
<input id="connect_version" type="text" class="form-control col-auto" placeholder="Version" <input id="connect_version" type="text" class="form-control col-auto" placeholder="Version"
aria-label="Version"> aria-label="Version" list="backend_version_list">
</div>
<datalist id="backend_version_list">
<option>AUTO</option>
<option value="1.19.2">1.19.1/2</option>
<option>1.19</option>
<option>1.18.2</option>
<option value="1.18.1">1.18(.1)</option>
<option>1.17.1</option>
<option>1.17</option>
<option value="1.16.5">1.16.4/5</option>
<option>1.16.3</option>
<option>1.16.2</option>
<option>1.16.1</option>
<option>1.16</option>
<option>1.15.2</option>
<option>1.15.1</option>
<option>1.15</option>
<option>1.14.4</option>
<option>1.14.3</option>
<option>1.14.2</option>
<option>1.14.1</option>
<option>1.14</option>
<option>1.13.2</option>
<option>1.13.1</option>
<option>1.13</option>
<option>1.12.2</option>
<option>1.12.1</option>
<option>1.12</option>
<option value="1.11.2">1.11.1/2</option>
<option>1.11</option>
<option value="1.10">1.10.x</option>
<option value="1.9.4">1.9.3/4</option>
<option>1.9.2</option>
<option>1.9.1</option>
<option>1.9</option>
<option>1.8.x</option>
<option value="1.7.10">1.7.6-10</option>
<option value="1.7.5">1.7.2-5</option>
</datalist>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group">
<span class="input-group-text"><abbr title="Username">u</abbr></span>
<input id="connect_user" type="text" class="form-control" placeholder="Back Username" <input id="connect_user" type="text" class="form-control" placeholder="Back Username"
aria-label="Backend Username" list="backend_user_list" maxlength="16"> aria-label="Backend Username" list="backend_user_list" maxlength="16">
</div>
<datalist id="backend_user_list"></datalist> <datalist id="backend_user_list"></datalist>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<div class="input-group">
<span class="input-group-text"><abbr title="Online Mode">o</abbr></span>
<select class="form-select" id="connect_online" aria-label="Online Mode"> <select class="form-select" id="connect_online" aria-label="Online Mode">
<option value="null" selected>Front Auth...</option> <option value="" selected>Front Auth...</option>
<option>AUTO</option> <option>AUTO</option>
<option value="true">Online</option> <option value="true">Online</option>
<option value="false">Offline (recommended for Geyser)</option> <option value="false">Offline (recommended for Geyser)</option>
</select> </select>
</div> </div>
</div>
<div class="col-md-2">
<div class="input-group">
<span class="input-group-text">.</span>
<input id="instance_suffix" type="text" class="form-control"
placeholder="Instance Suffix" aria-label="Instance Suffix" readonly>
</div>
</div>
</form> </form>
<p>You can also use <a href="https://jo0001.github.io/ViaSetup/aspirin" id="viasetup_address">the address <p>You can also use this address to specify the server:
generator</a> to specify the server</p> <span class="font-monospace" id="generated_address" data-bs-toggle="tooltip" data-bs-placement="top"
title="Click to copy"></span></p>
</div> </div>
</div> </div>
@ -318,10 +373,10 @@ frame-src 'self' https://login.microsoftonline.com/ https://login.live.com/"
<button aria-label="Close" class="btn-close" data-bs-dismiss="modal" type="button"></button> <button aria-label="Close" class="btn-close" data-bs-dismiss="modal" type="button"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p>The instance will cache your Minecraft access token, allowing you to connect without keeping <p>The instance will cache your Minecraft access token for some minutes, allowing you to connect
this page open.</p> without keeping this page open.</p>
<p>Note that the access token expires in ~1 day and a compromised instance may access your account <p>Note that the access token are valid for ~1 day and a compromised instance may be used to access
with malicious intents.</p> your account.</p>
<p>You'll need to connect as online-mode in the front-end. It's not possible to use the cached <p>You'll need to connect as online-mode in the front-end. It's not possible to use the cached
token when changing the backend username</p> token when changing the backend username</p>
<div class="input-group mb-3"> <div class="input-group mb-3">

View File

@ -9,3 +9,5 @@ const whitelistedOrigin = [
]; ];
// Default CORS Proxy config // Default CORS Proxy config
const defaultCorsProxy = "https://cors.re.yt.nom.br/"; const defaultCorsProxy = "https://cors.re.yt.nom.br/";
// Default instance suffix, in format "viaaas.example.com[:25565]", null to use the page hostname;
const defaultInstanceSuffix = null;

View File

@ -20,6 +20,7 @@ let listening = document.getElementById("listening");
let accounts = document.getElementById("accounts-list"); let accounts = document.getElementById("accounts-list");
let cors_proxy_txt = document.getElementById("cors-proxy"); let cors_proxy_txt = document.getElementById("cors-proxy");
let ws_url_txt = document.getElementById("ws-url"); let ws_url_txt = document.getElementById("ws-url");
let instance_suffix_input = document.getElementById("instance_suffix");
let listenVisible = false; let listenVisible = false;
let deltaTime = 0; let deltaTime = 0;
let workers = []; let workers = [];
@ -39,8 +40,12 @@ $(() => {
$(".async-css").attr("rel", "stylesheet"); $(".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());
$("[data-bs-toggle='tooltip']").get().forEach(it => {
new bootstrap.Tooltip(it);
});
cors_proxy_txt.value = getCorsProxy(); cors_proxy_txt.value = getCorsProxy();
ws_url_txt.value = getWsUrl(); ws_url_txt.value = getWsUrl();
instance_suffix_input.defaultValue = getDefaultInstanceSuffix();
$("#form_add_ms").on("submit", () => loginMs()); $("#form_add_ms").on("submit", () => loginMs());
$("#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()));
@ -48,8 +53,11 @@ $(() => {
$("#form_send_token").on("submit", () => submittedSendToken()); $("#form_send_token").on("submit", () => submittedSendToken());
$("#en_notifications").on("click", () => Notification.requestPermission().then(renderActions)); $("#en_notifications").on("click", () => Notification.requestPermission().then(renderActions));
$("#listen_continue").on("click", () => clickedListenContinue()); $("#listen_continue").on("click", () => clickedListenContinue());
window.addEventListener('beforeinstallprompt', e => e.preventDefault()); $("#address_info_form").on("input", () => generateAddress());
$("#generated_address").on("click", () => copyGeneratedAddress());
$(window).on("beforeinstallprompt", e => e.preventDefault());
ohNo(); ohNo();
generateAddress();
refreshAccountList(); refreshAccountList();
setInterval(refreshCorsStatus, 10 * 60 * 1000); setInterval(refreshCorsStatus, 10 * 60 * 1000);
refreshCorsStatus(); refreshCorsStatus();
@ -104,6 +112,39 @@ function refreshAccountList() {
addUsernameList(it.name); addUsernameList(it.name);
}); });
} }
function copyGeneratedAddress() {
navigator.clipboard.writeText($("#generated_address").text()).catch(e => console.log(e));
}
function generateAddress() {
let backAddress = $("#connect_address").val();
try {
let url = new URL("https://" + backAddress);
let finalAddress = "";
let host = url.hostname;
let version = $("#connect_version").val().toString().replaceAll(".", "_");
let username = $("#connect_user").val();
let onlineMode = $("#connect_online").val().toString();
if (host.includes(":") || host.includes("[")) {
host = host.replaceAll(":", "-")
.replaceAll(/[\[\]]/g, "") + ".sslip.io";
}
finalAddress += host;
if (url.port)
finalAddress += "._p" + url.port;
if (version)
finalAddress += "._v" + version;
if (username)
finalAddress += "._u" + username;
if (onlineMode)
finalAddress += "._o" + onlineMode.substring(0, 1);
finalAddress += "." + $("#instance_suffix").val();
$("#generated_address").text(finalAddress);
}
catch (e) {
console.log(e);
$("#generated_address").text("");
}
}
$("#mcIdUsername").text(mcIdUsername); $("#mcIdUsername").text(mcIdUsername);
function submittedListen() { function submittedListen() {
let user = $("#listen_username").val(); let user = $("#listen_username").val();
@ -314,6 +355,9 @@ function authNotification(msg, yes, no) {
function defaultCors() { function defaultCors() {
return self.defaultCorsProxy || "https://cors.re.yt.nom.br/"; return self.defaultCorsProxy || "https://cors.re.yt.nom.br/";
} }
function getDefaultInstanceSuffix() {
return self.defaultInstanceSuffix || location.hostname;
}
function getCorsProxy() { function getCorsProxy() {
return localStorage.getItem("viaaas_cors_proxy") || defaultCors(); return localStorage.getItem("viaaas_cors_proxy") || defaultCors();
} }

View File

@ -1,5 +1,6 @@
/// <reference path='config.js' /> /// <reference path='config.js' />
"use strict" "use strict"
// Note that some APIs only work on HTTPS
// Minecraft.id // Minecraft.id
let urlParams = new URLSearchParams(); let urlParams = new URLSearchParams();
@ -26,6 +27,7 @@ let listening = document.getElementById("listening");
let accounts = document.getElementById("accounts-list"); let accounts = document.getElementById("accounts-list");
let cors_proxy_txt = document.getElementById("cors-proxy") as HTMLInputElement; let cors_proxy_txt = document.getElementById("cors-proxy") as HTMLInputElement;
let ws_url_txt = document.getElementById("ws-url") as HTMLInputElement; let ws_url_txt = document.getElementById("ws-url") as HTMLInputElement;
let instance_suffix_input = document.getElementById("instance_suffix") as HTMLInputElement;
let listenVisible = false; let listenVisible = false;
// + deltaTime means that the clock is ahead // + deltaTime means that the clock is ahead
let deltaTime = 0; let deltaTime = 0;
@ -47,9 +49,13 @@ $(() => {
$(".async-css").attr("rel", "stylesheet"); $(".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());
$("[data-bs-toggle='tooltip']").get().forEach(it => {
new bootstrap.Tooltip(it);
});
cors_proxy_txt.value = getCorsProxy(); cors_proxy_txt.value = getCorsProxy();
ws_url_txt.value = getWsUrl(); ws_url_txt.value = getWsUrl();
instance_suffix_input.defaultValue = getDefaultInstanceSuffix();
$("#form_add_ms").on("submit", () => loginMs()); $("#form_add_ms").on("submit", () => loginMs());
$("#form_ws_url").on("submit", () => setWsUrl($("#ws-url").val() as string)); $("#form_ws_url").on("submit", () => setWsUrl($("#ws-url").val() as string));
@ -58,10 +64,13 @@ $(() => {
$("#form_send_token").on("submit", () => submittedSendToken()); $("#form_send_token").on("submit", () => submittedSendToken());
$("#en_notifications").on("click", () => Notification.requestPermission().then(renderActions)); $("#en_notifications").on("click", () => Notification.requestPermission().then(renderActions));
$("#listen_continue").on("click", () => clickedListenContinue()); $("#listen_continue").on("click", () => clickedListenContinue());
window.addEventListener('beforeinstallprompt', e => e.preventDefault()); $("#address_info_form").on("input", () => generateAddress());
$("#generated_address").on("click", () => copyGeneratedAddress());
$(window).on("beforeinstallprompt", e => e.preventDefault());
ohNo(); ohNo();
generateAddress();
refreshAccountList(); refreshAccountList();
setInterval(refreshCorsStatus, 10 * 60 * 1000); setInterval(refreshCorsStatus, 10 * 60 * 1000);
refreshCorsStatus(); refreshCorsStatus();
@ -125,6 +134,36 @@ function refreshAccountList() {
}); });
} }
function copyGeneratedAddress() {
navigator.clipboard.writeText($("#generated_address").text()).catch(e => console.log(e));
}
function generateAddress() {
let backAddress = $("#connect_address").val();
try {
let url = new URL("https://" + backAddress);
let finalAddress = "";
let host = url.hostname;
let version = $("#connect_version").val().toString().replaceAll(".", "_");
let username = $("#connect_user").val();
let onlineMode = $("#connect_online").val().toString();
if (host.includes(":") || host.includes("[")) {
host = host.replaceAll(":", "-")
.replaceAll(/[\[\]]/g, "") + ".sslip.io";
}
finalAddress += host;
if (url.port) finalAddress += "._p" + url.port;
if (version) finalAddress += "._v" + version;
if (username) finalAddress += "._u" + username;
if (onlineMode) finalAddress += "._o" + onlineMode.substring(0, 1);
finalAddress += "." + $("#instance_suffix").val();
$("#generated_address").text(finalAddress)
} catch (e) {
console.log(e);
$("#generated_address").text("");
}
}
$("#mcIdUsername").text(mcIdUsername); $("#mcIdUsername").text(mcIdUsername);
function submittedListen() { function submittedListen() {
@ -354,6 +393,11 @@ function defaultCors(): string {
return self.defaultCorsProxy || "https://cors.re.yt.nom.br/"; return self.defaultCorsProxy || "https://cors.re.yt.nom.br/";
} }
function getDefaultInstanceSuffix(): string {
// @ts-ignore
return self.defaultInstanceSuffix || location.hostname;
}
function getCorsProxy(): string { function getCorsProxy(): string {
return localStorage.getItem("viaaas_cors_proxy") || defaultCors(); return localStorage.getItem("viaaas_cors_proxy") || defaultCors();
} }

View File

@ -3,7 +3,7 @@
"target": "ES2018", "target": "ES2018",
"module": "ES2015", "module": "ES2015",
"lib": [ "lib": [
"ES2018", "ES2021",
"DOM" "DOM"
], ],
"moduleResolution": "Node", "moduleResolution": "Node",