TagSpaces is an offline, open source, document manager with tagging support
chore: extracting sidecar meta ext to appconfig
Ilian Sapundshieva416d8c41c7c
diff --git a/release/app/package-lock.json b/release/app/package-lock.jsonindex adbd87822..77f85b0c3 100644--- a/release/app/package-lock.json+++ b/release/app/package-lock.json@@ -1,17 +1,17 @@{"name": "tagspaces",- "version": "6.7.0",+ "version": "6.7.1","lockfileVersion": 2,"requires": true,"packages": {"": {"name": "tagspaces",- "version": "6.7.0",+ "version": "6.7.1","hasInstallScript": true,"license": "AGPL-3.0","dependencies": {"@elife/pm2": "3.6.1",- "@tagspaces/extensions": "1.0.202",+ "@tagspaces/extensions": "1.0.203","@tagspaces/tagspaces-common-node": "4.5.102","@tagspaces/tagspaces-ws": "4.5.102","sharp": "0.32.6",@@ -153,9 +153,9 @@}},"node_modules/@tagspaces/extensions": {- "version": "1.0.202",- "resolved": "https://registry.npmjs.org/@tagspaces/extensions/-/extensions-1.0.202.tgz",- "integrity": "sha512-ACSCvmksg5wmDYxdOGihw3thG9KqHzum0Afj1/nlFePGXee45JqudyOcsQEoJQRMJhnciEW2RJWautzkb/IUSA==",+ "version": "1.0.203",+ "resolved": "https://registry.npmjs.org/@tagspaces/extensions/-/extensions-1.0.203.tgz",+ "integrity": "sha512-+pfiopNBVujgtEWdUCdWqhly3dSwUoDYlE1feKtFAoxCneI7yqtBPcqVtAqKxBHJm9L+kNIZSR/TVmzW+uxqUg==","dependencies": {"shelljs": "^0.8.5","shx": "^0.3.4"@@ -1954,9 +1954,9 @@}},"@tagspaces/extensions": {- "version": "1.0.202",- "resolved": "https://registry.npmjs.org/@tagspaces/extensions/-/extensions-1.0.202.tgz",- "integrity": "sha512-ACSCvmksg5wmDYxdOGihw3thG9KqHzum0Afj1/nlFePGXee45JqudyOcsQEoJQRMJhnciEW2RJWautzkb/IUSA==",+ "version": "1.0.203",+ "resolved": "https://registry.npmjs.org/@tagspaces/extensions/-/extensions-1.0.203.tgz",+ "integrity": "sha512-+pfiopNBVujgtEWdUCdWqhly3dSwUoDYlE1feKtFAoxCneI7yqtBPcqVtAqKxBHJm9L+kNIZSR/TVmzW+uxqUg==","requires": {"shelljs": "^0.8.5","shx": "^0.3.4"diff --git a/src/renderer/AppConfig.ts b/src/renderer/AppConfig.tsindex ab6d5de9f..54f6de5c3 100644--- a/src/renderer/AppConfig.ts+++ b/src/renderer/AppConfig.ts@@ -172,6 +172,7 @@ AppConfig.defaultFileColor = '#33b5be';AppConfig.defaultCSSRadius = '10px';AppConfig.defaultSpaceBetweenButtons = '10px';AppConfig.aiFolder = 'ai';+AppConfig.sidecarRevisionExtension = '.meta';AppConfig.defaultMapBounds =typeof window !== 'undefined' && window.ExtDefaultMapBounds !== undefined? window.ExtDefaultMapBoundsdiff --git a/src/renderer/components/Revisions.tsx b/src/renderer/components/Revisions.tsxindex 0a3d0f35b..f49f4236c 100644--- a/src/renderer/components/Revisions.tsx+++ b/src/renderer/components/Revisions.tsx@@ -16,6 +16,7 @@**/+import AppConfig from '-/AppConfig';import { DeleteIcon, PreviewIcon, RestoreIcon } from '-/components/CommonIcons';import FilePreviewDialog from '-/components/dialogs/FilePreviewDialog';import TsIconButton from '-/components/TsIconButton';@@ -95,7 +96,9 @@ function Revisions() {location.listDirectoryPromise(backupPath, []).then((h) => {const history =revisionsType === 'meta'- ? h.filter((b) => b.path.endsWith('.meta'))+ ? h.filter((b) =>+ b.path.endsWith(AppConfig.sidecarRevisionExtension),+ ): h.filter((b) => b.path.endsWith(openedFile.extension));setRows(history.sort((a, b) =>@@ -136,7 +139,7 @@ function Revisions() {function restoreRevision(revisionPath) {const location = findLocation(openedEntry.locationID);- if (revisionPath.endsWith('.meta')) {+ if (revisionPath.endsWith(AppConfig.sidecarRevisionExtension)) {// restore descriptionlocation.loadJSONFile(revisionPath)diff --git a/src/renderer/components/dialogs/FilePreviewDialog.tsx b/src/renderer/components/dialogs/FilePreviewDialog.tsxindex 41345733c..348506d8f 100644--- a/src/renderer/components/dialogs/FilePreviewDialog.tsx+++ b/src/renderer/components/dialogs/FilePreviewDialog.tsx@@ -65,7 +65,7 @@ function FilePreviewDialog(props: Props) {}: undefined;- if (fsEntry?.name?.endsWith('meta')) {+ if (fsEntry?.name?.endsWith(AppConfig.sidecarRevisionExtension)) {const fileType: TS.FileTypes = supportedFileTypes.find((fileType) => fileType.viewer && fileType.type.toLowerCase() === 'json',);diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex 37f69944e..67236f8ea 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -1939,7 +1939,9 @@ export const IOActionsContextProvider = ({if (fsEntryMeta && fsEntryMeta.description) {const backupDir = getBackupDir(entry);location.listDirectoryPromise(backupDir, []).then((backup) => {- const haveBackup = backup.some((b) => b.path.endsWith('.meta'));+ const haveBackup = backup.some((b) =>+ b.path.endsWith(AppConfig.sidecarRevisionExtension),+ );if (!haveBackup) {// init descriptionconst targetPath = entry.isFile@@ -1955,7 +1957,7 @@ export const IOActionsContextProvider = ({);saveTextFilePromise({- path: targetPath + '.meta',+ path: targetPath + AppConfig.sidecarRevisionExtension,locationID: entry.locationID,},JSON.stringify({ description: fsEntryMeta?.description }),@@ -1978,7 +1980,10 @@ export const IOActionsContextProvider = ({location.getDirSeparator(),);saveTextFilePromise(- { path: targetPath + '.meta', locationID: entry.locationID },+ {+ path: targetPath + AppConfig.sidecarRevisionExtension,+ locationID: entry.locationID,+ },JSON.stringify({description: meta.description,...(author && { author: author }),