This commit is contained in:
+5
-3
@@ -18,16 +18,18 @@ function loadExtensionEnv(mode: string): NodeJS.ProcessEnv {
|
||||
}
|
||||
|
||||
function getGiteaHostPermissions(baseUrl?: string): string[] {
|
||||
const permissions = ["http://*/*", "https://*/*"];
|
||||
|
||||
if (!baseUrl?.trim()) {
|
||||
return [];
|
||||
return permissions;
|
||||
}
|
||||
|
||||
try {
|
||||
const url = new URL(baseUrl);
|
||||
return [`${url.protocol}//${url.host}/*`];
|
||||
return Array.from(new Set([...permissions, `${url.protocol}//${url.host}/*`]));
|
||||
} catch {
|
||||
console.warn(`VITE_GITEA_BASE_URL is not a valid URL: ${baseUrl}`);
|
||||
return [];
|
||||
return permissions;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user