mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 05:55:45 +08:00
Add support for Codespaces (#3432)
* Create devcontainer.json * WIP * WIP * WIP * Create README.md * Try to fix cypress issue * Add extensions * WIP * Minor
This commit is contained in:
@@ -72,13 +72,25 @@ export function setPageLocale() {
|
||||
*/
|
||||
export function getResBaseURL() {
|
||||
const env = process.env.NODE_ENV;
|
||||
if (env === "development" || localStorage.dev === "dev") {
|
||||
if (env === "development" && isDevContainer()) {
|
||||
return location.protocol + "//" + getDevContainerServerHostname();
|
||||
} else if (env === "development" || localStorage.dev === "dev") {
|
||||
return location.protocol + "//" + location.hostname + ":3001";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
export function isDevContainer() {
|
||||
// eslint-disable-next-line no-undef
|
||||
return (typeof DEVCONTAINER === "number" && DEVCONTAINER === 1);
|
||||
}
|
||||
|
||||
export function getDevContainerServerHostname() {
|
||||
// replace -3000 with -3001
|
||||
return location.hostname.replace(/-3000\.preview\.app\.github\.dev/, "-3001.preview.app.github.dev");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {} mqtt wheather or not the regex should take into account the fact that it is an mqtt uri
|
||||
|
Reference in New Issue
Block a user