diff --git a/lib/Listener/LoadViewerScript.php b/lib/Listener/LoadViewerScript.php
index 6d125b59b..e946fbafa 100644
--- a/lib/Listener/LoadViewerScript.php
+++ b/lib/Listener/LoadViewerScript.php
@@ -11,6 +11,7 @@
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Viewer\AppInfo\Application;
use OCA\Viewer\Event\LoadViewer;
+use OCP\AppFramework\Services\IAppConfig;
use OCP\AppFramework\Services\IInitialState;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
@@ -23,13 +24,16 @@
class LoadViewerScript implements IEventListener {
private IInitialState $initialStateService;
private IPreview $previewManager;
+ private IAppConfig $appConfig;
public function __construct(
IInitialState $initialStateService,
IPreview $previewManager,
+ IAppConfig $appConfig,
) {
$this->initialStateService = $initialStateService;
$this->previewManager = $previewManager;
+ $this->appConfig = $appConfig;
}
public function handle(Event $event): void {
@@ -37,10 +41,13 @@ public function handle(Event $event): void {
return;
}
+ $alwaysShowViewer = $this->appConfig->getAppValue('always_show_viewer', 'no') === 'yes';
+
Util::addStyle(Application::APP_ID, 'viewer-init');
Util::addStyle(Application::APP_ID, 'viewer-main');
Util::addInitScript(Application::APP_ID, 'viewer-init');
Util::addScript(Application::APP_ID, 'viewer-main', 'files');
$this->initialStateService->provideInitialState('enabled_preview_providers', array_keys($this->previewManager->getProviders()));
+ $this->initialStateService->provideInitialState('always_show_viewer', $alwaysShowViewer);
}
}
diff --git a/package-lock.json b/package-lock.json
index a268d9fae..52e8d99a7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
"license": "AGPL-3.0-or-later",
"dependencies": {
"@fontsource/roboto": "^5.2.5",
- "@mdi/svg": "^7.4.47",
+ "@mdi/svg": "file:../../custom-npms/nc-mdi-svg/dist",
"@nextcloud/auth": "^2.4.0",
"@nextcloud/axios": "^2.5.1",
"@nextcloud/dialogs": "^5.3.8",
@@ -22,7 +22,7 @@
"@nextcloud/paths": "^2.2.1",
"@nextcloud/router": "^3.0.1",
"@nextcloud/typings": "^1.9.1",
- "@nextcloud/vue": "^8.23.1",
+ "@nextcloud/vue": "file:../../custom-npms/nc-nextcloud-vue",
"@skjnldsv/vue-plyr": "^7.5.0",
"camelcase": "^8.0.0",
"debounce": "^2.2.0",
@@ -32,7 +32,7 @@
"react-filerobot-image-editor": "^4.9.1",
"vue": "^2.7.16",
"vue-async-computed": "^3.9.0",
- "vue-material-design-icons": "^5.3.1",
+ "vue-material-design-icons": "file:../../custom-npms/nc-vue-material-design-icons/dist",
"webdav": "^5.7.1"
},
"devDependencies": {
@@ -59,6 +59,117 @@
"npm": "^10.0.0"
}
},
+ "../../custom-npms/nc-mdi-svg/dist": {
+ "version": "7.4.47",
+ "license": "Apache-2.0"
+ },
+ "../../custom-npms/nc-nextcloud-vue": {
+ "version": "8.20.0",
+ "license": "AGPL-3.0-or-later",
+ "dependencies": {
+ "@floating-ui/dom": "^1.1.0",
+ "@linusborg/vue-simple-portal": "^0.1.5",
+ "@nextcloud/auth": "^2.4.0",
+ "@nextcloud/axios": "^2.5.0",
+ "@nextcloud/browser-storage": "^0.4.0",
+ "@nextcloud/capabilities": "^1.2.0",
+ "@nextcloud/event-bus": "^3.3.1",
+ "@nextcloud/initial-state": "^2.2.0",
+ "@nextcloud/l10n": "^3.1.0",
+ "@nextcloud/logger": "^3.0.2",
+ "@nextcloud/router": "^3.0.1",
+ "@nextcloud/sharing": "^0.2.3",
+ "@nextcloud/timezones": "^0.1.1",
+ "@nextcloud/vue-select": "^3.25.1",
+ "@vueuse/components": "^11.0.0",
+ "@vueuse/core": "^11.0.0",
+ "clone": "^2.1.2",
+ "debounce": "^2.2.0",
+ "dompurify": "^3.0.5",
+ "emoji-mart-vue-fast": "^15.0.1",
+ "escape-html": "^1.0.3",
+ "floating-vue": "^1.0.0-beta.19",
+ "focus-trap": "^7.4.3",
+ "linkify-string": "^4.0.0",
+ "md5": "^2.3.0",
+ "rehype-external-links": "^3.0.0",
+ "rehype-highlight": "^7.0.1",
+ "rehype-react": "^7.1.2",
+ "remark-breaks": "^4.0.0",
+ "remark-gfm": "^4.0.0",
+ "remark-parse": "^11.0.0",
+ "remark-rehype": "^11.0.0",
+ "splitpanes": "^2.4.1",
+ "string-length": "^5.0.1",
+ "striptags": "^3.2.0",
+ "tributejs": "^5.1.3",
+ "unified": "^11.0.1",
+ "unist-builder": "^4.0.0",
+ "unist-util-visit": "^5.0.0",
+ "vue": "^2.7.16",
+ "vue-color": "^2.8.1",
+ "vue-frag": "^1.4.3",
+ "vue-router": "^3.6.5",
+ "vue2-datepicker": "^3.11.0"
+ },
+ "devDependencies": {
+ "@babel/plugin-syntax-import-assertions": "^7.22.5",
+ "@babel/preset-typescript": "^7.22.5",
+ "@cypress/vue2": "^2.0.1",
+ "@fontsource/roboto": "^5.1.0",
+ "@jest/globals": "^29.7.0",
+ "@mdi/js": "file:../nc-mdi-js",
+ "@mdi/svg": "file:../nc-mdi-svg/dist",
+ "@nextcloud/babel-config": "^1.2.0",
+ "@nextcloud/browserslist-config": "^3.0.1",
+ "@nextcloud/eslint-config": "^8.4.1",
+ "@nextcloud/stylelint-config": "^3.0.1",
+ "@nextcloud/vite-config": "^1.2.2",
+ "@nextcloud/webpack-vue-config": "^6.0.1",
+ "@testing-library/cypress": "^10.0.2",
+ "@types/gettext-parser": "^4.0.4",
+ "@types/jest": "^29.5.5",
+ "@vue/test-utils": "^1.3.0",
+ "@vue/tsconfig": "^0.5.1",
+ "@vue/vue2-jest": "^29.0.0",
+ "babel-jest": "^29.0.1",
+ "babel-loader-exclude-node-modules-except": "^1.2.1",
+ "core-js": "^3.36.1",
+ "cypress": "^13.6.5",
+ "cypress-visual-regression": "^5.0.0",
+ "eslint-plugin-cypress": "^3.0.0",
+ "file-loader": "^6.2.0",
+ "gettext-extractor": "^3.7.2",
+ "gettext-parser": "^8.0.0",
+ "glob": "^11.0.0",
+ "jest": "^29.0.1",
+ "jest-environment-jsdom": "^29.7.0",
+ "jest-raw-loader": "^1.0.1",
+ "jest-serializer-vue": "^3.1.0",
+ "jest-transform-stub": "^2.0.0",
+ "node-polyfill-webpack-plugin": "^3.0.0",
+ "resolve-url-loader": "^5.0.0",
+ "sanitize-filename": "^1.6.3",
+ "ts-node": "^10.9.1",
+ "typescript": "^5.0.4",
+ "url-loader": "^4.1.1",
+ "vite": "^5.0.10",
+ "vue-eslint-parser": "^9.0.3",
+ "vue-material-design-icons": "file:../nc-vue-material-design-icons/dist",
+ "vue-styleguidist": "~4.72.0",
+ "vue-template-compiler": "^2.7.16",
+ "webpack": "^5.88.1",
+ "webpack-merge": "^6.0.1"
+ },
+ "engines": {
+ "node": "^20.0.0",
+ "npm": "^10.0.0"
+ }
+ },
+ "../../custom-npms/nc-vue-material-design-icons/dist": {
+ "version": "3.2.0",
+ "license": "MIT"
+ },
"node_modules/@actions/core": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
@@ -1552,10 +1663,8 @@
"license": "Apache-2.0"
},
"node_modules/@mdi/svg": {
- "version": "7.4.47",
- "resolved": "https://registry.npmjs.org/@mdi/svg/-/svg-7.4.47.tgz",
- "integrity": "sha512-WQ2gDll12T9WD34fdRFgQVgO8bag3gavrAgJ0frN4phlwdJARpE6gO1YvLEMJR0KKgoc+/Ea/A0Pp11I00xBvw==",
- "license": "Apache-2.0"
+ "resolved": "../../custom-npms/nc-mdi-svg/dist",
+ "link": true
},
"node_modules/@microsoft/api-extractor": {
"version": "7.52.8",
@@ -2140,63 +2249,8 @@
}
},
"node_modules/@nextcloud/vue": {
- "version": "8.27.0",
- "resolved": "https://registry.npmjs.org/@nextcloud/vue/-/vue-8.27.0.tgz",
- "integrity": "sha512-v9aTv5G5zVKN8PJVAP/WTcTspDXr6yxZtgGyQ4El5pZzMWk2+3wANT+VU4mdNCIpiJ2xyYorLs/Gg0Z9y73Anw==",
- "license": "AGPL-3.0-or-later",
- "dependencies": {
- "@floating-ui/dom": "^1.1.0",
- "@linusborg/vue-simple-portal": "^0.1.5",
- "@nextcloud/auth": "^2.4.0",
- "@nextcloud/axios": "^2.5.0",
- "@nextcloud/browser-storage": "^0.4.0",
- "@nextcloud/capabilities": "^1.2.0",
- "@nextcloud/event-bus": "^3.3.2",
- "@nextcloud/initial-state": "^2.2.0",
- "@nextcloud/l10n": "^3.2.0",
- "@nextcloud/logger": "^3.0.2",
- "@nextcloud/router": "^3.0.1",
- "@nextcloud/sharing": "^0.2.3",
- "@nextcloud/timezones": "^0.2.0",
- "@nextcloud/vue-select": "^3.25.1",
- "@vueuse/components": "^11.0.0",
- "@vueuse/core": "^11.0.0",
- "blurhash": "^2.0.5",
- "clone": "^2.1.2",
- "debounce": "^2.2.0",
- "dompurify": "^3.2.4",
- "emoji-mart-vue-fast": "^15.0.4",
- "escape-html": "^1.0.3",
- "floating-vue": "^1.0.0-beta.19",
- "focus-trap": "^7.4.3",
- "linkify-string": "^4.0.0",
- "md5": "^2.3.0",
- "p-queue": "^8.1.0",
- "rehype-external-links": "^3.0.0",
- "rehype-highlight": "^7.0.2",
- "rehype-react": "^7.1.2",
- "remark-breaks": "^4.0.0",
- "remark-parse": "^11.0.0",
- "remark-rehype": "^11.0.0",
- "remark-unlink-protocols": "^1.0.0",
- "splitpanes": "^2.4.1",
- "string-length": "^5.0.1",
- "striptags": "^3.2.0",
- "tabbable": "^6.2.0",
- "tributejs": "^5.1.3",
- "unified": "^11.0.1",
- "unist-builder": "^4.0.0",
- "unist-util-visit": "^5.0.0",
- "vue": "^2.7.16",
- "vue-color": "^2.8.1",
- "vue-frag": "^1.4.3",
- "vue-router": "^3.6.5",
- "vue2-datepicker": "^3.11.0"
- },
- "engines": {
- "node": "^20.0.0",
- "npm": "^10.0.0"
- }
+ "resolved": "../../custom-npms/nc-nextcloud-vue",
+ "link": true
},
"node_modules/@nextcloud/vue-select": {
"version": "3.25.1",
@@ -3423,15 +3477,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/debug": {
- "version": "4.1.12",
- "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
- "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
- "license": "MIT",
- "dependencies": {
- "@types/ms": "*"
- }
- },
"node_modules/@types/docker-modem": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/@types/docker-modem/-/docker-modem-3.0.6.tgz",
@@ -5821,12 +5866,6 @@
"node": ">= 0.10"
}
},
- "node_modules/clamp": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/clamp/-/clamp-1.0.1.tgz",
- "integrity": "sha512-kgMuFyE78OC6Dyu3Dy7vcx4uy97EIbVxJB/B0eJ3bUNAkwdNcxYzgKltnyADiYwsR7SEqkkUPsEUT//OVS6XMA==",
- "license": "MIT"
- },
"node_modules/clean-stack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
@@ -5954,16 +5993,6 @@
"node": ">= 0.8"
}
},
- "node_modules/comma-separated-tokens": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz",
- "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/commander": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
@@ -6506,12 +6535,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/date-format-parse": {
- "version": "0.2.7",
- "resolved": "https://registry.npmjs.org/date-format-parse/-/date-format-parse-0.2.7.tgz",
- "integrity": "sha512-/+lyMUKoRogMuTeOVii6lUwjbVlesN9YRYLzZT/g3TEZ3uD9QnpjResujeEqUW+OSNbT7T1+SYdyEkTcRv+KDQ==",
- "license": "MIT"
- },
"node_modules/dayjs": {
"version": "1.11.13",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz",
@@ -6708,15 +6731,6 @@
"node": ">=18"
}
},
- "node_modules/dequal": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
- "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
- "license": "MIT",
- "engines": {
- "node": ">=6"
- }
- },
"node_modules/des.js": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz",
@@ -6984,19 +6998,6 @@
"typescript": "^5.4.4"
}
},
- "node_modules/devlop": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz",
- "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==",
- "license": "MIT",
- "dependencies": {
- "dequal": "^2.0.0"
- },
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
@@ -10157,12 +10158,6 @@
"node": ">=10"
}
},
- "node_modules/inline-style-parser": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.1.1.tgz",
- "integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q==",
- "license": "MIT"
- },
"node_modules/internal-slot": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
@@ -10188,18 +10183,6 @@
"node": ">= 0.10"
}
},
- "node_modules/is-absolute-url": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz",
- "integrity": "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==",
- "license": "MIT",
- "engines": {
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/is-arguments": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz",
@@ -10587,18 +10570,6 @@
"node": ">=8"
}
},
- "node_modules/is-plain-obj": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
- "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
- "license": "MIT",
- "engines": {
- "node": ">=12"
- },
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
- }
- },
"node_modules/is-plain-object": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
@@ -11283,12 +11254,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/lodash.throttle": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/lodash.throttle/-/lodash.throttle-4.1.1.tgz",
- "integrity": "sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ==",
- "license": "MIT"
- },
"node_modules/lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
@@ -14797,16 +14762,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/space-separated-tokens": {
- "version": "2.0.2",
- "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
- "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/spdx-compare": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz",
@@ -14941,12 +14896,6 @@
"dev": true,
"license": "ISC"
},
- "node_modules/splitpanes": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/splitpanes/-/splitpanes-2.4.1.tgz",
- "integrity": "sha512-kpEo1WuMXuc6QfdQdO2V/fl/trONlkUKp+pputsLTiW9RMtwEvjb4/aYGm2m3+KAzjmb+zLwr4A4SYZu74+pgQ==",
- "license": "MIT"
- },
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -15245,12 +15194,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/striptags": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/striptags/-/striptags-3.2.0.tgz",
- "integrity": "sha512-g45ZOGzHDMe2bdYMdIvdAfCQkCTDMGBazSw1ypMowwGIee7ZQ5dU0rBJ8Jqgl+jAKIv4dbeE1jscZq9wid1Tkw==",
- "license": "MIT"
- },
"node_modules/strnum": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/strnum/-/strnum-2.1.1.tgz",
@@ -15264,15 +15207,6 @@
],
"license": "MIT"
},
- "node_modules/style-to-object": {
- "version": "0.4.4",
- "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-0.4.4.tgz",
- "integrity": "sha512-HYNoHZa2GorYNyqiCaBgsxvcJIn7OHq6inEga+E6Ke3m5JkoqpQbnFssk4jwe+K7AhGa2fcha4wSOf1Kn01dMg==",
- "license": "MIT",
- "dependencies": {
- "inline-style-parser": "0.1.1"
- }
- },
"node_modules/styled-components": {
"version": "6.1.18",
"resolved": "https://registry.npmjs.org/styled-components/-/styled-components-6.1.18.tgz",
@@ -15788,12 +15722,6 @@
"dev": true,
"peer": true
},
- "node_modules/tabbable": {
- "version": "6.2.0",
- "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
- "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==",
- "license": "MIT"
- },
"node_modules/table": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz",
@@ -15935,12 +15863,6 @@
"node": ">=0.6.0"
}
},
- "node_modules/tinycolor2": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
- "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==",
- "license": "MIT"
- },
"node_modules/tinyglobby": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz",
@@ -16039,32 +15961,6 @@
"tree-kill": "cli.js"
}
},
- "node_modules/tributejs": {
- "version": "5.1.3",
- "resolved": "https://registry.npmjs.org/tributejs/-/tributejs-5.1.3.tgz",
- "integrity": "sha512-B5CXihaVzXw+1UHhNFyAwUTMDk1EfoLP5Tj1VhD9yybZ1I8DZJEv8tZ1l0RJo0t0tk9ZhR8eG5tEsaCvRigmdQ==",
- "license": "MIT"
- },
- "node_modules/trim-lines": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz",
- "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
- "node_modules/trough": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz",
- "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/truncate-utf8-bytes": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
@@ -16722,34 +16618,6 @@
"extsprintf": "^1.2.0"
}
},
- "node_modules/vfile": {
- "version": "6.0.3",
- "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
- "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "vfile-message": "^4.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
- "node_modules/vfile-message": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz",
- "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==",
- "license": "MIT",
- "dependencies": {
- "@types/unist": "^3.0.0",
- "unist-util-stringify-position": "^4.0.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/unified"
- }
- },
"node_modules/vite": {
"version": "5.4.19",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",
@@ -17436,10 +17304,8 @@
}
},
"node_modules/vue-material-design-icons": {
- "version": "5.3.1",
- "resolved": "https://registry.npmjs.org/vue-material-design-icons/-/vue-material-design-icons-5.3.1.tgz",
- "integrity": "sha512-6UNEyhlTzlCeT8ZeX5WbpUGFTTPSbOoTQeoASTv7X4Ylh0pe8vltj+36VMK56KM0gG8EQVoMK/Qw/6evalg8lA==",
- "license": "MIT"
+ "resolved": "../../custom-npms/nc-vue-material-design-icons/dist",
+ "link": true
},
"node_modules/vue-resize": {
"version": "1.0.1",
@@ -17472,18 +17338,6 @@
"prettier": "^1.18.2 || ^2.0.0"
}
},
- "node_modules/vue2-datepicker": {
- "version": "3.11.1",
- "resolved": "https://registry.npmjs.org/vue2-datepicker/-/vue2-datepicker-3.11.1.tgz",
- "integrity": "sha512-6PU/+pnp2mgZAfnSXmbdwj9516XsEvTiw61Q5SNrvvdy8W/FCxk1GAe9UZn/m9YfS5A47yK6XkcjMHbp7aFApA==",
- "license": "MIT",
- "dependencies": {
- "date-format-parse": "^0.2.7"
- },
- "peerDependencies": {
- "vue": "^2.5.0"
- }
- },
"node_modules/wait-on": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-8.0.3.tgz",
@@ -17515,16 +17369,6 @@
"defaults": "^1.0.3"
}
},
- "node_modules/web-namespaces": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz",
- "integrity": "sha512-bKr1DkiNa2krS7qxNtdrtHAmzuYGFQLiQ13TsorsdT6ULTkPLKuu5+GsFpDlg6JFjUTwX2DyhMPG2be8uPrqsQ==",
- "license": "MIT",
- "funding": {
- "type": "github",
- "url": "https://github.com/sponsors/wooorm"
- }
- },
"node_modules/web-streams-polyfill": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
diff --git a/package.json b/package.json
index 9eef3d40a..64372eb88 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
},
"dependencies": {
"@fontsource/roboto": "^5.2.5",
- "@mdi/svg": "^7.4.47",
+ "@mdi/svg": "file:../../custom-npms/nc-mdi-svg/dist",
"@nextcloud/auth": "^2.4.0",
"@nextcloud/axios": "^2.5.1",
"@nextcloud/dialogs": "^5.3.8",
@@ -53,7 +53,7 @@
"@nextcloud/paths": "^2.2.1",
"@nextcloud/router": "^3.0.1",
"@nextcloud/typings": "^1.9.1",
- "@nextcloud/vue": "^8.23.1",
+ "@nextcloud/vue": "file:../../custom-npms/nc-nextcloud-vue",
"@skjnldsv/vue-plyr": "^7.5.0",
"camelcase": "^8.0.0",
"debounce": "^2.2.0",
@@ -63,7 +63,7 @@
"react-filerobot-image-editor": "^4.9.1",
"vue": "^2.7.16",
"vue-async-computed": "^3.9.0",
- "vue-material-design-icons": "^5.3.1",
+ "vue-material-design-icons": "file:../../custom-npms/nc-vue-material-design-icons/dist",
"webdav": "^5.7.1"
},
"browserslist": [
diff --git a/src/components/Default.vue b/src/components/Default.vue
new file mode 100644
index 000000000..3fcb7b698
--- /dev/null
+++ b/src/components/Default.vue
@@ -0,0 +1,67 @@
+
+
+
+
![mimetype-icon]()
+
+ {{ basename }}
+
+
+
+
+
+
+
diff --git a/src/components/Images.vue b/src/components/Images.vue
index 7d3b30f39..09c8a4b33 100644
--- a/src/components/Images.vue
+++ b/src/components/Images.vue
@@ -12,7 +12,8 @@
@close="onClose" />
-
+
node.type === 'folder')
+ }
+
return nodes.every((node) =>
Boolean(node.permissions & Permission.READ)
&& window.OCA.Viewer.mimetypes.includes(node.mime),
diff --git a/src/models/config.ts b/src/models/config.ts
new file mode 100644
index 000000000..ca6096b6b
--- /dev/null
+++ b/src/models/config.ts
@@ -0,0 +1,13 @@
+/**
+ * SPDX-FileLicenseText: 2024 STRATO AG
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ * SPDX-FileContributor: Mikhailo Matiyenko-Kupriyanov
+ */
+import { loadState } from '@nextcloud/initial-state'
+
+const alwaysShowViewer = loadState('viewer', 'always_show_viewer', false)
+
+export default {
+ alwaysShowViewer,
+ defaultMimeType: 'all',
+}
diff --git a/src/models/default.ts b/src/models/default.ts
new file mode 100644
index 000000000..94ef98f3a
--- /dev/null
+++ b/src/models/default.ts
@@ -0,0 +1,17 @@
+/**
+ * SPDX-FileCopyrightText: 2024 STRATO AG
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import Default from '../components/Default.vue'
+import config from './config.ts'
+
+export default {
+ id: 'default',
+ group: 'other',
+ mimes: [
+ config.defaultMimeType,
+ ],
+ mimesAliases: {},
+ component: Default,
+}
diff --git a/src/services/Viewer.js b/src/services/Viewer.js
index 9e91eb6dc..db1889439 100644
--- a/src/services/Viewer.js
+++ b/src/services/Viewer.js
@@ -6,6 +6,7 @@
import Images from '../models/images.js'
import Videos from '../models/videos.js'
import Audios from '../models/audios.js'
+import Default from '../models/default.ts'
import logger from './logger.js'
/**
@@ -61,6 +62,7 @@ export default class Viewer {
this.registerHandler(Images)
this.registerHandler(Videos)
this.registerHandler(Audios)
+ this.registerHandler(Default)
logger.debug('OCA.Viewer initialized')
}
diff --git a/src/utils/livePhotoUtils.ts b/src/utils/livePhotoUtils.ts
index 432252b15..20afec18c 100644
--- a/src/utils/livePhotoUtils.ts
+++ b/src/utils/livePhotoUtils.ts
@@ -26,6 +26,6 @@ export function findLivePhotoPeerFromName(referenceFile: BasicFileInfo, fileList
return fileList.find(comparedFile => {
// if same filename and extension is allowed
return comparedFile.filename !== referenceFile.filename
- && (comparedFile.basename.startsWith(referenceFile.name) && livePictureExtRegex.test(comparedFile.basename))
+ && (comparedFile.basename.toString().startsWith(referenceFile.name) && livePictureExtRegex.test(comparedFile.basename))
})
}
diff --git a/src/views/Viewer.vue b/src/views/Viewer.vue
index cb7279caf..edbbe9279 100644
--- a/src/views/Viewer.vue
+++ b/src/views/Viewer.vue
@@ -44,7 +44,7 @@
:inline-actions="canEdit ? 1 : 0"
:spread-navigation="true"
:style="{ width: isSidebarShown ? `${sidebarPosition}px` : null }"
- :name="currentFile.basename"
+ :name="modalTitle"
class="viewer"
size="full"
@close="close"
@@ -190,6 +190,7 @@ import { canDownload } from '../utils/canDownload.ts'
import { extractFilePaths, sortCompare } from '../utils/fileUtils.ts'
import getSortingConfig from '../services/FileSortingConfig.ts'
import cancelableRequest from '../utils/CancelableRequest.js'
+import configModule from '../models/config.ts'
import Error from '../components/Error.vue'
import File from '../models/file.js'
import getFileInfo from '../services/FileInfo.ts'
@@ -395,6 +396,14 @@ export default defineComponent({
}
},
+ modalTitle() {
+ if (!configModule.alwaysShowViewer) {
+ return this.currentFile.basename
+ }
+
+ return this.currentFile?.modal?.name === 'Default' ? '' : this.currentFile.basename
+ },
+
showComparison() {
return !this.isMobile
},
@@ -680,6 +689,11 @@ export default defineComponent({
handler = this.registeredHandlers[mime] ?? this.registeredHandlers[alias]
}
+ // fallback to default viewer if enabled
+ if (!handler && configModule.alwaysShowViewer) {
+ handler = this.registeredHandlers[configModule.defaultMimeType]
+ }
+
// if we don't have a handler for this mime, abort
if (!handler) {
logger.error('The following file could not be displayed', { fileInfo })
@@ -697,8 +711,10 @@ export default defineComponent({
this.comparisonFile = null
this.updatePreviousNext()
+ // fallback to default viewer group if enabled
+ const groupFallback = configModule.alwaysShowViewer ? this.mimeGroups[configModule.defaultMimeType] : undefined
// check if part of a group, if so retrieve full files list
- const group = this.mimeGroups[mime]
+ const group = this.mimeGroups[mime] ?? groupFallback
if (this.files && this.files.length > 0) {
logger.debug('A files list have been provided. No folder content will be fetched.')
// we won't sort files here, let's use the order the array has
@@ -721,8 +737,22 @@ export default defineComponent({
const fileList = await folderRequest(dirPath)
- // filter out the unwanted mimes
- const filteredFiles = fileList.filter(file => file.mime && mimes.indexOf(file.mime) !== -1)
+ let filteredFiles
+ if (configModule.alwaysShowViewer) {
+ // only include files with mime to exclude directories
+ // and office documents/pdfs to exclude collabora files
+ // otherwise accept all mimes
+ filteredFiles = fileList.filter(file => {
+ const mime = file?.mime;
+ const isOfficeDocument = mime && OC.MimeTypeList.aliases[mime]?.startsWith('x-office');
+ const isPdf = mime && mime === 'application/pdf';
+
+ return mime && !isOfficeDocument && !isPdf;
+ })
+ } else {
+ // filter out the unwanted mimes
+ filteredFiles = fileList.filter(file => file.mime && mimes.indexOf(file.mime) !== -1)
+ }
// sort like the files list
// TODO: implement global sorting API
@@ -749,7 +779,7 @@ export default defineComponent({
openFileFromList(fileInfo) {
// override mimetype if existing alias
const mime = fileInfo.mime
- this.currentFile = new File(fileInfo, mime, this.components[mime])
+ this.currentFile = new File(fileInfo, mime, this.components[mime] || this.components[configModule.defaultMimeType])
this.changeSidebar()
this.updatePreviousNext()
},