Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Add GitPod support to near login
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrichina committed Apr 1, 2020
1 parent f5d94ac commit 58f91f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ exports.login = async function(options) {

// if we found a suitable URL, attempt to use it
if (tempUrl) {
// open a browser to capture NEAR Wallet callback (and quietly direct the user if open fails)
try {
if (process.env.GITPOD_WORKSPACE_URL) {
const workspaceUrl = new URL(process.env.GITPOD_WORKSPACE_URL);
newUrl.searchParams.set('success_url', `https://${tempUrl.port}-${workspaceUrl.hostname}`);
} else {
newUrl.searchParams.set('success_url', `http://${tempUrl.hostname}:${tempUrl.port}`);
}

try {
// open a browser to capture NEAR Wallet callback (and quietly direct the user if open fails)
await open(newUrl.toString());
} catch (error) {
console.error(`Failed to open the URL [ ${newUrl.toString()} ]`, error);
Expand Down

0 comments on commit 58f91f2

Please sign in to comment.