diff --git a/api/src/__test__/core/utils/files/config-file-normalizer.test.ts b/api/src/__test__/core/utils/files/config-file-normalizer.test.ts index cf3796a1b..5a1d2c450 100644 --- a/api/src/__test__/core/utils/files/config-file-normalizer.test.ts +++ b/api/src/__test__/core/utils/files/config-file-normalizer.test.ts @@ -80,9 +80,11 @@ test('it creates a MEMORY config with NO OPTIONAL values', () => { test('it creates a FLASH config with OPTIONAL values', () => { const basicConfig = cloneDeep(initialState); + // 2fa & t2fa should be ignored basicConfig.remote['2Fa'] = 'yes'; basicConfig.local['2Fa'] = 'yes'; basicConfig.local.showT2Fa = 'yes'; + basicConfig.api.extraOrigins = 'myextra.origins'; basicConfig.remote.upnpEnabled = 'yes'; basicConfig.connectionStatus.upnpStatus = 'Turned On'; @@ -93,15 +95,11 @@ test('it creates a FLASH config with OPTIONAL values', () => { "extraOrigins": "myextra.origins", "version": "", }, - "local": { - "2Fa": "yes", - "showT2Fa": "yes", - }, + "local": {}, "notifier": { "apikey": "", }, "remote": { - "2Fa": "yes", "accesstoken": "", "apikey": "", "avatar": "", @@ -125,6 +123,7 @@ test('it creates a FLASH config with OPTIONAL values', () => { test('it creates a MEMORY config with OPTIONAL values', () => { const basicConfig = cloneDeep(initialState); + // 2fa & t2fa should be ignored basicConfig.remote['2Fa'] = 'yes'; basicConfig.local['2Fa'] = 'yes'; basicConfig.local.showT2Fa = 'yes'; @@ -142,15 +141,11 @@ test('it creates a MEMORY config with OPTIONAL values', () => { "minigraph": "PRE_INIT", "upnpStatus": "Turned On", }, - "local": { - "2Fa": "yes", - "showT2Fa": "yes", - }, + "local": {}, "notifier": { "apikey": "", }, "remote": { - "2Fa": "yes", "accesstoken": "", "allowedOrigins": "/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000", "apikey": "", diff --git a/api/src/__test__/store/modules/config.test.ts b/api/src/__test__/store/modules/config.test.ts index 1243c8e0a..dc9455ed8 100644 --- a/api/src/__test__/store/modules/config.test.ts +++ b/api/src/__test__/store/modules/config.test.ts @@ -14,16 +14,12 @@ test('Before init returns default values for all fields', async () => { "minigraph": "PRE_INIT", "upnpStatus": "", }, - "local": { - "2Fa": "", - "showT2Fa": "", - }, + "local": {}, "nodeEnv": "test", "notifier": { "apikey": "", }, "remote": { - "2Fa": "", "accesstoken": "", "allowedOrigins": "", "apikey": "", @@ -65,16 +61,12 @@ test('After init returns values from cfg file for all fields', async () => { minigraph: 'PRE_INIT', upnpStatus: '', }, - local: { - '2Fa': '', - showT2Fa: '', - }, + local: {}, nodeEnv: 'test', notifier: { apikey: 'unnotify_30994bfaccf839c65bae75f7fa12dd5ee16e69389f754c3b98ed7d5', }, remote: { - '2Fa': '', accesstoken: '', allowedOrigins: '', apikey: '_______________________BIG_API_KEY_HERE_________________________', @@ -122,16 +114,12 @@ test('updateUserConfig merges in changes to current state', async () => { minigraph: 'PRE_INIT', upnpStatus: '', }, - local: { - '2Fa': '', - showT2Fa: '', - }, + local: {}, nodeEnv: 'test', notifier: { apikey: 'unnotify_30994bfaccf839c65bae75f7fa12dd5ee16e69389f754c3b98ed7d5', }, remote: { - '2Fa': '', accesstoken: '', allowedOrigins: '', apikey: '_______________________BIG_API_KEY_HERE_________________________', diff --git a/api/src/core/utils/files/config-file-normalizer.ts b/api/src/core/utils/files/config-file-normalizer.ts index f6f82502c..3ab27adce 100644 --- a/api/src/core/utils/files/config-file-normalizer.ts +++ b/api/src/core/utils/files/config-file-normalizer.ts @@ -38,15 +38,11 @@ export const getWriteableConfig = ( version: api?.version ?? initialState.api.version, extraOrigins: api?.extraOrigins ?? initialState.api.extraOrigins, }, - local: { - ...(local?.['2Fa'] === 'yes' ? { '2Fa': local['2Fa'] } : {}), - ...(local?.showT2Fa === 'yes' ? { showT2Fa: local.showT2Fa } : {}), - }, + local: {}, notifier: { apikey: notifier.apikey ?? initialState.notifier.apikey, }, remote: { - ...(remote?.['2Fa'] === 'yes' ? { '2Fa': remote['2Fa'] } : {}), wanaccess: remote.wanaccess ?? initialState.remote.wanaccess, wanport: remote.wanport ?? initialState.remote.wanport, ...(remote.upnpEnabled ? { upnpEnabled: remote.upnpEnabled } : {}), diff --git a/api/src/store/modules/config.ts b/api/src/store/modules/config.ts index 8f875bd00..fe61d9b33 100644 --- a/api/src/store/modules/config.ts +++ b/api/src/store/modules/config.ts @@ -37,7 +37,6 @@ export const initialState: SliceState = { status: FileLoadStatus.UNLOADED, nodeEnv: NODE_ENV, remote: { - '2Fa': '', wanaccess: '', wanport: '', upnpEnabled: '', @@ -53,10 +52,7 @@ export const initialState: SliceState = { allowedOrigins: '', dynamicRemoteAccessType: DynamicRemoteAccessType.DISABLED, }, - local: { - showT2Fa: '', - '2Fa': '', - }, + local: {}, api: { extraOrigins: '', version: '', diff --git a/api/src/types/my-servers-config.d.ts b/api/src/types/my-servers-config.d.ts index af37e9a46..488c8392f 100644 --- a/api/src/types/my-servers-config.d.ts +++ b/api/src/types/my-servers-config.d.ts @@ -5,15 +5,11 @@ interface MyServersConfig extends Record { version: string; extraOrigins: string; }; - local: { - '2Fa'?: string; - showT2Fa?: string; - }; + local: {}; notifier: { apikey: string; }; remote: { - '2Fa'?: string; wanaccess: string; wanport: string; upnpEnabled?: string; @@ -38,12 +34,7 @@ export interface MyServersConfigWithMandatoryHiddenFields extends MyServersConfi api: { extraOrigins: string; }; - local: MyServersConfig['local'] & { - '2Fa': string; - showT2Fa: string; - }; remote: MyServersConfig['remote'] & { - '2Fa': string; upnpEnabled: string; dynamicRemoteAccessType: DynamicRemoteAccessType; }; diff --git a/plugin/docs/README.md b/plugin/docs/README.md new file mode 100644 index 000000000..4bd0a38e1 --- /dev/null +++ b/plugin/docs/README.md @@ -0,0 +1,15 @@ + +# Hidden Flags + +Use the following flags for additional functionality + +1. The deleteOnUninstall setting is for internal developers who are switching between the staging and production plugins, or otherwise installing/uninstalling the plugin a lot. Setting this to "no" prevents the uninstall routine from deleting your local flash backup files and disabling Remote Access. The assumption is that you will be reinstalling the plugin and don't want to lose those settings. +``` +[plugin] +deleteOnUninstall="no" +``` + +# Plugin Hosted Urls + +- Main: https://s3.amazonaws.com/dnld.lime-technology.com/unraid-api/dynamix.unraid.net.plg +- Staging: https://s3.amazonaws.com/dnld.lime-technology.com/unraid-api/dynamix.unraid.net.staging.plg