Skip to content

Commit

Permalink
feat: add preview provider for emf files
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Nov 17, 2023
1 parent 95be6b0 commit e71ecbb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use OCA\Richdocuments\Listener\ShareLinkListener;
use OCA\Richdocuments\Middleware\WOPIMiddleware;
use OCA\Richdocuments\PermissionManager;
use OCA\Richdocuments\Preview\EMF;
use OCA\Richdocuments\Preview\MSExcel;
use OCA\Richdocuments\Preview\MSWord;
use OCA\Richdocuments\Preview\OOXML;
Expand Down Expand Up @@ -88,6 +89,7 @@ public function register(IRegistrationContext $context): void {
'getPathForToken',
'getWopiForToken',
]);
$context->registerPreviewProvider(EMF::class, '/image\/emf/');

Check failure on line 92 in lib/AppInfo/Application.php

View workflow job for this annotation

GitHub Actions / Nextcloud

MissingDependency

lib/AppInfo/Application.php:92:37: MissingDependency: OCA\Richdocuments\Preview\EMF depends on class or interface oc\preview\provider that does not exist (see https://psalm.dev/157)
}

public function boot(IBootContext $context): void {
Expand Down
35 changes: 35 additions & 0 deletions lib/Preview/EMF.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

/**
* @copyright 2023 Daniel Kesselberg <[email protected]>
*
* @author Daniel Kesselberg <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Richdocuments\Preview;

class EMF extends Office {

Check failure on line 28 in lib/Preview/EMF.php

View workflow job for this annotation

GitHub Actions / Nextcloud

MissingDependency

lib/Preview/EMF.php:28:19: MissingDependency: OCA\Richdocuments\Preview\Office depends on class or interface oc\preview\provider that does not exist (see https://psalm.dev/157)
/**
* {@inheritDoc}
*/
public function getMimeType() {
return '/image\/emf/';
}
}

0 comments on commit e71ecbb

Please sign in to comment.