mirror of
https://github.com/unraid/api.git
synced 2026-02-13 11:38:29 -06:00
fix: ensure myServerConfig is never undefined
This commit is contained in:
@@ -52,8 +52,11 @@ export const myservers = () => {
|
||||
// Only update these if they exist
|
||||
if (file.remote) {
|
||||
// Update myservers config, this is used for origin checks in graphql
|
||||
myServersConfig.remote.wanaccess = file.remote.wanaccess ?? myServersConfig.remote.wanaccess;
|
||||
myServersConfig.remote.wanport = file.remote.wanport ?? myServersConfig.remote.wanport;
|
||||
myServersConfig.remote = {
|
||||
...(myServersConfig.remote ? myServersConfig.remote : {}),
|
||||
wanaccess: file.remote.wanaccess,
|
||||
wanport: file.remote.wanport
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -63,7 +63,7 @@ export const origins = {
|
||||
|
||||
// Get myservers config
|
||||
const configPath = paths.get('myservers-config')!;
|
||||
export const myServersConfig = loadState<{ remote: { wanport: string; wanaccess: string } }>(configPath);
|
||||
export const myServersConfig = loadState<{ remote?: { wanport?: string; wanaccess?: string } }>(configPath) ?? {};
|
||||
|
||||
// We use a "Set" + "array spread" to deduplicate the strings
|
||||
const getAllowedOrigins = (): string[] => {
|
||||
|
||||
Reference in New Issue
Block a user