21 lines
960 B
JavaScript
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.';
|
|
}
|
|
})();
|