mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Some updater improvements (#1725)
* Some updater improvements * Update CHANGELOG.md * Updated * Updated * Update index.tpl
This commit is contained in:
parent
11f5b50760
commit
ba704efba2
6 changed files with 33 additions and 6 deletions
|
@ -14,6 +14,7 @@
|
|||
- 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))
|
||||
- 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))
|
||||
- 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))
|
||||
|
|
|
@ -112,6 +112,12 @@ $bb_cfg['client_ban'] = [
|
|||
]
|
||||
];
|
||||
|
||||
// TorrentPier updater settings
|
||||
$bb_cfg['tp_updater_settings'] = [
|
||||
'enabled' => true,
|
||||
'allow_pre_releases' => false
|
||||
];
|
||||
|
||||
// TorrServer integration
|
||||
$bb_cfg['torr_server'] = [
|
||||
// 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_post_date_format'] = 'd-M-y H:i';
|
||||
$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'] = [
|
||||
'language' => true, // Allow user to change language
|
||||
|
@ -604,7 +610,7 @@ $bb_cfg['advert_url'] = 'info.php?show=advert';
|
|||
$bb_cfg['sitemap_sending'] = [
|
||||
// A list of URLs to which to send a sitemap for indexing by a search robot.
|
||||
// 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
|
||||
|
|
|
@ -13,10 +13,14 @@ if (!defined('BB_ROOT')) {
|
|||
|
||||
global $bb_cfg;
|
||||
|
||||
if (!$bb_cfg['tp_updater_settings']['enabled']) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
$updaterDownloader = new \TorrentPier\Updater();
|
||||
$updaterDownloader = $updaterDownloader->getLastVersion();
|
||||
$updaterDownloader = $updaterDownloader->getLastVersion($bb_cfg['tp_updater_settings']['allow_pre_releases']);
|
||||
|
||||
$getVersion = $updaterDownloader['tag_name'];
|
||||
$versionCodeActual = version_code($getVersion);
|
||||
|
|
|
@ -394,6 +394,11 @@ $user = new TorrentPier\Legacy\Common\User();
|
|||
|
||||
$userdata =& $user->data;
|
||||
|
||||
/**
|
||||
* Some shared defines
|
||||
*/
|
||||
define('TP_INSTANCE_HASH', $bb_cfg['tp_instance_hash']);
|
||||
|
||||
/**
|
||||
* Cron
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ class Updater
|
|||
*/
|
||||
private const STREAM_CONTEXT = [
|
||||
'http' => [
|
||||
'header' => 'User-Agent: ' . APP_NAME,
|
||||
'header' => 'User-Agent: ' . APP_NAME . '-' . TP_INSTANCE_HASH,
|
||||
'timeout' => 10,
|
||||
'ignore_errors' => true
|
||||
]
|
||||
|
@ -132,10 +132,21 @@ class Updater
|
|||
/**
|
||||
* Returns information of latest TorrentPier version
|
||||
*
|
||||
* @param bool $allowRC
|
||||
* @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];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,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><!-- IF updater.NEW_VERSION_MD5 --> · MD5: {updater.NEW_VERSION_MD5}<!-- ENDIF --></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 --> · <span class="copyElement" data-clipboard-text="{updater.NEW_VERSION_MD5}" title="{L_COPY_TO_CLIPBOARD}">MD5: {updater.NEW_VERSION_MD5}</span><!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- END updater -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue