Skip to content

Commit

Permalink
FIx deprecations in Nextcloud 24. Dropping ownCloud support.
Browse files Browse the repository at this point in the history
  • Loading branch information
ariselseng committed Jun 12, 2022
1 parent c80b326 commit 7ce41b2
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 55 deletions.
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ appstore:
--exclude=".*" \
--exclude="sign-*.sh"

docker run --user 1000 --rm -v $(appstore_build_directory)/$(app_name):/$(app_name) -v ~/.owncloud/certificates:/certs owncloud/server:10.0.9 php occ integrity:sign-app --path=/$(app_name) --privateKey="/certs/camerarawpreviews.key" --certificate="/certs/camerarawpreviews.crt"
tar -czlf build/$(app_name)_owncloud.tar.gz -C "$(appstore_build_directory)" $(app_name)
rm "$(appstore_build_directory)"/$(app_name)/appinfo/signature.json
docker run --rm -v $(appstore_build_directory)/$(app_name):/$(app_name) -v ~/.nextcloud/certificates:/certs nextcloud:17-apache php /usr/src/nextcloud/occ integrity:sign-app --path=/$(app_name) --privateKey="/certs/camerarawpreviews.key" --certificate="/certs/camerarawpreviews.crt"
docker run --rm -v $(appstore_build_directory)/$(app_name):/$(app_name) -v ~/.nextcloud/certificates:/certs nextcloud:24-apache php /usr/src/nextcloud/occ integrity:sign-app --path=/$(app_name) --privateKey="/certs/camerarawpreviews.key" --certificate="/certs/camerarawpreviews.crt"
tar -czf build/$(app_name)_nextcloud.tar.gz -C "$(appstore_build_directory)" $(app_name)

# Builds the source package for the app store, ignores php and js tests
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Camera RAW Previews
[![Github All Releases](https://img.shields.io/github/downloads/ariselseng/camerarawpreviews/total.svg)](https://github.com/ariselseng/camerarawpreviews/releases) [![paypal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/AriSelseng/2EUR)

A Nextcloud/ownCloud app that provides previews for camera RAW images like .CR2, .CRW, .DNG, .MRW, .NEF, .NRW, .RW2, .SRW, .SRW, etc.
A Nextcloud app that provides previews for camera RAW images like .CR2, .CRW, .DNG, .MRW, .NEF, .NRW, .RW2, .SRW, .SRW, etc.
This app also gives you preview of Adobe Indesign files (.INDD).


Expand All @@ -14,7 +14,7 @@ This app also gives you preview of Adobe Indesign files (.INDD).
Install in Nextcloud App store.
https://apps.nextcloud.com/apps/camerarawpreviews

Install in ownCloud Marketplace
Install in ownCloud Marketplace (older version that is not supported anymore, due to too much difference between owncloud and nextcloud now)
https://marketplace.owncloud.com/apps/camerarawpreviews

## Building locally
Expand Down
6 changes: 0 additions & 6 deletions appinfo/app.php

This file was deleted.

9 changes: 4 additions & 5 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>camerarawpreviews</id>
<name>Camera RAW Previews</name>
<summary>Preview and show camera RAW files in Nextcloud/ownCloud</summary>
<summary>Preview and show camera RAW files in Nextcloud</summary>
<description>
<![CDATA[This app will make previews of &quot;RAW&quot; files from cameras in Nextcloud/ownCloud.]]></description>
<version>0.7.15</version>
<![CDATA[This app will make previews of &quot;RAW&quot; files from cameras in Nextcloud.]]></description>
<version>0.7.16</version>
<licence>agpl</licence>
<author mail="ari@selseng.net" >Ari Selseng</author>
<namespace>CameraRawPreviews</namespace>
Expand All @@ -16,8 +16,7 @@
<bugs>https://github.com/ariselseng/camerarawpreviews/issues</bugs>
<dependencies>
<php min-version="7.2"></php>
<owncloud min-version="10.0.9" max-version="10"/>
<nextcloud min-version="17" max-version="23"/>
<nextcloud min-version="23" max-version="24"/>
</dependencies>
<types><filesystem/></types>
</info>
35 changes: 17 additions & 18 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

namespace OCA\CameraRawPreviews\AppInfo;

use OCA\CameraRawPreviews\RawPreviewIProvider2;
use OCA\CameraRawPreviews\RawPreviewIProviderV2;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\AppFramework\App;
use OCP\Util;

class Application extends App
class Application extends App implements IBootstrap
{
private $appName = 'camerarawpreviews';

Expand All @@ -16,30 +19,28 @@ public function __construct()
parent::__construct($this->appName);
}

public function register()
{
$this->registerScripts();
$this->registerProvider();
public function register(IRegistrationContext $context): void {
include_once __DIR__ . '/../../vendor/autoload.php';

$this->registerProvider($context);
}

private function registerScripts()
private function registerScripts(IBootContext $context)
{

if (!class_exists('\OCA\Viewer\Event\LoadViewer')) {
return;
}

$eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher();
$eventDispatcher = $context->getServerContainer()->get(IEventDispatcher::class);
$eventDispatcher->addListener(\OCA\Viewer\Event\LoadViewer::class, function () {
Util::addScript($this->appName, 'register-viewer'); // adds js/script.js
});
}

private function registerProvider()
private function registerProvider(IRegistrationContext $context)
{
$appName = $this->appName;
$server = $this->getContainer()->getServer();
$logger = $server->getLogger();
$previewManager = $server->query('PreviewManager');
$mimeTypeDetector = $server->getMimeTypeDetector();
$mimeTypeDetector->getAllMappings(); // is really needed

Expand Down Expand Up @@ -72,13 +73,11 @@ private function registerProvider()
'x3f' => ['image/x-dcraw'],
];
$mimeTypeDetector->registerTypeArray($mimesToDetect);
$context->registerPreviewProvider(RawPreviewIProviderV2::class, '/^((image\/x-dcraw)|(image\/x-indesign))(;+.*)*$/');
}

$previewManager->registerProvider('/^((image\/x-dcraw)|(image\/x-indesign))(;+.*)*$/', function () use ($logger, $appName) {
if (interface_exists('\OCP\Preview\IProvider2')) {
return new RawPreviewIProvider2($logger, $appName);
}
return new RawPreviewIProviderV2($logger, $appName);
});
public function boot(IBootContext $context): void {
$this->registerScripts($context);
}

}
5 changes: 2 additions & 3 deletions lib/RawPreviewBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace OCA\CameraRawPreviews;

require __DIR__ . '/../vendor/autoload.php';

use Exception;
use Intervention\Image\ImageManagerStatic as Image;
Expand All @@ -25,10 +24,10 @@ class RawPreviewBase
protected $appName;
protected $tmpFiles = [];

public function __construct(ILogger $logger, string $appName)
public function __construct(ILogger $logger)
{
$this->logger = $logger;
$this->appName = $appName;
$this->appName = 'camerarawpreviews';
}

/**
Expand Down
18 changes: 0 additions & 18 deletions lib/RawPreviewIProvider2.php

This file was deleted.

0 comments on commit 7ce41b2

Please sign in to comment.