Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: refactoring external configuration of the app

Ilian Sapundshievd6b9c8a58ae0
diff --git a/package-lock.json b/package-lock.json
index 22e24775c..77073939d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,10 +20,10 @@
"@mui/material": "7.3.7",
"@mui/x-data-grid": "8.24.0",
"@mui/x-date-pickers": "8.24.0",
- "@tagspaces/tagspaces-common": "4.5.110",
- "@tagspaces/tagspaces-common-aws3": "4.5.110",
- "@tagspaces/tagspaces-common-cordova": "4.5.110",
- "@tagspaces/tagspaces-indexer": "4.5.110",
+ "@tagspaces/tagspaces-common": "4.5.111",
+ "@tagspaces/tagspaces-common-aws3": "4.5.111",
+ "@tagspaces/tagspaces-common-cordova": "4.5.111",
+ "@tagspaces/tagspaces-indexer": "4.5.111",
"aws-amplify": "4.3.36",
"coordinate-parser": "1.0.7",
"crypto-js": "4.2.0",
@@ -174,7 +174,7 @@
"yarn": "please-use-npm"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.217"
+ "@tagspacespro/tagspacespro": "5.0.218"
}
},
"node_modules/@ampproject/remapping": {
@@ -18716,9 +18716,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.110.tgz",
- "integrity": "sha512-/6VBAYRj4TJrgU5kQ10ymN0hKcDZ0HMmAJ/kwHeu6IAiNBopLxWrzCu7adlrLbgIKo/aOQ84+95QjUBSO4Tkpw==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.111.tgz",
+ "integrity": "sha512-GxOivqGNOefWl+DewaJVZN+BfSNM2f896dxatTW39yDrTAGqPdlSF+9lF8LsLUp22bTE2pCrhnDB9icLeGD4EA==",
"license": "MIT",
"dependencies": {
"dompurify": "3.3.1",
@@ -18728,25 +18728,25 @@
}
},
"node_modules/@tagspaces/tagspaces-common-aws3": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.110.tgz",
- "integrity": "sha512-fgr97pSDJtj2bziIv2RffPiGAFZ5nf6XbQvBHbRReK5Vzt3taed2oWTxxLYVw6A7vl+aIDeVy/IMxMevI2ly3Q==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.5.111.tgz",
+ "integrity": "sha512-+AGGkjV2WJLfQEeWJkfePcyxccpxIEI15rf++ecLasSz2cGPox7TKvdHCC5ZrRkNijgtBMb649+NvTSYFbYJDA==",
"license": "MIT",
"dependencies": {
"@aws-sdk/client-s3": "3.996.0",
"@aws-sdk/lib-storage": "3.996.0",
"@aws-sdk/s3-request-presigner": "3.996.0",
- "@tagspaces/tagspaces-common": "^4.5.110",
+ "@tagspaces/tagspaces-common": "^4.5.111",
"crypto-js": "4.2.0"
}
},
"node_modules/@tagspaces/tagspaces-common-cordova": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.110.tgz",
- "integrity": "sha512-8AwyNsConppJ6Ghxt6dDtFXLuUlbmfi9kW897DNiTvdKvHS2s91iN7Gfu87FFyyuHyEdGj5SUU3KSCClx+MqPQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.5.111.tgz",
+ "integrity": "sha512-p3mjhJJ+O4HZY1yJwudx7uPT+5c4TkibZQd97Ua6HxrLRnEGanVIHRWLlATR8Nfo2+gop9nNLH67ALmoHFVPUA==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.110"
+ "@tagspaces/tagspaces-common": "^4.5.111"
}
},
"node_modules/@tagspaces/tagspaces-common/node_modules/marked": {
@@ -18775,18 +18775,18 @@
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.110.tgz",
- "integrity": "sha512-eJldsB+V7SrmACMwS6ts1foCADDpBLgNRdh24T02EbsU1cjwmqSlbcjH9NuFOC6bTwpBAojL4RgJf4Z/J0wWhQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.111.tgz",
+ "integrity": "sha512-FFJ3QTeOGI6JLo8jnUsLg1it3pBLndan5crjQlHiqsTII1FOtr/JCodRKitqDaQiAea54uvNQpKAGky4g11bhA==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.110"
+ "@tagspaces/tagspaces-common": "^4.5.111"
}
},
"node_modules/@tagspacespro/tagspacespro": {
- "version": "5.0.217",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.217/57747f132e61117e26e6f342d85a11ebaa267b5a",
- "integrity": "sha512-bAnPU+CUDOR2R5kzj53QAjUF2ZMxj68IT9ywqYPv7Dk/a1f3IDc9IQXQoQY5QvZzTxnZrk2dAdrDAV9ICdAoBw==",
+ "version": "5.0.218",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.218/809bb9172fcd469a22a8be95a88f5c75f8cd57ef",
+ "integrity": "sha512-xoEeA8FUJD7QyPBE8b1f1oSaw9ty+HZzfeiloX1nJ3vZpI1YrdrRBMfIT6uxZQZ0FjoN4QN+hBPMREwrbF2yRA==",
"license": "Proprietary",
"optional": true
},
diff --git a/package.json b/package.json
index 9943631b6..af76b2272 100644
--- a/package.json
+++ b/package.json
@@ -171,10 +171,10 @@
"@mui/material": "7.3.7",
"@mui/x-data-grid": "8.24.0",
"@mui/x-date-pickers": "8.24.0",
- "@tagspaces/tagspaces-common": "4.5.110",
- "@tagspaces/tagspaces-common-aws3": "4.5.110",
- "@tagspaces/tagspaces-common-cordova": "4.5.110",
- "@tagspaces/tagspaces-indexer": "4.5.110",
+ "@tagspaces/tagspaces-common": "4.5.111",
+ "@tagspaces/tagspaces-common-aws3": "4.5.111",
+ "@tagspaces/tagspaces-common-cordova": "4.5.111",
+ "@tagspaces/tagspaces-indexer": "4.5.111",
"aws-amplify": "4.3.36",
"coordinate-parser": "1.0.7",
"crypto-js": "4.2.0",
@@ -235,7 +235,7 @@
"zod-to-json-schema": "3.25.1"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.217"
+ "@tagspacespro/tagspacespro": "5.0.218"
},
"devDependencies": {
"@electron/rebuild": "^3.7.2",
diff --git a/release/app/package-lock.json b/release/app/package-lock.json
index 27a1a5abc..2eba5bc0a 100644
--- a/release/app/package-lock.json
+++ b/release/app/package-lock.json
@@ -12,8 +12,8 @@
"dependencies": {
"@elife/pm2": "3.6.1",
"@tagspaces/extensions": "1.0.221",
- "@tagspaces/tagspaces-common-node": "4.5.110",
- "@tagspaces/tagspaces-ws": "4.5.110",
+ "@tagspaces/tagspaces-common-node": "4.5.111",
+ "@tagspaces/tagspaces-ws": "4.5.111",
"sharp": "0.32.6",
"ws": "8.19.0"
},
@@ -138,9 +138,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.110.tgz",
- "integrity": "sha512-/6VBAYRj4TJrgU5kQ10ymN0hKcDZ0HMmAJ/kwHeu6IAiNBopLxWrzCu7adlrLbgIKo/aOQ84+95QjUBSO4Tkpw==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.111.tgz",
+ "integrity": "sha512-GxOivqGNOefWl+DewaJVZN+BfSNM2f896dxatTW39yDrTAGqPdlSF+9lF8LsLUp22bTE2pCrhnDB9icLeGD4EA==",
"license": "MIT",
"dependencies": {
"dompurify": "3.3.1",
@@ -150,24 +150,24 @@
}
},
"node_modules/@tagspaces/tagspaces-common-node": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.110.tgz",
- "integrity": "sha512-UE2OkAXzyl3e6x6KzGGj1741WWhSnR4Lu9GNAhSaV7P7SydofbaY2B4BWrnxRM2MeA86xgNNKCRWcBWmgJ8CQQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.111.tgz",
+ "integrity": "sha512-KnAzBITW2TkXSgVL0qiEZLCY8F7zU5mUjOTLo/JOT/CNQnURLKTkSyA1p9ZCuiGMthFfmaNF37nvnl1wgf7tew==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.110",
+ "@tagspaces/tagspaces-common": "^4.5.111",
"adm-zip": "0.5.16",
"fs-extra": "11.3.3",
"klaw": "4.1.0"
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.110.tgz",
- "integrity": "sha512-eJldsB+V7SrmACMwS6ts1foCADDpBLgNRdh24T02EbsU1cjwmqSlbcjH9NuFOC6bTwpBAojL4RgJf4Z/J0wWhQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.111.tgz",
+ "integrity": "sha512-FFJ3QTeOGI6JLo8jnUsLg1it3pBLndan5crjQlHiqsTII1FOtr/JCodRKitqDaQiAea54uvNQpKAGky4g11bhA==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.110"
+ "@tagspaces/tagspaces-common": "^4.5.111"
}
},
"node_modules/@tagspaces/tagspaces-pdf-extraction": {
@@ -190,26 +190,26 @@
}
},
"node_modules/@tagspaces/tagspaces-workers": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.110.tgz",
- "integrity": "sha512-JY8NftEdGtZlUaw/Z8K2Qfeo/eFLqYLDEBwH0W70TUzuimg+2JVpGnGkltK8xkUrO2Db4uNVID3YooxGdDPLDw==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.111.tgz",
+ "integrity": "sha512-4V7Gqa1fM2p3y4WJxZkF1H8Thj1gCLGAFDSlkujy2KHYcKn+5zSxdForBoJtDIZRx4KKqHrHgUMp9yKa+LSgDQ==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.5.110",
- "@tagspaces/tagspaces-common-node": "^4.5.110",
+ "@tagspaces/tagspaces-common": "^4.5.111",
+ "@tagspaces/tagspaces-common-node": "^4.5.111",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
"@tagspaces/tagspaces-thumbgen-image": "^4.5.60"
}
},
"node_modules/@tagspaces/tagspaces-ws": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.110.tgz",
- "integrity": "sha512-6IvnMIrAiW0BASUR1/xQYWCZn036q+jwrP/oYHt4cCh/yiR9S+f9Bz6FqxHG6S57PQDMH2DfirO8tKN+31vB7Q==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.111.tgz",
+ "integrity": "sha512-Ys5/GxGC7K71pC1dn3TC0kb79v0ONxpW4tto0x8jX//N6pHORzHAwiPrtoIta06PhrAJBEpiUE+s/CXEab8XQg==",
"license": "MIT",
"dependencies": {
- "@tagspaces/tagspaces-indexer": "^4.5.110",
+ "@tagspaces/tagspaces-indexer": "^4.5.111",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
- "@tagspaces/tagspaces-workers": "^4.5.110",
+ "@tagspaces/tagspaces-workers": "^4.5.111",
"find-free-ports": "3.1.1",
"jsonwebtoken": "9.0.3",
"ws": "8.19.0"
@@ -2562,9 +2562,9 @@
}
},
"@tagspaces/tagspaces-common": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.110.tgz",
- "integrity": "sha512-/6VBAYRj4TJrgU5kQ10ymN0hKcDZ0HMmAJ/kwHeu6IAiNBopLxWrzCu7adlrLbgIKo/aOQ84+95QjUBSO4Tkpw==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.5.111.tgz",
+ "integrity": "sha512-GxOivqGNOefWl+DewaJVZN+BfSNM2f896dxatTW39yDrTAGqPdlSF+9lF8LsLUp22bTE2pCrhnDB9icLeGD4EA==",
"requires": {
"dompurify": "3.3.1",
"marked": "^15.0.4",
@@ -2573,22 +2573,22 @@
}
},
"@tagspaces/tagspaces-common-node": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.110.tgz",
- "integrity": "sha512-UE2OkAXzyl3e6x6KzGGj1741WWhSnR4Lu9GNAhSaV7P7SydofbaY2B4BWrnxRM2MeA86xgNNKCRWcBWmgJ8CQQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.5.111.tgz",
+ "integrity": "sha512-KnAzBITW2TkXSgVL0qiEZLCY8F7zU5mUjOTLo/JOT/CNQnURLKTkSyA1p9ZCuiGMthFfmaNF37nvnl1wgf7tew==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.110",
+ "@tagspaces/tagspaces-common": "^4.5.111",
"adm-zip": "0.5.16",
"fs-extra": "11.3.3",
"klaw": "4.1.0"
}
},
"@tagspaces/tagspaces-indexer": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.110.tgz",
- "integrity": "sha512-eJldsB+V7SrmACMwS6ts1foCADDpBLgNRdh24T02EbsU1cjwmqSlbcjH9NuFOC6bTwpBAojL4RgJf4Z/J0wWhQ==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.5.111.tgz",
+ "integrity": "sha512-FFJ3QTeOGI6JLo8jnUsLg1it3pBLndan5crjQlHiqsTII1FOtr/JCodRKitqDaQiAea54uvNQpKAGky4g11bhA==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.110"
+ "@tagspaces/tagspaces-common": "^4.5.111"
}
},
"@tagspaces/tagspaces-pdf-extraction": {
@@ -2609,24 +2609,24 @@
}
},
"@tagspaces/tagspaces-workers": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.110.tgz",
- "integrity": "sha512-JY8NftEdGtZlUaw/Z8K2Qfeo/eFLqYLDEBwH0W70TUzuimg+2JVpGnGkltK8xkUrO2Db4uNVID3YooxGdDPLDw==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.5.111.tgz",
+ "integrity": "sha512-4V7Gqa1fM2p3y4WJxZkF1H8Thj1gCLGAFDSlkujy2KHYcKn+5zSxdForBoJtDIZRx4KKqHrHgUMp9yKa+LSgDQ==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.5.110",
- "@tagspaces/tagspaces-common-node": "^4.5.110",
+ "@tagspaces/tagspaces-common": "^4.5.111",
+ "@tagspaces/tagspaces-common-node": "^4.5.111",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
"@tagspaces/tagspaces-thumbgen-image": "^4.5.60"
}
},
"@tagspaces/tagspaces-ws": {
- "version": "4.5.110",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.110.tgz",
- "integrity": "sha512-6IvnMIrAiW0BASUR1/xQYWCZn036q+jwrP/oYHt4cCh/yiR9S+f9Bz6FqxHG6S57PQDMH2DfirO8tKN+31vB7Q==",
+ "version": "4.5.111",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.5.111.tgz",
+ "integrity": "sha512-Ys5/GxGC7K71pC1dn3TC0kb79v0ONxpW4tto0x8jX//N6pHORzHAwiPrtoIta06PhrAJBEpiUE+s/CXEab8XQg==",
"requires": {
- "@tagspaces/tagspaces-indexer": "^4.5.110",
+ "@tagspaces/tagspaces-indexer": "^4.5.111",
"@tagspaces/tagspaces-pdf-extraction": "^4.5.53",
- "@tagspaces/tagspaces-workers": "^4.5.110",
+ "@tagspaces/tagspaces-workers": "^4.5.111",
"find-free-ports": "3.1.1",
"jsonwebtoken": "9.0.3",
"ws": "8.19.0"
diff --git a/release/app/package.json b/release/app/package.json
index 7dba2311a..eeea2c224 100644
--- a/release/app/package.json
+++ b/release/app/package.json
@@ -19,8 +19,8 @@
"dependencies": {
"@elife/pm2": "3.6.1",
"@tagspaces/extensions": "1.0.221",
- "@tagspaces/tagspaces-common-node": "4.5.110",
- "@tagspaces/tagspaces-ws": "4.5.110",
+ "@tagspaces/tagspaces-common-node": "4.5.111",
+ "@tagspaces/tagspaces-ws": "4.5.111",
"sharp": "0.32.6",
"ws": "8.19.0"
},
diff --git a/src/renderer/AppConfig.ts b/src/renderer/AppConfig.ts
index 291f97a84..5a7c5e191 100644
--- a/src/renderer/AppConfig.ts
+++ b/src/renderer/AppConfig.ts
@@ -30,7 +30,6 @@ AppConfig.editableFiles = [
'sh',
'sql',
];
-
AppConfig.aiSupportedFiletypes = {
text: ['pdf', ...AppConfig.editableFiles],
image: ['jpg', 'jpeg', 'png'],
@@ -69,106 +68,96 @@ AppConfig.SearchTimePeriods = {
pastYear: { key: 'pastYear', periodSpan: 31556952000 },
moreThanYear: { key: 'moreThanYear', periodSpan: 31556952001 },
};
-AppConfig.SearchTypeGroups =
- typeof window !== 'undefined' && window.ExtSearchTypeGroups !== undefined
- ? window.ExtSearchTypeGroups
- : {
- [AppConfig.SearchTypes.any]: [''],
- [AppConfig.SearchTypes.images]: [
- 'jpg',
- 'jpeg',
- 'jfif',
- 'jif',
- 'jiff',
- 'png',
- 'gif',
- 'svg',
- 'heic',
- 'webp',
- 'bmp',
- 'tga',
- 'tif',
- 'tiff',
- 'nef',
- 'cr2',
- 'dng',
- 'psd',
- 'avif',
- 'nef',
- ],
- [AppConfig.SearchTypes.notes]: ['md', 'mdown', 'txt', 'html', 'mdx'],
- [AppConfig.SearchTypes.documents]: [
- 'pdf',
- 'doc',
- 'docx',
- 'xls',
- 'xlsx',
- 'odt',
- 'ods',
- 'odp',
- 'pptx',
- 'numbers',
- 'potx',
- 'sldx',
- 'dotx',
- ],
- [AppConfig.SearchTypes.audio]: [
- 'ogg',
- 'mp3',
- 'wav',
- 'wave',
- 'flac',
- 'acc',
- 'm4a',
- 'm4b',
- 'm4p',
- 'opus',
- 'aiff',
- 'speex',
- 'wma',
- ],
- [AppConfig.SearchTypes.video]: [
- 'ogv',
- 'mp4',
- 'webm',
- 'm4v',
- 'mkv',
- 'avi',
- '3gp',
- '3g2',
- 'mov',
- ],
- [AppConfig.SearchTypes.archives]: [
- 'zip',
- 'rar',
- 'gz',
- 'tgz',
- 'arc',
- '7z',
- ],
- [AppConfig.SearchTypes.bookmarks]: [
- 'url',
- 'lnk',
- 'sym',
- 'desktop',
- 'website',
- ],
- [AppConfig.SearchTypes.ebooks]: [
- 'epub',
- 'mobi',
- 'azw',
- 'prc',
- 'azw1',
- 'azw3',
- 'azw4',
- 'azw8',
- 'azk',
- ],
- [AppConfig.SearchTypes.emails]: ['eml', 'msg'],
- [AppConfig.SearchTypes.folders]: ['folders'],
- [AppConfig.SearchTypes.files]: ['files'],
- [AppConfig.SearchTypes.untagged]: ['untagged'],
- };
+AppConfig.SearchTypeGroups = {
+ [AppConfig.SearchTypes.any]: [''],
+ [AppConfig.SearchTypes.images]: [
+ 'jpg',
+ 'jpeg',
+ 'jfif',
+ 'jif',
+ 'jiff',
+ 'png',
+ 'gif',
+ 'svg',
+ 'heic',
+ 'webp',
+ 'bmp',
+ 'tga',
+ 'tif',
+ 'tiff',
+ 'nef',
+ 'cr2',
+ 'dng',
+ 'psd',
+ 'avif',
+ 'nef',
+ ],
+ [AppConfig.SearchTypes.notes]: ['md', 'mdown', 'txt', 'html', 'mdx'],
+ [AppConfig.SearchTypes.documents]: [
+ 'pdf',
+ 'doc',
+ 'docx',
+ 'xls',
+ 'xlsx',
+ 'odt',
+ 'ods',
+ 'odp',
+ 'pptx',
+ 'numbers',
+ 'potx',
+ 'sldx',
+ 'dotx',
+ ],
+ [AppConfig.SearchTypes.audio]: [
+ 'ogg',
+ 'mp3',
+ 'wav',
+ 'wave',
+ 'flac',
+ 'acc',
+ 'm4a',
+ 'm4b',
+ 'm4p',
+ 'opus',
+ 'aiff',
+ 'speex',
+ 'wma',
+ ],
+ [AppConfig.SearchTypes.video]: [
+ 'ogv',
+ 'mp4',
+ 'webm',
+ 'm4v',
+ 'mkv',
+ 'avi',
+ '3gp',
+ '3g2',
+ 'mov',
+ ],
+ [AppConfig.SearchTypes.archives]: ['zip', 'rar', 'gz', 'tgz', 'arc', '7z'],
+ [AppConfig.SearchTypes.bookmarks]: [
+ 'url',
+ 'lnk',
+ 'sym',
+ 'desktop',
+ 'website',
+ ],
+ [AppConfig.SearchTypes.ebooks]: [
+ 'epub',
+ 'mobi',
+ 'azw',
+ 'prc',
+ 'azw1',
+ 'azw3',
+ 'azw4',
+ 'azw8',
+ 'azk',
+ ],
+ [AppConfig.SearchTypes.emails]: ['eml', 'msg'],
+ [AppConfig.SearchTypes.folders]: ['folders'],
+ [AppConfig.SearchTypes.files]: ['files'],
+ [AppConfig.SearchTypes.untagged]: ['untagged'],
+};
AppConfig.autoSaveInterval = 40000;
AppConfig.maxCollectedTag = 500;
AppConfig.maxLoops = 2;
@@ -179,38 +168,14 @@ AppConfig.defaultSpaceBetweenButtons = '10px';
AppConfig.aiFolder = 'ai';
AppConfig.aiChatFileName = 'tsc.json';
AppConfig.sidecarRevisionExtension = '.meta';
-AppConfig.defaultMapBounds =
- typeof window !== 'undefined' && window.ExtDefaultMapBounds !== undefined
- ? window.ExtDefaultMapBounds
- : {
- southWest: { lat: 56, lng: -13 },
- northEast: { lat: 29, lng: 50 },
- };
-
-AppConfig.showTSLogo =
- typeof window !== 'undefined' && window.ExtShowTSLogo !== undefined
- ? window.ExtShowTSLogo
- : true;
-
-AppConfig.showTSVersion =
- typeof window !== 'undefined' && window.ExtShowTSVersion !== undefined
- ? window.ExtShowTSVersion
- : true;
-
-AppConfig.defaultTemplate =
- typeof window !== 'undefined' && window.ExtDefaultFileTemplate !== undefined
- ? window.ExtDefaultFileTemplate
- : {
- id: 'default',
- name: 'Default',
- content: '{createdInApp} ({date}) {author}',
- fileNameTmpl: 'note[{timestamp}]',
- };
-
-AppConfig.hideProFeatures =
- typeof window !== 'undefined' &&
- (window.ExtHideProFeatures !== undefined ? window.ExtHideProFeatures : false);
-
+AppConfig.ExtDefaultMapBounds = {
+ southWest: { lat: 56, lng: -13 },
+ northEast: { lat: 29, lng: 50 },
+};
+AppConfig.ExtLightThemeLightColor = '#dcf3ec';
+AppConfig.ExtLightThemeMainColor = '#1dd19f';
+AppConfig.ExtDarkThemeLightColor = '#56454e';
+AppConfig.ExtDarkThemeMainColor = '#ff9abe';
AppConfig.backgroundColors = [
'transparent',
'#00000044',
diff --git a/src/renderer/components/CustomLogo.tsx b/src/renderer/components/CustomLogo.tsx
index 50628f400..f62fca948 100644
--- a/src/renderer/components/CustomLogo.tsx
+++ b/src/renderer/components/CustomLogo.tsx
@@ -42,8 +42,8 @@ function CustomLogo() {
let customLogo =
'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>';
// let customLogo = TextLogoIcon;
- if (AppConfig.customLogo) {
- customLogo = AppConfig.customLogo;
+ if (AppConfig.ExtLogoURL) {
+ customLogo = AppConfig.ExtLogoURL;
}
return customLogo;
}, []);
diff --git a/src/renderer/components/EditSearchQuery.tsx b/src/renderer/components/EditSearchQuery.tsx
index f816a48cc..c3ffb8aa1 100644
--- a/src/renderer/components/EditSearchQuery.tsx
+++ b/src/renderer/components/EditSearchQuery.tsx
@@ -437,7 +437,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchUntaggedEntries')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.images.toString()}
+ title={AppConfig.SearchTypeGroups.images?.toString()}
value={AppConfig.SearchTypes.images}
>
<TsIconButton size="small">
@@ -446,7 +446,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchPictures')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.documents.toString()}
+ title={AppConfig.SearchTypeGroups.documents?.toString()}
value={AppConfig.SearchTypes.documents}
>
<TsIconButton size="small">
@@ -455,7 +455,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchDocuments')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.notes.toString()}
+ title={AppConfig.SearchTypeGroups.notes?.toString()}
value={AppConfig.SearchTypes.notes}
>
<TsIconButton size="small">
@@ -464,7 +464,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchNotes')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.audio.toString()}
+ title={AppConfig.SearchTypeGroups.audio?.toString()}
value={AppConfig.SearchTypes.audio}
>
<TsIconButton size="small">
@@ -473,7 +473,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchAudio')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.video.toString()}
+ title={AppConfig.SearchTypeGroups.video?.toString()}
value={AppConfig.SearchTypes.video}
>
<TsIconButton size="small">
@@ -482,7 +482,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchVideoFiles')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.archives.toString()}
+ title={AppConfig.SearchTypeGroups.archives?.toString()}
value={AppConfig.SearchTypes.archives}
>
<TsIconButton size="small">
@@ -491,7 +491,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchArchives')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.bookmarks.toString()}
+ title={AppConfig.SearchTypeGroups.bookmarks?.toString()}
value={AppConfig.SearchTypes.bookmarks}
>
<TsIconButton size="small">
@@ -500,7 +500,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchBookmarks')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.ebooks.toString()}
+ title={AppConfig.SearchTypeGroups.ebooks?.toString()}
value={AppConfig.SearchTypes.ebooks}
>
<TsIconButton size="small">
@@ -509,7 +509,7 @@ function EditSearchQuery(props: Props) {
{t('core:searchEbooks')}
</MenuItem>
<MenuItem
- title={AppConfig.SearchTypeGroups.emails.toString()}
+ title={AppConfig.SearchTypeGroups.emails?.toString()}
value={AppConfig.SearchTypes.emails}
>
<TsIconButton size="small">
diff --git a/src/renderer/components/EntryContainerNav.tsx b/src/renderer/components/EntryContainerNav.tsx
index a29e65d83..22531fc9c 100644
--- a/src/renderer/components/EntryContainerNav.tsx
+++ b/src/renderer/components/EntryContainerNav.tsx
@@ -66,7 +66,7 @@ function EntryContainerNav(props: Props) {
alignItems: 'center',
}}
>
- {!AppConfig.hideProFeatures && (
+ {!AppConfig.ExtHideProFeatures && (
<ProTooltip tooltip={t('core:toggleBookmark')}>
<TsIconButton
data-tid="toggleBookmarkTID"
diff --git a/src/renderer/components/EntryIcon.tsx b/src/renderer/components/EntryIcon.tsx
index 276be9d9a..18061650e 100644
--- a/src/renderer/components/EntryIcon.tsx
+++ b/src/renderer/components/EntryIcon.tsx
@@ -62,8 +62,15 @@ const ICONS = {
function getIcon(isFile: boolean, fileExtension: string): React.ReactNode {
if (!isFile) return ICONS.folder;
- const { audio, video, images, notes, bookmarks, emails, ebooks } =
- AppConfig.SearchTypeGroups;
+ const {
+ audio = [],
+ video = [],
+ images = [],
+ notes = [],
+ bookmarks = [],
+ emails = [],
+ ebooks = [],
+ } = AppConfig.SearchTypeGroups;
if (audio.includes(fileExtension)) return ICONS.audio;
if (video.includes(fileExtension)) return ICONS.video;
if (images.includes(fileExtension)) return ICONS.image;
diff --git a/src/renderer/components/FolderContainer.tsx b/src/renderer/components/FolderContainer.tsx
index db1c7fff4..55f80e82c 100644
--- a/src/renderer/components/FolderContainer.tsx
+++ b/src/renderer/components/FolderContainer.tsx
@@ -153,7 +153,7 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {
() =>
AvailablePerspectives.map((perspective) => {
let includePerspective = true;
- if (AppConfig.hideProFeatures && !Pro && perspective.pro === true) {
+ if (AppConfig.ExtHideProFeatures && !Pro && perspective.pro === true) {
includePerspective = false;
}
return (
@@ -192,7 +192,7 @@ function FolderContainer({ toggleDrawer, drawerOpened, hidden }: Props) {
() =>
AvailablePerspectives.map((perspective) => {
let includePerspective = true;
- if (AppConfig.hideProFeatures && !Pro && perspective.pro === true) {
+ if (AppConfig.ExtHideProFeatures && !Pro && perspective.pro === true) {
includePerspective = false;
}
return (
diff --git a/src/renderer/components/MobileNavigation.tsx b/src/renderer/components/MobileNavigation.tsx
index 798895976..230f2e071 100644
--- a/src/renderer/components/MobileNavigation.tsx
+++ b/src/renderer/components/MobileNavigation.tsx
@@ -120,7 +120,8 @@ function MobileNavigation(props: Props) {
const { currentUser } = useUserContext();
const [showTeaserBanner, setShowTeaserBanner] = useState(true);
const [anchorUser, setAnchorUser] = useState<HTMLButtonElement | null>(null);
- const showProTeaser = !AppConfig.hideProFeatures && !Pro && showTeaserBanner;
+ const showProTeaser =
+ !AppConfig.ExtHideProFeatures && !Pro && showTeaserBanner;
const { hideDrawer, width } = props;
const switchTheme = useCallback(
() => dispatch(SettingsActions.switchTheme()),
@@ -540,7 +541,7 @@ function MobileNavigation(props: Props) {
<ListItemText primary={t('core:createDirectory')} />
</MenuItem>
<Divider />
- {!AppConfig.locationsReadOnly && (
+ {!AppConfig.ExtLocationsReadOnly && (
<MenuItem
key="createNewLocation"
data-tid="createNewLocationTID"
diff --git a/src/renderer/components/PerspectiveSelector.tsx b/src/renderer/components/PerspectiveSelector.tsx
index 10b3e773a..276fd0054 100644
--- a/src/renderer/components/PerspectiveSelector.tsx
+++ b/src/renderer/components/PerspectiveSelector.tsx
@@ -61,7 +61,7 @@ function PerspectiveSelector(props: Props) {
AvailablePerspectives.forEach((perspective) => {
let includePerspective = true;
- if (AppConfig.hideProFeatures && !Pro && perspective.pro === true) {
+ if (AppConfig.ExtHideProFeatures && !Pro && perspective.pro === true) {
includePerspective = false;
}
if (includePerspective) {
diff --git a/src/renderer/components/RenderPerspective.tsx b/src/renderer/components/RenderPerspective.tsx
index d538f5b5f..8ff0c807d 100644
--- a/src/renderer/components/RenderPerspective.tsx
+++ b/src/renderer/components/RenderPerspective.tsx
@@ -193,7 +193,7 @@ function RenderPerspective(props: Props) {
//!currentDirectoryPath && currentDirectoryEntries.length < 1;
if (showWelcomePanel) {
- return AppConfig.showWelcomePanel ? <WelcomePanelAsync /> : null;
+ return AppConfig.ExtShowWelcomePanel ? <WelcomePanelAsync /> : null;
}
function getPerspectiveComponent() {
diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsx
index 5eec6117a..41f9537e0 100644
--- a/src/renderer/components/SearchAutocomplete.tsx
+++ b/src/renderer/components/SearchAutocomplete.tsx
@@ -124,7 +124,7 @@ function SearchAutocomplete(props: Props) {
const fileTypes = useRef<Array<string>>(
searchQuery.fileTypes
? searchQuery.fileTypes
- : AppConfig.SearchTypeGroups.any,
+ : AppConfig.SearchTypeGroups?.any,
);
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
const actionValues = useRef<Array<SearchOptionType>>([]);
@@ -245,7 +245,7 @@ function SearchAutocomplete(props: Props) {
if (
searchQuery.fileTypes &&
JSON.stringify(searchQuery.fileTypes) !==
- JSON.stringify(AppConfig.SearchTypeGroups.any)
+ JSON.stringify(AppConfig.SearchTypeGroups?.any)
) {
fileTypes.current = searchQuery.fileTypes;
emptySearch = false;
diff --git a/src/renderer/components/TagLibrary.tsx b/src/renderer/components/TagLibrary.tsx
index e2cdd44cb..6cede5328 100644
--- a/src/renderer/components/TagLibrary.tsx
+++ b/src/renderer/components/TagLibrary.tsx
@@ -352,11 +352,12 @@ function TagLibrary({ reduceHeightBy }: Props) {
}}
data-tid="tagLibraryTagGroupList"
>
- {AppConfig.showSmartTags && (
- <Box sx={{ paddingTop: 0, paddingBottom: 0 }}>
- {SmartTags(t).map(renderTagGroup)}
- </Box>
- )}
+ {AppConfig.ExtShowSmartTags === undefined ||
+ (AppConfig.ExtShowSmartTags && (
+ <Box sx={{ paddingTop: 0, paddingBottom: 0 }}>
+ {SmartTags(t).map(renderTagGroup)}
+ </Box>
+ ))}
<Box sx={{ paddingTop: 0 }}>{wSpaceTagGroups.map(renderTagGroup)}</Box>
</Box>
</Box>
diff --git a/src/renderer/components/dialogs/AboutDialog.tsx b/src/renderer/components/dialogs/AboutDialog.tsx
index a26abd5db..3ec72944f 100644
--- a/src/renderer/components/dialogs/AboutDialog.tsx
+++ b/src/renderer/components/dialogs/AboutDialog.tsx
@@ -28,8 +28,7 @@ import TsDialogTitle from '-/components/dialogs/components/TsDialogTitle';
import { useLicenseDialogContext } from '-/components/dialogs/hooks/useLicenseDialogContext';
import { useThirdPartyLibsDialogContext } from '-/components/dialogs/hooks/useThirdPartyLibsDialogContext';
import { Pro } from '-/pro';
-import { getLastVersionPromise } from '-/reducers/settings';
-import { openURLExternally } from '-/services/utils-io';
+import { getLastVersionPromise, openURLExternally } from '-/services/utils-io';
import versionMeta from '-/version.json';
import { Box } from '@mui/material';
import DialogContent from '@mui/material/DialogContent';
@@ -104,16 +103,16 @@ function AboutDialog(props: Props) {
if (AppConfig.isWeb) {
privacyURL = '';
}
- if (window.ExtPrivacyURL) {
- privacyURL = window.ExtPrivacyURL;
+ if (AppConfig.ExtPrivacyURL) {
+ privacyURL = AppConfig.ExtPrivacyURL;
}
let imprintURL = Links.links.imprintURL;
if (AppConfig.isWeb) {
imprintURL = '';
}
- if (window.ExtImprintURL) {
- imprintURL = window.ExtImprintURL;
+ if (AppConfig.ExtImprintURL) {
+ imprintURL = AppConfig.ExtImprintURL;
}
const theme = useTheme();
diff --git a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
index ea06dc593..642d893ff 100644
--- a/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
+++ b/src/renderer/components/dialogs/CreateEditLocationDialog.tsx
@@ -960,7 +960,7 @@ function CreateEditLocationDialog(props: Props) {
}
/>
)}
- {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
+ {AppConfig.ExtUseSidecarsForFileTagging !== undefined ? (
<FormControlLabel
labelPlacement="start"
sx={{ justifyContent: 'space-between', marginLeft: 0 }}
diff --git a/src/renderer/components/dialogs/NewFileDialog.tsx b/src/renderer/components/dialogs/NewFileDialog.tsx
index b650e2478..d33574425 100644
--- a/src/renderer/components/dialogs/NewFileDialog.tsx
+++ b/src/renderer/components/dialogs/NewFileDialog.tsx
@@ -120,7 +120,7 @@ function NewFileDialog(props: Props) {
filenameTagPlacedAtEnd,
);
}
- const template = fileTemplate ?? window.ExtDefaultFileTemplate;
+ const template = fileTemplate ?? AppConfig.ExtDefaultFileTemplate;
if (template && template.fileNameTmpl !== undefined) {
return getFileNameFromTemplate(template);
}
@@ -141,7 +141,7 @@ function NewFileDialog(props: Props) {
function getFileContent() {
if (fileType === 'url') return '';
- const template = fileTemplate ?? window.ExtDefaultFileTemplate;
+ const template = fileTemplate ?? AppConfig.ExtDefaultFileTemplate;
if (template && template.content) {
return getFileContentFromTemplate(template);
}
diff --git a/src/renderer/components/dialogs/components/SettingsAI.tsx b/src/renderer/components/dialogs/components/SettingsAI.tsx
index 4374a7e1f..aa2c67630 100644
--- a/src/renderer/components/dialogs/components/SettingsAI.tsx
+++ b/src/renderer/components/dialogs/components/SettingsAI.tsx
@@ -185,7 +185,7 @@ function SettingsAI(props: Props) {
forceUpdate();
}
- const externalConfig = typeof window.ExtAI !== 'undefined';
+ const externalConfig = typeof AppConfig.ExtAI !== 'undefined';
const actionButtons = (key) => (
<InputAdornment
@@ -542,7 +542,7 @@ function SettingsAI(props: Props) {
multiline
rows={5}
disabled={
- !(typeof window.ExtDefaultQuestionPrompt === 'undefined')
+ !(typeof AppConfig.ExtDefaultQuestionPrompt === 'undefined')
}
label={t('defaultQuestionPrompt')}
value={
@@ -565,7 +565,9 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(typeof AppConfig.ExtDefaultSystemPrompt === 'undefined')
+ }
label={t('defaultSystemPrompt')}
value={
aiTemplates.current['DEFAULT_SYSTEM_PROMPT'] ??
@@ -587,7 +589,7 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={!(typeof AppConfig.ExtSummarizePrompt === 'undefined')}
label={t('summarizePrompt')}
value={
aiTemplates.current['SUMMARIZE_PROMPT'] ??
@@ -609,7 +611,11 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(
+ typeof AppConfig.ExtDescriptionFromImagePrompt === 'undefined'
+ )
+ }
label={t('imageDescription')}
value={
aiTemplates.current['IMAGE_DESCRIPTION_PROMPT'] ??
@@ -632,7 +638,12 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(
+ typeof AppConfig.ExtDescriptionFromImageStructuredPrompt ===
+ 'undefined'
+ )
+ }
label={t('imageDescriptionStructured')}
value={
aiTemplates.current['IMAGE_DESCRIPTION_STRUCTURED_PROMPT'] ??
@@ -658,7 +669,9 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(typeof AppConfig.ExtDescriptionFromTextPrompt === 'undefined')
+ }
label={t('textDescription')}
value={
aiTemplates.current['TEXT_DESCRIPTION_PROMPT'] ??
@@ -680,7 +693,9 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(typeof AppConfig.ExtTagsFromImagePrompt === 'undefined')
+ }
label={t('generateImageTags')}
value={
aiTemplates.current['IMAGE_TAGS_PROMPT'] ??
@@ -702,7 +717,9 @@ function SettingsAI(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!(typeof window.ExtDefaultSystemPrompt === 'undefined')}
+ disabled={
+ !(typeof AppConfig.ExtTagsFromTextPrompt === 'undefined')
+ }
label={t('generateTags')}
value={
aiTemplates.current['TEXT_TAGS_PROMPT'] ??
diff --git a/src/renderer/components/dialogs/components/SettingsAdvanced.tsx b/src/renderer/components/dialogs/components/SettingsAdvanced.tsx
index f78062d39..8596d9419 100644
--- a/src/renderer/components/dialogs/components/SettingsAdvanced.tsx
+++ b/src/renderer/components/dialogs/components/SettingsAdvanced.tsx
@@ -112,7 +112,7 @@ function SettingsAdvanced(props: Props) {
workSpacesContext.openNewWorkspaceDialog(workSpace);
};
- const geoTaggingFormatDisabled = AppConfig.geoTaggingFormat !== undefined;
+ const geoTaggingFormatDisabled = AppConfig.ExtGeoTaggingFormat !== undefined;
const setDevMode = (devMode) => dispatch(SettingsActions.setDevMode(devMode));
@@ -297,7 +297,7 @@ function SettingsAdvanced(props: Props) {
}
value={
geoTaggingFormatDisabled
- ? AppConfig.geoTaggingFormat
+ ? AppConfig.ExtGeoTaggingFormat
: settings.geoTaggingFormat
}
onChange={(event: any) => setGeoTaggingFormat(event.target.value)}
@@ -387,7 +387,7 @@ function SettingsAdvanced(props: Props) {
/>
<Switch
data-tid="settingsEnableDevMode"
- disabled={window.ExtDevMode && window.ExtDevMode === true}
+ disabled={AppConfig?.ExtDevMode === true}
onClick={() => setDevMode(!devMode)}
checked={devMode}
/>
diff --git a/src/renderer/components/dialogs/components/SettingsGeneral.tsx b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
index ab620a123..708c68fe0 100644
--- a/src/renderer/components/dialogs/components/SettingsGeneral.tsx
+++ b/src/renderer/components/dialogs/components/SettingsGeneral.tsx
@@ -123,8 +123,6 @@ function SettingsGeneral() {
defaultPerspective = settings.defaultPerspective;
}
- const geoTaggingFormatDisabled = AppConfig.geoTaggingFormat !== undefined;
-
const setDesktopMode = (desktopMode) =>
dispatch(SettingsActions.setDesktopMode(desktopMode));
@@ -340,13 +338,13 @@ function SettingsGeneral() {
jsx: (
<ListItem
title={
- AppConfig.useSidecarsForFileTaggingDisableSetting
+ AppConfig.ExtUseSidecarsForFileTagging !== undefined
? t('core:settingExternallyConfigured')
: ''
}
>
<ListItemText primary={t('core:fileTaggingSetting')} />
- {AppConfig.useSidecarsForFileTaggingDisableSetting ? (
+ {AppConfig.ExtUseSidecarsForFileTagging !== undefined ? (
<TsButton disabled>
{persistTagsInSidecarFile
? t('core:useSidecarFile')
@@ -460,14 +458,14 @@ function SettingsGeneral() {
jsx: (
<ListItem
title={
- window.ExtCheckForUpdatesOnStartup !== undefined
+ AppConfig.ExtCheckForUpdatesOnStartup !== undefined
? t('core:settingExternallyConfigured')
: ''
}
>
<ListItemText primary={t('core:checkForNewVersionOnStartup')} />
<Switch
- disabled={window.ExtCheckForUpdatesOnStartup !== undefined}
+ disabled={AppConfig.ExtCheckForUpdatesOnStartup !== undefined}
data-tid="settingsSetCheckForUpdates"
onClick={() =>
dispatch(
@@ -477,8 +475,8 @@ function SettingsGeneral() {
)
}
checked={
- window.ExtCheckForUpdatesOnStartup !== undefined
- ? window.ExtCheckForUpdatesOnStartup
+ AppConfig.ExtCheckForUpdatesOnStartup !== undefined
+ ? AppConfig.ExtCheckForUpdatesOnStartup
: settings.checkForUpdates
}
/>
@@ -531,14 +529,14 @@ function SettingsGeneral() {
jsx: (
<ListItem
title={
- window.ExtUseOnlyTagsFromTagLibrary !== undefined
+ AppConfig.ExtUseOnlyTagsFromTagLibrary !== undefined
? t('core:settingExternallyConfigured')
: ''
}
>
<ListItemText primary={t('core:useOnlyTagsFromTagLibrary')} />
<Switch
- disabled={window.ExtUseOnlyTagsFromTagLibrary !== undefined}
+ disabled={AppConfig.ExtUseOnlyTagsFromTagLibrary !== undefined}
data-tid="useOnlyTagsFromTagLibraryTID"
onClick={() =>
dispatch(
@@ -548,8 +546,8 @@ function SettingsGeneral() {
)
}
checked={
- window.ExtUseOnlyTagsFromTagLibrary !== undefined
- ? window.ExtUseOnlyTagsFromTagLibrary
+ AppConfig.ExtUseOnlyTagsFromTagLibrary !== undefined
+ ? AppConfig.ExtUseOnlyTagsFromTagLibrary
: settings.useOnlyTagsFromTagLibrary
}
/>
@@ -562,7 +560,7 @@ function SettingsGeneral() {
<ListItem>
<ListItemText primary={t('core:useGenerateThumbnails')} />
<Switch
- disabled={AppConfig.useGenerateThumbnails !== undefined}
+ disabled={AppConfig.ExtUseGenerateThumbnails !== undefined}
data-tid="settingsUseGenerateThumbnails"
onClick={() =>
dispatch(
@@ -572,8 +570,8 @@ function SettingsGeneral() {
)
}
checked={
- AppConfig.useGenerateThumbnails !== undefined
- ? AppConfig.useGenerateThumbnails
+ AppConfig.ExtUseGenerateThumbnails !== undefined
+ ? AppConfig.ExtUseGenerateThumbnails
: settings.useGenerateThumbnails
}
/>
@@ -682,7 +680,7 @@ function SettingsGeneral() {
<ListItemText primary={t('enableMobileMode')} />
<Switch
data-tid="settingsSetDesktopMode"
- disabled={!(typeof window.ExtDisplayMode === 'undefined')}
+ disabled={!(typeof AppConfig.ExtDisplayMode === 'undefined')}
onClick={() => setDesktopMode(!settings.desktopMode)}
checked={!settings.desktopMode}
/>
@@ -848,12 +846,16 @@ function SettingsGeneral() {
}
/>
<TsTextField
- disabled={window.ExtAuthor !== undefined}
+ disabled={AppConfig.ExtAuthor !== undefined}
title={
- window.ExtAuthor ? t('core:settingExternallyConfigured') : ''
+ AppConfig.ExtAuthor
+ ? t('core:settingExternallyConfigured')
+ : ''
}
data-tid="authorTID"
- value={window.ExtAuthor ? window.ExtAuthor : settings.author}
+ value={
+ AppConfig.ExtAuthor ? AppConfig.ExtAuthor : settings.author
+ }
onChange={(event) => setAuthor(event.target.value)}
slotProps={{
input: {
@@ -862,7 +864,7 @@ function SettingsGeneral() {
<TooltipTS title={t('loadDefaultAuthor')}>
<TsIconButton
data-tid="loadDefaultAuthorTID"
- disabled={window.ExtAuthor !== undefined}
+ disabled={AppConfig.ExtAuthor !== undefined}
onClick={() =>
dispatch(SettingsActions.setAuthor(undefined))
}
@@ -907,7 +909,7 @@ function SettingsGeneral() {
jsx: (
<ListItem
title={
- window.ExtUseLocationTags !== undefined
+ AppConfig.ExtUseLocationTags !== undefined
? t('core:settingExternallyConfigured')
: ''
}
@@ -923,13 +925,13 @@ function SettingsGeneral() {
/>
<Switch
data-tid="saveTagInLocationTID"
- disabled={!Pro || window.ExtUseLocationTags !== undefined}
+ disabled={!Pro || AppConfig.ExtUseLocationTags !== undefined}
onClick={() => {
Pro && setSaveTagInLocation(!settings.saveTagInLocation);
}}
checked={
- window.ExtUseLocationTags !== undefined
- ? window.ExtUseLocationTags
+ AppConfig.ExtUseLocationTags !== undefined
+ ? AppConfig.ExtUseLocationTags
: settings.saveTagInLocation
}
/>
diff --git a/src/renderer/components/dialogs/components/SettingsTemplates.tsx b/src/renderer/components/dialogs/components/SettingsTemplates.tsx
index 826d0a267..7e7573f5f 100644
--- a/src/renderer/components/dialogs/components/SettingsTemplates.tsx
+++ b/src/renderer/components/dialogs/components/SettingsTemplates.tsx
@@ -61,7 +61,7 @@ function SettingsTemplates(props: Props) {
)
: undefined;
const templatesArray = fileTemplatesContext?.getTemplates() ?? [
- AppConfig.defaultTemplate,
+ AppConfig.ExtDefaultFileTemplate,
];
function saveTemplate(key?: string) {
@@ -73,7 +73,7 @@ function SettingsTemplates(props: Props) {
} else {
// new template
const id = getUuid();
- const def = AppConfig.defaultTemplate;
+ const def = AppConfig.ExtDefaultFileTemplate;
const temp = {
id,
name: 'new template',
@@ -111,7 +111,7 @@ function SettingsTemplates(props: Props) {
/* const defaultTemplate =
templatesArray?.find((t) => t.type === undefined) ||
- AppConfig.defaultTemplate;*/
+ AppConfig.ExtDefaultFileTemplate;*/
function toggleType(template: TS.FileTemplate, type: 'html' | 'md' | 'txt') {
if (!fileTemplatesContext) return;
@@ -149,7 +149,7 @@ function SettingsTemplates(props: Props) {
<ProLabel />
<InfoIcon
tooltip={
- !!window.ExtFileTemplates &&
+ !!AppConfig.ExtFileTemplates &&
'Template functionalities are disabled because templates are externally configured'
}
></InfoIcon>
@@ -187,7 +187,7 @@ function SettingsTemplates(props: Props) {
file will get an unique name.
</Typography>
<TsButton
- disabled={!!window.ExtFileTemplates}
+ disabled={!!AppConfig.ExtFileTemplates}
onClick={() => {
saveTemplate();
}}
@@ -197,7 +197,7 @@ function SettingsTemplates(props: Props) {
{t('addTemplate')}
</TsButton>
<TsButton
- disabled={!!window.ExtFileTemplates}
+ disabled={!!AppConfig.ExtFileTemplates}
variant="text"
onClick={() => {
fileTemplatesContext.resetTemplates();
@@ -211,17 +211,17 @@ function SettingsTemplates(props: Props) {
>
{t('resetTemplates')}
</TsButton>
- <TemplatesDropDown disabled={!!window.ExtFileTemplates} />
+ <TemplatesDropDown disabled={!!AppConfig.ExtFileTemplates} />
<TemplatesDropDown
- disabled={!!window.ExtFileTemplates}
+ disabled={!!AppConfig.ExtFileTemplates}
fileType="md"
/>
<TemplatesDropDown
- disabled={!!window.ExtFileTemplates}
+ disabled={!!AppConfig.ExtFileTemplates}
fileType="txt"
/>
<TemplatesDropDown
- disabled={!!window.ExtFileTemplates}
+ disabled={!!AppConfig.ExtFileTemplates}
fileType="html"
/>
</AccordionDetails>
@@ -268,7 +268,7 @@ function SettingsTemplates(props: Props) {
</small>
</Typography>
<TsIconButton
- disabled={!Pro || !!window.ExtFileTemplates}
+ disabled={!Pro || !!AppConfig.ExtFileTemplates}
aria-label="removeTemplate"
tooltip={t('core:remove')}
onClick={(e) => {
@@ -311,7 +311,7 @@ function SettingsTemplates(props: Props) {
<AccordionDetails>
<TsTextField
fullWidth
- disabled={!Pro || !!window.ExtFileTemplates}
+ disabled={!Pro || !!AppConfig.ExtFileTemplates}
label={t('name')}
error={!currentTemplate(template).name}
value={currentTemplate(template).name}
@@ -386,7 +386,7 @@ function SettingsTemplates(props: Props) {
fullWidth
multiline
rows={5}
- disabled={!Pro || !!window.ExtFileTemplates}
+ disabled={!Pro || !!AppConfig.ExtFileTemplates}
label={t('core:templateContent')}
value={currentTemplate(template).content}
onChange={(e) => {
@@ -402,7 +402,7 @@ function SettingsTemplates(props: Props) {
/>
<TsTextField
fullWidth
- disabled={!Pro || !!window.ExtFileTemplates}
+ disabled={!Pro || !!AppConfig.ExtFileTemplates}
error={!currentTemplate(template).fileNameTmpl}
label={t('fileNameTmpl')}
placeholder="e.g.: note[{timestamp}] or {uuid}"
diff --git a/src/renderer/components/menus/LocationContextMenu.tsx b/src/renderer/components/menus/LocationContextMenu.tsx
index 0678c6daf..08111c1f2 100644
--- a/src/renderer/components/menus/LocationContextMenu.tsx
+++ b/src/renderer/components/menus/LocationContextMenu.tsx
@@ -154,7 +154,7 @@ function LocationContextMenu(props: Props) {
};
const menuItems = [];
- if (!AppConfig.locationsReadOnly && !selectedLocation.isNotEditable) {
+ if (!AppConfig.ExtLocationsReadOnly && !selectedLocation.isNotEditable) {
menuItems.push(
<MenuItem
key="editLocation"
@@ -195,7 +195,7 @@ function LocationContextMenu(props: Props) {
);
}
menuItems.push(<Divider />);
- if (!AppConfig.locationsReadOnly) {
+ if (!AppConfig.ExtLocationsReadOnly) {
menuItems.push(
<MenuItem
key="duplicateLocation"
@@ -221,7 +221,7 @@ function LocationContextMenu(props: Props) {
<ListItemText primary={t('core:indexLocation')} />
</MenuItem>,
);
- if (!AppConfig.locationsReadOnly) {
+ if (!AppConfig.ExtLocationsReadOnly) {
menuItems.push(<Divider />);
menuItems.push(
<MenuItem
@@ -261,7 +261,7 @@ function LocationContextMenu(props: Props) {
</MenuItem>,
);
}
- if (!AppConfig.locationsReadOnly)
+ if (!AppConfig.ExtLocationsReadOnly)
menuItems.push(
<MenuItem
key="closeLocationTID"
diff --git a/src/renderer/components/menus/LocationManagerMenu.tsx b/src/renderer/components/menus/LocationManagerMenu.tsx
index 98cf1731f..d0330a1b5 100644
--- a/src/renderer/components/menus/LocationManagerMenu.tsx
+++ b/src/renderer/components/menus/LocationManagerMenu.tsx
@@ -29,11 +29,11 @@ import {
import { ProLabel } from '-/components/HelperComponents';
import TsIconButton from '-/components/TsIconButton';
import TsMenuList from '-/components/TsMenuList';
-import { useLinkDialogContext } from '-/components/dialogs/hooks/useLinkDialogContext';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { useLocationIndexContext } from '-/hooks/useLocationIndexContext';
import { Pro } from '-/pro';
import { openURLExternally } from '-/services/utils-io';
+import { TS } from '-/tagspaces.namespace';
import { Divider } from '@mui/material';
import ListItemIcon from '@mui/material/ListItemIcon';
import ListItemText from '@mui/material/ListItemText';
@@ -43,7 +43,6 @@ import Links from 'assets/links';
import { useContext, useState } from 'react';
import { useTranslation } from 'react-i18next';
import SidePanelTitle from '../SidePanelTitle';
-import { TS } from '-/tagspaces.namespace';
interface Props {
exportLocations: () => void;
@@ -72,7 +71,7 @@ function LocationManagerMenu(props: Props) {
: undefined;
const menuItems = [];
- if (!AppConfig.locationsReadOnly) {
+ if (!AppConfig.ExtLocationsReadOnly) {
menuItems.push(
<MenuItem
key="locationManagerMenuCreateLocation"
@@ -115,7 +114,7 @@ function LocationManagerMenu(props: Props) {
/>
</MenuItem>,
);
- if (!AppConfig.locationsReadOnly) {
+ if (!AppConfig.ExtLocationsReadOnly) {
menuItems.push(
<MenuItem
disabled={!Pro}
diff --git a/src/renderer/containers/MainPage.tsx b/src/renderer/containers/MainPage.tsx
index 62f35d128..e910b1ab0 100644
--- a/src/renderer/containers/MainPage.tsx
+++ b/src/renderer/containers/MainPage.tsx
@@ -350,7 +350,7 @@ function MainPage() {
}
`}
</style>
- {isDesktopMode || (AppConfig.isAmplify && !isLoggedIn()) ? (
+ {isDesktopMode || (AppConfig.ExtIsAmplify && !isLoggedIn()) ? (
<>
<Drawer
sx={{ backgroundColor: 'unset' }}
diff --git a/src/renderer/containers/Root.tsx b/src/renderer/containers/Root.tsx
index 9dbe3f23c..e29dc682a 100644
--- a/src/renderer/containers/Root.tsx
+++ b/src/renderer/containers/Root.tsx
@@ -196,7 +196,7 @@ export default function Root({ store, persistor }: RootType) {
// loading={<LoadingScreen />}
onBeforeLift={() => {
// eslint-disable-next-line react/prop-types
- if (!AppConfig.isAmplify) {
+ if (!AppConfig.ExtIsAmplify) {
// || store.app.user !== undefined
// @ts-ignore
store.dispatch(AppActions.initApp());
diff --git a/src/renderer/hooks/ThumbGenerationContextProvider.tsx b/src/renderer/hooks/ThumbGenerationContextProvider.tsx
index 7df7625a3..47e9618c2 100644
--- a/src/renderer/hooks/ThumbGenerationContextProvider.tsx
+++ b/src/renderer/hooks/ThumbGenerationContextProvider.tsx
@@ -207,8 +207,8 @@ export const ThumbGenerationContextProvider = ({
if (!location || location.disableThumbnailGeneration === true) {
return false; // dont generate thumbnails if it's not enabled in location settings
}
- if (AppConfig.useGenerateThumbnails !== undefined) {
- return AppConfig.useGenerateThumbnails;
+ if (AppConfig.ExtUseGenerateThumbnails !== undefined) {
+ return AppConfig.ExtUseGenerateThumbnails;
}
return useGenerateThumbnails;
}
diff --git a/src/renderer/hooks/UserContextProvider.tsx b/src/renderer/hooks/UserContextProvider.tsx
index f3ff7050d..c13696c4b 100644
--- a/src/renderer/hooks/UserContextProvider.tsx
+++ b/src/renderer/hooks/UserContextProvider.tsx
@@ -16,8 +16,9 @@
*
*/
-import React, { createContext, useMemo, useRef } from 'react';
+import AppConfig from '-/AppConfig';
import { CognitoUserInterface } from '@aws-amplify/ui-components';
+import React, { createContext, useMemo, useRef } from 'react';
type UserContextData = {
currentUser: CognitoUserInterface;
@@ -48,7 +49,9 @@ export const UserContextProvider = ({ children }: UserContextProviderProps) => {
};
const user = useRef<CognitoUserInterface>(
- window.ExtDemoUser ? createCognitoUser(window.ExtDemoUser) : undefined,
+ AppConfig.ExtDemoUser
+ ? createCognitoUser(AppConfig.ExtDemoUser)
+ : undefined,
);
const [ignored, forceUpdate] = React.useReducer((x) => x + 1, 0, undefined);
diff --git a/src/renderer/perspectives/common/DirectoryMenuItems.tsx b/src/renderer/perspectives/common/DirectoryMenuItems.tsx
index be50e6dce..f5b99165b 100644
--- a/src/renderer/perspectives/common/DirectoryMenuItems.tsx
+++ b/src/renderer/perspectives/common/DirectoryMenuItems.tsx
@@ -283,7 +283,7 @@ export function getDirectoryMenuItems(
<ListItemText primary={t('core:createLinkFile')} />
</MenuItem>,
);
- if (!AppConfig.hideProFeatures) {
+ if (!AppConfig.ExtHideProFeatures) {
menuItems.push(
<MenuItem
key="createNewFromTemplate"
@@ -309,7 +309,7 @@ export function getDirectoryMenuItems(
);
}
}
- if (createNewAudio && !AppConfig.hideProFeatures) {
+ if (createNewAudio && !AppConfig.ExtHideProFeatures) {
menuItems.push(
<MenuItem
key="createNewAudio"
@@ -373,7 +373,7 @@ export function getDirectoryMenuItems(
if (selectedEntries.length < 2) {
menuItems.push(<Divider key={`divider-${menuItems.length}`} />);
if (
- !AppConfig.hideProFeatures &&
+ !AppConfig.ExtHideProFeatures &&
Pro &&
!isReadOnlyMode &&
setFolderThumbnail &&
@@ -398,7 +398,7 @@ export function getDirectoryMenuItems(
);
}
if (
- !AppConfig.hideProFeatures &&
+ !AppConfig.ExtHideProFeatures &&
Pro &&
!isReadOnlyMode &&
changeFolderThumbnail
@@ -422,7 +422,7 @@ export function getDirectoryMenuItems(
);
}
if (
- !AppConfig.hideProFeatures &&
+ !AppConfig.ExtHideProFeatures &&
Pro &&
!isReadOnlyMode &&
changeFolderBackground
@@ -484,7 +484,7 @@ export function getDirectoryMenuItems(
}
if (
- !AppConfig.hideProFeatures &&
+ !AppConfig.ExtHideProFeatures &&
AppConfig.isElectron &&
AppConfig.isMacLike &&
!perspectiveMode &&
diff --git a/src/renderer/perspectives/grid/components/MainToolbar.tsx b/src/renderer/perspectives/grid/components/MainToolbar.tsx
index 2bfa81744..5596ba64b 100644
--- a/src/renderer/perspectives/grid/components/MainToolbar.tsx
+++ b/src/renderer/perspectives/grid/components/MainToolbar.tsx
@@ -252,7 +252,7 @@ function MainToolbar(props: Props) {
<DeleteIcon />
</TsToolbarButton>
)}
- {!AppConfig.hideProFeatures &&
+ {!AppConfig.ExtHideProFeatures &&
Pro &&
currentLocation?.haveObjectStoreSupport() && (
<TsToolbarButton
@@ -282,7 +282,7 @@ function MainToolbar(props: Props) {
<DownloadIcon />
</TsToolbarButton>
)}
- {!AppConfig.hideProFeatures &&
+ {!AppConfig.ExtHideProFeatures &&
Pro &&
!AppConfig.isCordovaAndroid && ( // SaveAs do not work on Android
<TsToolbarButton
diff --git a/src/renderer/reducers/app.ts b/src/renderer/reducers/app.ts
index dc2c56297..b2f4fe201 100644
--- a/src/renderer/reducers/app.ts
+++ b/src/renderer/reducers/app.ts
@@ -17,7 +17,6 @@
*/
import AppConfig from '-/AppConfig';
-import { cleanFrontDirSeparator } from '@tagspaces/tagspaces-common/paths';
import {
actions as SettingsActions,
getCheckForUpdateOnStartup,
@@ -30,6 +29,7 @@ import {
setLanguage,
} from '-/services/utils-io';
import { getURLParameter } from '-/utils/dom';
+import { cleanFrontDirSeparator } from '@tagspaces/tagspaces-common/paths';
import i18n from '../services/i18n';
import { AnyAction } from 'redux';
@@ -57,19 +57,19 @@ export const types = {
let showLocations = true;
let showTagLibrary = false;
let showSearch = false;
-if (window.ExtDefaultVerticalPanel === 'none') {
+if (AppConfig.ExtDefaultVerticalPanel === 'none') {
showLocations = false;
showTagLibrary = false;
showSearch = false;
-} else if (window.ExtDefaultVerticalPanel === 'locations') {
+} else if (AppConfig.ExtDefaultVerticalPanel === 'locations') {
showLocations = true;
showTagLibrary = false;
showSearch = false;
-} else if (window.ExtDefaultVerticalPanel === 'taglibrary') {
+} else if (AppConfig.ExtDefaultVerticalPanel === 'taglibrary') {
showLocations = false;
showTagLibrary = true;
showSearch = false;
-} else if (window.ExtDefaultVerticalPanel === 'search') {
+} else if (AppConfig.ExtDefaultVerticalPanel === 'search') {
showLocations = false;
showTagLibrary = false;
showSearch = true;
@@ -95,15 +95,6 @@ export const initialState = {
isEntryInFullWidth: false,
tagLibraryPanelOpened: showTagLibrary,
searchPanelOpened: showSearch,
- /*user: window.ExtDemoUser
- ? {
- attributes: window.ExtDemoUser,
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- associateSoftwareToken: () => {},
- // eslint-disable-next-line @typescript-eslint/no-empty-function
- verifySoftwareToken: () => {},
- }
- : undefined,*/
};
// The state described here will not be persisted
diff --git a/src/renderer/reducers/index.ts b/src/renderer/reducers/index.ts
index 13431bb40..d0572c028 100644
--- a/src/renderer/reducers/index.ts
+++ b/src/renderer/reducers/index.ts
@@ -16,6 +16,7 @@
*
*/
import AppConfig from '-/AppConfig';
+import { loadJSONString } from '@tagspaces/tagspaces-common/utils-io';
import { persistCombineReducers, PersistConfig } from 'redux-persist';
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
import storage from 'redux-persist/lib/storage';
@@ -24,25 +25,160 @@ import locations from './locations';
import searches from './searches';
import settings from './settings';
-// const xhr = new XMLHttpRequest();
-// xhr.open('GET', 'extconfig.json', true); // ../../../../extconfig.js
-// xhr.onreadystatechange = function () {
-// if (xhr.readyState === 4 && xhr.status === 200) {
-// const data = JSON.parse(xhr.responseText);
-// console.log(data);
-// window.ExtAuthor = data.ExtAuthor;
-// AppConfig.showTSVersion = false;
-// window.ExtLocations = data.ExtLocations;
-// }
-// };
-// xhr.send();
+function configureApp(extConfigObj) {
+ if (!extConfigObj) return;
+ if (extConfigObj.ExtLocations) {
+ externalLocations = extConfigObj.ExtLocations;
+ }
+ if (extConfigObj.ExtSearches) {
+ externalSearches = extConfigObj.ExtSearches;
+ }
+ AppConfig.showTSLogo =
+ extConfigObj.ExtShowTSLogo !== undefined
+ ? extConfigObj.ExtShowTSLogo
+ : true;
+ AppConfig.showTSVersion =
+ extConfigObj.ExtShowTSVersion !== undefined
+ ? extConfigObj.ExtShowTSVersion
+ : true;
+ AppConfig.ExtShowWelcomePanel =
+ extConfigObj.ExtShowWelcomePanel !== undefined
+ ? extConfigObj.ExtShowWelcomePanel
+ : true;
+ AppConfig.ExtAuthor = extConfigObj.ExtAuthor ?? AppConfig.ExtAuthor;
+ AppConfig.ExtPrivacyURL =
+ extConfigObj.ExtPrivacyURL ?? AppConfig.ExtPrivacyURL;
+ AppConfig.ExtImprintURL =
+ extConfigObj.ExtImprintURL ?? AppConfig.ExtImprintURL;
+ AppConfig.ExtLogoURL = extConfigObj.ExtLogoURL ?? AppConfig.ExtLogoURL;
+ AppConfig.ExtIsFirstRun =
+ extConfigObj.ExtIsFirstRun ?? AppConfig.ExtIsFirstRun;
+ AppConfig.ExtDisplayMode =
+ extConfigObj.ExtDisplayMode ?? AppConfig.ExtDisplayMode;
+ AppConfig.ExtCheckForUpdatesOnStartup =
+ extConfigObj.ExtCheckForUpdatesOnStartup ??
+ AppConfig.ExtCheckForUpdatesOnStartup;
+ AppConfig.ExtUseSidecarsForFileTagging =
+ extConfigObj.ExtUseSidecarsForFileTagging ??
+ AppConfig.ExtUseSidecarsForFileTagging;
+ AppConfig.ExtUseOnlyTagsFromTagLibrary =
+ extConfigObj.ExtUseOnlyTagsFromTagLibrary ??
+ AppConfig.ExtUseOnlyTagsFromTagLibrary;
+ AppConfig.ExtFilenameTagPlacedAtEnd =
+ extConfigObj.ExtFilenameTagPlacedAtEnd ??
+ AppConfig.ExtFilenameTagPlacedAtEnd;
+ AppConfig.ExtTagLibrary =
+ extConfigObj.ExtTagLibrary ?? AppConfig.ExtTagLibrary;
+ AppConfig.SearchTypeGroups =
+ extConfigObj.ExtSearchTypeGroups ?? AppConfig.SearchTypeGroups;
+ AppConfig.ExtMapTileServers =
+ extConfigObj.ExtMapTileServers ?? AppConfig.ExtMapTileServers;
+ AppConfig.ExtGeoTaggingFormat =
+ extConfigObj.ExtGeoTaggingFormat ?? AppConfig.ExtGeoTaggingFormat;
+ AppConfig.ExtDefaultMapBounds =
+ extConfigObj.ExtDefaultMapBounds ?? AppConfig.ExtDefaultMapBounds;
+ AppConfig.ExtDefaultVerticalPanel =
+ extConfigObj.ExtDefaultVerticalPanel ?? AppConfig.ExtDefaultVerticalPanel; // do not work should be refactored in app.ts
+ AppConfig.ExtShowSmartTags =
+ extConfigObj.ExtShowSmartTags ?? AppConfig.ExtShowSmartTags;
+ AppConfig.ExtUseLocationTags =
+ extConfigObj.ExtUseLocationTags ?? AppConfig.ExtUseLocationTags;
+ AppConfig.ExtHideProFeatures = extConfigObj.ExtHideProFeatures ?? false;
+ AppConfig.ExtTheme = extConfigObj.ExtTheme ?? AppConfig.ExtTheme;
+ AppConfig.ExtDefaultPerspective =
+ extConfigObj.ExtDefaultPerspective ?? AppConfig.ExtDefaultPerspective; // currently not implemented
+ AppConfig.ExtLightThemeLightColor =
+ extConfigObj.ExtLightThemeLightColor ?? AppConfig.ExtLightThemeLightColor; // do not apply currently
+ AppConfig.ExtLightThemeMainColor =
+ extConfigObj.ExtLightThemeMainColor ?? AppConfig.ExtLightThemeMainColor; // do not apply currently
+ AppConfig.ExtDarkThemeLightColor =
+ extConfigObj.ExtDarkThemeLightColor ?? AppConfig.ExtDarkThemeLightColor; // do not apply currently
+ AppConfig.ExtDarkThemeMainColor =
+ extConfigObj.ExtDarkThemeMainColor ?? AppConfig.ExtDarkThemeMainColor; // do not apply currently
+ AppConfig.ExtDefaultSystemPrompt =
+ extConfigObj.ExtDefaultSystemPrompt ?? AppConfig.ExtDefaultSystemPrompt;
+ AppConfig.ExtDefaultQuestionPrompt =
+ extConfigObj.ExtDefaultQuestionPrompt ?? AppConfig.ExtDefaultQuestionPrompt;
+ AppConfig.ExtSummarizePrompt =
+ extConfigObj.ExtSummarizePrompt ?? AppConfig.ExtSummarizePrompt;
+ AppConfig.ExtDescriptionFromImageStructuredPrompt =
+ extConfigObj.ExtDescriptionFromImageStructuredPrompt ??
+ AppConfig.ExtDescriptionFromImageStructuredPrompt;
+ AppConfig.ExtDescriptionFromImagePrompt =
+ extConfigObj.ExtDescriptionFromImagePrompt ??
+ AppConfig.ExtDescriptionFromImagePrompt;
+ AppConfig.ExtDescriptionFromTextPrompt =
+ extConfigObj.ExtDescriptionFromTextPrompt ??
+ AppConfig.ExtDescriptionFromTextPrompt;
+ AppConfig.ExtDescriptionFromTextPrompt =
+ extConfigObj.ExtDescriptionFromTextPrompt ??
+ AppConfig.ExtDescriptionFromTextPrompt;
+ AppConfig.ExtTagsFromImagePrompt =
+ extConfigObj.ExtTagsFromImagePrompt ?? AppConfig.ExtTagsFromImagePrompt;
+ AppConfig.ExtTagsFromTextPrompt =
+ extConfigObj.ExtTagsFromTextPrompt ?? AppConfig.ExtTagsFromTextPrompt;
+ AppConfig.ExtDefaultFileTemplate = extConfigObj.ExtDefaultFileTemplate ?? {
+ id: 'default',
+ name: 'Default',
+ content: '{createdInApp} ({date}) {author}',
+ fileNameTmpl: 'note[{timestamp}]',
+ };
+ AppConfig.ExtFileTemplates =
+ extConfigObj.ExtFileTemplates ?? AppConfig.ExtFileTemplates;
+ AppConfig.ExtDevMode = extConfigObj.ExtDevMode ?? AppConfig.ExtDevMode; // not documented
+ AppConfig.ExtIsAmplify = extConfigObj.ExtIsAmplify ?? AppConfig.ExtIsAmplify; // not documented
+ AppConfig.ExtWorkSpaces =
+ extConfigObj.ExtWorkSpaces ?? AppConfig.ExtWorkSpaces; // not documented
+ AppConfig.ExtAI = extConfigObj.ExtAI ?? AppConfig.ExtAI; // not documented
+ AppConfig.ExtAutoSaveEnabled =
+ extConfigObj.ExtAutoSaveEnabled ?? AppConfig.ExtAutoSaveEnabled; // not documented and not fully impl.
+ AppConfig.ExtRevisionsEnabled =
+ extConfigObj.ExtRevisionsEnabled ?? AppConfig.ExtRevisionsEnabled; // not documented and not fully impl.
+ AppConfig.ExtDemoUser = extConfigObj.ExtDemoUser ?? AppConfig.ExtDemoUser; // not used anymore
+ AppConfig.ExtRegularTheme =
+ extConfigObj.ExtRegularTheme ?? AppConfig.ExtRegularTheme; // not documented
+ AppConfig.ExtDarkTheme = extConfigObj.ExtDarkTheme ?? AppConfig.ExtDarkTheme; // not documented
+ AppConfig.ExtSupportedFileTypes =
+ extConfigObj.ExtSupportedFileTypes ?? AppConfig.ExtSupportedFileTypes; // not documented
+ AppConfig.ExtExtensionsFound =
+ extConfigObj.ExtExtensionsFound ?? AppConfig.ExtExtensionsFound; // not documented
+ AppConfig.ExtUseGenerateThumbnails =
+ extConfigObj.ExtUseGenerateThumbnails ?? AppConfig.ExtUseGenerateThumbnails; // not documented
+ AppConfig.ExtSaveLocationsInBrowser =
+ extConfigObj.ExtSaveLocationsInBrowser ?? false;
+ AppConfig.ExtLocationsReadOnly = // computed value
+ AppConfig.ExtLocations !== undefined &&
+ AppConfig.ExtLocations instanceof Array
+ ? AppConfig.ExtLocations.length > 0
+ : false;
+}
+
+let externalLocations = false;
+let externalSearches = false;
-const externalLocations = window.ExtLocations || false;
-const externalSearches = window.ExtSearches || false;
+configureApp(window); // Configuring from extconfig.js if loaded
+
+const xhr = new XMLHttpRequest();
+xhr.open('GET', '../../../../extconfig.json', false); // false = synchronous ../../../../extconfig.json
+try {
+ xhr.send(); // Will pause execution here until it finishes or fails
+ // Status 200 is for HTTP servers, Status 0 is for local file:// protocol
+ if ((xhr.status === 200 || xhr.status === 0) && xhr.responseText) {
+ const jsonConfig = loadJSONString(xhr.responseText);
+ console.log('Loaded extconfig.json:', jsonConfig);
+ configureApp(jsonConfig);
+ } else {
+ // Handled case: File exists but returned 404, 403, etc.
+ console.warn(`extconfig.json returned status ${xhr.status}.`);
+ }
+} catch (error) {
+ // Handled case: File completely missing, network offline, or CORS error
+ console.warn('extconfig.json is not available or could not be loaded.');
+}
const blacklist = ['app'];
if (
- !AppConfig.saveLocationsInBrowser &&
+ !AppConfig.ExtSaveLocationsInBrowser &&
(externalLocations || AppConfig.isWeb)
) {
blacklist.push('locations');
diff --git a/src/renderer/reducers/settings-default.ts b/src/renderer/reducers/settings-default.ts
index 091c29f61..c4a86c37a 100644
--- a/src/renderer/reducers/settings-default.ts
+++ b/src/renderer/reducers/settings-default.ts
@@ -23,27 +23,27 @@ import keyBindings from '-/reducers/keybindings-default';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
let desktopMode = !AppConfig.isMobile;
-if (window.ExtDisplayMode && window.ExtDisplayMode === 'mobile') {
+if (AppConfig.ExtDisplayMode === 'mobile') {
desktopMode = false;
-} else if (window.ExtDisplayMode && window.ExtDisplayMode === 'desktop') {
+} else if (AppConfig.ExtDisplayMode === 'desktop') {
desktopMode = true;
}
let checkForUpdates = true;
-if (window.ExtCheckForUpdatesOnStartup !== undefined) {
- checkForUpdates = window.ExtCheckForUpdatesOnStartup;
+if (AppConfig.ExtCheckForUpdatesOnStartup !== undefined) {
+ checkForUpdates = AppConfig.ExtCheckForUpdatesOnStartup;
}
let filenameTagPlacedAtEnd = true;
-if (window.ExtFilenameTagPlacedAtEnd !== undefined) {
- filenameTagPlacedAtEnd = window.ExtFilenameTagPlacedAtEnd;
+if (AppConfig.ExtFilenameTagPlacedAtEnd !== undefined) {
+ filenameTagPlacedAtEnd = AppConfig.ExtFilenameTagPlacedAtEnd;
}
let useOnlyTagsFromTagLibrary = false;
-if (window.ExtUseOnlyTagsFromTagLibrary !== undefined) {
- useOnlyTagsFromTagLibrary = window.ExtUseOnlyTagsFromTagLibrary;
+if (AppConfig.ExtUseOnlyTagsFromTagLibrary !== undefined) {
+ useOnlyTagsFromTagLibrary = AppConfig.ExtUseOnlyTagsFromTagLibrary;
}
let author = '';
-if (window.ExtAuthor !== undefined) {
- author = window.ExtAuthor;
+if (AppConfig.ExtAuthor !== undefined) {
+ author = AppConfig.ExtAuthor;
} else if (AppConfig.isElectron) {
try {
author = window.electronIO.ipcRenderer.getSync('getAuthor');
@@ -67,11 +67,11 @@ export default {
tagDelimiter: AppConfig.tagDelimiter,
maxSearchResult: 1000,
desktopMode,
- devMode: window.ExtDevMode ? window.ExtDevMode : false,
+ devMode: AppConfig.ExtDevMode ? AppConfig.ExtDevMode : false,
saveTagInLocation:
- typeof window.ExtUseLocationTags === 'undefined'
+ typeof AppConfig.ExtUseLocationTags === 'undefined'
? false
- : window.ExtUseLocationTags,
+ : AppConfig.ExtUseLocationTags,
newHTMLFileContent:
'<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body></body></html>',
showUnixHiddenEntries: false,
@@ -124,16 +124,16 @@ export default {
folderOpenHistory: false,
fileEditHistory: false,
isRevisionsEnabled:
- typeof window.ExtRevisionsEnabled === 'undefined'
+ typeof AppConfig.ExtRevisionsEnabled === 'undefined'
? true
- : window.ExtRevisionsEnabled,
+ : AppConfig.ExtRevisionsEnabled,
prefixTagContainer: AppConfig.prefixTagContainer,
author: author,
aiProviders: [],
isAutoSaveEnabled:
- typeof window.ExtAutoSaveEnabled === 'undefined'
+ typeof AppConfig.ExtAutoSaveEnabled === 'undefined'
? false
- : window.ExtAutoSaveEnabled,
+ : AppConfig.ExtAutoSaveEnabled,
supportedLanguages: [
{
iso: 'en',
@@ -253,12 +253,12 @@ export default {
},
],
keyBindings: keyBindings(AppConfig.isMacLike),
- supportedFileTypes: window.ExtSupportedFileTypes
- ? [...supportedFileTypes, ...window.ExtSupportedFileTypes]
+ supportedFileTypes: AppConfig.ExtSupportedFileTypes
+ ? [...supportedFileTypes, ...AppConfig.ExtSupportedFileTypes]
: supportedFileTypes,
explicitlyDeletedFileTypes: [],
- extensionsFound: window.ExtExtensionsFound
- ? [...extensionsFound, ...window.ExtExtensionsFound]
+ extensionsFound: AppConfig.ExtExtensionsFound
+ ? [...extensionsFound, ...AppConfig.ExtExtensionsFound]
: extensionsFound,
enabledExtensions: [],
mapTileServers: [
diff --git a/src/renderer/reducers/settings.ts b/src/renderer/reducers/settings.ts
index 10626450b..8800f293c 100644
--- a/src/renderer/reducers/settings.ts
+++ b/src/renderer/reducers/settings.ts
@@ -22,6 +22,7 @@ import { TabNames } from '-/hooks/EntryPropsTabsContextProvider';
import {
getDefaultEditor,
getDefaultViewer,
+ getLastVersionPromise,
mergeByProp,
setZoomFactorElectron,
updateByProp,
@@ -29,9 +30,7 @@ import {
import { TS } from '-/tagspaces.namespace';
import versionMeta from '-/version.json';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
-import Links from 'assets/links';
import semver from 'semver';
-import { Pro } from '../pro';
import { actions as AppActions } from './app';
import defaultSettings from './settings-default';
@@ -140,10 +139,10 @@ export default (state: any = defaultSettings, action: any) => {
return {
...defaultSettings,
...state,
- currentTheme: window.ExtTheme || state.currentTheme,
+ currentTheme: AppConfig.ExtTheme || state.currentTheme,
currentRegularTheme:
- window.ExtRegularTheme || state.currentRegularTheme,
- currentDarkTheme: window.ExtDarkTheme || state.currentDarkTheme,
+ AppConfig.ExtRegularTheme || state.currentRegularTheme,
+ currentDarkTheme: AppConfig.ExtDarkTheme || state.currentDarkTheme,
supportedThemes: defaultSettings.supportedThemes, // taking always the themes from default settings
supportedLanguages: defaultSettings.supportedLanguages, // taking always the languages from default settings
keyBindings: [
@@ -853,83 +852,30 @@ export const actions = {
type: types.SET_FILE_EDIT_HISTORY,
fileEditHistory,
}),
- checkForUpdate:
- () =>
- (
- dispatch: (actions: Object) => void,
- // getState: () => any
- ) => {
- // const { settings } = getState();
- getLastVersionPromise()
- .then((lastVersion) => {
- console.log('Last version on server: ' + lastVersion);
- const newVersion = semver.coerce(lastVersion); // lastVersion '3.0.5' ;
- const currentVersion = semver.coerce(versionMeta.version);
- // const lastPublishedVersion = semver.coerce(settings.lastPublishedVersion);
- if (
- semver.valid(newVersion) &&
- semver.gt(newVersion, currentVersion)
- ) {
- console.log('New version available: ' + newVersion.version + '!');
- dispatch(actions.setLastPublishedVersion(newVersion.version));
- // if (semver.gt(newVersion, lastPublishedVersion)) {
- dispatch(AppActions.setUpdateAvailable(true));
- // }
- } else {
- console.log(
- 'Current version: ' + versionMeta.version + ' is up to date',
- );
- }
- return true;
- })
- .catch((error) => {
- console.log('Error while checking for update: ' + error);
- });
- },
+ checkForUpdate: () => (dispatch: (actions: Object) => void) => {
+ getLastVersionPromise()
+ .then((lastVersion) => {
+ console.log('Last version on server: ' + lastVersion);
+ const newVersion = semver.coerce(lastVersion); // lastVersion '3.0.5' ;
+ const currentVersion = semver.coerce(versionMeta.version);
+ // const lastPublishedVersion = semver.coerce(settings.lastPublishedVersion);
+ if (semver.valid(newVersion) && semver.gt(newVersion, currentVersion)) {
+ console.log('New version available: ' + newVersion.version + '!');
+ dispatch(actions.setLastPublishedVersion(newVersion.version));
+ dispatch(AppActions.setUpdateAvailable(true));
+ } else {
+ console.log(
+ 'Current version: ' + versionMeta.version + ' is up to date',
+ );
+ }
+ return true;
+ })
+ .catch((error) => {
+ console.log('Error while checking for update: ' + error);
+ });
+ },
};
-/**
- * TODO move out of reducer
- */
-export function getLastVersionPromise(): Promise<string> {
- return new Promise((resolve, reject) => {
- console.log('Checking for new version...');
- const xhr = new XMLHttpRequest();
- let versionFile = 'tagspaces.json';
- const proText = Pro ? 'pro-' : '';
- if (AppConfig.isWeb) {
- versionFile = 'tagspaces-pro-web.json';
- } else if (AppConfig.isWin) {
- versionFile = 'tagspaces-' + proText + 'win-x64.json';
- } else if (AppConfig.isMacLike) {
- versionFile = 'tagspaces-' + proText + 'mac.json';
- } else if (AppConfig.isLinux) {
- versionFile = 'tagspaces-' + proText + 'linux-x64.json';
- } else if (AppConfig.isAndroid) {
- versionFile = 'tagspaces-' + proText + 'android.json';
- }
- const updateUrl =
- Links.links.checkNewVersionURL +
- versionFile +
- '?cv=' +
- versionMeta.version;
- xhr.open('GET', updateUrl, true);
- xhr.responseType = 'json';
- xhr.onerror = reject;
- xhr.onload = () => {
- const data = xhr.response || xhr.responseText;
- // console.log('Response from server: ' + JSON.stringify(data));
- const versioningData = JSON.parse(JSON.stringify(data));
- if (versioningData.appVersion && versioningData.appVersion.length > 0) {
- resolve(versioningData.appVersion);
- } else {
- reject('Could not validate update data');
- }
- };
- xhr.send();
- });
-}
-
function getDefaultAI(aiProviderId: string, aiProviders: AIProvider[]) {
if (aiProviderId) {
const provider = aiProviders.find((p) => p.enable && p.id === aiProviderId);
@@ -946,43 +892,43 @@ function getDefaultAI(aiProviderId: string, aiProviders: AIProvider[]) {
// Selectors
export const getEntrySplitSize = (state: any) => state.settings.entrySplitSize;
export const getMapTileServer = (state: any): TS.MapTileServer =>
- AppConfig.mapTileServers
- ? AppConfig.mapTileServers[0]
+ AppConfig.ExtMapTileServers
+ ? AppConfig.ExtMapTileServers[0]
: state.settings.mapTileServers[0];
export const getMapTileServers = (state: any): Array<TS.MapTileServer> =>
- AppConfig.mapTileServers || state.settings.mapTileServers;
+ AppConfig.ExtMapTileServers || state.settings.mapTileServers;
export const getSettings = (state: any) => state.settings;
export const getEnableWS = (state: any) => state.settings.enableWS;
export const getDesktopMode = (state: any) => {
- if (typeof window.ExtDisplayMode === 'undefined') {
+ if (typeof AppConfig.ExtDisplayMode === 'undefined') {
return state.settings.desktopMode;
}
- return window.ExtDisplayMode !== 'mobile';
+ return AppConfig.ExtDisplayMode !== 'mobile';
};
export const isDevMode = (state: any) =>
- window.ExtDevMode ? window.ExtDevMode : state.settings.devMode;
+ AppConfig.ExtDevMode ? AppConfig.ExtDevMode : state.settings.devMode;
export const isRevisionsEnabled = (state: any) =>
state.settings.isRevisionsEnabled;
export const isReorderTags = (state: any) => state.settings.reorderTags;
export const getDefaultAIProvider = (state: any) => {
- if (typeof window.ExtAI === 'undefined') {
+ if (typeof AppConfig.ExtAI === 'undefined') {
return getDefaultAI(
state.settings.aiProviderId,
state.settings.aiProviders,
);
}
- return getDefaultAI(window.ExtAI.defaultEngine, window.ExtAI.engines);
+ return getDefaultAI(AppConfig.ExtAI.defaultEngine, AppConfig.ExtAI.engines);
};
export const getAIProviders = (state: any) => {
- if (typeof window.ExtAI === 'undefined') {
+ if (typeof AppConfig.ExtAI === 'undefined') {
return state.settings.aiProviders;
}
- return window.ExtAI.engines;
+ return AppConfig.ExtAI.engines;
};
export const getPrefixTagContainer = (state: any) =>
state.settings.prefixTagContainer;
export const getAuthor = (state: any) =>
- window.ExtAuthor ?? state.settings.author;
+ AppConfig.ExtAuthor ?? state.settings.author;
export const getGeoTaggingFormat = (state: any) =>
state.settings.geoTaggingFormat;
export const getAddTagsToLibrary = (state: any) =>
@@ -990,7 +936,9 @@ export const getAddTagsToLibrary = (state: any) =>
export const getWarningOpeningFilesExternally = (state: any) =>
state.settings.warningOpeningFilesExternally;
export const getCheckForUpdateOnStartup = (state: any) =>
- state.settings.checkForUpdates;
+ AppConfig.ExtCheckForUpdatesOnStartup !== undefined
+ ? AppConfig.ExtCheckForUpdatesOnStartup
+ : state.settings.checkForUpdates;
export const getLastPublishedVersion = (state: any) =>
state.settings.lastPublishedVersion;
export const getShowUnixHiddenEntries = (state: any) =>
@@ -1024,11 +972,13 @@ export const getMaxCollectedTag = (state: any) =>
? state.settings.maxCollectedTag
: AppConfig.maxCollectedTag;
export const getPersistTagsInSidecarFile = (state: any): boolean =>
- AppConfig.useSidecarsForFileTaggingDisableSetting
- ? AppConfig.useSidecarsForFileTagging
+ AppConfig.ExtUseSidecarsForFileTagging !== undefined
+ ? AppConfig.ExtUseSidecarsForFileTagging
: state.settings.persistTagsInSidecarFile;
export const getFileNameTagPlace = (state: any): boolean =>
- state.settings.filenameTagPlacedAtEnd;
+ typeof AppConfig.ExtFilenameTagPlacedAtEnd === 'undefined'
+ ? state.settings.filenameTagPlacedAtEnd
+ : AppConfig.ExtFilenameTagPlacedAtEnd;
export const getUseGenerateThumbnails = (state: any) =>
state.settings.useGenerateThumbnails;
export const getKeyBindings = (state: any) => state.settings.keyBindings;
@@ -1065,9 +1015,9 @@ export const getStoredSearchesVisible = (state: any) =>
state.settings.storedSearchesVisible;
export const getShowBookmarks = (state: any) => state.settings.showBookmarks;
export const getSaveTagInLocation = (state: any) =>
- typeof window.ExtUseLocationTags === 'undefined'
+ typeof AppConfig.ExtUseLocationTags === 'undefined'
? state.settings.saveTagInLocation
- : window.ExtUseLocationTags;
+ : AppConfig.ExtUseLocationTags;
export const getFileOpenHistory = (state: any) =>
state.settings.fileOpenHistory;
export const getFolderOpenHistory = (state: any) =>
@@ -1075,10 +1025,10 @@ export const getFolderOpenHistory = (state: any) =>
export const getFileEditHistory = (state: any) =>
state.settings.fileEditHistory;
export const isFirstRun = (state: any) => {
- if (typeof window.ExtIsFirstRun === 'undefined') {
+ if (typeof AppConfig.ExtIsFirstRun === 'undefined') {
return state.settings.firstRun;
}
- return window.ExtIsFirstRun;
+ return AppConfig.ExtIsFirstRun;
};
const kbObject: any = {};
diff --git a/src/renderer/services/search.ts b/src/renderer/services/search.ts
index 936a59a60..c5268db33 100644
--- a/src/renderer/services/search.ts
+++ b/src/renderer/services/search.ts
@@ -34,7 +34,7 @@ export function haveSearchFilters(searchQuery: TS.SearchQuery) {
(searchQuery.tagsNOT !== undefined && searchQuery.tagsNOT.length > 0) ||
(searchQuery.tagsOR !== undefined && searchQuery.tagsOR.length > 0) ||
(searchQuery.fileTypes !== undefined &&
- searchQuery.fileTypes !== AppConfig.SearchTypeGroups.any) ||
+ searchQuery.fileTypes !== AppConfig.SearchTypeGroups?.any) ||
searchQuery.lastModified ||
searchQuery.dateCreated ||
searchQuery.tagTimePeriodFrom ||
diff --git a/src/renderer/services/taglibrary-utils.ts b/src/renderer/services/taglibrary-utils.ts
index eb26f82ed..feb3351b5 100644
--- a/src/renderer/services/taglibrary-utils.ts
+++ b/src/renderer/services/taglibrary-utils.ts
@@ -1,18 +1,19 @@
+import AppConfig from '-/AppConfig';
+import { saveAsTextFile } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
+import versionMeta from '-/version.json';
import {
formatDateTime4Tag,
prepareTagGroupForExport,
} from '@tagspaces/tagspaces-common/misc';
-import versionMeta from '-/version.json';
-import { saveAsTextFile } from '-/services/utils-io';
import defaultTagLibrary from '../reducers/taglibrary-default';
import TagGroup = TS.TagGroup;
export const tagLibraryKey = 'tsTagLibrary';
export function getTagLibrary(): TS.TagGroup[] {
- if (window.ExtTagLibrary) {
- return window.ExtTagLibrary.map((tagGroup) => ({
+ if (AppConfig.ExtTagLibrary) {
+ return AppConfig.ExtTagLibrary.map((tagGroup) => ({
...tagGroup,
readOnly: true,
}));
diff --git a/src/renderer/services/thumbsgenerator.ts b/src/renderer/services/thumbsgenerator.ts
index b540feec0..e2014e63f 100644
--- a/src/renderer/services/thumbsgenerator.ts
+++ b/src/renderer/services/thumbsgenerator.ts
@@ -33,7 +33,7 @@ let maxSize = AppConfig.maxThumbSize;
const pdfMaxSize = 1000;
export const supportedMisc = ['url', 'html', 'htm'];
-export const supportedImgs = AppConfig.SearchTypeGroups.images;
+export const supportedImgs = AppConfig.SearchTypeGroups?.images;
export const supportedContainers = [
'zip',
'pages',
diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.ts
index a28b56c78..9eccd4a92 100644
--- a/src/renderer/services/utils-io.ts
+++ b/src/renderer/services/utils-io.ts
@@ -16,6 +16,7 @@
*/
import AppConfig from '-/AppConfig';
+import { Pro } from '-/pro';
import defaultSettings from '-/reducers/settings-default';
import { TS } from '-/tagspaces.namespace';
import { CommonLocation } from '-/utils/CommonLocation';
@@ -27,7 +28,8 @@ import {
extractFileName,
extractTagsAsObjects,
} from '@tagspaces/tagspaces-common/paths';
-import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
+import { getUuid, loadJSONString } from '@tagspaces/tagspaces-common/utils-io';
+import Links from 'assets/links';
import DOMPurify from 'dompurify';
import { saveAs } from 'file-saver';
import { marked } from 'marked';
@@ -376,6 +378,44 @@ export function loadFileContentPromise(
});
}
+export function getLastVersionPromise(): Promise<string> {
+ return new Promise((resolve, reject) => {
+ console.log('Checking for new version...');
+ const xhr = new XMLHttpRequest();
+ let versionFile = 'tagspaces.json';
+ const proText = Pro ? 'pro-' : '';
+ if (AppConfig.isWeb) {
+ versionFile = 'tagspaces-pro-web.json';
+ } else if (AppConfig.isWin) {
+ versionFile = 'tagspaces-' + proText + 'win-x64.json';
+ } else if (AppConfig.isMacLike) {
+ versionFile = 'tagspaces-' + proText + 'mac.json';
+ } else if (AppConfig.isLinux) {
+ versionFile = 'tagspaces-' + proText + 'linux-x64.json';
+ } else if (AppConfig.isAndroid) {
+ versionFile = 'tagspaces-' + proText + 'android.json';
+ }
+ const updateUrl =
+ Links.links.checkNewVersionURL +
+ versionFile +
+ '?cv=' +
+ versionMeta.version;
+ xhr.open('GET', updateUrl, true);
+ xhr.responseType = 'text';
+ xhr.onerror = reject;
+ xhr.onload = () => {
+ const data = xhr.response || xhr.responseText;
+ const versioningData = loadJSONString(data);
+ if (versioningData.appVersion && versioningData.appVersion.length > 0) {
+ resolve(versioningData.appVersion);
+ } else {
+ reject('Could not validate update data');
+ }
+ };
+ xhr.send();
+ });
+}
+
/**
* @param mdContent
* @param maxLength - for preview of fist 200 chars
diff --git a/src/renderer/utils/Themes.ts b/src/renderer/utils/Themes.ts
index 3325b8a32..fa43771aa 100644
--- a/src/renderer/utils/Themes.ts
+++ b/src/renderer/utils/Themes.ts
@@ -23,11 +23,11 @@ export const createTSTheme = (themeName: string, isDark: boolean = false) => {
let palette = isDark ? darkThemes[themeName] : lightThemes[themeName];
if (!palette) {
const primaryLightColor = isDark
- ? AppConfig.darkThemeLightColor
- : AppConfig.lightThemeLightColor;
+ ? AppConfig.ExtDarkThemeLightColor
+ : AppConfig.ExtLightThemeLightColor;
const primaryMainColor = isDark
- ? AppConfig.darkThemeMainColor
- : AppConfig.lightThemeMainColor;
+ ? AppConfig.ExtDarkThemeMainColor
+ : AppConfig.ExtLightThemeMainColor;
palette = {
mode: isDark ? 'dark' : 'light',
primary: {
@@ -61,9 +61,9 @@ export const darkThemes = {};
darkThemes['darklegacy'] = {
mode: 'dark',
primary: {
- light: AppConfig.darkThemeLightColor,
- main: AppConfig.darkThemeMainColor, // #ff9abe
- dark: AppConfig.darkThemeMainColor,
+ light: AppConfig.ExtDarkThemeLightColor,
+ main: AppConfig.ExtDarkThemeMainColor, // #ff9abe
+ dark: AppConfig.ExtDarkThemeMainColor,
},
secondary: { main: '#006541' },
background: { default: '#282A36' },
@@ -134,9 +134,9 @@ export const lightThemes = {};
lightThemes['legacy'] = {
mode: 'light',
primary: {
- light: AppConfig.lightThemeLightColor,
- main: AppConfig.lightThemeMainColor, // #1dd19f
- dark: AppConfig.lightThemeMainColor,
+ light: AppConfig.ExtLightThemeLightColor,
+ main: AppConfig.ExtLightThemeMainColor, // #1dd19f
+ dark: AppConfig.ExtLightThemeMainColor,
},
secondary: { main: '#e22e60' },
background: { default: '#fff' },