mirror of
https://github.com/unraid/api.git
synced 2026-04-24 16:28:31 -05:00
fix: bail on undefined in checkKey function
This commit is contained in:
@@ -330,14 +330,18 @@ export class ApiManager extends EventEmitter {
|
||||
await lock.runExclusive(async () => {
|
||||
apiManagerLogger.debug('Checking API key for validity.');
|
||||
const file = loadState<{ remote: { apikey: string } }>(filePath);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/non-nullable-type-assertion-style
|
||||
const apiKey = dotProp.get(file, 'remote.apikey')! as string;
|
||||
const apiKey: string | undefined = dotProp.get(file, 'remote.apikey');
|
||||
|
||||
// No API key passed
|
||||
if (apiKey === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.debug('Checking API key "%s".', apiKey);
|
||||
|
||||
// Same key as current
|
||||
if (!force && (apiKey === this.getKey('my_servers')?.key)) {
|
||||
apiManagerLogger.debug('%s was updated but the API key didn\'t change', filePath);
|
||||
apiManagerLogger.debug('%s was updated but the API key didn\'t change.', filePath);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const myservers = () => {
|
||||
|
||||
// If we have one enable/disable it. If this is
|
||||
// missing it's likely we shipped without Sentry
|
||||
// initialised. This would be done for a reason!
|
||||
// initialized. This would be done for a reason!
|
||||
if (sentryClient) {
|
||||
// Check if the value changed
|
||||
if (sentryClient.getOptions().enabled !== isEnabled) {
|
||||
@@ -49,7 +49,6 @@ export const myservers = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// @todo: add cfg files similar to states
|
||||
// Update myservers config, this is used for origin checks in graphql
|
||||
myServersConfig.remote.wanaccess = file.remote.wanaccess;
|
||||
myServersConfig.remote.wanport = file.remote.wanport;
|
||||
|
||||
Reference in New Issue
Block a user