TagSpaces is an offline, open source, document manager with tagging support
Fix opening file externally on Android
Stanimird21a75fa85e9
diff --git a/package-lock.json b/package-lock.jsonindex d8975a725..bfe6259c0 100644--- a/package-lock.json+++ b/package-lock.json@@ -19,10 +19,10 @@"@mui/lab": "5.0.0-alpha.170","@mui/material": "^5.15.19","@mui/x-date-pickers": "^5.0.20",- "@tagspaces/tagspaces-common": "4.3.23",- "@tagspaces/tagspaces-common-aws3": "4.3.23",- "@tagspaces/tagspaces-common-cordova": "4.3.23",- "@tagspaces/tagspaces-indexer": "4.3.23",+ "@tagspaces/tagspaces-common": "4.3.24",+ "@tagspaces/tagspaces-common-aws3": "4.3.24",+ "@tagspaces/tagspaces-common-cordova": "4.3.24",+ "@tagspaces/tagspaces-indexer": "4.3.24","@tagspaces/tagspaces-md": "4.3.21","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0",@@ -13741,9 +13741,9 @@}},"node_modules/@tagspaces/tagspaces-common": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.23.tgz",- "integrity": "sha512-rbWV9Fydiu77zc0MHJ6zFfUjA/mDSOcB4e3K6RYrke87XAtle1/CnAm+Gq/t/zKjW6ZWsmwvo8pDoqK1dyJQ3Q==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.24.tgz",+ "integrity": "sha512-zjNPJCxBbb0OM3QIMTi2XGkSnfZAYRIcy05LFkvDkpray4NXT6C3aFX7S4aIUBjC4EExJKAtjsI3Gknf51bczA==","dependencies": {"dotenv": "^16.0.2","picomatch": "^3.0.1",@@ -13751,11 +13751,11 @@}},"node_modules/@tagspaces/tagspaces-common-aws3": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.3.23.tgz",- "integrity": "sha512-/rgjuHkxXM3ylcQCP3VKceCMGHhxWQZv6klRs5moxZogWX2B0VTv5wQwWSDNk8J9g7AKxLQD/rnexOMBQFAe3Q==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-aws3/-/tagspaces-common-aws3-4.3.24.tgz",+ "integrity": "sha512-Ih9I9dLUnnh7CJ0lg+yRDa+XsX00GGb0rDEouC/QYOMJEHvCkf/ZkN1cXHnZSp0Lof8QjS3Vh///0Pw/VbTQdA==","dependencies": {- "@tagspaces/tagspaces-common": "^4.3.23",+ "@tagspaces/tagspaces-common": "^4.3.24","aws-sdk": "2.1605.0"}},@@ -13811,11 +13811,11 @@}},"node_modules/@tagspaces/tagspaces-common-cordova": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.3.23.tgz",- "integrity": "sha512-jjRda9yeiFzGEZWK8cBWtNWEfUHJzYIbb8Ccgm4Owg9nySADJzGyAHiV02FyOCbiVZeohM352+i02RzjAoFzoA==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-cordova/-/tagspaces-common-cordova-4.3.24.tgz",+ "integrity": "sha512-3nTxqzH3YLtcuJ6UFv/luN/tRST3rg9y+if8LyyO22Nrwy+8dmy4pIaY2Ylukn3jxdQTvw2V9XSVO9ez78Kd3w==","dependencies": {- "@tagspaces/tagspaces-common": "^4.3.23"+ "@tagspaces/tagspaces-common": "^4.3.24"}},"node_modules/@tagspaces/tagspaces-common/node_modules/uuid": {@@ -13827,11 +13827,11 @@}},"node_modules/@tagspaces/tagspaces-indexer": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.3.23.tgz",- "integrity": "sha512-/uYe4cyc6UABb7jcdViWrOwM3/iFIsIM6mB9C+UT1NuiMAzbSE/AvAbqOpQ8+jF9i/FjQui868gypZzAZdsGFA==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-indexer/-/tagspaces-indexer-4.3.24.tgz",+ "integrity": "sha512-ea+Q2alUgm7IZHEjYJdF9Rl5dsinuw+HOdHB6Hx8GND+mQkwC4QOBBRDL05dqk/bnyGSYJA7THhnnRUqgRgrXw==","dependencies": {- "@tagspaces/tagspaces-common": "^4.3.23"+ "@tagspaces/tagspaces-common": "^4.3.24"}},"node_modules/@tagspaces/tagspaces-md": {diff --git a/package.json b/package.jsonindex 8a4d9cf65..f43f0af82 100644--- a/package.json+++ b/package.json@@ -160,10 +160,10 @@"@mui/lab": "5.0.0-alpha.170","@mui/material": "^5.15.19","@mui/x-date-pickers": "^5.0.20",- "@tagspaces/tagspaces-common": "4.3.23",- "@tagspaces/tagspaces-common-aws3": "4.3.23",- "@tagspaces/tagspaces-common-cordova": "4.3.23",- "@tagspaces/tagspaces-indexer": "4.3.23",+ "@tagspaces/tagspaces-common": "4.3.24",+ "@tagspaces/tagspaces-common-aws3": "4.3.24",+ "@tagspaces/tagspaces-common-cordova": "4.3.24",+ "@tagspaces/tagspaces-indexer": "4.3.24","@tagspaces/tagspaces-md": "4.3.21","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0",diff --git a/release/app/package-lock.json b/release/app/package-lock.jsonindex cfe4c84e4..2b22a7961 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.118",- "@tagspaces/tagspaces-common-node": "4.3.23",- "@tagspaces/tagspaces-ws": "4.3.23",+ "@tagspaces/tagspaces-common-node": "4.3.24",+ "@tagspaces/tagspaces-ws": "4.3.24","sharp": "0.32.6","ws": "8.16.0"},@@ -43,9 +43,9 @@}},"node_modules/@tagspaces/tagspaces-common": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.23.tgz",- "integrity": "sha512-rbWV9Fydiu77zc0MHJ6zFfUjA/mDSOcB4e3K6RYrke87XAtle1/CnAm+Gq/t/zKjW6ZWsmwvo8pDoqK1dyJQ3Q==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.24.tgz",+ "integrity": "sha512-zjNPJCxBbb0OM3QIMTi2XGkSnfZAYRIcy05LFkvDkpray4NXT6C3aFX7S4aIUBjC4EExJKAtjsI3Gknf51bczA==","dependencies": {"dotenv": "^16.0.2","picomatch": "^3.0.1",@@ -53,11 +53,11 @@}},"node_modules/@tagspaces/tagspaces-common-node": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.3.23.tgz",- "integrity": "sha512-spK20QbPjVCpqGuq+DDQCim3vbhJG5MrJUir24U2MTI4rIGnJfTIc0B60fPMC9yF4XIEJZr/dPSuc6EzN9OgBQ==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.3.24.tgz",+ "integrity": "sha512-1xQ3Kw6wp82misZBWG2cVypAhzxDsGbY/ABFmX/4srdOdojvtu3W1XTdyG3Q4BGyEy0UFi7q5DSDqP1UQk99HQ==","dependencies": {- "@tagspaces/tagspaces-common": "^4.3.23",+ "@tagspaces/tagspaces-common": "^4.3.24","adm-zip": "0.5.10","fs-extra": "^10.0.0","klaw": "^4.1.0",@@ -74,22 +74,22 @@}},"node_modules/@tagspaces/tagspaces-workers": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.3.23.tgz",- "integrity": "sha512-l3JjvzeMDNg0QU8lESkgdmHD0GmOVi8U4qKE/akQ13zclyIGhiQdddp4JsfRFGIFilitBUrlKvfWALFanqx/FQ==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.3.24.tgz",+ "integrity": "sha512-WLUCofRU0ian0vH0MV2DoyLqF5p+hb+hwVTmRsyMLJv5bw+e7x54p+IqFOu0Qu+Cpf08LMufxgSmqWeUPR5rMQ==","dependencies": {- "@tagspaces/tagspaces-common": "^4.3.23",- "@tagspaces/tagspaces-common-node": "^4.3.23",+ "@tagspaces/tagspaces-common": "^4.3.24",+ "@tagspaces/tagspaces-common-node": "^4.3.24","@tagspaces/tagspaces-thumbgen-image": "^4.2.3","fswin": "^3.24.524"}},"node_modules/@tagspaces/tagspaces-ws": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.3.23.tgz",- "integrity": "sha512-4AjGQ5ruiywGLP2R2D1wjew5F4MtOACF0SWH4zVM/BM9wAC9hLWGxEdPr3nXerdvg6k/p7L9J1cNzoVxmxvlOA==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.3.24.tgz",+ "integrity": "sha512-CXKZBIabbg3VNJOZuP7bdWrA3KeCg/SrsQmQTO2ADniz26K8gJnglzcSC/GWAAe17pFdl1PM8qcwvggcVx1tDg==","dependencies": {- "@tagspaces/tagspaces-workers": "^4.3.23",+ "@tagspaces/tagspaces-workers": "^4.3.24","find-free-ports": "^3.1.1","jsonwebtoken": "^8.5.1","ws": "^8.15.1"@@ -1131,9 +1131,9 @@}},"@tagspaces/tagspaces-common": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.23.tgz",- "integrity": "sha512-rbWV9Fydiu77zc0MHJ6zFfUjA/mDSOcB4e3K6RYrke87XAtle1/CnAm+Gq/t/zKjW6ZWsmwvo8pDoqK1dyJQ3Q==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common/-/tagspaces-common-4.3.24.tgz",+ "integrity": "sha512-zjNPJCxBbb0OM3QIMTi2XGkSnfZAYRIcy05LFkvDkpray4NXT6C3aFX7S4aIUBjC4EExJKAtjsI3Gknf51bczA==","requires": {"dotenv": "^16.0.2","picomatch": "^3.0.1",@@ -1141,11 +1141,11 @@}},"@tagspaces/tagspaces-common-node": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.3.23.tgz",- "integrity": "sha512-spK20QbPjVCpqGuq+DDQCim3vbhJG5MrJUir24U2MTI4rIGnJfTIc0B60fPMC9yF4XIEJZr/dPSuc6EzN9OgBQ==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-common-node/-/tagspaces-common-node-4.3.24.tgz",+ "integrity": "sha512-1xQ3Kw6wp82misZBWG2cVypAhzxDsGbY/ABFmX/4srdOdojvtu3W1XTdyG3Q4BGyEy0UFi7q5DSDqP1UQk99HQ==","requires": {- "@tagspaces/tagspaces-common": "^4.3.23",+ "@tagspaces/tagspaces-common": "^4.3.24","adm-zip": "0.5.10","fs-extra": "^10.0.0","klaw": "^4.1.0",@@ -1162,22 +1162,22 @@}},"@tagspaces/tagspaces-workers": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.3.23.tgz",- "integrity": "sha512-l3JjvzeMDNg0QU8lESkgdmHD0GmOVi8U4qKE/akQ13zclyIGhiQdddp4JsfRFGIFilitBUrlKvfWALFanqx/FQ==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-workers/-/tagspaces-workers-4.3.24.tgz",+ "integrity": "sha512-WLUCofRU0ian0vH0MV2DoyLqF5p+hb+hwVTmRsyMLJv5bw+e7x54p+IqFOu0Qu+Cpf08LMufxgSmqWeUPR5rMQ==","requires": {- "@tagspaces/tagspaces-common": "^4.3.23",- "@tagspaces/tagspaces-common-node": "^4.3.23",+ "@tagspaces/tagspaces-common": "^4.3.24",+ "@tagspaces/tagspaces-common-node": "^4.3.24","@tagspaces/tagspaces-thumbgen-image": "^4.2.3","fswin": "^3.24.524"}},"@tagspaces/tagspaces-ws": {- "version": "4.3.23",- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.3.23.tgz",- "integrity": "sha512-4AjGQ5ruiywGLP2R2D1wjew5F4MtOACF0SWH4zVM/BM9wAC9hLWGxEdPr3nXerdvg6k/p7L9J1cNzoVxmxvlOA==",+ "version": "4.3.24",+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-ws/-/tagspaces-ws-4.3.24.tgz",+ "integrity": "sha512-CXKZBIabbg3VNJOZuP7bdWrA3KeCg/SrsQmQTO2ADniz26K8gJnglzcSC/GWAAe17pFdl1PM8qcwvggcVx1tDg==","requires": {- "@tagspaces/tagspaces-workers": "^4.3.23",+ "@tagspaces/tagspaces-workers": "^4.3.24","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.jsonindex 194a47497..3f69e00d9 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.118",- "@tagspaces/tagspaces-common-node": "4.3.23",- "@tagspaces/tagspaces-ws": "4.3.23",+ "@tagspaces/tagspaces-common-node": "4.3.24",+ "@tagspaces/tagspaces-ws": "4.3.24","sharp": "0.32.6","ws": "8.16.0"},diff --git a/src/renderer/components/menus/FileMenu.tsx b/src/renderer/components/menus/FileMenu.tsxindex c74085e2b..91d5daf4b 100644--- a/src/renderer/components/menus/FileMenu.tsx+++ b/src/renderer/components/menus/FileMenu.tsx@@ -358,7 +358,7 @@ function FileMenu(props: Props) {onClick={() => {onClose();if (selectedFilePath) {- openDirectoryMessage(selectedFilePath);+ openFileNatively(selectedFilePath);}}}>diff --git a/src/renderer/hooks/IOActionsContextProvider.tsx b/src/renderer/hooks/IOActionsContextProvider.tsxindex 2300b1b70..a88eba52f 100644--- a/src/renderer/hooks/IOActionsContextProvider.tsx+++ b/src/renderer/hooks/IOActionsContextProvider.tsx@@ -1351,18 +1351,25 @@ export const IOActionsContextProvider = ({}function openFileNatively(selectedFile?: string) {- // todo reload selectedEntries or find better place for this functionif (selectedFile === undefined) {if (selectedEntries && selectedEntries.length > 0) {const fsEntry = selectedEntries[selectedEntries.length - 1];- if (fsEntry.isFile) {- openFileMessage(fsEntry.path, warningOpeningFilesExternally);- } else {- openDirectoryMessage(fsEntry.path);- }+ openFsEntryNatively(fsEntry);+ }+ } else {+ openFsEntryNatively(currentLocation.toFsEntry(selectedFile, true));+ }+ }++ function openFsEntryNatively(fsEntry: TS.FileSystemEntry) {+ if (fsEntry.isFile) {+ if (AppConfig.isCordova) {+ currentLocation.openFile(fsEntry);+ } else {+ openFileMessage(fsEntry.path, warningOpeningFilesExternally);}} else {- openFileMessage(selectedFile, warningOpeningFilesExternally);+ openDirectoryMessage(fsEntry.path);}}diff --git a/src/renderer/services/utils-io.ts b/src/renderer/services/utils-io.tsindex 2d3639220..8ff98d039 100644--- a/src/renderer/services/utils-io.ts+++ b/src/renderer/services/utils-io.ts@@ -907,6 +907,7 @@ export function openFileMessage() {if (AppConfig.isElectron) {window.electronIO.ipcRenderer.sendMessage('openFile', filePath);+ } else if (AppConfig.isCordova) {} else {console.error('Is supported only in Electron');}@@ -995,3 +996,30 @@ export function removePrefix(str, prefix) {}return str.trim();}++export function getMimeType(extension: string): string | undefined {+ const mimeTypes: { [key: string]: string } = {+ txt: 'text/plain',+ html: 'text/html',+ htm: 'text/html',+ css: 'text/css',+ js: 'application/javascript',+ json: 'application/json',+ xml: 'application/xml',+ pdf: 'application/pdf',+ png: 'image/png',+ jpg: 'image/jpeg',+ jpeg: 'image/jpeg',+ gif: 'image/gif',+ bmp: 'image/bmp',+ webp: 'image/webp',+ mp3: 'audio/mpeg',+ wav: 'audio/wav',+ mp4: 'video/mp4',+ avi: 'video/x-msvideo',+ mov: 'video/quicktime',+ zip: 'application/zip',+ rar: 'application/x-rar-compressed',+ };+ return mimeTypes[extension.toLowerCase()];+}diff --git a/src/renderer/utils/CommonLocation.ts b/src/renderer/utils/CommonLocation.tsindex fbdd132f8..a06199ab3 100644--- a/src/renderer/utils/CommonLocation.ts+++ b/src/renderer/utils/CommonLocation.ts@@ -20,6 +20,7 @@ import { TS } from '-/tagspaces.namespace';import {getDescriptionPreview,getFulfilledResults,+ getMimeType,} from '-/services/utils-io';export class CommonLocation implements TS.Location {@@ -924,4 +925,10 @@ export class CommonLocation implements TS.Location {};});};++ openFile = (file: TS.FileSystemEntry): void => {+ if (AppConfig.isCordova) {+ this.ioAPI.openFile(file.path, getMimeType(file.extension));+ }+ };}