|
@@ -43,12 +43,12 @@
|
|
let loginPromise = new Promise((f,r) => {
|
|
let loginPromise = new Promise((f,r) => {
|
|
resolveLogin = f;
|
|
resolveLogin = f;
|
|
});
|
|
});
|
|
|
|
+ const loginElem = document.getElementById("loginLink");
|
|
|
|
+ const statusElem = document.getElementById("networkStatus");
|
|
const loginUrlCb = (url) => {
|
|
const loginUrlCb = (url) => {
|
|
- const a = document.getElementById("loginLink");
|
|
|
|
- a.href = url;
|
|
|
|
- a.target = "_blank";
|
|
|
|
- const status = document.getElementById("networkStatus");
|
|
|
|
- status.innerHTML = "Tailscale Login";
|
|
|
|
|
|
+ loginElem.href = url;
|
|
|
|
+ loginElem.target = "_blank";
|
|
|
|
+ statusElem.innerHTML = "Tailscale Login";
|
|
resolveLogin(url);
|
|
resolveLogin(url);
|
|
};
|
|
};
|
|
const stateUpdateCb = (state) => {
|
|
const stateUpdateCb = (state) => {
|
|
@@ -60,8 +60,7 @@
|
|
}
|
|
}
|
|
case State.Running:
|
|
case State.Running:
|
|
{
|
|
{
|
|
- const a = document.getElementById("loginLink");
|
|
|
|
- a.href = "https://login.tailscale.com/admin/machines";
|
|
|
|
|
|
+ loginElem.href = "https://login.tailscale.com/admin/machines";
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case State.Starting:
|
|
case State.Starting:
|
|
@@ -80,8 +79,7 @@
|
|
};
|
|
};
|
|
const netmapUpdateCb = (map) => {
|
|
const netmapUpdateCb = (map) => {
|
|
const ip = map.self.addresses[0];
|
|
const ip = map.self.addresses[0];
|
|
- const status = document.getElementById("networkStatus");
|
|
|
|
- status.innerHTML = "IP: "+ip;
|
|
|
|
|
|
+ statusElem.innerHTML = "IP: "+ip;
|
|
};
|
|
};
|
|
const { listen, connect, bind, up } = await autoConf({
|
|
const { listen, connect, bind, up } = await autoConf({
|
|
loginUrlCb,
|
|
loginUrlCb,
|
|
@@ -91,15 +89,15 @@
|
|
window.networkInterface.bind = bind;
|
|
window.networkInterface.bind = bind;
|
|
window.networkInterface.connect = connect;
|
|
window.networkInterface.connect = connect;
|
|
window.networkInterface.listen = listen;
|
|
window.networkInterface.listen = listen;
|
|
- window.startTailscaleAndGetLogin = async () => {
|
|
|
|
- const a = document.getElementById("loginLink");
|
|
|
|
- a.onclick = null;
|
|
|
|
- const status = document.getElementById("networkStatus");
|
|
|
|
- status.innerHTML = "Downloading network code...";
|
|
|
|
|
|
+ loginElem.style.cursor = "pointer";
|
|
|
|
+ statusElem.style.color = "white";
|
|
|
|
+ loginElem.onclick = async () => {
|
|
|
|
+ loginElem.onclick = null;
|
|
|
|
+ statusElem.innerHTML = "Downloading network code...";
|
|
const w = window.open("login.html", "_blank");
|
|
const w = window.open("login.html", "_blank");
|
|
await up();
|
|
await up();
|
|
w.document.body.innerHTML = "Starting login...";
|
|
w.document.body.innerHTML = "Starting login...";
|
|
- status.innerHTML = "Starting login...";
|
|
|
|
|
|
+ statusElem.innerHTML = "Starting login...";
|
|
const url = await loginPromise;
|
|
const url = await loginPromise;
|
|
w.location.href = url;
|
|
w.location.href = url;
|
|
};
|
|
};
|
|
@@ -138,8 +136,8 @@
|
|
</a>
|
|
</a>
|
|
</li>
|
|
</li>
|
|
<li style=" margin-right: 50px; height: 100%; display: flex; align-items: center;">
|
|
<li style=" margin-right: 50px; height: 100%; display: flex; align-items: center;">
|
|
- <a id="loginLink" href="#" onclick="startTailscaleAndGetLogin()" style="text-decoration: none">
|
|
|
|
- <div id="networkStatus" style="color: white; font-family: montserrat; font-weight: 700; font-size: large;">Tailscale Login</div>
|
|
|
|
|
|
+ <a id="loginLink" style="text-decoration: none; cursor:not-allowed;">
|
|
|
|
+ <div id="networkStatus" style="color: grey; font-family: montserrat; font-weight: 700; font-size: large;">Tailscale Login</div>
|
|
</a>
|
|
</a>
|
|
</li>
|
|
</li>
|
|
</div>
|
|
</div>
|