diff --git a/packages/nicolium/src/actions/frontend-config.ts b/packages/nicolium/src/actions/frontend-config.ts index 952cc8417..acd1af99d 100644 --- a/packages/nicolium/src/actions/frontend-config.ts +++ b/packages/nicolium/src/actions/frontend-config.ts @@ -54,7 +54,6 @@ const loadFrontendConfig = () => async (dispatch: AppDispatch, getState: () => R if (result) { dispatch(fetchFrontendConfig(host)); - return; } else { return dispatch(fetchFrontendConfig(host)); } diff --git a/packages/nicolium/src/actions/settings.ts b/packages/nicolium/src/actions/settings.ts index f0db1562c..2abcc0bb6 100644 --- a/packages/nicolium/src/actions/settings.ts +++ b/packages/nicolium/src/actions/settings.ts @@ -73,7 +73,7 @@ const updateAuthAccount = async (url: string, settings: any) => { }; const updateSettingsStore = - (settings: any) => (dispatch: AppDispatch, getState: () => RootState) => { + (settings: any) => async (dispatch: AppDispatch, getState: () => RootState) => { const state = getState(); const client = getClient(state); @@ -85,6 +85,17 @@ const updateSettingsStore = }, }), ); + } else if (client.features.notes) { + const note = (await client.accounts.getRelationships([state.me as string]))[0]?.note; + const settingsNote = `${encodeURIComponent(JSON.stringify(settings))}`; + + if (/(.*)<\/nicolium-config>/.test(note || '')) { + const newNote = note!.replace(/(.*)<\/nicolium-config>/, settingsNote); + return client.accounts.updateAccountNote(state.me as string, newNote); + } else { + const newNote = `${note || ''}\n\n${settingsNote}`; + return client.accounts.updateAccountNote(state.me as string, newNote); + } } else { const accountUrl = selectOwnAccount(state)!.url;