diff options
-rw-r--r-- | Changelog.md | 5 | ||||
-rw-r--r-- | appinfo/info.xml | 15 | ||||
-rw-r--r-- | js/checksum.tabview.js | 12 | ||||
-rw-r--r-- | lib/Controller/ChecksumController.php | 6 |
4 files changed, 28 insertions, 10 deletions
diff --git a/Changelog.md b/Changelog.md index 53ba31e..f8a695f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,11 @@ Changelog ========= +**0.3.4** +- updated info.xml +- added error handling if hash algorithm is not supported by server +- added reload button on ajax error response + **0.3.3** - added sha384 diff --git a/appinfo/info.xml b/appinfo/info.xml index 6b10580..5f008d0 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,8 +4,19 @@ <id>checksum</id> <name>Checksum</name> <summary>Creating a hash checksum of a file.</summary> - <description>Creating a hash checksum of a file.</description> - <version>0.3.3</version> + <description> + Creating a hash checksum of a file. + Possible algorithms are md5, sha1, sha256, sha384, sha512 and crc32. + + Just open the details view of the file (Sidebar). There should be a new tab called "Checksum". + Select a algorithm and it will try to generate a hash. + If you want an other algorithm, just click on the reload button. + </description> + <documentation> + <user>https://github.com/westberliner/owncloud-checksum/blob/v0.3.4/README.md</user> + <admin>https://github.com/westberliner/owncloud-checksum/blob/v0.3.4/README.md</admin> + </documentation> + <version>0.3.4</version> <licence>agpl</licence> <author>westberliner</author> <types> diff --git a/js/checksum.tabview.js b/js/checksum.tabview.js index 710e0b1..a95cdaa 100644 --- a/js/checksum.tabview.js +++ b/js/checksum.tabview.js @@ -94,15 +94,17 @@ var msg = ''; if('success' == data.response) { msg = algorithmType + ': ' + data.msg; - msg += '<br><br><a id="reload-checksum" class="icon icon-history" style="display:block" href=""></a>'; - - this.delegateEvents({ - 'click #reload-checksum': '_onReloadEvent' - }); } if('error' == data.response) { msg = data.msg; } + + msg += '<br><br><a id="reload-checksum" class="icon icon-history" style="display:block" href=""></a>'; + + this.delegateEvents({ + 'click #reload-checksum': '_onReloadEvent' + }); + this.$el.find('.get-checksum').html(msg); }, diff --git a/lib/Controller/ChecksumController.php b/lib/Controller/ChecksumController.php index 8784c57..da31f59 100644 --- a/lib/Controller/ChecksumController.php +++ b/lib/Controller/ChecksumController.php @@ -27,12 +27,11 @@ class ChecksumController extends Controller { * @param (string) $type - hash algorithm type */ public function check($source, $type) { - if(!$this->checkAlgorithmType($type)) { return new JSONResponse( array( 'response' => 'error', - 'msg' => $this->language->t('This is not a valid algorithm type.') + 'msg' => $this->language->t('The algorithm type "%s" is not a valid or supported algorithm type.', array($type)) ) ); } @@ -65,7 +64,8 @@ class ChecksumController extends Controller { } protected function checkAlgorithmType($type) { - return in_array($type, $this->getAllowedAlgorithmTypes()); + $list_algos = hash_algos(); + return in_array($type, $this->getAllowedAlgorithmTypes()) && in_array($type, $list_algos); } protected function getAllowedAlgorithmTypes() { |