mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Minor improvements (#1490)
* Minor improvements * Update CHANGELOG.md * Update functions.php * Update build_check_updates.php * Update index.php * Updated
This commit is contained in:
parent
33720fb284
commit
3db9095b78
6 changed files with 43 additions and 30 deletions
|
@ -20,9 +20,9 @@
|
|||
- Demo mode: Allow registering torrents by default [\#1440](https://github.com/torrentpier/torrentpier/pull/1440) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Temp: Removed showing forum description in `viewforum.php` [\#1465](https://github.com/torrentpier/torrentpier/pull/1465) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Code refactoring [\#1441](https://github.com/torrentpier/torrentpier/pull/1441) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481), [\#1482](https://github.com/torrentpier/torrentpier/pull/1482), [\#1484](https://github.com/torrentpier/torrentpier/pull/1484) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Minor improvements [\#1435](https://github.com/torrentpier/torrentpier/pull/1435), [\#1443](https://github.com/torrentpier/torrentpier/pull/1443), [\#1446](https://github.com/torrentpier/torrentpier/pull/1446), [\#1450](https://github.com/torrentpier/torrentpier/pull/1450), [\#1452](https://github.com/torrentpier/torrentpier/pull/1452), [\#1458](https://github.com/torrentpier/torrentpier/pull/1458), [\#1461](https://github.com/torrentpier/torrentpier/pull/1461), [\#1462](https://github.com/torrentpier/torrentpier/pull/1462), [\#1467](https://github.com/torrentpier/torrentpier/pull/1467), [\#1469](https://github.com/torrentpier/torrentpier/pull/1469), [\#1472](https://github.com/torrentpier/torrentpier/pull/1472), [\#1477](https://github.com/torrentpier/torrentpier/pull/1477), [\#1480](https://github.com/torrentpier/torrentpier/pull/1480), [\#1481](https://github.com/torrentpier/torrentpier/pull/1481), [\#1482](https://github.com/torrentpier/torrentpier/pull/1482), [\#1484](https://github.com/torrentpier/torrentpier/pull/1484), [\#1490](https://github.com/torrentpier/torrentpier/pull/1490) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Updated deps [\#1454](https://github.com/torrentpier/torrentpier/pull/1454), [\#1455](https://github.com/torrentpier/torrentpier/pull/1455), [\#1459](https://github.com/torrentpier/torrentpier/pull/1459), [\#1460](https://github.com/torrentpier/torrentpier/pull/1460), [\#1485](https://github.com/torrentpier/torrentpier/pull/1485), [\#1486](https://github.com/torrentpier/torrentpier/pull/1486) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479), [\#1487](https://github.com/torrentpier/torrentpier/pull/1487) ([Exileum](https://github.com/Exileum))
|
||||
- New Crowdin updates [\#1444](https://github.com/torrentpier/torrentpier/pull/1444), [\#1447](https://github.com/torrentpier/torrentpier/pull/1447), [\#1453](https://github.com/torrentpier/torrentpier/pull/1453), [\#1468](https://github.com/torrentpier/torrentpier/pull/1468), [\#1473](https://github.com/torrentpier/torrentpier/pull/1473), [\#1476](https://github.com/torrentpier/torrentpier/pull/1476), [\#1479](https://github.com/torrentpier/torrentpier/pull/1479), [\#1487](https://github.com/torrentpier/torrentpier/pull/1487), [\#1489](https://github.com/torrentpier/torrentpier/pull/1489) ([Exileum](https://github.com/Exileum))
|
||||
|
||||
## [v2.4.2](https://github.com/torrentpier/torrentpier/tree/v2.4.2) (2024-03-30)
|
||||
[Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.1...v2.4.2)
|
||||
|
|
|
@ -83,13 +83,16 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') {
|
|||
]);
|
||||
|
||||
// Check for updates
|
||||
$template->assign_block_vars('updater', [
|
||||
'UPDATE_AVAILABLE' => $update_data['available_update'],
|
||||
'NEW_VERSION_NUMBER' => $update_data['latest_version'],
|
||||
'NEW_VERSION_SIZE' => $update_data['latest_version_size'],
|
||||
'NEW_VERSION_DL_LINK' => $update_data['latest_version_dl_link'],
|
||||
'NEW_VERSION_LINK' => $update_data['latest_version_link'],
|
||||
]);
|
||||
if (!empty($update_data)) {
|
||||
$template->assign_block_vars('updater', [
|
||||
'UPDATE_AVAILABLE' => $update_data['available_update'],
|
||||
'NEW_VERSION_NUMBER' => $update_data['latest_version'],
|
||||
'NEW_VERSION_SIZE' => $update_data['latest_version_size'],
|
||||
'NEW_VERSION_DL_LINK' => $update_data['latest_version_dl_link'],
|
||||
'NEW_VERSION_LINK' => $update_data['latest_version_link'],
|
||||
'NEW_VERSION_MD5' => $update_data['latest_version_checksum']
|
||||
]);
|
||||
}
|
||||
|
||||
// Get forum statistics
|
||||
$total_posts = $stats['postcount'];
|
||||
|
|
|
@ -60,4 +60,4 @@ if (IN_DEMO_MODE) {
|
|||
}
|
||||
|
||||
// Check for updates
|
||||
$datastore->rm('check_updates');
|
||||
$datastore->update('check_updates');
|
||||
|
|
|
@ -26,21 +26,30 @@ if ($updater_content !== false) {
|
|||
if (is_array($json_response) && !empty($json_response)) {
|
||||
$get_version = $json_response['tag_name'];
|
||||
$version_code_actual = (int)trim(str_replace(['.', 'v'], '', $get_version));
|
||||
$has_update = VERSION_CODE < $version_code_actual;
|
||||
|
||||
// Save current version & latest available
|
||||
if ($has_update) {
|
||||
// Has update!
|
||||
if (VERSION_CODE < $version_code_actual) {
|
||||
$latest_release_file = $json_response['assets'][0]['browser_download_url'];
|
||||
|
||||
// Save current version & latest available
|
||||
file_write(VERSION_CODE . "\n" . $version_code_actual, UPDATER_FILE, replace_content: true);
|
||||
}
|
||||
|
||||
// Build data array
|
||||
$data = [
|
||||
'available_update' => $has_update,
|
||||
'latest_version' => $get_version,
|
||||
'latest_version_size' => isset($json_response['assets'][0]['size']) ? humn_size($json_response['assets'][0]['size']) : false,
|
||||
'latest_version_dl_link' => $json_response['assets'][0]['browser_download_url'] ?? $json_response['html_url'],
|
||||
'latest_version_link' => $json_response['html_url']
|
||||
];
|
||||
// Get MD5 checksum
|
||||
$md5_file_checksum = '';
|
||||
if (isset($latest_release_file)) {
|
||||
$md5_file_checksum = strtoupper(md5_file($latest_release_file));
|
||||
}
|
||||
|
||||
// Build data array
|
||||
$data = [
|
||||
'available_update' => true,
|
||||
'latest_version' => $get_version,
|
||||
'latest_version_size' => isset($json_response['assets'][0]['size']) ? humn_size($json_response['assets'][0]['size']) : false,
|
||||
'latest_version_dl_link' => $latest_release_file ?? $json_response['html_url'],
|
||||
'latest_version_checksum' => $md5_file_checksum,
|
||||
'latest_version_link' => $json_response['html_url']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$this->store('check_updates', $data);
|
||||
|
|
|
@ -2152,16 +2152,17 @@ function readUpdaterFile(): array|bool
|
|||
return false;
|
||||
}
|
||||
|
||||
$str = [];
|
||||
if ($updaterFile = fopen(UPDATER_FILE, 'r')) {
|
||||
while (!feof($updaterFile)) {
|
||||
$str[] = trim(fgets($updaterFile));
|
||||
}
|
||||
$updaterFile = new SplFileObject(UPDATER_FILE, 'r');
|
||||
$updaterFile->setFlags(SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE);
|
||||
|
||||
$lines = [];
|
||||
foreach ($updaterFile as $line) {
|
||||
$lines[] = is_numeric($line) ? (int)$line : 0;
|
||||
}
|
||||
|
||||
return [
|
||||
'previous_version' => is_numeric($str[0]) ? (int)$str[0] : 0,
|
||||
'latest_version' => is_numeric($str[1]) ? (int)$str[1] : 0
|
||||
'previous_version' => $lines[0],
|
||||
'latest_version' => $lines[1]
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
<!-- IF updater.UPDATE_AVAILABLE -->
|
||||
<tr>
|
||||
<td class="row1" nowrap="nowrap" width="25%"><b>{L_UPDATE_AVAILABLE}:</b></td>
|
||||
<td class="row2"><b>{updater.NEW_VERSION_NUMBER}</b><!-- IF updater.NEW_VERSION_SIZE --> ({L_SIZE}: {updater.NEW_VERSION_SIZE})<!-- ENDIF --> · <a target="_blank" href="{updater.NEW_VERSION_DL_LINK}">{L_DOWNLOAD}</a> · <a target="_blank" href="{updater.NEW_VERSION_LINK}">{L_CHANGELOG}</a></td>
|
||||
<td class="row2"><b>{updater.NEW_VERSION_NUMBER}</b><!-- IF updater.NEW_VERSION_SIZE --> ({L_SIZE}: {updater.NEW_VERSION_SIZE})<!-- ENDIF --> · <a target="_blank" href="{updater.NEW_VERSION_DL_LINK}">{L_DOWNLOAD}</a> · <a target="_blank" href="{updater.NEW_VERSION_LINK}">{L_CHANGELOG}</a><!-- IF updater.NEW_VERSION_MD5 --> · MD5: {updater.NEW_VERSION_MD5}<!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- END updater -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue