Skip to content

Commit

Permalink
Use AuthURL in status for now (bg needed for up)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbraad committed Jun 7, 2023
1 parent fa2aeb3 commit 181aa18
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ export async function activate(extensionContext: podmanDesktopAPI.ExtensionConte
// check registration status
// if not registered => "BackendState": "NeedsLogin"
if (status.BackendState === 'NeedsLogin') {
// no markdown description
//const upResponse = await getTailscaleUp()
// get the authurl but ignore the response
await getTailscaleUp()
// now AUthURL is filled in status
const loginstatusResponse = await getTailscaleStatus();
const [loginstatus, rawloginStatus] = loginstatusResponse;

// no markdown description so no QR
await podmanDesktopAPI.window.showInformationMessage(
'Please register node to your tailnet\n\n' + status.AuthURL,
'Please register node to your tailnet\n\n' + loginstatus.AuthURL,
'OK',
);
}
Expand All @@ -67,6 +71,6 @@ async function getTailscaleStatus(): Promise<[StatusResponse, string]> {
}

async function getTailscaleUp(): Promise<[TailscaleUpResponse, string]> {
const up = await exec('podman', ['exec', containerName, 'tailscale up --reset --force-reauth --json']);
const up = await exec('podman', ['exec', containerName, 'tailscale up --reset --force-reauth --json --timeout 1s']);
return [JSON.parse(up.stdOut), up.stdOut];
}

0 comments on commit 181aa18

Please sign in to comment.