Skip to content

Commit

Permalink
Add support for NC 21
Browse files Browse the repository at this point in the history
Signed-off-by: ACTom <i@actom.me>
  • Loading branch information
ACTom committed Dec 28, 2020
1 parent 60f7963 commit 0e76277
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source_dir=$(build_dir)/source
sign_dir=$(build_dir)/sign
package_name=$(app_name)
cert_dir=$(CURDIR)/../../key
version+=0.0.23
version+=0.0.24

all: appstore

Expand Down
6 changes: 3 additions & 3 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<name>Mind Map</name>
<summary>A Mind map editor</summary>
<description><![CDATA[This application enables Nextcloud users to open, save and edit mind map files in the web browser. If enabled, an entry in the New button at the top of the web browser the Mindmap file entry appears. When clicked, a new mindmap file opens in the browser and the file can be saved into the current Nextcloud directory.]]></description>
<version>0.0.23</version>
<version>0.0.24</version>
<licence>agpl</licence>
<author mail="i@actom.me" homepage="https://actom.me">Jingtao Yan</author>
<namespace>Files_MindMap</namespace>
<category>files</category>
<category>office</category>
<website>https://github.com/ACTom/files_mindmap</website>
<bugs>https://github.com/ACTom/files_mindmap/issues</bugs>
<repository type="git">https://github.com/ACTom/files_mindmap.git</repository>
<website>https://github.com/ACTom/files_mindmap</website>
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/1-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/1.png</screenshot>
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/2-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/2.png</screenshot>
<screenshot small-thumbnail="https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/3-small.png">https://raw.githubusercontent.com/ACTom/files_mindmap/master/screenshots/3.png</screenshot>
<dependencies>
<nextcloud min-version="14" max-version="20"/>
<nextcloud min-version="14" max-version="21"/>
</dependencies>
<repair-steps>
<install>
Expand Down
15 changes: 9 additions & 6 deletions lib/Migration/InstallStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,17 @@ public function getName() {
/**
* @param IOutput $output
*/
public function run(IOutput $output) {
public function run(IOutput $output) {
$currentVersion = implode('.', \OC_Util::getVersion());

$this->logger->info("Copy mindmap icon to core/img directory.", ["app" => "files_mindmap"]);
$appImagePath = __DIR__ . '/../../img/mindmap.svg';
$coreImagePath = \OC::$SERVERROOT . '/core/img/filetypes/mindmap.svg';
if (!file_exists($coreImagePath) || md5_file($coreImagePath) !== md5_file($appImagePath)) {
copy($appImagePath, $coreImagePath);
if (version_compare($currentVersion, '21.0.0.11', '<')) {
/* Since 21.0.0 beta4, NC has mindmap's mimetype icon */
$this->logger->info("Copy mindmap icon to core/img directory.", ["app" => "files_mindmap"]);
$appImagePath = __DIR__ . '/../../img/mindmap.svg';
$coreImagePath = \OC::$SERVERROOT . '/core/img/filetypes/mindmap.svg';
if (!file_exists($coreImagePath) || md5_file($coreImagePath) !== md5_file($appImagePath)) {
copy($appImagePath, $coreImagePath);
}
}

if (version_compare($currentVersion, '19.0.0.4', '<')) {
Expand Down
20 changes: 12 additions & 8 deletions lib/Migration/UninstallStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,18 @@ public function getName() {
* @param IOutput $output
*/
public function run(IOutput $output) {
$configDir = \OC::$configDir;
$mimetypealiasesFile = $configDir . 'mimetypealiases.json';
$mimetypemappingFile = $configDir . 'mimetypemapping.json';

$this->removeFromFile($mimetypealiasesFile, ['application/km' => 'mindmap', 'application/x-freemind' => 'mindmap', 'application/vnd.xmind.workbook' => 'mindmap']);
$this->removeFromFile($mimetypemappingFile, ['km' => ['application/km'], 'mm' => ['application/x-freemind'], 'xmind' => ['application/vnd.xmind.workbook']]);
$this->logger->info("Remove .km,.mm,.xmind from mimetype list.", ["app" => "files_mindmap"]);
$this->updateJS->run(new StringInput(''), new ConsoleOutput());
$currentVersion = implode('.', \OC_Util::getVersion());
if (version_compare($currentVersion, '19.0.0.4', '<')) {
/* Since 19.0.0.beta3, NC has mindmap's mimetype */
$configDir = \OC::$configDir;
$mimetypealiasesFile = $configDir . 'mimetypealiases.json';
$mimetypemappingFile = $configDir . 'mimetypemapping.json';

$this->removeFromFile($mimetypealiasesFile, ['application/km' => 'mindmap', 'application/x-freemind' => 'mindmap', 'application/vnd.xmind.workbook' => 'mindmap']);
$this->removeFromFile($mimetypemappingFile, ['km' => ['application/km'], 'mm' => ['application/x-freemind'], 'xmind' => ['application/vnd.xmind.workbook']]);
$this->logger->info("Remove .km,.mm,.xmind from mimetype list.", ["app" => "files_mindmap"]);
$this->updateJS->run(new StringInput(''), new ConsoleOutput());
}
}

private function removeFromFile(string $filename, array $data) {
Expand Down

0 comments on commit 0e76277

Please sign in to comment.