aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-08-11 14:32:42 +0200
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-08-17 18:56:38 +0200
commit28725c46a84db6e733c42e38cbc5e1b7f0e3854b (patch)
tree6915d025434815635017439555006a3d2e5e0ee8 /lib/public
parent9df5212a40f5a5011755f987eaf9b63652ef6848 (diff)
downloadnextcloud-server-28725c46a84db6e733c42e38cbc5e1b7f0e3854b.tar.gz
nextcloud-server-28725c46a84db6e733c42e38cbc5e1b7f0e3854b.zip
feat: redirect to the mime icon if no preview available
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Files/IMimeTypeDetector.php6
-rw-r--r--lib/public/Preview/IMimeIconProvider.php37
2 files changed, 43 insertions, 0 deletions
diff --git a/lib/public/Files/IMimeTypeDetector.php b/lib/public/Files/IMimeTypeDetector.php
index 11ba5cfc95f..9992c153edc 100644
--- a/lib/public/Files/IMimeTypeDetector.php
+++ b/lib/public/Files/IMimeTypeDetector.php
@@ -82,4 +82,10 @@ interface IMimeTypeDetector {
* @since 8.2.0
*/
public function mimeTypeIcon($mimeType);
+
+ /**
+ * @return string[]
+ * @since 28.0.0
+ */
+ public function getAllAliases(): array;
}
diff --git a/lib/public/Preview/IMimeIconProvider.php b/lib/public/Preview/IMimeIconProvider.php
new file mode 100644
index 00000000000..cb397ddfda7
--- /dev/null
+++ b/lib/public/Preview/IMimeIconProvider.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license AGPL-3.0-or-later
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+namespace OCP\Preview;
+
+/**
+ * Interface IMimeIconProvider
+ *
+ * @since 28.0.0
+ */
+interface IMimeIconProvider {
+ /**
+ * Get the URL to the icon for the given mime type
+ * Used by the preview provider to show a mime icon
+ * if no preview is available.
+ * @since 28.0.0
+ */
+ public function getMimeIconUrl(string $mime): string|null;
+}