Files
holesail-browser/extension/wrong-domain.js
T
Raven Scott d58a0b6e2d
CI / Build & Test (push) Has been cancelled
first commit
2026-02-27 18:13:59 -05:00

21 lines
960 B
JavaScript

(function () {
const params = new URLSearchParams(window.location.search);
const host = (params.get('host') || '').trim();
const subEl = document.getElementById('sub');
const suggestionEl = document.getElementById('suggestion');
if (host) {
if (subEl) subEl.textContent = 'You tried to open: ' + host + '.host.test';
const suggestedHost = host + '.hs';
const proxyPort = 8443;
const suggestedUrl = 'https://' + suggestedHost + ':' + proxyPort + '/';
if (suggestionEl) {
suggestionEl.innerHTML = 'Use this address instead: <a href="' + suggestedUrl + '" id="go">' + suggestedUrl + '</a>';
const link = document.getElementById('go');
if (link) link.addEventListener('click', function (e) { e.preventDefault(); window.location.href = suggestedUrl; });
}
} else {
if (suggestionEl) suggestionEl.textContent = 'Use a hostname ending in .hs (e.g. myapp.hs) and add it in the Holesail Dashboard.';
}
})();