-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ft/small-style-adjustements
- Loading branch information
Showing
12 changed files
with
213 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ dist/ | |
.plasmo | ||
|
||
# bpp - http://bpp.browser.market/ | ||
keys.json | ||
key*.json | ||
|
||
# typescript | ||
.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,4 +60,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const DEFAULT_GITPOD_ENDPOINT = "https://gitpod.io"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import type { PlasmoCSConfig } from "plasmo"; | ||
import { Storage } from "@plasmohq/storage"; | ||
import { STORAGE_AUTOMATICALLY_DETECT_GITPOD, STORAGE_KEY_ADDRESS } from "~storage"; | ||
import { parseEndpoint } from "~utils/parse-endpoint"; | ||
import { DEFAULT_GITPOD_ENDPOINT } from "~constants"; | ||
|
||
/** | ||
* Checks if the current site is a Gitpod instance. | ||
*/ | ||
const isSiteGitpod = (): boolean => { | ||
return !!document.head.querySelector("meta[name=Gitpod]"); | ||
} | ||
|
||
export const config: PlasmoCSConfig = { | ||
matches: ["https://*/*"] | ||
} | ||
|
||
const storage = new Storage(); | ||
|
||
const automaticallyUpdateEndpoint = async () => { | ||
if (await storage.get<boolean>(STORAGE_AUTOMATICALLY_DETECT_GITPOD) === false) { | ||
return; | ||
} | ||
|
||
const currentUserSetEndpoint = await storage.get(STORAGE_KEY_ADDRESS); | ||
if (!currentUserSetEndpoint || currentUserSetEndpoint === DEFAULT_GITPOD_ENDPOINT) { | ||
const currentHost = window.location.host; | ||
if (currentHost !== new URL(DEFAULT_GITPOD_ENDPOINT).host) { | ||
console.log(`Gitpod extension: switching default endpoint to ${currentHost}.`) | ||
await storage.set(STORAGE_KEY_ADDRESS, parseEndpoint(currentHost)); | ||
} | ||
} | ||
} | ||
if (isSiteGitpod()) { | ||
sessionStorage.setItem("browser-extension-installed", "true"); | ||
automaticallyUpdateEndpoint(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
export const STORAGE_KEY_ADDRESS = "gitpod-installation-address"; | ||
export const STORAGE_KEY_NEW_TAB = "gitpod-installation-new-tab"; | ||
export const STORAGE_KEY_NEW_TAB = "gitpod-installation-new-tab"; | ||
export const STORAGE_AUTOMATICALLY_DETECT_GITPOD = "gitpod-installation-automatically-detect-gitpod"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters