Skip to content

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

Create index fixes v3 (#2079)

Stanimir1692a87e5b92
diff --git a/package-lock.json b/package-lock.json
index b6e3e56d3..047cc977d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,10 +19,10 @@
"@mui/lab": "5.0.0-alpha.160",
"@mui/material": "^5.15.4",
"@mui/x-date-pickers": "^5.0.20",
- "@tagspaces/tagspaces-common": "4.1.18",
- "@tagspaces/tagspaces-common-aws": "4.1.18",
- "@tagspaces/tagspaces-common-cordova": "4.1.20",
- "@tagspaces/tagspaces-indexer": "4.1.18",
+ "@tagspaces/tagspaces-common": "4.2.0",
+ "@tagspaces/tagspaces-common-aws": "4.2.2",
+ "@tagspaces/tagspaces-common-cordova": "4.2.1",
+ "@tagspaces/tagspaces-indexer": "4.2.2",
"@tagspaces/tagspaces-md": "4.1.14",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
@@ -197,7 +197,7 @@
"yarn": "please-use-npm"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.27"
+ "@tagspacespro/tagspacespro": "5.0.26-alpha.3"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@@ -13449,9 +13449,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.1.18.tgz",
- "integrity": "sha512-cB3fL1XBg6KrXVD2y+s9xpaABEjRYpdS4fWP2tZUuEcqvCdsBMBtz0nyf2KpOcU2y86GbU46eEsfwyxbt+UyGg==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.2.0.tgz",
+ "integrity": "sha512-mGMiizaHaOuhM4S+mHzPtAsCf6hiGwAycl0o+8A3l4ZpuM3DVJdmccuhx57rdm3qXokrsJSEWgcn/TjEvx7DJw==",
"dependencies": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -13459,11 +13459,11 @@
}
},
"node_modules/@tagspaces/tagspaces-common-aws": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws/-/tagspaces-common-aws-4.1.18.tgz",
- "integrity": "sha512-teQFDCpNiJS5ghH513wyc8edC5GkUQi9O8TmgcN6piQye3U9VMmjPSK1LgtWTUeXgNPZkfKJ9GIcYc/rJS/VYg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws/-/tagspaces-common-aws-4.2.2.tgz",
+ "integrity": "sha512-GHkXim0w8iY/huBLFInnyscgyUiNlvLwMHnhQgrfhLE8/KfEnMyWY8ZfhZtwMI9aZjgU9WCYB+cfQrep41ZeCw==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.1.18",
+ "@tagspaces/tagspaces-common": "^4.2.0",
"aws-sdk": "2.1161.0"
}
},
@@ -13534,11 +13534,11 @@
}
},
"node_modules/@tagspaces/tagspaces-common-cordova": {
- "version": "4.1.20",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.1.20.tgz",
- "integrity": "sha512-cDc62Vme15vHITjKMTQvD+/PqJ3D9Jnyug498hQg+Pp4OrRIy973d6fk0otknAceTU8K44EzYML9kfkdUUc1Jg==",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.2.1.tgz",
+ "integrity": "sha512-5fmF+87yoT9cAyPN+Hisgeaj7WIePPCNIupfCmDrnbro5AewJPa+5Cz42QcoULyUdSe/P14mSPnOTFjwg0IhwQ==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0"
}
},
"node_modules/@tagspaces/tagspaces-common/node_modules/uuid": {
@@ -13550,11 +13550,11 @@
}
},
"node_modules/@tagspaces/tagspaces-indexer": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.1.18.tgz",
- "integrity": "sha512-FBUGjsEIn5ZoE3Kvqp4KJFvnbSgEj0vctZMeHgenB8r4vK6I+CEllrrXpICD1oTdbZD+gPaOgGiv3MIYL1+iig==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.2.2.tgz",
+ "integrity": "sha512-b5N5Eu2W6yuKGbuMxlNJwheYpukDyClmKToGzCUJkksXxQBUqizTkxxpmov6I1q60C5vwSD9vf/qw3l/kxT3hA==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0"
}
},
"node_modules/@tagspaces/tagspaces-md": {
@@ -13596,9 +13596,9 @@
}
},
"node_modules/@tagspacespro/tagspacespro": {
- "version": "5.0.27",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.27/5caf77f721e21aa6c97205a4c8175099c5389c4d",
- "integrity": "sha512-JSVf3lTpmCsZrQm3xCdBjjvDRQ5/kqFi41N5Lo62tFhykLAFdxeVAoMtnyJAnt/rB8nMkaNTLDNhHsS6/MYNDw==",
+ "version": "5.0.26-alpha.3",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.26-alpha.3/d616f07bcddf380b28e2f2d75d9fbbd6531c9dc2",
+ "integrity": "sha512-DOaIN0L+L5CMBtWtDZYMaAoPsImVKiCgDw47LfD08kXcrrmNQEdSjM1VBnRfilzNUUNiLr4av6u+NIkKxSVRCQ==",
"license": "Proprietary",
"optional": true
},
@@ -20145,9 +20145,9 @@
}
},
"node_modules/dompurify": {
- "version": "3.0.11",
- "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.11.tgz",
- "integrity": "sha512-Fan4uMuyB26gFV3ovPoEoQbxRRPfTu3CvImyZnhGq5fsIEO+gEFLp45ISFt+kQBWsK5ulDdT0oV28jS1UrwQLg=="
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.0.tgz",
+ "integrity": "sha512-yoU4rhgPKCo+p5UrWWWNKiIq+ToGqmVVhk0PmMYBK4kRsR3/qhemNFL8f6CFmBd4gMwm3F4T7HBoydP5uY07fA=="
},
"node_modules/domutils": {
"version": "2.8.0",
@@ -59107,9 +59107,9 @@
}
},
"@tagspaces/tagspaces-common": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.1.18.tgz",
- "integrity": "sha512-cB3fL1XBg6KrXVD2y+s9xpaABEjRYpdS4fWP2tZUuEcqvCdsBMBtz0nyf2KpOcU2y86GbU46eEsfwyxbt+UyGg==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.2.0.tgz",
+ "integrity": "sha512-mGMiizaHaOuhM4S+mHzPtAsCf6hiGwAycl0o+8A3l4ZpuM3DVJdmccuhx57rdm3qXokrsJSEWgcn/TjEvx7DJw==",
"requires": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -59124,11 +59124,11 @@
}
},
"@tagspaces/tagspaces-common-aws": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws/-/tagspaces-common-aws-4.1.18.tgz",
- "integrity": "sha512-teQFDCpNiJS5ghH513wyc8edC5GkUQi9O8TmgcN6piQye3U9VMmjPSK1LgtWTUeXgNPZkfKJ9GIcYc/rJS/VYg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws/-/tagspaces-common-aws-4.2.2.tgz",
+ "integrity": "sha512-GHkXim0w8iY/huBLFInnyscgyUiNlvLwMHnhQgrfhLE8/KfEnMyWY8ZfhZtwMI9aZjgU9WCYB+cfQrep41ZeCw==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.1.18",
+ "@tagspaces/tagspaces-common": "^4.2.0",
"aws-sdk": "2.1161.0"
},
"dependencies": {
@@ -59189,19 +59189,19 @@
}
},
"@tagspaces/tagspaces-common-cordova": {
- "version": "4.1.20",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.1.20.tgz",
- "integrity": "sha512-cDc62Vme15vHITjKMTQvD+/PqJ3D9Jnyug498hQg+Pp4OrRIy973d6fk0otknAceTU8K44EzYML9kfkdUUc1Jg==",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.2.1.tgz",
+ "integrity": "sha512-5fmF+87yoT9cAyPN+Hisgeaj7WIePPCNIupfCmDrnbro5AewJPa+5Cz42QcoULyUdSe/P14mSPnOTFjwg0IhwQ==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0"
}
},
"@tagspaces/tagspaces-indexer": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.1.18.tgz",
- "integrity": "sha512-FBUGjsEIn5ZoE3Kvqp4KJFvnbSgEj0vctZMeHgenB8r4vK6I+CEllrrXpICD1oTdbZD+gPaOgGiv3MIYL1+iig==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.2.2.tgz",
+ "integrity": "sha512-b5N5Eu2W6yuKGbuMxlNJwheYpukDyClmKToGzCUJkksXxQBUqizTkxxpmov6I1q60C5vwSD9vf/qw3l/kxT3hA==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0"
}
},
"@tagspaces/tagspaces-md": {
@@ -59235,9 +59235,9 @@
}
},
"@tagspacespro/tagspacespro": {
- "version": "5.0.27",
- "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.27/5caf77f721e21aa6c97205a4c8175099c5389c4d",
- "integrity": "sha512-JSVf3lTpmCsZrQm3xCdBjjvDRQ5/kqFi41N5Lo62tFhykLAFdxeVAoMtnyJAnt/rB8nMkaNTLDNhHsS6/MYNDw==",
+ "version": "5.0.26-alpha.3",
+ "resolved": "https://npm.pkg.github.com/download/@tagspacespro/tagspacespro/5.0.26-alpha.3/d616f07bcddf380b28e2f2d75d9fbbd6531c9dc2",
+ "integrity": "sha512-DOaIN0L+L5CMBtWtDZYMaAoPsImVKiCgDw47LfD08kXcrrmNQEdSjM1VBnRfilzNUUNiLr4av6u+NIkKxSVRCQ==",
"optional": true
},
"@teamsupercell/typings-for-css-modules-loader": {
@@ -64331,9 +64331,9 @@
}
},
"dompurify": {
- "version": "3.0.11",
- "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.11.tgz",
- "integrity": "sha512-Fan4uMuyB26gFV3ovPoEoQbxRRPfTu3CvImyZnhGq5fsIEO+gEFLp45ISFt+kQBWsK5ulDdT0oV28jS1UrwQLg=="
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.0.tgz",
+ "integrity": "sha512-yoU4rhgPKCo+p5UrWWWNKiIq+ToGqmVVhk0PmMYBK4kRsR3/qhemNFL8f6CFmBd4gMwm3F4T7HBoydP5uY07fA=="
},
"domutils": {
"version": "2.8.0",
diff --git a/package.json b/package.json
index 8a109e143..2d0874fa2 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,8 @@
"scripts": {
"browserslist:update": "npx browserslist@latest --update-db",
"bs": "npm run build && npm run run-electron",
+ "bs-dev": "npx cross-env DEBUG_PROD=true npm run build && npm run run-electron",
+ "erb-link": "ln -s \"$(pwd)/.erb\" \"$(pwd)/release/app/.erb\"",
"prebuild": "rimraf release/app/dist && npm run prepare-node && npm run generate-extensions",
"build": "npm run prebuild && concurrently \"npm run build:main\" \"npm run build:renderer\" && node -r ts-node/register ./.erb/scripts/link-modules.ts",
"build-e2e": "node scripts/setup-tests.js && cross-env E2E_BUILD=true NODE_ENV=test npm run build",
@@ -157,10 +159,10 @@
"@mui/lab": "5.0.0-alpha.160",
"@mui/material": "^5.15.4",
"@mui/x-date-pickers": "^5.0.20",
- "@tagspaces/tagspaces-common": "4.1.18",
- "@tagspaces/tagspaces-common-aws": "4.1.18",
- "@tagspaces/tagspaces-common-cordova": "4.1.20",
- "@tagspaces/tagspaces-indexer": "4.1.18",
+ "@tagspaces/tagspaces-common": "4.2.0",
+ "@tagspaces/tagspaces-common-aws": "4.2.2",
+ "@tagspaces/tagspaces-common-cordova": "4.2.1",
+ "@tagspaces/tagspaces-indexer": "4.2.2",
"@tagspaces/tagspaces-md": "4.1.14",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
@@ -226,7 +228,7 @@
"uuid": "^9.0.0"
},
"optionalDependencies": {
- "@tagspacespro/tagspacespro": "5.0.27"
+ "@tagspacespro/tagspacespro": "5.0.26-alpha.3"
},
"devDependencies": {
"@electron/notarize": "^2.2.0",
diff --git a/release/app/package-lock.json b/release/app/package-lock.json
index ba966bed7..d3e13b309 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.102",
- "@tagspaces/tagspaces-common-node": "4.1.18",
- "@tagspaces/tagspaces-ws": "4.1.18",
+ "@tagspaces/tagspaces-common-node": "4.2.0",
+ "@tagspaces/tagspaces-ws": "4.2.2",
"sharp": "0.32.6",
"ws": "8.16.0"
},
@@ -43,9 +43,9 @@
}
},
"node_modules/@tagspaces/tagspaces-common": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.1.18.tgz",
- "integrity": "sha512-cB3fL1XBg6KrXVD2y+s9xpaABEjRYpdS4fWP2tZUuEcqvCdsBMBtz0nyf2KpOcU2y86GbU46eEsfwyxbt+UyGg==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.2.0.tgz",
+ "integrity": "sha512-mGMiizaHaOuhM4S+mHzPtAsCf6hiGwAycl0o+8A3l4ZpuM3DVJdmccuhx57rdm3qXokrsJSEWgcn/TjEvx7DJw==",
"dependencies": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -53,11 +53,11 @@
}
},
"node_modules/@tagspaces/tagspaces-common-node": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.1.18.tgz",
- "integrity": "sha512-s7RPobOLY/YLbEvDaQXY1GYKY2HwfPMpQi+l6mJwPbrH7Lv7pJml2xuc7NWMkeQIxtOR9rLkX68ikbSxLjtBxw==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.2.0.tgz",
+ "integrity": "sha512-3z2zzkxxn1EoP2sbMRhSh/Q/pnw7B24QO5uuKJGgrMqepFgteYERW0GjeqvsZ+frYILXcqGsUK0EioTNRq/sGA==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.1.18",
+ "@tagspaces/tagspaces-common": "^4.2.0",
"adm-zip": "^0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0",
@@ -65,37 +65,37 @@
}
},
"node_modules/@tagspaces/tagspaces-platforms": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-4.1.18.tgz",
- "integrity": "sha512-H1c3t9KWUaaAdL92+1rOMjyq/Jz8qdMysQrCxLLb39keP9rWbXCa2HT+FMJ6vqhvRq+eZimGSW8SHjn5h41b6w==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-4.2.2.tgz",
+ "integrity": "sha512-wjRHvbiRxJ53p5MKxIckqVF/gb9YtDr3FsXT40j8aQyGFw/Z6BvFBydTLhldpUxlJxuvVbjeuj4IP3LoxWirUQ==",
"hasInstallScript": true
},
"node_modules/@tagspaces/tagspaces-thumbgen-image": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-thumbgen-image/-/tagspaces-thumbgen-image-4.1.18.tgz",
- "integrity": "sha512-rJKSYpMaKsTN5ryF3N/INnjqJJetk/GLFOevk6SKAVYTfL2pdNpHBP0JtC29No+hVRfUYMV7FZ+LlLqO25Vcow==",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-thumbgen-image/-/tagspaces-thumbgen-image-4.2.1.tgz",
+ "integrity": "sha512-2yR4SHQMGIXZ7fHBnrUxwm9XUfQxLUuBu3eFVwDS4NcMh6Zx9JlF2ohF+hACbZlDcM1TDd6vIMxPUik3bBCqsQ==",
"dependencies": {
"async": "^3.2.4",
"sharp": "^0.32.6"
}
},
"node_modules/@tagspaces/tagspaces-workers": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.1.18.tgz",
- "integrity": "sha512-Br5ZeuY+OxWPTUIR/tOQPYdROJ1kR41fLdOEoYw84YGX0GiqQxs/5srsC3C1vrAevbP1l0wPRx5zLwqdRFC6yg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.2.2.tgz",
+ "integrity": "sha512-6dmBm6lPVGNPcVa86CULGcNtaxtPeBl7XyWps4uJCk/PmMpHiM22m4PtGoSMJoUYiJgqm71xVqv5ZQEGAEwqQw==",
"dependencies": {
- "@tagspaces/tagspaces-common": "^4.1.18",
- "@tagspaces/tagspaces-common-node": "^4.1.18",
- "@tagspaces/tagspaces-platforms": "^4.1.18",
- "@tagspaces/tagspaces-thumbgen-image": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0",
+ "@tagspaces/tagspaces-common-node": "^4.2.0",
+ "@tagspaces/tagspaces-platforms": "^4.2.2",
+ "@tagspaces/tagspaces-thumbgen-image": "^4.2.1"
}
},
"node_modules/@tagspaces/tagspaces-ws": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.1.18.tgz",
- "integrity": "sha512-oAVj2vkXuAwUJTAvEP2WCJjPOwTq2DjV9y0cM3zyLSG782xxbvq6y5nIZ7mX8tKBCU1bXYQwpZWgfZKFwRAe7w==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.2.2.tgz",
+ "integrity": "sha512-rG2y0H3EHOwt5Yp6MXXs6FhMvT6A9BLCJHOVNagcP2tnlMOWtMIuADVqhOTzpKyrbzrh3oeNqT2hFoX5qIeaUA==",
"dependencies": {
- "@tagspaces/tagspaces-workers": "^4.1.18",
+ "@tagspaces/tagspaces-workers": "^4.2.2",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^8.5.1",
"ws": "^8.15.1"
@@ -1102,9 +1102,9 @@
}
},
"@tagspaces/tagspaces-common": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.1.18.tgz",
- "integrity": "sha512-cB3fL1XBg6KrXVD2y+s9xpaABEjRYpdS4fWP2tZUuEcqvCdsBMBtz0nyf2KpOcU2y86GbU46eEsfwyxbt+UyGg==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.2.0.tgz",
+ "integrity": "sha512-mGMiizaHaOuhM4S+mHzPtAsCf6hiGwAycl0o+8A3l4ZpuM3DVJdmccuhx57rdm3qXokrsJSEWgcn/TjEvx7DJw==",
"requires": {
"dotenv": "^16.0.2",
"picomatch": "^3.0.1",
@@ -1112,11 +1112,11 @@
}
},
"@tagspaces/tagspaces-common-node": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.1.18.tgz",
- "integrity": "sha512-s7RPobOLY/YLbEvDaQXY1GYKY2HwfPMpQi+l6mJwPbrH7Lv7pJml2xuc7NWMkeQIxtOR9rLkX68ikbSxLjtBxw==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.2.0.tgz",
+ "integrity": "sha512-3z2zzkxxn1EoP2sbMRhSh/Q/pnw7B24QO5uuKJGgrMqepFgteYERW0GjeqvsZ+frYILXcqGsUK0EioTNRq/sGA==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.1.18",
+ "@tagspaces/tagspaces-common": "^4.2.0",
"adm-zip": "^0.5.10",
"fs-extra": "^10.0.0",
"klaw": "^4.1.0",
@@ -1124,36 +1124,36 @@
}
},
"@tagspaces/tagspaces-platforms": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-4.1.18.tgz",
- "integrity": "sha512-H1c3t9KWUaaAdL92+1rOMjyq/Jz8qdMysQrCxLLb39keP9rWbXCa2HT+FMJ6vqhvRq+eZimGSW8SHjn5h41b6w=="
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-4.2.2.tgz",
+ "integrity": "sha512-wjRHvbiRxJ53p5MKxIckqVF/gb9YtDr3FsXT40j8aQyGFw/Z6BvFBydTLhldpUxlJxuvVbjeuj4IP3LoxWirUQ=="
},
"@tagspaces/tagspaces-thumbgen-image": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-thumbgen-image/-/tagspaces-thumbgen-image-4.1.18.tgz",
- "integrity": "sha512-rJKSYpMaKsTN5ryF3N/INnjqJJetk/GLFOevk6SKAVYTfL2pdNpHBP0JtC29No+hVRfUYMV7FZ+LlLqO25Vcow==",
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-thumbgen-image/-/tagspaces-thumbgen-image-4.2.1.tgz",
+ "integrity": "sha512-2yR4SHQMGIXZ7fHBnrUxwm9XUfQxLUuBu3eFVwDS4NcMh6Zx9JlF2ohF+hACbZlDcM1TDd6vIMxPUik3bBCqsQ==",
"requires": {
"async": "^3.2.4",
"sharp": "^0.32.6"
}
},
"@tagspaces/tagspaces-workers": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.1.18.tgz",
- "integrity": "sha512-Br5ZeuY+OxWPTUIR/tOQPYdROJ1kR41fLdOEoYw84YGX0GiqQxs/5srsC3C1vrAevbP1l0wPRx5zLwqdRFC6yg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.2.2.tgz",
+ "integrity": "sha512-6dmBm6lPVGNPcVa86CULGcNtaxtPeBl7XyWps4uJCk/PmMpHiM22m4PtGoSMJoUYiJgqm71xVqv5ZQEGAEwqQw==",
"requires": {
- "@tagspaces/tagspaces-common": "^4.1.18",
- "@tagspaces/tagspaces-common-node": "^4.1.18",
- "@tagspaces/tagspaces-platforms": "^4.1.18",
- "@tagspaces/tagspaces-thumbgen-image": "^4.1.18"
+ "@tagspaces/tagspaces-common": "^4.2.0",
+ "@tagspaces/tagspaces-common-node": "^4.2.0",
+ "@tagspaces/tagspaces-platforms": "^4.2.2",
+ "@tagspaces/tagspaces-thumbgen-image": "^4.2.1"
}
},
"@tagspaces/tagspaces-ws": {
- "version": "4.1.18",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.1.18.tgz",
- "integrity": "sha512-oAVj2vkXuAwUJTAvEP2WCJjPOwTq2DjV9y0cM3zyLSG782xxbvq6y5nIZ7mX8tKBCU1bXYQwpZWgfZKFwRAe7w==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.2.2.tgz",
+ "integrity": "sha512-rG2y0H3EHOwt5Yp6MXXs6FhMvT6A9BLCJHOVNagcP2tnlMOWtMIuADVqhOTzpKyrbzrh3oeNqT2hFoX5qIeaUA==",
"requires": {
- "@tagspaces/tagspaces-workers": "^4.1.18",
+ "@tagspaces/tagspaces-workers": "^4.2.2",
"find-free-ports": "^3.1.1",
"jsonwebtoken": "^8.5.1",
"ws": "^8.15.1"
diff --git a/release/app/package.json b/release/app/package.json
index 1b00cb4fd..bb6a5746a 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.102",
- "@tagspaces/tagspaces-common-node": "4.1.18",
- "@tagspaces/tagspaces-ws": "4.1.18",
+ "@tagspaces/tagspaces-common-node": "4.2.0",
+ "@tagspaces/tagspaces-ws": "4.2.2",
"sharp": "0.32.6",
"ws": "8.16.0"
},
diff --git a/src/renderer/components/DirectoryTreeView.tsx b/src/renderer/components/DirectoryTreeView.tsx
index 5b3fc618e..311e70e2a 100644
--- a/src/renderer/components/DirectoryTreeView.tsx
+++ b/src/renderer/components/DirectoryTreeView.tsx
@@ -17,7 +17,7 @@
*/
import React, { useState, forwardRef, useImperativeHandle, Ref } from 'react';
-import { useDispatch, useSelector } from 'react-redux';
+import { useSelector } from 'react-redux';
import Table from 'rc-table';
import FolderIcon from '@mui/icons-material/FolderOpen';
import { locationType } from '@tagspaces/tagspaces-common/misc';
@@ -145,7 +145,7 @@ const DirectoryTreeView = forwardRef(
.then(() => {
loadSubDirectories(subDir);
changeLocation(subDir);
- return openDirectory(subDir.path);
+ return openDirectory(subDir.path, subDir.uuid);
})
.catch((error) => {
console.log('enableObjectStoreSupport', error);
@@ -154,7 +154,7 @@ const DirectoryTreeView = forwardRef(
PlatformIO.disableObjectStoreSupport();
loadSubDirectories(subDir);
changeLocation(subDir);
- openDirectory(subDir.path);
+ openDirectory(subDir.path, subDir.uuid);
}
};
diff --git a/src/renderer/components/EntryContainer.tsx b/src/renderer/components/EntryContainer.tsx
index 41d79a5e9..9408fb949 100644
--- a/src/renderer/components/EntryContainer.tsx
+++ b/src/renderer/components/EntryContainer.tsx
@@ -485,7 +485,7 @@ function EntryContainer() {
entryProp.path,
);
if (currentDirectoryPath === openedEntryDir) {
- openDirectory(openedEntryDir);
+ openDirectory(openedEntryDir, openedEntry.locationId);
/*
updateOpenedFile(openedEntry.path, {
...openedEntry,
diff --git a/src/renderer/components/LocationView.tsx b/src/renderer/components/LocationView.tsx
index 35b4a2650..df6f852eb 100644
--- a/src/renderer/components/LocationView.tsx
+++ b/src/renderer/components/LocationView.tsx
@@ -92,7 +92,7 @@ function LocationView(props: Props) {
const handleLocationClick = () => {
if (currentLocation && location.uuid === currentLocation.uuid) {
// the same location click
- openDirectory(currentLocationPath); //PlatformIO.getLocationPath(location));
+ openDirectory(currentLocationPath, location.uuid); //PlatformIO.getLocationPath(location));
} else {
// this.directoryTreeRef[location.uuid].loadSubDir(location, 1);
// setSelectedEntries([]);
diff --git a/src/renderer/components/PathBreadcrumbs.tsx b/src/renderer/components/PathBreadcrumbs.tsx
index d1d888918..f280fb18d 100644
--- a/src/renderer/components/PathBreadcrumbs.tsx
+++ b/src/renderer/components/PathBreadcrumbs.tsx
@@ -172,7 +172,7 @@ function PathBreadcrumbs(props: Props) {
href="#"
label={folderName}
icon={index === 0 && locationTypeIcon}
- onClick={() => openDirectory(pathPart)}
+ onClick={() => openDirectory(pathPart, currentLocation.uuid)}
/>
</Tooltip>
);
diff --git a/src/renderer/components/SearchAutocomplete.tsx b/src/renderer/components/SearchAutocomplete.tsx
index 9f2b8f830..7018a8a4c 100644
--- a/src/renderer/components/SearchAutocomplete.tsx
+++ b/src/renderer/components/SearchAutocomplete.tsx
@@ -122,10 +122,10 @@ function SearchAutocomplete(props: Props) {
const fileTypes = useRef<Array<string>>(
searchQuery.fileTypes ? searchQuery.fileTypes : FileTypeGroups.any,
);
- const [ignored, forceUpdate] = useReducer((x) => x + 1, 0);
+ const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
const actionValues = useRef<Array<SearchOptionType>>([]);
const [searchBoxing, setSearchBoxing] = useState<ScopeType>(
- searchQuery.searchBoxing || 'location',
+ searchQuery.searchBoxing || scope.location,
);
const searchType = useRef<'fuzzy' | 'semistrict' | 'strict'>(
@@ -212,14 +212,14 @@ function SearchAutocomplete(props: Props) {
}
if (searchQuery.searchBoxing) {
- setSearchBoxing(searchQuery.searchBoxing);
+ const sBoxing = !currentLocation
+ ? scope.global
+ : searchQuery.searchBoxing;
+ setSearchBoxing(sBoxing);
emptySearch = false;
actions.push({
action: SearchQueryComposition.SCOPE.fullName,
- label:
- SearchQueryComposition.SCOPE.fullName +
- ' ' +
- searchQuery.searchBoxing,
+ label: SearchQueryComposition.SCOPE.fullName + ' ' + sBoxing,
});
}
if (
@@ -350,7 +350,7 @@ function SearchAutocomplete(props: Props) {
isAction(action.action, SearchQueryComposition.SCOPE),
)
) {
- setSearchBoxing('location');
+ setSearchBoxing(scope.location);
}
if (
!exceptions.some((action) =>
diff --git a/src/renderer/components/SearchOptions.ts b/src/renderer/components/SearchOptions.ts
index 86d53ba3c..6e992ca72 100644
--- a/src/renderer/components/SearchOptions.ts
+++ b/src/renderer/components/SearchOptions.ts
@@ -129,9 +129,9 @@ export const LastModified = {
moreThanYear: 31556952001, // over 1 year
};
export const scope = {
- location: 'location',
- folder: 'folder',
- global: 'global',
+ location: 'location' as ScopeType,
+ folder: 'folder' as ScopeType,
+ global: 'global' as ScopeType,
};
export const accuracy = {
diff --git a/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx b/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx
index dcb0c0a89..09be0e902 100644
--- a/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx
+++ b/src/renderer/components/dialogs/IsTruncatedConfirmDialog.tsx
@@ -71,11 +71,7 @@ function IsTruncatedConfirmDialog(props: Props) {
);
onClose();
if (currentLocation.type === locationType.TYPE_CLOUD) {
- PlatformIO.enableObjectStoreSupport(currentLocation)
- .then(() => openDirectory(currentDirectoryPath))
- .catch((error) => {
- console.log('enableObjectStoreSupport', error);
- });
+ openDirectory(currentDirectoryPath, currentLocation.uuid);
}
}
}
diff --git a/src/renderer/components/menus/DirectoryMenu.tsx b/src/renderer/components/menus/DirectoryMenu.tsx
index dddaa1158..46fa36473 100644
--- a/src/renderer/components/menus/DirectoryMenu.tsx
+++ b/src/renderer/components/menus/DirectoryMenu.tsx
@@ -164,7 +164,7 @@ function DirectoryMenu(props: Props) {
}
function openDir() {
- return openDirectory(directoryPath);
+ return openDirectory(directoryPath, currentLocation.uuid);
}
function showProperties() {
diff --git a/src/renderer/components/menus/FileMenu.tsx b/src/renderer/components/menus/FileMenu.tsx
index 693361ad1..0520e1552 100644
--- a/src/renderer/components/menus/FileMenu.tsx
+++ b/src/renderer/components/menus/FileMenu.tsx
@@ -251,7 +251,7 @@ function FileMenu(props: Props) {
selectedFilePath,
PlatformIO.getDirSeparator(),
);
- return openDirectory(parentFolder);
+ return openDirectory(parentFolder, currentLocation.uuid);
}
}
diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsx
index d5a05adc5..7d7edc9f3 100644
--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx
+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx
@@ -296,14 +296,15 @@ export const CurrentLocationContextProvider = ({
function switchLocationTypeByID(locationId: string) {
const location = locations.find((location) => location.uuid === locationId);
- return switchLocationType(location);
+ return setLocationType(location);
+ //return switchLocationType(location);
}
/**
* @param location
* return Promise<currentLocationId> if location is changed or null if location and type is changed
*/
- function switchLocationType(location: TS.Location) {
+ /*function switchLocationType(location: TS.Location) {
if (location !== undefined) {
if (currentLocation === undefined) {
return setLocationType(location).then(() => null);
@@ -313,13 +314,12 @@ export const CurrentLocationContextProvider = ({
return setLocationType(location).then(() => null);
} else {
// handle the same location type but different location
- // dispatch(actions.setCurrentLocationId(location.uuid));
return setLocationType(location).then(() => currentLocation.uuid);
}
}
}
return Promise.resolve(null);
- }
+ }*/
function switchCurrentLocationType() {
return setLocationType(currentLocation);
diff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsx
index aa6858827..5958b8240 100644
--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx
+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx
@@ -102,6 +102,7 @@ type DirectoryContentContextData = {
) => any;
openDirectory: (
dirPath: string,
+ locationID?: string,
showHiddenEntries?: boolean,
) => Promise<boolean>;
openCurrentDirectory: (showHiddenEntries?: boolean) => Promise<boolean>;
@@ -112,7 +113,10 @@ type DirectoryContentContextData = {
setCurrentDirectoryDirs: (dirs: TS.OrderVisibilitySettings[]) => void;
setCurrentDirectoryFiles: (files: TS.OrderVisibilitySettings[]) => void;
updateCurrentDirEntry: (path: string, entry: TS.FileSystemEntry) => void;
- updateCurrentDirEntries: (dirEntries: TS.FileSystemEntry[]) => void;
+ updateCurrentDirEntries: (
+ dirEntries: TS.FileSystemEntry[],
+ checkCurrentDir?: boolean,
+ ) => void;
//updateThumbnailUrl: (filePath: string, thumbUrl: string) => void;
setDirectoryMeta: (meta: TS.FileSystemEntryMeta) => void;
setSearchResults: (entries: TS.FileSystemEntry[]) => void;
@@ -185,6 +189,7 @@ export const DirectoryContentContextProvider = ({
currentLocation,
skipInitialDirList,
getLocationPath,
+ switchLocationTypeByID,
} = useCurrentLocationContext();
const { actions } = useEditedEntryContext();
const { metaActions, setReflectMetaActions } = useEditedEntryMetaContext();
@@ -230,7 +235,7 @@ export const DirectoryContentContextProvider = ({
getLocationPath(currentLocation).then((locationPath) => {
currentLocationPath.current = locationPath;
if (!skipInitialDirList) {
- return openDirectory(locationPath);
+ return openDirectory(locationPath, currentLocation.uuid);
}
});
manualPerspective.current = 'unspecified';
@@ -438,16 +443,19 @@ export const DirectoryContentContextProvider = ({
}
function setSearchResults(searchResults: TS.FileSystemEntry[]) {
- setCurrentDirectoryEntries(
- searchResults.map((sr) => ({
- ...sr,
- // @ts-ignore temp fix model in common
- ...(sr.thumbPath && {
- // @ts-ignore
- meta: { ...(sr.meta && sr.meta), thumbPath: sr.thumbPath },
- }),
- })),
- );
+ if (isSearchMode.current) {
+ setCurrentDirectoryEntries(searchResults);
+ /*setCurrentDirectoryEntries(
+ searchResults.map((sr) => ({
+ ...sr,
+ // @ts-ignore temp fix model in common
+ ...(sr.thumbPath && {
+ // @ts-ignore
+ meta: { ...(sr.meta && sr.meta), thumbPath: sr.thumbPath },
+ }),
+ })),
+ );*/
+ }
}
function appendSearchResults(searchResults: TS.FileSystemEntry[]) {
@@ -488,7 +496,7 @@ export const DirectoryContentContextProvider = ({
cleanTrailingDirSeparator(currentLocationPath.current),
)
) {
- openDirectory(parentDirectory);
+ openDirectory(parentDirectory, currentLocation.uuid);
} else {
showNotification(t('core:parentDirNotInLocation'), 'warning', true);
// dispatch(actions.setIsLoading(false));
@@ -533,16 +541,18 @@ export const DirectoryContentContextProvider = ({
function updateCurrentDirEntries(
dirEntries: TS.FileSystemEntry[],
- //currentDirEntries?: TS.FileSystemEntry[],
+ checkCurrentDir = true,
) {
if (dirEntries) {
const entries = dirEntries.filter((e) => e !== undefined);
- const isNotFromCurrentDir = entries.some(
- (e) =>
- !cleanFrontDirSeparator(e.path).startsWith(
- cleanFrontDirSeparator(currentDirectoryPath.current),
- ),
- );
+ const isNotFromCurrentDir =
+ checkCurrentDir &&
+ entries.some(
+ (e) =>
+ !cleanFrontDirSeparator(e.path).startsWith(
+ cleanFrontDirSeparator(currentDirectoryPath.current),
+ ),
+ );
if (
entries.length > 0 &&
!isNotFromCurrentDir //entries[0].path.startsWith(currentDirectoryPath.current)
@@ -552,6 +562,22 @@ export const DirectoryContentContextProvider = ({
currentDirectoryEntries.current &&
currentDirectoryEntries.current.length > 0
) {
+ /*if (inlineUpdate) {
+ // inline update currentDirectoryEntries
+ let isUpdated = false;
+ for (const oldEntry of currentDirectoryEntries.current) {
+ const entryUpdated = entries.find(
+ (updated) => updated.path === oldEntry.path,
+ );
+ if (entryUpdated) {
+ oldEntry.meta = { ...oldEntry.meta, ...entryUpdated.meta };
+ isUpdated = true;
+ }
+ }
+ if (isUpdated) {
+ forceUpdate();
+ }
+ }*/
setCurrentDirectoryEntries(
currentDirectoryEntries.current.map((e) => {
const eUpdated = entries.filter((u) => u.path === e.path);
@@ -563,7 +589,6 @@ export const DirectoryContentContextProvider = ({
}
return e;
}),
- //getMergedEntries(currentDirectoryEntries.current, entries),
);
} else {
setCurrentDirectoryEntries(entries);
@@ -681,29 +706,37 @@ export const DirectoryContentContextProvider = ({
showHiddenEntries = undefined,
): Promise<boolean> {
if (currentDirectoryPath.current !== undefined) {
- return openDirectory(currentDirectoryPath.current, showHiddenEntries);
+ return openDirectory(
+ currentDirectoryPath.current,
+ currentLocation.uuid,
+ showHiddenEntries,
+ );
}
return Promise.resolve(false);
}
function openDirectory(
dirPath: string,
+ locationID: string = undefined,
showHiddenEntries = undefined,
): Promise<boolean> {
if (dirPath !== undefined) {
- const reloadMeta = currentDirectoryPath.current === dirPath;
- return loadDirectoryContent(dirPath, true, showHiddenEntries).then(
- (dirEntries) => {
- if (dirEntries && reloadMeta) {
- // load meta files (reload of the same directory is not handled from ThumbGenerationContextProvider)
- return loadCurrentDirMeta(dirPath, dirEntries).then((entries) => {
- updateCurrentDirEntries(entries);
- return true;
- });
- }
- return true;
- },
- );
+ const currentLocationID = locationID ? locationID : currentLocation.uuid;
+ return switchLocationTypeByID(currentLocationID).then(() => {
+ const reloadMeta = currentDirectoryPath.current === dirPath;
+ return loadDirectoryContent(dirPath, true, showHiddenEntries).then(
+ (dirEntries) => {
+ if (dirEntries && reloadMeta) {
+ // load meta files (reload of the same directory is not handled from ThumbGenerationContextProvider)
+ return loadCurrentDirMeta(dirPath, dirEntries).then((entries) => {
+ updateCurrentDirEntries(entries);
+ return true;
+ });
+ }
+ return true;
+ },
+ );
+ });
}
return Promise.resolve(false);
}
@@ -1039,7 +1072,7 @@ export const DirectoryContentContextProvider = ({
toggleDirVisibility,
};
}, [
- // currentLocation,
+ currentLocation,
currentLocationPath.current,
currentDirectoryEntries.current,
currentDirectoryPath.current,
diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsx
index 4b38dd54a..d2ab63d0c 100644
--- a/src/renderer/hooks/IOActionsContextProvider.tsx
+++ b/src/renderer/hooks/IOActionsContextProvider.tsx
@@ -1187,7 +1187,7 @@ export const IOActionsContextProvider = ({
openFileNatively,
duplicateFile,
};
- }, [warningOpeningFilesExternally]);
+ }, [warningOpeningFilesExternally, currentDirectoryPath]);
return (
<IOActionsContext.Provider value={context}>
diff --git a/src/renderer/hooks/LocationIndexContextProvider.tsx b/src/renderer/hooks/LocationIndexContextProvider.tsx
index 01e33770c..196aaa07f 100644
--- a/src/renderer/hooks/LocationIndexContextProvider.tsx
+++ b/src/renderer/hooks/LocationIndexContextProvider.tsx
@@ -25,17 +25,26 @@ import React, {
} from 'react';
import { useSelector } from 'react-redux';
import { useTranslation } from 'react-i18next';
+import * as cordovaIO from '@tagspaces/tagspaces-common-cordova';
+import * as objectStoreAPI from '@tagspaces/tagspaces-common-aws';
import { TS } from '-/tagspaces.namespace';
-import { createDirectoryIndex } from '-/services/utils-io';
+import {
+ createDirectoryIndex,
+ executePromisesInBatches,
+ getThumbPath,
+ loadIndexFromDisk,
+} from '-/services/utils-io';
import { getEnableWS } from '-/reducers/settings';
import { locationType } from '@tagspaces/tagspaces-common/misc';
import PlatformIO from '-/services/platform-facade';
import { useCurrentLocationContext } from '-/hooks/useCurrentLocationContext';
import { getLocations } from '-/reducers/locations';
import AppConfig from '-/AppConfig';
-import { hasIndex, loadIndex } from '@tagspaces/tagspaces-indexer';
import Search from '-/services/search';
-import { getThumbFileLocationForFile } from '@tagspaces/tagspaces-common/paths';
+import {
+ getThumbFileLocationForDirectory,
+ getThumbFileLocationForFile,
+} from '@tagspaces/tagspaces-common/paths';
import { useDirectoryContentContext } from '-/hooks/useDirectoryContentContext';
import { useNotificationContext } from '-/hooks/useNotificationContext';
import { useEditedEntryContext } from '-/hooks/useEditedEntryContext';
@@ -82,16 +91,18 @@ export const LocationIndexContextProvider = ({
const { t } = useTranslation();
const { currentLocation, getLocationPath } = useCurrentLocationContext();
- const { setSearchResults, appendSearchResults } =
+ const { setSearchResults, appendSearchResults, updateCurrentDirEntries } =
useDirectoryContentContext();
const { actions } = useEditedEntryContext();
const { showNotification, hideNotifications } = useNotificationContext();
+ const { switchLocationTypeByID, switchCurrentLocationType } =
+ useCurrentLocationContext();
const enableWS = useSelector(getEnableWS);
const allLocations = useSelector(getLocations);
const isIndexing = useRef<boolean>(false);
- const lastError = useRef(undefined);
+ //const lastError = useRef(undefined);
const index = useRef<TS.FileSystemEntry[]>(undefined);
const indexLoadedOn = useRef<number>(undefined);
const [ignored, forceUpdate] = useReducer((x) => x + 1, 0, undefined);
@@ -200,7 +211,7 @@ export const LocationIndexContextProvider = ({
): Promise<boolean> {
isIndexing.current = true;
forceUpdate();
- return createDirectoryIndex(
+ return createDirectoryIndexWrapper(
{ path: directoryPath, locationID },
extractText,
ignorePatterns,
@@ -217,7 +228,7 @@ export const LocationIndexContextProvider = ({
})
.catch((err) => {
isIndexing.current = false;
- lastError.current = err;
+ //lastError.current = err;
forceUpdate();
return false;
});
@@ -225,74 +236,72 @@ export const LocationIndexContextProvider = ({
function createLocationIndex(location: TS.Location): Promise<boolean> {
if (location) {
- const isCurrentLocation =
- currentLocation && currentLocation.uuid === location.uuid;
- getLocationPath(location).then((locationPath) => {
- if (location.type === locationType.TYPE_CLOUD) {
- return PlatformIO.enableObjectStoreSupport(location)
- .then(() =>
- createDirIndex(
- locationPath,
- location.fullTextIndex,
- isCurrentLocation,
- location.uuid,
- ),
- )
- .catch(() => {
- PlatformIO.disableObjectStoreSupport();
- return false;
- });
- } else if (location.type === locationType.TYPE_WEBDAV) {
- PlatformIO.enableWebdavSupport(location);
- return createDirIndex(
- locationPath,
- location.fullTextIndex,
- isCurrentLocation,
- location.uuid,
- );
- } else if (location.type === locationType.TYPE_LOCAL) {
- PlatformIO.disableObjectStoreSupport();
- return createDirIndex(
- locationPath,
- location.fullTextIndex,
- isCurrentLocation,
- location.uuid,
- );
- }
+ return getLocationPath(location).then((locationPath) => {
+ const isCurrentLocation =
+ currentLocation && currentLocation.uuid === location.uuid;
+ return createDirIndex(
+ locationPath,
+ location.fullTextIndex,
+ isCurrentLocation,
+ location.uuid,
+ location.ignorePatternPaths,
+ )
+ .then(() => true)
+ .catch(() => {
+ return false;
+ });
});
}
return Promise.resolve(false);
}
- function createLocationsIndexes(extractText = true): Promise<boolean> {
+ function createDirectoryIndexWrapper(
+ param: string | any,
+ extractText = false,
+ ignorePatterns: Array<string> = [],
+ enableWS = true,
+ // disableIndexing = true,
+ ): Promise<any> {
+ return switchLocationTypeByID(param.locationID)
+ .then(() =>
+ createDirectoryIndex(param, extractText, ignorePatterns, enableWS),
+ )
+ .then((index) => switchCurrentLocationType().then(() => index))
+ .catch((err) => {
+ //lastError.current = err;
+ console.warn('Error loading text content ' + err);
+ return false; //switchCurrentLocationType();
+ });
+ }
+
+ async function createLocationsIndexes(extractText = true): Promise<boolean> {
isIndexing.current = true;
forceUpdate();
- const promises = allLocations.map((location: TS.Location) =>
- getLocationPath(location).then((locationPath) =>
- createDirectoryIndex(
- { path: locationPath, location: location.uuid },
+ //(async () => {
+ for (let location of allLocations) {
+ try {
+ const locationPath = await getLocationPath(location);
+ await createDirectoryIndexWrapper(
+ { path: locationPath, locationID: location.uuid },
extractText,
location.ignorePatternPaths,
enableWS,
- ).catch((err) => {
- lastError.current = err;
- }),
- ),
- );
-
- return Promise.all(promises)
- .then((e) => {
- isIndexing.current = false;
- forceUpdate();
- console.log('Resolution is complete!', e);
- return true;
- })
- .catch((e) => {
+ );
+ } catch (error) {
+ console.error('An error occurred:', error);
+ }
+ }
+ // })();
+ isIndexing.current = false;
+ forceUpdate();
+ console.log('Resolution is complete!');
+ return true;
+ /*.catch((e) => {
isIndexing.current = false;
forceUpdate();
console.warn('Resolution is failed!', e);
return false;
- });
+ });*/
}
function clearDirectoryIndex() {
@@ -301,17 +310,131 @@ export const LocationIndexContextProvider = ({
forceUpdate();
}
+ function normalizePath(filePath) {
+ //filePath = filePath.replace(new RegExp("//+", "g"), "/");
+ filePath = filePath.replace('\\', '/');
+ if (filePath.indexOf('/') === 0) {
+ filePath = filePath.substr(1);
+ }
+ return decodeURIComponent(filePath);
+ }
+
+ function enhanceSearchEntry(
+ entry: TS.FileSystemEntry,
+ ): Promise<TS.FileSystemEntry> {
+ const loc = allLocations.find((l) => l.uuid === entry.locationID);
+ if (loc) {
+ const thumbFilePath = entry.isFile
+ ? getThumbFileLocationForFile(
+ entry.path,
+ PlatformIO.getDirSeparator(),
+ false,
+ )
+ : getThumbFileLocationForDirectory(
+ entry.path,
+ PlatformIO.getDirSeparator(),
+ );
+ if (thumbFilePath) {
+ return checkFileExist(thumbFilePath, loc).then((exist) => {
+ if (exist) {
+ const thumbPath =
+ loc.type === locationType.TYPE_CLOUD
+ ? getURLforPath(thumbFilePath, loc)
+ : thumbFilePath;
+ return { ...entry, meta: { ...entry.meta, thumbPath } };
+ }
+ return undefined;
+ });
+ }
+ }
+ return undefined;
+ }
+
+ function getURLforPath(path: string, location: TS.Location) {
+ const api = objectStoreAPI.getS3Api(location);
+ return api.getSignedUrl('getObject', {
+ Bucket: location.bucketName,
+ Key: normalizePath(path),
+ Expires: 900,
+ });
+ }
+
+ function checkFileExist(
+ path: string,
+ location: TS.Location,
+ ): Promise<boolean> {
+ if (location.type === locationType.TYPE_LOCAL) {
+ return window.electronIO.ipcRenderer.invoke('checkFileExist', path);
+ } else if (location.type === locationType.TYPE_CLOUD) {
+ const api = objectStoreAPI.getS3Api(location);
+ return api
+ .headObject({
+ Bucket: location.bucketName,
+ Key: normalizePath(path),
+ })
+ .promise()
+ .then(
+ () => true,
+ (err) => false,
+ );
+ } else if (location.type === locationType.TYPE_WEBDAV) {
+ // TODO
+ } else if (AppConfig.isCordova) {
+ return cordovaIO.checkFileExist(path);
+ }
+ }
+
+ function enhanceSearchEntries(entries: TS.FileSystemEntry[]) {
+ const promises: Promise<TS.FileSystemEntry>[] = entries.map(
+ (entry: TS.FileSystemEntry) => enhanceSearchEntry(entry),
+ );
+ executePromisesInBatches(promises).then((entriesEnhanced) => {
+ updateCurrentDirEntries(entriesEnhanced, false);
+ });
+ }
+
+ function getSearchResults(
+ searchIndex: TS.FileSystemEntry[],
+ searchQuery: TS.SearchQuery,
+ //isCloudLocation: boolean,
+ ): Promise<TS.FileSystemEntry[]> {
+ return Search.searchLocationIndex(searchIndex, searchQuery)
+ .then((searchResults) => {
+ //enhanceSearchEntries(searchResults);
+ return searchResults;
+ })
+ .catch((err) => {
+ // dispatch(AppActions.hideNotifications());
+ console.log('Searching Index failed: ', err);
+ showNotification(
+ t('core:searchingFailed') + ' ' + err.message,
+ 'warning',
+ true,
+ );
+ return [];
+ });
+ }
+
function searchLocationIndex(searchQuery: TS.SearchQuery) {
window.walkCanceled = false;
if (!currentLocation) {
- showNotification(t('core:pleaseOpenLocation'), 'warning', true);
+ //showNotification(t('core:pleaseOpenLocation'), 'warning', true);
+ searchAllLocations(searchQuery);
return;
}
const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
showNotification(t('core:searching'), 'default', false, 'TIDSearching');
setTimeout(async () => {
- const index = getIndex();
+ const currentPath = await getLocationPath(currentLocation);
+ let directoryIndex = getIndex();
+ if (!directoryIndex || directoryIndex.length < 1) {
+ directoryIndex = await loadIndexFromDisk(
+ currentPath,
+ currentLocation.uuid,
+ );
+ setIndex(directoryIndex);
+ }
// Workaround used to show the start search notification
const currentTime = new Date().getTime();
const indexAge = indexLoadedOn.current
@@ -321,11 +444,12 @@ export const LocationIndexContextProvider = ({
? currentLocation.maxIndexAge
: AppConfig.maxIndexAge;
- const currentPath = await getLocationPath(currentLocation);
if (
searchQuery.forceIndexing ||
(!currentLocation.disableIndexing &&
- (!index || index.length < 1 || indexAge > maxIndexAge))
+ (!directoryIndex ||
+ directoryIndex.length < 1 ||
+ indexAge > maxIndexAge))
) {
console.log('Start creating index for : ' + currentPath);
const newIndex = await createDirectoryIndex(
@@ -339,102 +463,63 @@ export const LocationIndexContextProvider = ({
enableWS,
);
setIndex(newIndex);
- } else if (isCloudLocation || !index || index.length === 0) {
- const newIndex = await loadIndex(
- {
- path: currentPath,
- locationID: currentLocation.uuid,
- ...(isCloudLocation && { bucketName: currentLocation.bucketName }),
- },
- PlatformIO.getDirSeparator(),
- PlatformIO.loadTextFilePromise,
- );
- setIndex(newIndex);
}
- Search.searchLocationIndex(getIndex(), searchQuery)
- .then((searchResults) => {
- if (isCloudLocation) {
- searchResults.forEach((entry: TS.FileSystemEntry) => {
- if (
- entry.meta &&
- entry.meta.thumbPath &&
- entry.meta.thumbPath.length > 1
- // !entry.thumbPath.startsWith('http')
- ) {
- const thumbPath = entry.path.startsWith('/')
- ? entry.path.substring(1)
- : entry.path;
- // eslint-disable-next-line no-param-reassign
- entry.meta.thumbPath = PlatformIO.getURLforPath(
- getThumbFileLocationForFile(
- thumbPath,
- PlatformIO.getDirSeparator(),
- ),
- );
- }
- });
- }
- setSearchResults(searchResults);
- hideNotifications();
- return true;
- })
- .catch((err) => {
- setSearchResults([]);
- // dispatch(AppActions.hideNotifications());
- console.log('Searching Index failed: ', err);
- showNotification(
- t('core:searchingFailed') + ' ' + err.message,
- 'warning',
- true,
- );
- });
+ getSearchResults(getIndex(), searchQuery).then((results) => {
+ setSearchResults(results);
+ enhanceSearchEntries(results);
+ });
+
+ hideNotifications();
}, 50);
}
function searchAllLocations(searchQuery: TS.SearchQuery) {
console.time('globalSearch');
+ setSearchResults([]);
showNotification(t('core:searching'), 'default', false, 'TIDSearching');
// Preparing for global search
// setSearchResults([]);
- if (currentLocation && currentLocation.type === locationType.TYPE_CLOUD) {
+ /*if (currentLocation && currentLocation.type === locationType.TYPE_CLOUD) {
PlatformIO.disableObjectStoreSupport();
- }
+ }*/
window.walkCanceled = false;
- let searchResultCount = 0;
+ //let searchResultCount = 0;
+ let searchResults = [];
let maxSearchResultReached = false;
const result = allLocations.reduce(
(accumulatorPromise, location) =>
accumulatorPromise.then(async () => {
// cancel search if max search result count reached
- if (searchResultCount >= searchQuery.maxSearchResults) {
+ if (searchResults.length >= searchQuery.maxSearchResults) {
maxSearchResultReached = true;
return Promise.resolve();
}
const nextPath = await getLocationPath(location);
- let directoryIndex = [];
- let indexExist = false;
const isCloudLocation = location.type === locationType.TYPE_CLOUD;
- console.log('Searching in: ' + nextPath);
+ await switchLocationTypeByID(location.uuid);
+ let directoryIndex = await loadIndexFromDisk(nextPath, location.uuid);
+ //console.log('Searching in: ' + nextPath);
showNotification(
t('core:searching') + ' ' + location.name,
'default',
- true,
+ false,
'TIDSearching',
);
- if (isCloudLocation) {
- await PlatformIO.enableObjectStoreSupport(location);
- }
- // if (Pro && Pro.Indexer && Pro.Indexer.hasIndex) {
- indexExist = await hasIndex(
- nextPath,
- PlatformIO.getPropertiesPromise,
- ); // , PlatformIO.getDirSeparator());
+
+ /*const folderIndexPath =
+ getMetaDirectoryPath(nextPath) +
+ PlatformIO.getDirSeparator() +
+ AppConfig.folderIndexFile;
+ const indexExist = await PlatformIO.checkFileExist(folderIndexPath);*/
if (
- searchQuery.forceIndexing ||
- (!location.disableIndexing && !indexExist)
+ !location.disableIndexing &&
+ (!directoryIndex ||
+ directoryIndex.length < 1 ||
+ searchQuery.forceIndexing)
+ // || (!location.disableIndexing && !indexExist)
) {
console.log('Creating index for : ' + nextPath);
directoryIndex = await createDirectoryIndex(
@@ -447,21 +532,19 @@ export const LocationIndexContextProvider = ({
location.ignorePatternPaths,
enableWS,
);
- } else {
- console.log('Loading index for : ' + nextPath);
- directoryIndex = await loadIndex(
- {
- path: nextPath,
- locationID: location.uuid,
- ...(isCloudLocation && {
- bucketName: currentLocation.bucketName,
- }),
- },
- PlatformIO.getDirSeparator(),
- PlatformIO.loadTextFilePromise,
- );
}
- return Search.searchLocationIndex(directoryIndex, searchQuery)
+ return getSearchResults(directoryIndex, searchQuery).then(
+ (results) => {
+ //searchResultCount += results.length;
+ if (results.length > 0) {
+ searchResults = [...searchResults, ...results];
+ appendSearchResults(results);
+ }
+ //hideNotifications();
+ return true;
+ },
+ );
+ /*return Search.searchLocationIndex(directoryIndex, searchQuery)
.then((searchResults: Array<TS.FileSystemEntry>) => {
let enhancedSearchResult = searchResults;
if (isCloudLocation) {
@@ -491,15 +574,15 @@ export const LocationIndexContextProvider = ({
searchResultCount += enhancedSearchResult.length;
appendSearchResults(enhancedSearchResult);
hideNotifications();
- if (isCloudLocation) {
+ /!*if (isCloudLocation) {
PlatformIO.disableObjectStoreSupport();
- }
+ }*!/
return true;
})
.catch((e) => {
- if (isCloudLocation) {
+ /!*if (isCloudLocation) {
PlatformIO.disableObjectStoreSupport();
- }
+ }*!/
console.log('Searching Index failed: ', e);
setSearchResults([]);
// dispatch(AppActions.hideNotifications());
@@ -508,18 +591,19 @@ export const LocationIndexContextProvider = ({
'warning',
true,
);
- });
+ });*/
}),
Promise.resolve(),
);
result
.then(() => {
+ enhanceSearchEntries(searchResults);
console.timeEnd('globalSearch');
if (maxSearchResultReached) {
showNotification(
'Global search finished, reaching the max. search results. The first ' +
- searchResultCount +
+ searchResults.length +
' entries are listed.',
'default',
true,
@@ -528,21 +612,15 @@ export const LocationIndexContextProvider = ({
showNotification(t('Global search completed'), 'default', true);
}
console.log('Global search completed!');
- if (
- currentLocation &&
- currentLocation.type === locationType.TYPE_CLOUD
- ) {
- PlatformIO.enableObjectStoreSupport(currentLocation);
- }
- return true;
+ return switchCurrentLocationType();
})
.catch((e) => {
- if (
+ /*if (
currentLocation &&
currentLocation.type === locationType.TYPE_CLOUD
) {
PlatformIO.enableObjectStoreSupport(currentLocation);
- }
+ }*/
console.timeEnd('globalSearch');
console.warn('Global search failed!', e);
});
diff --git a/src/renderer/hooks/OpenedEntryContextProvider.tsx b/src/renderer/hooks/OpenedEntryContextProvider.tsx
index a287de91e..d65c8e2a4 100644
--- a/src/renderer/hooks/OpenedEntryContextProvider.tsx
+++ b/src/renderer/hooks/OpenedEntryContextProvider.tsx
@@ -81,6 +81,10 @@ type OpenedEntryContextData = {
) => Promise<boolean>;*/
openEntry: (path?: string, showDetails?) => Promise<boolean>;
openFsEntry: (fsEntry?: TS.FileSystemEntry, showDetails?) => Promise<boolean>;
+ openEntryInternal: (
+ fsEntry: TS.FileSystemEntry,
+ showDetails?,
+ ) => Promise<boolean>;
toggleEntryFullWidth: () => void;
openLink: (url: string, options?) => void;
goForward: () => void;
@@ -108,6 +112,7 @@ export const OpenedEntryContext = createContext<OpenedEntryContextData>({
//updateOpenedFile: () => Promise.resolve(false),
openEntry: undefined,
openFsEntry: undefined,
+ openEntryInternal: undefined,
toggleEntryFullWidth: () => {},
openLink: () => {},
goForward: () => {},
@@ -127,8 +132,12 @@ export const OpenedEntryContextProvider = ({
const dispatch: AppDispatch = useDispatch();
const { t } = useTranslation();
- const { openLocation, currentLocation, getLocationPath } =
- useCurrentLocationContext();
+ const {
+ openLocation,
+ currentLocation,
+ getLocationPath,
+ switchLocationTypeByID,
+ } = useCurrentLocationContext();
const { currentDirectoryPath, currentLocationPath, openDirectory } =
useDirectoryContentContext();
@@ -409,15 +418,45 @@ export const OpenedEntryContextProvider = ({
});
}
+ function openEntryInternal(
+ fsEntry: TS.FileSystemEntry,
+ showDetails = undefined,
+ ): Promise<boolean> {
+ return switchLocationTypeByID(fsEntry.locationID).then(() => {
+ return getAllPropertiesPromise(fsEntry.path)
+ .then((entry: TS.FileSystemEntry) => {
+ if (entry) {
+ return openFsEntry(entry, showDetails);
+ } else {
+ showNotification(
+ 'File ' + fsEntry.path + ' not exist on filesystem!',
+ 'warning',
+ true,
+ );
+ return openFsEntry(fsEntry, showDetails);
+ }
+ })
+ .catch((error) => {
+ console.warn(
+ 'Error getting properties for entry: ' +
+ fsEntry.path +
+ ' - ' +
+ error,
+ );
+ return false;
+ });
+ });
+ }
+
function openFsEntry(
fsEntry?: TS.FileSystemEntry,
showDetails = undefined,
): Promise<boolean> {
- if (fsEntry === undefined) {
+ if (!fsEntry) {
if (selectedEntries && selectedEntries.length > 0) {
const lastSelectedEntry = selectedEntries[selectedEntries.length - 1];
if (!lastSelectedEntry.isFile) {
- return openDirectory(lastSelectedEntry.path); //, false);
+ return openDirectory(lastSelectedEntry.path, currentLocation.uuid); //, false);
}
} else {
return Promise.resolve(false);
@@ -569,7 +608,7 @@ export const OpenedEntryContextProvider = ({
openFsEntry(fsEntry);
setEntryInFullWidth(options.fullWidth);
} else {
- openDirectory(fsEntry.path);
+ openDirectory(fsEntry.path, currentLocation.uuid);
}
return true;
})
@@ -614,9 +653,9 @@ export const OpenedEntryContextProvider = ({
locationPath.length > 0
? locationPath + '/' + newRelDir
: directoryPath;
- openDirectory(dirFullPath);
+ openDirectory(dirFullPath, targetLocation.uuid);
} else {
- openDirectory(locationPath);
+ openDirectory(locationPath, targetLocation.uuid);
}
if (entryPath) {
@@ -654,9 +693,9 @@ export const OpenedEntryContextProvider = ({
directoryPath,
);
//locationPath + PlatformIO.getDirSeparator() + directoryPath;
- openDirectory(dirFullPath);
+ openDirectory(dirFullPath, targetLocation.uuid);
} else {
- openDirectory(locationPath);
+ openDirectory(locationPath, targetLocation.uuid);
}
if (entryPath && entryPath.length > 0) {
@@ -794,6 +833,7 @@ export const OpenedEntryContextProvider = ({
//updateOpenedFile,
openEntry,
openFsEntry,
+ openEntryInternal,
toggleEntryFullWidth,
goForward,
goBack,
diff --git a/src/renderer/hooks/TaggingActionsContextProvider.tsx b/src/renderer/hooks/TaggingActionsContextProvider.tsx
index 097264462..b01829504 100644
--- a/src/renderer/hooks/TaggingActionsContextProvider.tsx
+++ b/src/renderer/hooks/TaggingActionsContextProvider.tsx
@@ -358,134 +358,155 @@ export const TaggingActionsContextProvider = ({
}
/**
- * @param path
+ * @param entry: TS.FileSystemEntry
* @param tags
* @param reflect
* return newPath
*/
- async function addTagsToEntry(
- path: string,
+ async function addTagsToFsEntry(
+ entry: TS.FileSystemEntry,
tags: Array<TS.Tag>,
reflect: boolean = true,
): Promise<string> {
- const entryProperties = await PlatformIO.getPropertiesPromise(path);
- let fsEntryMeta;
- try {
- fsEntryMeta = entryProperties.isFile
- ? await loadFileMetaDataPromise(path)
- : await loadDirMetaDataPromise(path);
- } catch (error) {
- console.log('No sidecar found ' + error);
- }
+ if (entry) {
+ let fsEntryMeta;
+ try {
+ fsEntryMeta = entry.isFile
+ ? await loadFileMetaDataPromise(entry.path)
+ : await loadDirMetaDataPromise(entry.path);
+ } catch (error) {
+ console.log('No sidecar found ' + error);
+ }
- if (!entryProperties.isFile || persistTagsInSidecarFile) {
- // Handling adding tags in sidecar
- if (fsEntryMeta) {
- const uniqueTags = getNonExistingTags(
- tags,
- extractTags(path, tagDelimiter, PlatformIO.getDirSeparator()),
- fsEntryMeta.tags,
- );
- if (uniqueTags.length > 0) {
- const newTags: TS.Tag[] = [...fsEntryMeta.tags, ...uniqueTags];
- const updatedFsEntryMeta = {
- ...fsEntryMeta,
- tags: newTags,
- };
- return saveMetaDataPromise(path, updatedFsEntryMeta)
+ if (!entry.isFile || persistTagsInSidecarFile) {
+ // Handling adding tags in sidecar
+ if (fsEntryMeta) {
+ const uniqueTags = getNonExistingTags(
+ tags,
+ extractTags(entry.path, tagDelimiter, PlatformIO.getDirSeparator()),
+ fsEntryMeta.tags,
+ );
+ if (uniqueTags.length > 0) {
+ const newTags: TS.Tag[] = [...fsEntryMeta.tags, ...uniqueTags];
+ const updatedFsEntryMeta = {
+ ...fsEntryMeta,
+ tags: newTags,
+ };
+ return saveMetaDataPromise(entry.path, updatedFsEntryMeta)
+ .then(() => {
+ if (reflect) {
+ reflectUpdateMeta(entry.path);
+ }
+ return entry.path;
+ })
+ .catch((err) => {
+ console.warn(
+ 'Error adding tags for ' + entry.path + ' with ' + err,
+ );
+ showNotification(
+ t('core:addingTagsFailed' as any) as string,
+ 'error',
+ true,
+ );
+ return entry.path;
+ });
+ }
+ } else {
+ const newFsEntryMeta = { tags };
+ return saveMetaDataPromise(entry.path, newFsEntryMeta)
.then(() => {
if (reflect) {
- reflectUpdateMeta(path);
+ reflectUpdateMeta(entry.path);
}
- return path;
+ return entry.path;
})
- .catch((err) => {
- console.warn('Error adding tags for ' + path + ' with ' + err);
+ .catch((error) => {
+ console.warn(
+ 'Error adding tags for ' + entry.path + ' with ' + error,
+ );
showNotification(
t('core:addingTagsFailed' as any) as string,
'error',
true,
);
- return path;
+ return entry.path;
+ });
+ }
+ } else if (fsEntryMeta) {
+ // Handling tags in filename by existing sidecar
+ const extractedTags = extractTags(
+ entry.path,
+ tagDelimiter,
+ PlatformIO.getDirSeparator(),
+ );
+ const uniqueTags = getNonExistingTags(
+ tags,
+ extractedTags,
+ fsEntryMeta.tags,
+ );
+ if (uniqueTags.length > 0) {
+ const newFilePath = addTagsToFilePath(
+ entry.path,
+ uniqueTags.map((tag) => tag.title),
+ );
+ if (entry.path !== newFilePath) {
+ return renameFile(entry.path, newFilePath, reflect).then(() => {
+ return newFilePath;
});
+ }
}
} else {
- const newFsEntryMeta = { tags };
- return saveMetaDataPromise(path, newFsEntryMeta)
- .then(() => {
- if (reflect) {
- reflectUpdateMeta(path);
- }
- return path;
- })
- .catch((error) => {
- console.warn('Error adding tags for ' + path + ' with ' + error);
- showNotification(
- t('core:addingTagsFailed' as any) as string,
- 'error',
- true,
- );
- return path;
- });
- }
- } else if (fsEntryMeta) {
- // Handling tags in filename by existing sidecar
- const extractedTags = extractTags(
- path,
- tagDelimiter,
- PlatformIO.getDirSeparator(),
- );
- const uniqueTags = getNonExistingTags(
- tags,
- extractedTags,
- fsEntryMeta.tags,
- );
- if (uniqueTags.length > 0) {
+ // Handling tags in filename by no sidecar
const newFilePath = addTagsToFilePath(
- path,
- uniqueTags.map((tag) => tag.title),
+ entry.path,
+ tags.map((tag) => tag.title),
);
- if (path !== newFilePath) {
- return renameFile(path, newFilePath, reflect).then(() => {
+ if (entry.path !== newFilePath) {
+ return renameFile(entry.path, newFilePath, reflect).then(() => {
return newFilePath;
});
}
}
- } else {
- // Handling tags in filename by no sidecar
- const newFilePath = addTagsToFilePath(
- path,
- tags.map((tag) => tag.title),
- );
- if (path !== newFilePath) {
- return renameFile(path, newFilePath, reflect).then(() => {
- return newFilePath;
- });
- }
- }
- return Promise.resolve(path);
-
- function getNonExistingTags(
- newTagsArray: Array<TS.Tag>,
- fileTagsArray: string[],
- sideCarTagsArray: Array<TS.Tag>,
- ): TS.Tag[] {
- const newTags = [];
- for (let i = 0; i < newTagsArray.length; i += 1) {
- // check if tag is already in the fileTagsArray
- if (fileTagsArray.indexOf(newTagsArray[i].title) === -1) {
- // check if tag is already in the sideCarTagsArray
- if (
- sideCarTagsArray.findIndex(
- (sideCarTag) => sideCarTag.title === newTagsArray[i].title,
- ) === -1
- ) {
- newTags.push(newTagsArray[i]);
+ return Promise.resolve(entry.path);
+
+ function getNonExistingTags(
+ newTagsArray: Array<TS.Tag>,
+ fileTagsArray: string[],
+ sideCarTagsArray: Array<TS.Tag>,
+ ): TS.Tag[] {
+ const newTags = [];
+ for (let i = 0; i < newTagsArray.length; i += 1) {
+ // check if tag is already in the fileTagsArray
+ if (fileTagsArray.indexOf(newTagsArray[i].title) === -1) {
+ // check if tag is already in the sideCarTagsArray
+ if (
+ sideCarTagsArray.findIndex(
+ (sideCarTag) => sideCarTag.title === newTagsArray[i].title,
+ ) === -1
+ ) {
+ newTags.push(newTagsArray[i]);
+ }
}
}
+ return newTags;
}
- return newTags;
}
+ return Promise.resolve('');
+ }
+ /**
+ * @param path
+ * @param tags
+ * @param reflect
+ * return newPath
+ */
+ function addTagsToEntry(
+ path: string,
+ tags: Array<TS.Tag>,
+ reflect: boolean = true,
+ ): Promise<string> {
+ return PlatformIO.getPropertiesPromise(path).then((entry) =>
+ addTagsToFsEntry(entry, tags, reflect),
+ );
}
/**
diff --git a/src/renderer/locales/en/core.json b/src/renderer/locales/en/core.json
index cae1f5a59..f94cacb20 100644
--- a/src/renderer/locales/en/core.json
+++ b/src/renderer/locales/en/core.json
@@ -519,6 +519,7 @@
"location": "Location",
"locationId": "Location ID",
"folder": "Folder",
+ "global": "Global",
"globalSearch": "Global",
"localLocation": "Local - pointing to a local folder",
"objectStorage": "Object Storage",
diff --git a/src/renderer/perspectives/common/main-container.tsx b/src/renderer/perspectives/common/main-container.tsx
index 22e18fab4..fb2c04d2f 100644
--- a/src/renderer/perspectives/common/main-container.tsx
+++ b/src/renderer/perspectives/common/main-container.tsx
@@ -54,11 +54,12 @@ export const renderCell = (
setSelectedEntries,
lastSelectedEntryPath,
directoryContent,
- openFsEntry,
+ openEntryInternal,
openFileNatively,
openDirectory,
setFileContextMenuAnchorEl,
setDirContextMenuAnchorEl,
+ switchLocationTypeByID,
showNotification: (
text: string,
notificationType: string,
@@ -132,7 +133,7 @@ export const renderCell = (
const openLocation = (fsEntry: TS.FileSystemEntry) => {
if (fsEntry.isFile) {
setSelectedEntries([fsEntry]);
- openFsEntry(fsEntry);
+ openEntryInternal(fsEntry);
//openEntry(fsEntry.path);
} else {
console.log('Handle Grid cell db click, selected path : ', fsEntry.path);
@@ -228,29 +229,7 @@ export const renderCell = (
setSelectedEntries([fsEntry]);
if (fsEntry.isFile) {
if (singleClickAction === 'openInternal') {
- getAllPropertiesPromise(fsEntry.path)
- .then((entry: TS.FileSystemEntry) => {
- if (entry) {
- openFsEntry(entry);
- } else {
- openFsEntry(fsEntry);
- showNotification(
- 'File ' + fsEntry.path + ' not exist on filesystem!',
- 'warning',
- true,
- );
- }
- })
- .catch((error) => {
- console.warn(
- 'Error getting properties for entry: ' +
- fsEntry.path +
- ' - ' +
- error,
- );
- return false;
- });
- // openEntry(fsEntry.path);
+ openEntryInternal(fsEntry);
} else if (singleClickAction === 'openExternal') {
openFileNatively(fsEntry.path);
}
diff --git a/src/renderer/perspectives/grid/components/GridCell.tsx b/src/renderer/perspectives/grid/components/GridCell.tsx
index 65a645285..c983d1a32 100644
--- a/src/renderer/perspectives/grid/components/GridCell.tsx
+++ b/src/renderer/perspectives/grid/components/GridCell.tsx
@@ -18,7 +18,7 @@
import React, { useEffect, useMemo, useReducer, useRef } from 'react';
import { useSelector, useDispatch } from 'react-redux';
-import { useTheme, styled } from '@mui/material/styles';
+import { useTheme } from '@mui/material/styles';
import { useTranslation } from 'react-i18next';
import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
@@ -37,6 +37,7 @@ import {
import {
formatFileSize,
formatDateTime,
+ locationType,
} from '@tagspaces/tagspaces-common/misc';
import {
extractTagsAsObjects,
@@ -65,6 +66,7 @@ import { useSelectedEntriesContext } from '-/hooks/useSelectedEntriesContext';
import { usePerspectiveSettingsContext } from '-/hooks/usePerspectiveSettingsContext';
import i18n from '-/services/i18n';
import { useEditedEntryMetaContext } from '-/hooks/useEditedEntryMetaContext';
+import { getLocations } from '-/reducers/locations';
export function urlGetDelim(url) {
return url.indexOf('?') > 0 ? '&' : '?';
@@ -136,6 +138,7 @@ function GridCell(props: Props) {
const { readOnlyMode } = useCurrentLocationContext();
const supportedFileTypes = useSelector(getSupportedFileTypes);
const reorderTags: boolean = useSelector(isReorderTags);
+ const locations: Array<TS.Location> = useSelector(getLocations);
//const lastThumbnailImageChange = useSelector(getLastThumbnailImageChange);
// const desktopMode = useSelector(isDesktopMode);
const dispatch: AppDispatch = useDispatch();
@@ -243,6 +246,18 @@ function GridCell(props: Props) {
const entryPath = fsEntry.path;
const isSmall = entrySize === 'tiny' || entrySize === 'small';
+ function isLocalFile(locationID): boolean {
+ if (locationID) {
+ const loc = locations.find((l) => l.uuid === locationID);
+ if (loc) {
+ return loc.type === locationType.TYPE_LOCAL;
+ }
+ }
+ return false;
+ }
+
+ const isLocal = fsEntry.locationID ? isLocalFile(fsEntry.locationID) : false;
+
const renderTags = useMemo(() => {
let sideCarLength = 0;
return entryTags.map((tag: TS.Tag, index) => {
@@ -430,6 +445,7 @@ function GridCell(props: Props) {
src={getThumbPath(
fsEntry.meta.thumbPath,
fsEntry.meta?.lastUpdated,
+ isLocal,
)}
style={{
height: maxHeight - 70,
diff --git a/src/renderer/perspectives/grid/components/GridPagination.tsx b/src/renderer/perspectives/grid/components/GridPagination.tsx
index 10088079e..bbfbbad76 100644
--- a/src/renderer/perspectives/grid/components/GridPagination.tsx
+++ b/src/renderer/perspectives/grid/components/GridPagination.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect, useReducer, useRef } from 'react';
+import React, { useRef } from 'react';
import { useTheme } from '@mui/material/styles';
import Typography from '@mui/material/Typography';
import Tooltip from '-/components/Tooltip';
@@ -99,10 +99,11 @@ function GridPagination(props: Props) {
singleClickAction,
} = usePerspectiveSettingsContext();
const { lastSelectedEntryPath } = useSelectedEntriesContext();
- const { openFsEntry } = useOpenedEntryContext();
+ const { openEntryInternal } = useOpenedEntryContext();
const { moveFiles, openFileNatively } = useIOActionsContext();
const { showNotification } = useNotificationContext();
- const { readOnlyMode, currentLocation } = useCurrentLocationContext();
+ const { readOnlyMode, currentLocation, switchLocationTypeByID } =
+ useCurrentLocationContext();
const { openDirectory, directoryMeta } = useDirectoryContentContext();
const { sortedDirContent } = useSortedDirContext();
const { page, pageFiles, setCurrentPage } = usePaginationContext();
@@ -330,11 +331,12 @@ function GridPagination(props: Props) {
setSelectedEntries,
lastSelectedEntryPath,
sortedDirContent,
- openFsEntry,
+ openEntryInternal,
openFileNatively,
openDirectory,
setFileContextMenuAnchorEl,
setDirContextMenuAnchorEl,
+ switchLocationTypeByID,
showNotification,
moveFiles,
clearSelection,
@@ -354,11 +356,12 @@ function GridPagination(props: Props) {
setSelectedEntries,
lastSelectedEntryPath,
sortedDirContent,
- openFsEntry,
+ openEntryInternal,
openFileNatively,
openDirectory,
setFileContextMenuAnchorEl,
setDirContextMenuAnchorEl,
+ switchLocationTypeByID,
showNotification,
moveFiles,
clearSelection,
diff --git a/src/renderer/services/meta-loader.ts b/src/renderer/services/meta-loader.ts
index 5394edd9e..5402e26aa 100644
--- a/src/renderer/services/meta-loader.ts
+++ b/src/renderer/services/meta-loader.ts
@@ -100,7 +100,7 @@ function setThumbForEntry(
PlatformIO.getDirSeparator(),
false,
);
- const metaFile = meta.find((m) => thumbPath.endsWith(m.path));
+ const metaFile = meta.find((m) => thumbPath && thumbPath.endsWith(m.path));
if (thumbPath && metaFile) {
thumbEntry.meta = { id: getUuid(), thumbPath }; //{ ...metaFile, thumbPath };
if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {
diff --git a/src/renderer/services/platform-facade.ts b/src/renderer/services/platform-facade.ts
index f095b96fe..c6005d27e 100644
--- a/src/renderer/services/platform-facade.ts
+++ b/src/renderer/services/platform-facade.ts
@@ -396,13 +396,15 @@ export default class PlatformFacade {
};
static checkFileExist = (file: string): Promise<boolean> => {
+ if (file === undefined) {
+ return Promise.resolve(false);
+ }
if (objectStoreAPI) {
- return objectStoreAPI
- .getPropertiesPromise({
- path: file,
- bucketName: objectStoreAPI.config().bucketName,
- })
- .then((stats) => stats && stats.isFile);
+ return objectStoreAPI.isFileExist({
+ path: file,
+ bucketName: objectStoreAPI.config().bucketName,
+ });
+ //.then((stats) => stats && stats.isFile);
} else if (webDavAPI) {
return webDavAPI
.getPropertiesPromise(file)
diff --git a/src/renderer/services/search.ts b/src/renderer/services/search.ts
index fc121caf0..c70a3f48d 100644
--- a/src/renderer/services/search.ts
+++ b/src/renderer/services/search.ts
@@ -352,7 +352,7 @@ export default class Search {
static searchLocationIndex = (
locationContent: Array<TS.FileSystemEntry>,
searchQuery: TS.SearchQuery,
- ): Promise<Array<TS.FileSystemEntry> | []> =>
+ ): Promise<TS.FileSystemEntry[]> =>
new Promise((resolve, reject) => {
console.time('searchtime');
if (!locationContent || locationContent.length === 0) {
diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.ts
index 3addff79c..0e82dc753 100644
--- a/src/renderer/services/utils-io.ts
+++ b/src/renderer/services/utils-io.ts
@@ -17,11 +17,7 @@
*/
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
-import {
- createIndex,
- loadIndex,
- enhanceDirectoryIndex,
-} from '@tagspaces/tagspaces-indexer';
+import { createIndex } from '@tagspaces/tagspaces-indexer';
import {
enhanceEntry,
loadJSONString,
@@ -46,6 +42,7 @@ import {
getThumbFileLocationForFile,
getBgndFileLocationForDirectory,
cleanFrontDirSeparator,
+ joinPaths,
} from '@tagspaces/tagspaces-common/paths';
import AppConfig from '-/AppConfig';
import PlatformIO from './platform-facade';
@@ -526,13 +523,62 @@ async function persistIndex(param: string | any, directoryIndex: any) {
});
}
+export function enhanceDirectoryIndex(
+ directoryIndex: TS.FileSystemEntry[],
+ locationID,
+ folderPath,
+): TS.FileSystemEntry[] {
+ return directoryIndex.map((i: TS.FileSystemEntry) => ({
+ ...i,
+ locationID,
+ path: joinPaths(
+ AppConfig.dirSeparator,
+ folderPath,
+ AppConfig.isWin ? i.path.replaceAll('/', AppConfig.dirSeparator) : i.path, //toPlatformPath()
+ ),
+ }));
+}
+
+export function loadIndexFromDisk(
+ folderPath: string,
+ locationID: string,
+): Promise<TS.FileSystemEntry[]> {
+ const folderIndexPath =
+ getMetaDirectoryPath(folderPath) +
+ PlatformIO.getDirSeparator() +
+ AppConfig.folderIndexFile;
+ return PlatformIO.loadTextFilePromise(folderIndexPath)
+ .then((jsonContent) => {
+ const directoryIndex = loadJSONString(
+ jsonContent,
+ ) as TS.FileSystemEntry[];
+ return enhanceDirectoryIndex(directoryIndex, locationID, folderPath);
+ /*return enhanceDirectoryIndex(
+ {
+ path: folderPath,
+ locationID: location.uuid,
+ ...(location.type === locationType.TYPE_CLOUD && {
+ bucketName: location.bucketName,
+ }),
+ },
+ directoryIndex,
+ location.uuid,
+ ) as TS.FileSystemEntry[];*/
+ })
+ .catch((e) => {
+ console.log('cannot load json:' + folderPath, e);
+ return undefined;
+ });
+ // const indexExist = PlatformIO.checkFileExist(folderIndexPath);
+}
+
export function createDirectoryIndex(
param: string | any,
extractText = false,
ignorePatterns: Array<string> = [],
enableWS = true,
// disableIndexing = true,
-) {
+): Promise<TS.FileSystemEntry[]> {
//: Promise<TS.FileSystemEntry[]> {
if (Pro && Pro.Watcher) {
Pro.Watcher.stopWatching();
@@ -560,11 +606,12 @@ export function createDirectoryIndex(
ignorePatterns,
).then((result) => {
if (result && result.success) {
- return loadIndex(
+ return loadIndexFromDisk(dirPath, locationID);
+ /*return loadIndex(
{ path: dirPath, locationID },
PlatformIO.getDirSeparator(),
PlatformIO.loadTextFilePromise,
- );
+ );*/
} else if (result && result.error) {
console.error('createDirectoryIndexInWorker failed:' + result.error);
} else {
@@ -597,7 +644,12 @@ export function createDirectoryIndex(
persistIndex(param, directoryIndex).then((success) => {
if (success) {
console.log('Index generated in folder: ' + directoryPath);
- return enhanceDirectoryIndex(param, directoryIndex, locationID);
+ return enhanceDirectoryIndex(
+ directoryIndex,
+ locationID,
+ directoryPath,
+ );
+ //return enhanceDirectoryIndex(param, directoryIndex, locationID);
}
return undefined;
}),
@@ -1279,7 +1331,9 @@ export function getDescriptionPreview(mdContent, maxLength = 200) {
if (preview.length > maxLength) {
preview = preview.substring(0, maxLength) + '...';
}
- return preview.replace(/[#*!_\[\]()`]/g, '');
+ return preview.replaceAll('\n', ' ').replaceAll('|', '');
+ // .replaceAll('\\\\', '');
+ // return preview.replace(/[#*!_\[\]()`]/g, '');
}
// export function removeMarkDown(mdContent) {
@@ -1478,11 +1532,23 @@ export function getFolderThumbPath(path: string, dt = undefined) {
return undefined;
}
-export function getThumbPath(thumbPath: string, dt = undefined) {
+/**
+ * @param thumbPath
+ * @param dt
+ * @param isLocalFile - force to generate local URL
+ */
+export function getThumbPath(
+ thumbPath: string,
+ dt = undefined,
+ isLocalFile = false,
+) {
if (!thumbPath) {
return undefined;
}
- if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {
+ if (
+ !isLocalFile &&
+ (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport())
+ ) {
if (isSignedURL(thumbPath)) {
return thumbPath;
}
diff --git a/src/renderer/tagspaces.namespace.d.ts b/src/renderer/tagspaces.namespace.d.ts
index 45a2313a1..efd1848ef 100644
--- a/src/renderer/tagspaces.namespace.d.ts
+++ b/src/renderer/tagspaces.namespace.d.ts
@@ -1,3 +1,5 @@
+import { ScopeType } from '-/components/SearchOptions';
+
/**
* TagSpaces - universal file and folder organizer
* Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
@@ -84,7 +86,7 @@ export namespace TS {
tagsNOT?: Array<Tag>;
lastModified?: string;
fileSize?: string;
- searchBoxing?: 'location' | 'folder' | 'global';
+ searchBoxing?: ScopeType;
searchType?: 'fuzzy' | 'semistrict' | 'strict';
forceIndexing?: boolean;
currentDirectory?: string;
@@ -159,6 +161,7 @@ export namespace TS {
name: string;
isFile: boolean;
isNewFile?: boolean;
+ locationID?: string;
//isAutoSaveEnabled?: boolean; // common with OpenedEntry
extension?: string;
textContent?: string;
diff --git a/tests/e2e/fileopener.pw.e2e.js b/tests/e2e/fileopener.pw.e2e.js
index 2121cc2e0..d74b12595 100644
--- a/tests/e2e/fileopener.pw.e2e.js
+++ b/tests/e2e/fileopener.pw.e2e.js
@@ -291,9 +291,9 @@ test.describe('TST08 - File folder properties', () => {
test.skip('TST3005 - Description for folders [Pro]', async () => {});
/**
- * reload file button not visible on electron (github app size specific)
+ * reload file button failed on web windows only but the problem is in test only
*/
- test('TST0812 - Reload file [web,minio,electron]', async () => {
+ test('TST0812 - Reload file [minio,electron]', async () => {
// open fileProperties
await clickOn(getGridFileSelector('sample.txt'));
//Toggle Properties