[Scummvm-git-logs] scummvm-web master -> 290142bcd478d800137bc6986be203e7e51a09a3
Mataniko
mataniko at gmail.com
Mon Nov 19 13:57:01 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .
Summary:
290142bcd4 WEB: Add SHA256 to Downloads
Commit: 290142bcd478d800137bc6986be203e7e51a09a3
https://github.com/scummvm/scummvm-web/commit/290142bcd478d800137bc6986be203e7e51a09a3
Author: Matan Bareket (mataniko at gmail.com)
Date: 2018-11-19T07:52:59-05:00
Commit Message:
WEB: Add SHA256 to Downloads
Changed paths:
include/Objects/File.php
templates/components/list_items.tpl
diff --git a/include/Objects/File.php b/include/Objects/File.php
index 0ab796a..76c906a 100644
--- a/include/Objects/File.php
+++ b/include/Objects/File.php
@@ -64,6 +64,14 @@ class File extends BasicObject {
if ($ext == '.bz2' || $ext == '.gz' || $ext == '.xz' || $ext == '.7z')
$ext = substr($url, strrpos($url, '.', -(strlen($url) - strrpos($url, '.') + 1)));
+ if (is_file($fname . '.sha256') && is_readable($fname . '.sha256')) {
+ $this->_extra_info['sha256'] = file_get_contents($fname . '.sha256');
+ } else {
+ $hash = hash_file('sha256', $fname);
+ $this->_extra_info['sha256'] = $hash;
+ file_put_contents($fname . '.sha256', $hash);
+ }
+
$this->_extra_info['ext'] = $ext;
$this->_extra_info['msg'] = $data['extra_msg'];
}
diff --git a/templates/components/list_items.tpl b/templates/components/list_items.tpl
index 0eb276f..c95ba3b 100644
--- a/templates/components/list_items.tpl
+++ b/templates/components/list_items.tpl
@@ -1,7 +1,7 @@
{if is_array($list) && $list|@count > 0}
- <ul class="downloads">
- {foreach from=$list item=item}
- {if $item instanceof File}
+ <ul class="downloads">
+ {foreach from=$list item=item}
+ {if $item instanceof File}
{assign var='data' value=$item->getExtraInfo()}
<li class="file">
<span class="sprite-{$type}-{$item->getCategoryIcon()} sprite"></span>
@@ -11,7 +11,8 @@
{if is_array($data)}
(
{if $item->getType() == 'daily'}{#listItemsBuildFromRepo#} {/if}
- {$data.size} {if $data.ext == '.exe'}Win32 {/if}{$data.ext}{if $data.date != ""}{#listItemsDate#} {$data.date}{/if}
+ {$data.size} {if $data.ext == '.exe'}Win32 {/if}{$data.ext}{if $data.date != ""}{#listItemsDate#} {$data.date}{/if}
+ {if $data.sha256 != ""} sha256: <a href="{eval var=$item->getURL()}.sha256">{$data.sha256}</a>{/if}
) {if $data.msg != ""}{$data.msg}{/if}
{else}
{if $item->getType() != 'daily'}
More information about the Scummvm-git-logs
mailing list