Skip to content

A local-first personal finance app

:electron: Move file settings to the file management area (#3584)

Michael Clarka7b8d1251c18
diff --git a/packages/desktop-client/src/browser-preload.browser.js b/packages/desktop-client/src/browser-preload.browser.js
index 2522fce906..a65e4b09a2 100644
--- a/packages/desktop-client/src/browser-preload.browser.js
+++ b/packages/desktop-client/src/browser-preload.browser.js
@@ -151,6 +151,8 @@ global.Actual = {
setTheme: theme => {
window.__actionsForMenu.saveGlobalPrefs({ theme });
},
+
+ moveBudgetDirectory: () => {},
};
function inputFocused(e) {
diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx
index 19ca95755e..59af5cd24a 100644
--- a/packages/desktop-client/src/components/Modals.tsx
+++ b/packages/desktop-client/src/components/Modals.tsx
@@ -41,7 +41,9 @@ import { HoldBufferModal } from './modals/HoldBufferModal';
import { ImportTransactionsModal } from './modals/ImportTransactionsModal';
import { KeyboardShortcutModal } from './modals/KeyboardShortcutModal';
import { LoadBackupModal } from './modals/LoadBackupModal';
+import { ConfirmChangeDocumentDirModal } from './modals/manager/ConfirmChangeDocumentDir';
import { DeleteFileModal } from './modals/manager/DeleteFileModal';
+import { FilesSettingsModal } from './modals/manager/FilesSettingsModal';
import { ImportActualModal } from './modals/manager/ImportActualModal';
import { ImportModal } from './modals/manager/ImportModal';
import { ImportYNAB4Modal } from './modals/manager/ImportYNAB4Modal';
@@ -573,6 +575,16 @@ export function Modals() {
return <DeleteFileModal key={name} file={options.file} />;
case 'import':
return <ImportModal key={name} />;
+ case 'files-settings':
+ return <FilesSettingsModal key={name} />;
+ case 'confirm-change-document-dir':
+ return (
+ <ConfirmChangeDocumentDirModal
+ key={name}
+ currentBudgetDirectory={options.currentBudgetDirectory}
+ newDirectory={options.newDirectory}
+ />
+ );
case 'import-ynab4':
return <ImportYNAB4Modal key={name} />;
case 'import-ynab5':
diff --git a/packages/desktop-client/src/components/alerts.tsx b/packages/desktop-client/src/components/alerts.tsx
index 831dc52a68..7cb177b8f7 100644
--- a/packages/desktop-client/src/components/alerts.tsx
+++ b/packages/desktop-client/src/components/alerts.tsx
@@ -66,9 +66,9 @@ export const Information = ({ style, children }: ScopedAlertProps) => {
color={theme.pageTextLight}
backgroundColor="transparent"
style={{
- ...style,
boxShadow: 'none',
padding: 5,
+ ...style,
}}
>
{children}
diff --git a/packages/desktop-client/src/components/manager/BudgetList.tsx b/packages/desktop-client/src/components/manager/BudgetList.tsx
index 37f3f83938..1cd0f5e3c9 100644
--- a/packages/desktop-client/src/components/manager/BudgetList.tsx
+++ b/packages/desktop-client/src/components/manager/BudgetList.tsx
@@ -12,7 +12,10 @@ import {
loadBudget,
pushModal,
} from 'loot-core/client/actions';
-import { isNonProductionEnvironment } from 'loot-core/src/shared/environment';
+import {
+ isElectron,
+ isNonProductionEnvironment,
+} from 'loot-core/src/shared/environment';
import {
type File,
type LocalFile,
@@ -26,6 +29,7 @@ import { AnimatedLoading } from '../../icons/AnimatedLoading';
import {
SvgCloudCheck,
SvgCloudDownload,
+ SvgCog,
SvgDotsHorizontalTriple,
SvgFileDouble,
} from '../../icons/v1';
@@ -324,12 +328,33 @@ function RefreshButton({
);
}
+function SettingsButton({ onOpenSettings }: { onOpenSettings: () => void }) {
+ const { t } = useTranslation();
+
+ return (
+ <View>
+ <Button
+ variant="bare"
+ aria-label={t('Settings')}
+ onPress={() => {
+ onOpenSettings();
+ }}
+ style={{ padding: 10 }}
+ >
+ <SvgCog style={{ width: 18, height: 18 }} />
+ </Button>
+ </View>
+ );
+}
+
function BudgetListHeader({
quickSwitchMode,
onRefresh,
+ onOpenSettings,
}: {
quickSwitchMode: boolean;
onRefresh: () => void;
+ onOpenSettings: () => void;
}) {
return (
<View
@@ -346,7 +371,17 @@ function BudgetListHeader({
>
<Trans>Files</Trans>
</Text>
- {!quickSwitchMode && <RefreshButton onRefresh={onRefresh} />}
+ {!quickSwitchMode && (
+ <View
+ style={{
+ flexDirection: 'row',
+ gap: '0.2rem',
+ }}
+ >
+ <RefreshButton onRefresh={onRefresh} />
+ {isElectron() && <SettingsButton onOpenSettings={onOpenSettings} />}
+ </View>
+ )}
</View>
);
}
@@ -425,6 +460,7 @@ export function BudgetList({ showHeader = true, quickSwitchMode = false }) {
<BudgetListHeader
quickSwitchMode={quickSwitchMode}
onRefresh={refresh}
+ onOpenSettings={() => dispatch(pushModal('files-settings'))}
/>
)}
<BudgetFiles
diff --git a/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx
new file mode 100644
index 0000000000..23e81a4f23
--- /dev/null
+++ b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx
@@ -0,0 +1,208 @@
+import React, { useCallback, useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
+import { useDispatch } from 'react-redux';
+
+import { addNotification } from 'loot-core/client/actions';
+
+import { useGlobalPref } from '../../../hooks/useGlobalPref';
+import { theme, styles } from '../../../style';
+import { Information } from '../../alerts';
+import { Button, ButtonWithLoading } from '../../common/Button2';
+import { Modal, ModalCloseButton, ModalHeader } from '../../common/Modal';
+import { Text } from '../../common/Text';
+import { View } from '../../common/View';
+import { Checkbox } from '../../forms';
+
+function DirectoryDisplay({ directory }: { directory: string }) {
+ return (
+ <View style={{ flexDirection: 'row', gap: '0.5rem', width: '100%' }}>
+ <Text
+ title={directory}
+ style={{
+ backgroundColor: theme.pageBackground,
+ padding: '5px 10px',
+ borderRadius: 4,
+ overflow: 'auto',
+ whiteSpace: 'nowrap',
+ width: '100%',
+ ...styles.horizontalScrollbar,
+ '::-webkit-scrollbar': {
+ height: '8px',
+ },
+ }}
+ >
+ {directory}
+ </Text>
+ </View>
+ );
+}
+
+export function ConfirmChangeDocumentDirModal({
+ currentBudgetDirectory,
+ newDirectory,
+}: {
+ currentBudgetDirectory: string;
+ newDirectory: string;
+}) {
+ const [error, setError] = useState('');
+ const [loading, setLoading] = useState(false);
+ const [moveFiles, setMoveFiles] = useState(false);
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+
+ const restartElectronServer = useCallback(() => {
+ globalThis.window.Actual?.restartElectronServer();
+ }, []);
+
+ const [_documentDir, setDocumentDirPref] = useGlobalPref(
+ 'documentDir',
+ restartElectronServer,
+ );
+
+ const moveDirectory = async (close: () => void) => {
+ setError('');
+ setLoading(true);
+ try {
+ if (moveFiles) {
+ await globalThis.window.Actual?.moveBudgetDirectory(
+ currentBudgetDirectory,
+ newDirectory,
+ );
+ }
+
+ setDocumentDirPref(newDirectory);
+
+ dispatch(
+ addNotification({
+ type: 'message',
+ message: t('Actual’s data directory successfully changed.'),
+ }),
+ );
+ close();
+ } catch (error) {
+ console.error('There was an error changing your directory', error);
+ setError(
+ t(
+ 'There was an error changing your directory, please check the directory and try again.',
+ ),
+ );
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ return (
+ <Modal name="confirm-change-document-dir">
+ {({ state: { close } }) => (
+ <>
+ <ModalHeader
+ title={t('Are you sure?')}
+ rightContent={<ModalCloseButton onPress={close} />}
+ />
+ <View
+ style={{
+ padding: 15,
+ gap: 15,
+ paddingTop: 0,
+ paddingBottom: 25,
+ maxWidth: 550,
+ lineHeight: '1.5em',
+ }}
+ >
+ <View
+ style={{
+ gap: 15,
+ backgroundColor: theme.pillBackground,
+ alignSelf: 'flex-start',
+ alignItems: 'flex-start',
+ padding: 15,
+ borderRadius: 4,
+ border: '1px solid ' + theme.pillBorderDark,
+ width: '100%',
+ }}
+ >
+ <Text>
+ <Trans>
+ You are about to change Actual’s data directory from:
+ </Trans>
+ </Text>
+ <DirectoryDisplay directory={currentBudgetDirectory} />
+ <Text>
+ <Trans>To:</Trans>
+ </Text>
+ <DirectoryDisplay directory={newDirectory} />
+ <label
+ htmlFor="moveFiles"
+ style={{
+ userSelect: 'none',
+ flexDirection: 'row',
+ gap: '0.5rem',
+ display: 'flex',
+ alignItems: 'center',
+ }}
+ >
+ <Checkbox
+ id="moveFiles"
+ name="moveFiles"
+ checked={moveFiles}
+ onChange={() => setMoveFiles(!moveFiles)}
+ />
+ <Trans>Move files to new directory</Trans>
+ </label>
+ {moveFiles && (
+ <Information style={{ color: theme.warningText, padding: 0 }}>
+ <Trans>
+ Files in the destination folder with the same name will be
+ overwritten.
+ </Trans>
+ </Information>
+ )}
+
+ {!moveFiles && (
+ <Information style={{ padding: 0 }}>
+ <Trans>
+ Your files won’t be moved. You can manually move them to the
+ folder.
+ </Trans>
+ </Information>
+ )}
+
+ {error && <Text style={{ color: theme.errorText }}>{error}</Text>}
+ </View>
+ <View
+ style={{
+ gap: '1rem',
+ flexDirection: 'row',
+ justifyContent: 'center',
+ }}
+ >
+ <Button
+ variant="normal"
+ style={{
+ padding: '10px 30px',
+ fontSize: 14,
+ alignSelf: 'center',
+ }}
+ onPress={close}
+ >
+ <Trans>Cancel</Trans>
+ </Button>
+ <ButtonWithLoading
+ variant="primary"
+ isLoading={loading}
+ style={{
+ padding: '10px 30px',
+ fontSize: 14,
+ alignSelf: 'center',
+ }}
+ onPress={() => moveDirectory(close)}
+ >
+ <Trans>Change Directory</Trans>
+ </ButtonWithLoading>
+ </View>
+ </View>
+ </>
+ )}
+ </Modal>
+ );
+}
diff --git a/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx b/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx
new file mode 100644
index 0000000000..55d1e7bee6
--- /dev/null
+++ b/packages/desktop-client/src/components/modals/manager/FilesSettingsModal.tsx
@@ -0,0 +1,190 @@
+import React, { useState } from 'react';
+import { Trans, useTranslation } from 'react-i18next';
+import { useDispatch } from 'react-redux';
+
+import { loadAllFiles, pushModal } from 'loot-core/client/actions';
+
+import { useGlobalPref } from '../../../hooks/useGlobalPref';
+import { SvgPencil1 } from '../../../icons/v2';
+import { theme, styles } from '../../../style';
+import { Button } from '../../common/Button2';
+import { Modal, ModalCloseButton, ModalHeader } from '../../common/Modal';
+import { Text } from '../../common/Text';
+import { View } from '../../common/View';
+
+function FileLocationSettings() {
+ const [documentDir, _setDocumentDirPref] = useGlobalPref('documentDir');
+ const [_documentDirChanged, setDirChanged] = useState(false);
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+
+ async function onChooseDocumentDir() {
+ const chosenDirectory = await window.Actual?.openFileDialog({
+ properties: ['openDirectory'],
+ });
+
+ if (chosenDirectory && documentDir && chosenDirectory[0] !== documentDir) {
+ setDirChanged(true);
+
+ dispatch(
+ pushModal('confirm-change-document-dir', {
+ currentBudgetDirectory: documentDir,
+ newDirectory: chosenDirectory[0],
+ }),
+ );
+ }
+ }
+
+ return (
+ <View
+ style={{
+ gap: 15,
+ backgroundColor: theme.pillBackground,
+ alignSelf: 'flex-start',
+ alignItems: 'flex-start',
+ padding: 15,
+ borderRadius: 4,
+ border: '1px solid ' + theme.pillBorderDark,
+ width: '100%',
+ }}
+ >
+ <Text>
+ <Trans>
+ <strong>Actual’s data directory</strong>{' '}
+ <small style={{ marginLeft: '0.5rem' }}>
+ <i>where your files are stored</i>
+ </small>
+ </Trans>
+ </Text>
+ <View style={{ flexDirection: 'row', gap: '0.5rem', width: '100%' }}>
+ <Text
+ title={documentDir}
+ style={{
+ backgroundColor: theme.pageBackground,
+ padding: '5px 10px',
+ borderRadius: 4,
+ overflow: 'auto',
+ whiteSpace: 'nowrap',
+ width: '100%',
+ ...styles.horizontalScrollbar,
+ '::-webkit-scrollbar': {
+ height: '8px',
+ },
+ }}
+ >
+ {documentDir}
+ </Text>
+ <Button onPress={onChooseDocumentDir} aria-label={t('Change location')}>
+ <SvgPencil1
+ style={{
+ width: 11,
+ height: 11,
+ }}
+ />
+ </Button>
+ </View>
+ </View>
+ );
+}
+
+function SelfSignedCertLocationSettings() {
+ const [serverSelfSignedCertPref, _setServerSelfSignedCertPref] =
+ useGlobalPref('serverSelfSignedCert');
+
+ if (!serverSelfSignedCertPref) {
+ return null;
+ }
+
+ return (
+ <View
+ style={{
+ gap: 15,
+ backgroundColor: theme.pillBackground,
+ alignSelf: 'flex-start',
+ alignItems: 'flex-start',
+ padding: 15,
+ borderRadius: 4,
+ border: '1px solid ' + theme.pillBorderDark,
+ width: '100%',
+ }}
+ >
+ <Text>
+ <strong>
+ <Trans>Server self-signed certificate</Trans>
+ </strong>{' '}
+ <small style={{ marginLeft: '0.5rem' }}>
+ <i>
+ <Trans>enables a secure connection</Trans>
+ </i>
+ </small>
+ </Text>
+ <View style={{ flexDirection: 'row', gap: '0.5rem', width: '100%' }}>
+ <Text
+ title={serverSelfSignedCertPref}
+ style={{
+ backgroundColor: theme.pageBackground,
+ padding: '5px 10px',
+ borderRadius: 4,
+ overflow: 'auto',
+ whiteSpace: 'nowrap',
+ width: '100%',
+ ...styles.horizontalScrollbar,
+ '::-webkit-scrollbar': {
+ height: '8px',
+ },
+ }}
+ >
+ {serverSelfSignedCertPref}
+ </Text>
+ </View>
+ </View>
+ );
+}
+
+export function FilesSettingsModal() {
+ const dispatch = useDispatch();
+
+ function closeModal(close: () => void) {
+ dispatch(loadAllFiles());
+ close();
+ }
+
+ return (
+ <Modal name="files-settings">
+ {({ state: { close } }) => (
+ <>
+ <ModalHeader
+ title="Settings"
+ rightContent={
+ <ModalCloseButton onPress={() => closeModal(close)} />
+ }
+ />
+ <View
+ style={{
+ padding: 15,
+ gap: 15,
+ paddingTop: 0,
+ paddingBottom: 25,
+ maxWidth: 550,
+ lineHeight: '1.5em',
+ }}
+ >
+ <FileLocationSettings />
+ <SelfSignedCertLocationSettings />
+ <Button
+ variant="primary"
+ style={{
+ padding: '10px 30px',
+ fontSize: 14,
+ alignSelf: 'center',
+ }}
+ onPress={() => closeModal(close)}
+ >
+ <Trans>OK</Trans>
+ </Button>
+ </View>
+ </>
+ )}
+ </Modal>
+ );
+}
diff --git a/packages/desktop-client/src/components/settings/Backups.tsx b/packages/desktop-client/src/components/settings/Backups.tsx
new file mode 100644
index 0000000000..e31d2293cd
--- /dev/null
+++ b/packages/desktop-client/src/components/settings/Backups.tsx
@@ -0,0 +1,31 @@
+import React from 'react';
+import { Trans } from 'react-i18next';
+
+import { Text } from '../common/Text';
+
+import { Setting } from './UI';
+
+export function Backups() {
+ const BACKUP_FREQUENCY_MINS = 15;
+ const MAX_BACKUPS = 10;
+
+ return (
+ <Setting>
+ <Text>
+ <strong>
+ <Trans>Backups</Trans>
+ </strong>
+ <p>
+ <Trans>
+ Backups are taken every {{ BACKUP_FREQUENCY_MINS }} minutes and
+ stored in{' '}
+ <strong>
+ <i>Actual’s data directory</i>
+ </strong>
+ . Actual retains a maximum of {{ MAX_BACKUPS }} backups at any time.
+ </Trans>
+ </p>
+ </Text>
+ </Setting>
+ );
+}
diff --git a/packages/desktop-client/src/components/settings/Global.tsx b/packages/desktop-client/src/components/settings/Global.tsx
deleted file mode 100644
index 86cedba10e..0000000000
--- a/packages/desktop-client/src/components/settings/Global.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import React, { useState, useEffect, useRef } from 'react';
-
-import { useGlobalPref } from '../../hooks/useGlobalPref';
-import { theme } from '../../style';
-import { Information } from '../alerts';
-import { Button } from '../common/Button2';
-import { Text } from '../common/Text';
-import { View } from '../common/View';
-
-import { Setting } from './UI';
-
-export function GlobalSettings() {
- const [documentDir, setDocumentDirPref] = useGlobalPref('documentDir');
-
- const [documentDirChanged, setDirChanged] = useState(false);
- const dirScrolled = useRef<HTMLSpanElement>(null);
-
- useEffect(() => {
- if (dirScrolled.current) {
- dirScrolled.current.scrollTo(10000, 0);
- }
- }, []);
-
- async function onChooseDocumentDir() {
- const res = await window.Actual?.openFileDialog({
- properties: ['openDirectory'],
- });
- if (res) {
- setDocumentDirPref(res[0]);
- setDirChanged(true);
- }
- }
-
- return (
- <Setting
- primaryAction={
- <>
- <View style={{ flexDirection: 'row', gap: '0.5rem', width: '100%' }}>
- <Text
- innerRef={dirScrolled}
- title={documentDir}
- style={{
- backgroundColor: theme.pageBackground,
- padding: '7px 10px',
- borderRadius: 4,
- overflow: 'auto',
- whiteSpace: 'nowrap',
- width: '100%',
- '::-webkit-scrollbar': { display: 'none' }, // Removes the scrollbar
- }}
- >
- {documentDir}
- </Text>
- <Button onPress={onChooseDocumentDir}>Change location</Button>
- </View>
-
- {documentDirChanged && (
- <Information>
- <strong>Remember</strong> to copy your budget(s) into the new
- folder. <br />A restart is required for this change to take
- effect.
- </Information>
- )}
- </>
- }
- >
- <Text>
- <strong>Actual’s files</strong> are stored in a folder on your computer.
- Currently, that’s:
- </Text>
- </Setting>
- );
-}
diff --git a/packages/desktop-client/src/components/settings/index.tsx b/packages/desktop-client/src/components/settings/index.tsx
index e2439ab98a..04380ee782 100644
--- a/packages/desktop-client/src/components/settings/index.tsx
+++ b/packages/desktop-client/src/components/settings/index.tsx
@@ -2,8 +2,8 @@ import React, { type ReactNode, useEffect } from 'react';
import { media } from 'glamor';
+import { isElectron } from 'loot-core/shared/environment';
import { listen } from 'loot-core/src/platform/client/fetch';
-import { isElectron } from 'loot-core/src/shared/environment';
import { useActions } from '../../hooks/useActions';
import { useFeatureFlag } from '../../hooks/useFeatureFlag';
@@ -23,13 +23,13 @@ import { MOBILE_NAV_HEIGHT } from '../mobile/MobileNavTabs';
import { Page } from '../Page';
import { useServerVersion } from '../ServerContext';
+import { Backups } from './Backups';
import { BudgetTypeSettings } from './BudgetTypeSettings';
import { EncryptionSettings } from './Encryption';
import { ExperimentalFeatures } from './Experimental';
import { ExportBudget } from './Export';
import { FixSplits } from './FixSplits';
import { FormatSettings } from './Format';
-import { GlobalSettings } from './Global';
import { ResetCache, ResetSync } from './Reset';
import { ThemeSettings } from './Themes';
import { AdvancedToggle, Setting } from './UI';
@@ -171,11 +171,11 @@ export function Settings() {
</View>
)}
<About />
- {isElectron() && <GlobalSettings />}
<ThemeSettings />
<FormatSettings />
<EncryptionSettings />
{useFeatureFlag('reportBudget') && <BudgetTypeSettings />}
+ {isElectron() && <Backups />}
<ExportBudget />
<AdvancedToggle>
<AdvancedAbout />
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.ts
index ac3618ed31..92649a96c1 100644
--- a/packages/desktop-electron/index.ts
+++ b/packages/desktop-electron/index.ts
@@ -16,6 +16,7 @@ import {
OpenDialogSyncOptions,
SaveDialogOptions,
} from 'electron';
+import { copy, exists, remove } from 'fs-extra';
import promiseRetry from 'promise-retry';
import { getMenu } from './menu';
@@ -403,3 +404,32 @@ ipcMain.on('set-theme', (_event, theme: string) => {
);
}
});
+
+ipcMain.handle(
+ 'move-budget-directory',
+ async (_event, currentBudgetDirectory: string, newDirectory: string) => {
+ try {
+ if (!currentBudgetDirectory || !newDirectory) {
+ throw new Error('The from and to directories must be provided');
+ }
+
+ if (newDirectory.startsWith(currentBudgetDirectory)) {
+ throw new Error(
+ 'The destination must not be a subdirectory of the current directory',
+ );
+ }
+
+ if (!(await exists(newDirectory))) {
+ throw new Error('The destination directory does not exist');
+ }
+
+ await copy(currentBudgetDirectory, newDirectory, {
+ overwrite: true,
+ });
+ await remove(currentBudgetDirectory);
+ } catch (error) {
+ console.error('There was an error moving your directory', error);
+ throw error;
+ }
+ },
+);
diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.json
index 1c504ac9e6..cfee1fa3c8 100644
--- a/packages/desktop-electron/package.json
+++ b/packages/desktop-electron/package.json
@@ -87,6 +87,7 @@
"dependencies": {
"better-sqlite3": "^9.6.0",
"electron-log": "4.4.8",
+ "fs-extra": "^11.2.0",
"node-fetch": "^2.7.0",
"promise-retry": "^2.0.1"
},
@@ -94,6 +95,7 @@
"@electron/notarize": "2.4.0",
"@electron/rebuild": "3.6.0",
"@types/copyfiles": "^2",
+ "@types/fs-extra": "^11",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"electron": "30.0.6",
diff --git a/packages/desktop-electron/preload.ts b/packages/desktop-electron/preload.ts
index 7ede444291..c6f8327ebf 100644
--- a/packages/desktop-electron/preload.ts
+++ b/packages/desktop-electron/preload.ts
@@ -73,4 +73,15 @@ contextBridge.exposeInMainWorld('Actual', {
setTheme: (theme: string) => {
ipcRenderer.send('set-theme', theme);
},
+
+ moveBudgetDirectory: (
+ currentBudgetDirectory: string,
+ newDirectory: string,
+ ) => {
+ return ipcRenderer.invoke(
+ 'move-budget-directory',
+ currentBudgetDirectory,
+ newDirectory,
+ );
+ },
});
diff --git a/packages/loot-core/src/client/state-types/modals.d.ts b/packages/loot-core/src/client/state-types/modals.d.ts
index c1c5405ffd..c7ccf14f23 100644
--- a/packages/loot-core/src/client/state-types/modals.d.ts
+++ b/packages/loot-core/src/client/state-types/modals.d.ts
@@ -86,6 +86,13 @@ type FinanceModals = {
'import-actual': null;
+ 'files-settings': null;
+
+ 'confirm-change-document-dir': {
+ currentBudgetDirectory: string;
+ newDirectory: string;
+ };
+
'create-encryption-key': { recreate?: boolean };
'fix-encryption-key': {
hasExistingKey?: boolean;
diff --git a/packages/loot-core/src/server/main.ts b/packages/loot-core/src/server/main.ts
index c510854948..a2a547173a 100644
--- a/packages/loot-core/src/server/main.ts
+++ b/packages/loot-core/src/server/main.ts
@@ -1273,6 +1273,7 @@ handlers['load-global-prefs'] = async function () {
[, encryptKey],
[, theme],
[, preferredDarkTheme],
+ [, serverSelfSignedCert],
] = await asyncStorage.multiGet([
'floating-sidebar',
'max-months',
@@ -1280,6 +1281,7 @@ handlers['load-global-prefs'] = async function () {
'encrypt-key',
'theme',
'preferred-dark-theme',
+ 'server-self-signed-cert',
]);
return {
floatingSidebar: floatingSidebar === 'true' ? true : false,
@@ -1298,6 +1300,7 @@ handlers['load-global-prefs'] = async function () {
preferredDarkTheme === 'dark' || preferredDarkTheme === 'midnight'
? preferredDarkTheme
: 'dark',
+ serverSelfSignedCert: serverSelfSignedCert || undefined,
};
};
diff --git a/packages/loot-core/typings/window.d.ts b/packages/loot-core/typings/window.d.ts
index 9dde1c2b45..1a56a14fb2 100644
--- a/packages/loot-core/typings/window.d.ts
+++ b/packages/loot-core/typings/window.d.ts
@@ -17,6 +17,10 @@ declare global {
relaunch: () => void;
reload: (() => Promise<void>) | undefined;
restartElectronServer: () => void;
+ moveBudgetDirectory: (
+ currentBudgetDirectory: string,
+ newDirectory: string,
+ ) => Promise<void>;
};
__navigate?: import('react-router').NavigateFunction;
diff --git a/upcoming-release-notes/3584.md b/upcoming-release-notes/3584.md
new file mode 100644
index 0000000000..120b29c815
--- /dev/null
+++ b/upcoming-release-notes/3584.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [MikesGlitch]
+---
+
+Moving file settings to the management page and enabling budget file relocation
diff --git a/yarn.lock b/yarn.lock
index 5da1e170ba..c73d98bd2c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5145,6 +5145,16 @@ __metadata:
languageName: node
linkType: hard
+"@types/fs-extra@npm:^11":
+ version: 11.0.4
+ resolution: "@types/fs-extra@npm:11.0.4"
+ dependencies:
+ "@types/jsonfile": "npm:*"
+ "@types/node": "npm:*"
+ checksum: 10/acc4c1eb0cde7b1f23f3fe6eb080a14832d8fa9dc1761aa444c5e2f0f6b6fa657ed46ebae32fb580a6700fc921b6165ce8ac3e3ba030c3dd15f10ad4dd4cae98
+ languageName: node
+ linkType: hard
+
"@types/graceful-fs@npm:^4.1.2, @types/graceful-fs@npm:^4.1.3":
version: 4.1.6
resolution: "@types/graceful-fs@npm:4.1.6"
@@ -5239,6 +5249,15 @@ __metadata:
languageName: node
linkType: hard
+"@types/jsonfile@npm:*":
+ version: 6.1.4
+ resolution: "@types/jsonfile@npm:6.1.4"
+ dependencies:
+ "@types/node": "npm:*"
+ checksum: 10/309fda20eb5f1cf68f2df28931afdf189c5e7e6bec64ac783ce737bb98908d57f6f58757ad5da9be37b815645a6f914e2d4f3ac66c574b8fe1ba6616284d0e97
+ languageName: node
+ linkType: hard
+
"@types/keyv@npm:^3.1.1, @types/keyv@npm:^3.1.4":
version: 3.1.4
resolution: "@types/keyv@npm:3.1.4"
@@ -8412,12 +8431,14 @@ __metadata:
"@electron/notarize": "npm:2.4.0"
"@electron/rebuild": "npm:3.6.0"
"@types/copyfiles": "npm:^2"
+ "@types/fs-extra": "npm:^11"
better-sqlite3: "npm:^9.6.0"
copyfiles: "npm:^2.4.1"
cross-env: "npm:^7.0.3"
electron: "npm:30.0.6"
electron-builder: "npm:24.13.3"
electron-log: "npm:4.4.8"
+ fs-extra: "npm:^11.2.0"
node-fetch: "npm:^2.7.0"
promise-retry: "npm:^2.0.1"
typescript: "npm:^5.5.4"
@@ -10141,7 +10162,7 @@ __metadata:
languageName: node
linkType: hard
-"fs-extra@npm:^11.1.0":
+"fs-extra@npm:^11.1.0, fs-extra@npm:^11.2.0":
version: 11.2.0
resolution: "fs-extra@npm:11.2.0"
dependencies: