Some updater improvements (#1725)

* Some updater improvements

* Update CHANGELOG.md

* Updated

* Updated

* Update index.tpl
This commit is contained in:
Roman Kelesidis 2024-12-31 13:07:19 +07:00 committed by GitHub
commit ba704efba2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 33 additions and 6 deletions

View file

@ -14,6 +14,7 @@
- Fixed issues with searching by username [\#1722](https://github.com/torrentpier/torrentpier/pull/1722) ([belomaxorka](https://github.com/belomaxorka)) - Fixed issues with searching by username [\#1722](https://github.com/torrentpier/torrentpier/pull/1722) ([belomaxorka](https://github.com/belomaxorka))
- Fixed searching by username in `memberlist.php` [\#1721](https://github.com/torrentpier/torrentpier/pull/1721) ([belomaxorka](https://github.com/belomaxorka)) - Fixed searching by username in `memberlist.php` [\#1721](https://github.com/torrentpier/torrentpier/pull/1721) ([belomaxorka](https://github.com/belomaxorka))
- Set `cursor: pointer;` for buttons, inputs (buttons) [\#1710](https://github.com/torrentpier/torrentpier/pull/1710), [\#1711](https://github.com/torrentpier/torrentpier/pull/1711) ([belomaxorka](https://github.com/belomaxorka)) - Set `cursor: pointer;` for buttons, inputs (buttons) [\#1710](https://github.com/torrentpier/torrentpier/pull/1710), [\#1711](https://github.com/torrentpier/torrentpier/pull/1711) ([belomaxorka](https://github.com/belomaxorka))
- Some updater improvements [\#1725](https://github.com/torrentpier/torrentpier/pull/1725) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1705](https://github.com/torrentpier/torrentpier/pull/1705), [\#1713](https://github.com/torrentpier/torrentpier/pull/1713), [\#1715](https://github.com/torrentpier/torrentpier/pull/1715), [\#1717](https://github.com/torrentpier/torrentpier/pull/1717), [\#1719](https://github.com/torrentpier/torrentpier/pull/1719), [\#1720](https://github.com/torrentpier/torrentpier/pull/1720) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1705](https://github.com/torrentpier/torrentpier/pull/1705), [\#1713](https://github.com/torrentpier/torrentpier/pull/1713), [\#1715](https://github.com/torrentpier/torrentpier/pull/1715), [\#1717](https://github.com/torrentpier/torrentpier/pull/1717), [\#1719](https://github.com/torrentpier/torrentpier/pull/1719), [\#1720](https://github.com/torrentpier/torrentpier/pull/1720) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1723](https://github.com/torrentpier/torrentpier/pull/1723) ([belomaxorka](https://github.com/belomaxorka)) - Updated deps [\#1723](https://github.com/torrentpier/torrentpier/pull/1723) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1704](https://github.com/torrentpier/torrentpier/pull/1704), [\#1706](https://github.com/torrentpier/torrentpier/pull/1706), [\#1714](https://github.com/torrentpier/torrentpier/pull/1714), [\#1716](https://github.com/torrentpier/torrentpier/pull/1716) ([Exileum](https://github.com/Exileum)) - New Crowdin updates [\#1704](https://github.com/torrentpier/torrentpier/pull/1704), [\#1706](https://github.com/torrentpier/torrentpier/pull/1706), [\#1714](https://github.com/torrentpier/torrentpier/pull/1714), [\#1716](https://github.com/torrentpier/torrentpier/pull/1716) ([Exileum](https://github.com/Exileum))

View file

@ -112,6 +112,12 @@ $bb_cfg['client_ban'] = [
] ]
]; ];
// TorrentPier updater settings
$bb_cfg['tp_updater_settings'] = [
'enabled' => true,
'allow_pre_releases' => false
];
// TorrServer integration // TorrServer integration
$bb_cfg['torr_server'] = [ $bb_cfg['torr_server'] = [
// Read more: https://github.com/YouROK/TorrServer // Read more: https://github.com/YouROK/TorrServer
@ -584,7 +590,7 @@ $bb_cfg['flist_max_files'] = 0; // Max allowed number of files to process for gi
$bb_cfg['last_visit_date_format'] = 'd-M H:i'; $bb_cfg['last_visit_date_format'] = 'd-M H:i';
$bb_cfg['last_post_date_format'] = 'd-M-y H:i'; $bb_cfg['last_post_date_format'] = 'd-M-y H:i';
$bb_cfg['poll_max_days'] = 180; // How many days will the poll be active $bb_cfg['poll_max_days'] = 180; // How many days will the poll be active
$bb_cfg['integrity_check'] = true; // TorrentPier files integrity check (Not recommended to disable!) $bb_cfg['integrity_check'] = true; // TorrentPier files integrity check
$bb_cfg['allow_change'] = [ $bb_cfg['allow_change'] = [
'language' => true, // Allow user to change language 'language' => true, // Allow user to change language
@ -604,7 +610,7 @@ $bb_cfg['advert_url'] = 'info.php?show=advert';
$bb_cfg['sitemap_sending'] = [ $bb_cfg['sitemap_sending'] = [
// A list of URLs to which to send a sitemap for indexing by a search robot. // A list of URLs to which to send a sitemap for indexing by a search robot.
// Syntax: 'Resource name' => 'link to endpoint' // Syntax: 'Resource name' => 'link to endpoint'
'Google' => 'https://google.com/webmasters/sitemaps/ping?sitemap=', // Sitemap sending is deprecated. See: https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping
]; ];
// Extensions // Extensions

View file

@ -13,10 +13,14 @@ if (!defined('BB_ROOT')) {
global $bb_cfg; global $bb_cfg;
if (!$bb_cfg['tp_updater_settings']['enabled']) {
return;
}
$data = []; $data = [];
$updaterDownloader = new \TorrentPier\Updater(); $updaterDownloader = new \TorrentPier\Updater();
$updaterDownloader = $updaterDownloader->getLastVersion(); $updaterDownloader = $updaterDownloader->getLastVersion($bb_cfg['tp_updater_settings']['allow_pre_releases']);
$getVersion = $updaterDownloader['tag_name']; $getVersion = $updaterDownloader['tag_name'];
$versionCodeActual = version_code($getVersion); $versionCodeActual = version_code($getVersion);

View file

@ -394,6 +394,11 @@ $user = new TorrentPier\Legacy\Common\User();
$userdata =& $user->data; $userdata =& $user->data;
/**
* Some shared defines
*/
define('TP_INSTANCE_HASH', $bb_cfg['tp_instance_hash']);
/** /**
* Cron * Cron
*/ */

View file

@ -45,7 +45,7 @@ class Updater
*/ */
private const STREAM_CONTEXT = [ private const STREAM_CONTEXT = [
'http' => [ 'http' => [
'header' => 'User-Agent: ' . APP_NAME, 'header' => 'User-Agent: ' . APP_NAME . '-' . TP_INSTANCE_HASH,
'timeout' => 10, 'timeout' => 10,
'ignore_errors' => true 'ignore_errors' => true
] ]
@ -132,10 +132,21 @@ class Updater
/** /**
* Returns information of latest TorrentPier version * Returns information of latest TorrentPier version
* *
* @param bool $allowRC
* @return array * @return array
*/ */
public function getLastVersion(): array public function getLastVersion(bool $allowRC = true): array
{ {
if (!$allowRC) {
foreach ($this->jsonResponse as $index) {
if (isset($index['prerelease']) && $index['prerelease']) {
continue;
}
return $index;
}
}
return $this->jsonResponse[0]; return $this->jsonResponse[0];
} }
} }

View file

@ -183,7 +183,7 @@
<!-- IF updater.UPDATE_AVAILABLE --> <!-- IF updater.UPDATE_AVAILABLE -->
<tr> <tr>
<td class="row1" nowrap="nowrap" width="25%"><b>{L_UPDATE_AVAILABLE}:</b></td> <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 -->&nbsp;({L_SIZE}:&nbsp;{updater.NEW_VERSION_SIZE})<!-- ENDIF -->&nbsp;&middot;&nbsp;<a target="_blank" href="{updater.NEW_VERSION_DL_LINK}">{L_DOWNLOAD}</a>&nbsp;&middot;&nbsp;<a target="_blank" href="{updater.NEW_VERSION_LINK}">{L_CHANGELOG}</a><!-- IF updater.NEW_VERSION_MD5 -->&nbsp;&middot;&nbsp;MD5:&nbsp;{updater.NEW_VERSION_MD5}<!-- ENDIF --></td> <td class="row2"><b>{updater.NEW_VERSION_NUMBER}</b><!-- IF updater.NEW_VERSION_SIZE -->&nbsp;({L_SIZE}:&nbsp;{updater.NEW_VERSION_SIZE})<!-- ENDIF -->&nbsp;&middot;&nbsp;<a target="_blank" href="{updater.NEW_VERSION_DL_LINK}">{L_DOWNLOAD}</a>&nbsp;&middot;&nbsp;<a target="_blank" href="{updater.NEW_VERSION_LINK}">{L_CHANGELOG}</a><!-- IF updater.NEW_VERSION_MD5 -->&nbsp;&middot;&nbsp;<span class="copyElement" data-clipboard-text="{updater.NEW_VERSION_MD5}" title="{L_COPY_TO_CLIPBOARD}">MD5:&nbsp;{updater.NEW_VERSION_MD5}</span><!-- ENDIF --></td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- END updater --> <!-- END updater -->