mirror of
https://github.com/etkecc/synapse-admin.git
synced 2024-11-28 11:29:02 +03:00
properly handle restrictBaseUrl
config option, fixes #128
This commit is contained in:
parent
c698f57395
commit
6faebaf9df
1 changed files with 8 additions and 1 deletions
|
@ -43,6 +43,13 @@ export const LoadConfig = (context: Config): Config => {
|
||||||
|
|
||||||
// below we try to calculate "final" config, which will contain values from context and already set values in storage
|
// below we try to calculate "final" config, which will contain values from context and already set values in storage
|
||||||
// because LoadConfig could be called multiple times to get config from different sources
|
// because LoadConfig could be called multiple times to get config from different sources
|
||||||
|
let finalRestrictBaseUrl: string | string[] = "";
|
||||||
|
try {
|
||||||
|
finalRestrictBaseUrl = JSON.parse(storage.getItem("restrict_base_url") || "");
|
||||||
|
if (Array.isArray(finalRestrictBaseUrl) && finalRestrictBaseUrl.length == 1) {
|
||||||
|
finalRestrictBaseUrl = finalRestrictBaseUrl[0];
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
let finalAsManagedUsers: string[] = [];
|
let finalAsManagedUsers: string[] = [];
|
||||||
try {
|
try {
|
||||||
finalAsManagedUsers = JSON.parse(storage.getItem("as_managed_users") || "");
|
finalAsManagedUsers = JSON.parse(storage.getItem("as_managed_users") || "");
|
||||||
|
@ -54,7 +61,7 @@ export const LoadConfig = (context: Config): Config => {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restrictBaseUrl: storage.getItem("restrict_base_url") || "",
|
restrictBaseUrl: finalRestrictBaseUrl,
|
||||||
asManagedUsers: finalAsManagedUsers,
|
asManagedUsers: finalAsManagedUsers,
|
||||||
supportURL: storage.getItem("support_url") || "",
|
supportURL: storage.getItem("support_url") || "",
|
||||||
menu: finalMenu,
|
menu: finalMenu,
|
||||||
|
|
Loading…
Reference in a new issue