mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
Minor improvements (#1730)
* Minor improvements * Updated * Updated * Update common.php * Update common.php * Updated * Revert "Updated" This reverts commit204d196ba5
. * Revert "Update common.php" This reverts commiteb24dc1c85
. * Updated * Updated * Update build_check_updates.php * Update build_check_updates.php * Update common.php * Update build_check_updates.php * Updated * Update CHANGELOG.md
This commit is contained in:
parent
4a076a09cc
commit
768837608b
9 changed files with 119 additions and 71 deletions
|
@ -16,7 +16,7 @@
|
|||
- 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), [\#1728](https://github.com/torrentpier/torrentpier/pull/1728) ([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), [\#1728](https://github.com/torrentpier/torrentpier/pull/1728), [\#1730](https://github.com/torrentpier/torrentpier/pull/1730) ([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))
|
||||
|
||||
|
|
19
common.php
19
common.php
|
@ -87,9 +87,10 @@ if (is_file(BB_PATH . '/library/config.local.php')) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Error reporting
|
||||
* Initialize debug
|
||||
*/
|
||||
if (env('APP_ENV') === 'local') {
|
||||
define('APP_ENV', env('APP_ENV', 'production'));
|
||||
if (APP_ENV === 'local') {
|
||||
define('DBG_USER', true); // forced debug
|
||||
} else {
|
||||
define('DBG_USER', isset($_COOKIE[COOKIE_DBG]));
|
||||
|
@ -347,26 +348,12 @@ function sys(string $param)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns version code
|
||||
*
|
||||
* @param string $version
|
||||
* @return int
|
||||
*/
|
||||
function version_code(string $version): int
|
||||
{
|
||||
return (int)trim(str_replace(['.', 'v'], '', $version));
|
||||
}
|
||||
|
||||
/**
|
||||
* Some shared defines
|
||||
*/
|
||||
// Initialize demo mode
|
||||
define('IN_DEMO_MODE', env('APP_DEMO_MODE', false));
|
||||
|
||||
// Version code
|
||||
define('VERSION_CODE', version_code($bb_cfg['tp_version']));
|
||||
|
||||
// Ratio status
|
||||
define('RATIO_ENABLED', TR_RATING_LIMITS && MIN_DL_FOR_RATIO > 0);
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
"claviska/simpleimage": "^4.0",
|
||||
"egulias/email-validator": "^4.0.1",
|
||||
"filp/whoops": "^2.15",
|
||||
"z4kn4fein/php-semver": "^v3.0.0",
|
||||
"gigablah/sphinxphp": "2.0.8",
|
||||
"google/recaptcha": "^1.3",
|
||||
"jacklul/monolog-telegram": "^3.1",
|
||||
|
@ -63,7 +64,7 @@
|
|||
"php-curl-class/php-curl-class": "^11.0.0",
|
||||
"league/flysystem": "^3.28",
|
||||
"longman/ip-tools": "1.2.1",
|
||||
"matthiasmullie/scrapbook": "dev-master",
|
||||
"matthiasmullie/scrapbook": "^1.5.4",
|
||||
"monolog/monolog": "^3.4",
|
||||
"samdark/sitemap": "2.4.1",
|
||||
"symfony/finder": "^6.4",
|
||||
|
|
122
composer.lock
generated
122
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5cd54867fb93869122d1d00ee6f2764b",
|
||||
"content-hash": "a3dd6c29793f928936aec555bba8ca5c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "arokettu/bencode",
|
||||
|
@ -1787,16 +1787,16 @@
|
|||
},
|
||||
{
|
||||
"name": "matthiasmullie/scrapbook",
|
||||
"version": "dev-master",
|
||||
"version": "1.5.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/matthiasmullie/scrapbook.git",
|
||||
"reference": "510129d83dd21b29d0fde6886a7a08d435d1ae65"
|
||||
"reference": "6ca64d54d7106deffbb98cb9c6a6f5fdb13ce1f1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/matthiasmullie/scrapbook/zipball/510129d83dd21b29d0fde6886a7a08d435d1ae65",
|
||||
"reference": "510129d83dd21b29d0fde6886a7a08d435d1ae65",
|
||||
"url": "https://api.github.com/repos/matthiasmullie/scrapbook/zipball/6ca64d54d7106deffbb98cb9c6a6f5fdb13ce1f1",
|
||||
"reference": "6ca64d54d7106deffbb98cb9c6a6f5fdb13ce1f1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1822,7 +1822,6 @@
|
|||
"ext-redis": ">=2.2.0||0.0.0.0",
|
||||
"league/flysystem": ">=1.0"
|
||||
},
|
||||
"default-branch": true,
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@ -1875,7 +1874,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/matthiasmullie/scrapbook/issues",
|
||||
"source": "https://github.com/matthiasmullie/scrapbook/tree/master"
|
||||
"source": "https://github.com/matthiasmullie/scrapbook/tree/1.5.4"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1883,7 +1882,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-05-30T09:05:39+00:00"
|
||||
"time": "2024-12-20T11:47:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
|
@ -2809,12 +2808,12 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "3.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -2957,12 +2956,12 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "3.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -3081,16 +3080,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v6.4.13",
|
||||
"version": "v6.4.17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958"
|
||||
"reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/daea9eca0b08d0ed1dc9ab702a46128fd1be4958",
|
||||
"reference": "daea9eca0b08d0ed1dc9ab702a46128fd1be4958",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7",
|
||||
"reference": "1d0e8266248c5d9ab6a87e3789e6dc482af3c9c7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3125,7 +3124,7 @@
|
|||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v6.4.13"
|
||||
"source": "https://github.com/symfony/finder/tree/v6.4.17"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -3141,7 +3140,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-10-01T08:30:56+00:00"
|
||||
"time": "2024-12-29T13:51:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/mailer",
|
||||
|
@ -3225,16 +3224,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v6.4.13",
|
||||
"version": "v6.4.17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "1de1cf14d99b12c7ebbb850491ec6ae3ed468855"
|
||||
"reference": "ea87c8850a54ff039d3e0ab4ae5586dd4e6c0232"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/1de1cf14d99b12c7ebbb850491ec6ae3ed468855",
|
||||
"reference": "1de1cf14d99b12c7ebbb850491ec6ae3ed468855",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/ea87c8850a54ff039d3e0ab4ae5586dd4e6c0232",
|
||||
"reference": "ea87c8850a54ff039d3e0ab4ae5586dd4e6c0232",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3290,7 +3289,7 @@
|
|||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v6.4.13"
|
||||
"source": "https://github.com/symfony/mime/tree/v6.4.17"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -3306,7 +3305,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-10-25T15:07:50+00:00"
|
||||
"time": "2024-12-02T11:09:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill",
|
||||
|
@ -3447,12 +3446,12 @@
|
|||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"thanks": {
|
||||
"url": "https://github.com/symfony/contracts",
|
||||
"name": "symfony/contracts"
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "3.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
|
@ -3589,6 +3588,60 @@
|
|||
}
|
||||
],
|
||||
"time": "2024-07-20T21:52:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "z4kn4fein/php-semver",
|
||||
"version": "v3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/z4kn4fein/php-semver.git",
|
||||
"reference": "049a1d81e92235c8b3c9ab30a96fcbaa929a266d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/z4kn4fein/php-semver/zipball/049a1d81e92235c8b3c9ab30a96fcbaa929a266d",
|
||||
"reference": "049a1d81e92235c8b3c9ab30a96fcbaa929a266d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.0",
|
||||
"phpstan/phpstan": "^1.0",
|
||||
"phpunit/phpunit": "^10"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"z4kn4fein\\SemVer\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Peter Csajtai",
|
||||
"email": "peter.csajtai@outlook.com"
|
||||
}
|
||||
],
|
||||
"description": "Semantic Versioning library for PHP. It implements the full semantic version 2.0.0 specification and provides ability to parse, compare, and increment semantic versions along with validation against constraints.",
|
||||
"homepage": "https://github.com/z4kn4fein/php-semver",
|
||||
"keywords": [
|
||||
"comparison",
|
||||
"semantic",
|
||||
"semver",
|
||||
"validation",
|
||||
"version",
|
||||
"versioning"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/z4kn4fein/php-semver/issues",
|
||||
"source": "https://github.com/z4kn4fein/php-semver/tree/v3.0.0"
|
||||
},
|
||||
"time": "2024-04-01T16:17:27+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
@ -3682,14 +3735,13 @@
|
|||
"minimum-stability": "dev",
|
||||
"stability-flags": {
|
||||
"arokettu/monsterid": 20,
|
||||
"gemorroj/m3u-parser": 20,
|
||||
"matthiasmullie/scrapbook": 20
|
||||
"gemorroj/m3u-parser": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": "^8.1 | ^8.2 | ^8.3 | ^8.4"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-dev": {},
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ if (!$info_hash = (string)$this->request['info_hash'] or !ctype_xdigit($info_has
|
|||
$this->ajax_die("Invalid info_hash: $info_hash");
|
||||
}
|
||||
|
||||
$isAudio = !empty($this->request['is_audio']);
|
||||
$isAudio = isset($this->request['is_audio']) && $this->request['is_audio'];
|
||||
|
||||
// Get ffprobe info from TorrServer
|
||||
$ffpInfo = (new \TorrentPier\TorrServerAPI())->getFfpInfo($info_hash, $file_index, $attach_id);
|
||||
|
|
|
@ -22,28 +22,22 @@ $data = [];
|
|||
$updaterDownloader = new \TorrentPier\Updater();
|
||||
$updaterDownloader = $updaterDownloader->getLastVersion($bb_cfg['tp_updater_settings']['allow_pre_releases']);
|
||||
|
||||
$getVersion = $updaterDownloader['tag_name'];
|
||||
$versionCodeActual = version_code($getVersion);
|
||||
$getVersion = versionFormatter($updaterDownloader['tag_name']);
|
||||
$currentVersion = versionFormatter($bb_cfg['tp_version']);
|
||||
|
||||
// Has update!
|
||||
if (VERSION_CODE < $versionCodeActual) {
|
||||
if (\z4kn4fein\SemVer\Version::greaterThan($getVersion, $currentVersion)) {
|
||||
$latestBuildFileLink = $updaterDownloader['assets'][0]['browser_download_url'];
|
||||
|
||||
// Check updater file
|
||||
$updater_file = readUpdaterFile();
|
||||
$updater_need_replaced = !empty($updater_file) && ($updater_file['latest_version']['short_code'] < $versionCodeActual);
|
||||
$updaterFile = readUpdaterFile();
|
||||
$updaterFileNeedReplaced = !empty($updaterFile) && \z4kn4fein\SemVer\Version::greaterThan($getVersion, $updaterFile['latest_version']);
|
||||
|
||||
// Save current version & latest available
|
||||
if (!is_file(UPDATER_FILE) || $updater_need_replaced) {
|
||||
if (!is_file(UPDATER_FILE) || $updaterFileNeedReplaced) {
|
||||
file_write(json_encode([
|
||||
'previous_version' => [
|
||||
'short_code' => VERSION_CODE,
|
||||
'version' => $bb_cfg['tp_version']
|
||||
],
|
||||
'latest_version' => [
|
||||
'short_code' => $versionCodeActual,
|
||||
'version' => $getVersion
|
||||
]
|
||||
'previous_version' => $currentVersion,
|
||||
'latest_version' => $getVersion
|
||||
]), UPDATER_FILE, replace_content: true);
|
||||
}
|
||||
|
||||
|
|
|
@ -792,7 +792,7 @@ function generate_user_info($row, bool $have_auth = IS_ADMIN): array
|
|||
{
|
||||
global $userdata, $lang, $images, $bb_cfg;
|
||||
|
||||
$from = !empty($row['user_from']) ? render_flag($row['user_from']) : $lang['NOSELECT'];
|
||||
$from = !empty($row['user_from']) ? render_flag($row['user_from'], false) : $lang['NOSELECT'];
|
||||
$joined = bb_date($row['user_regdate'], 'Y-m-d H:i', false);
|
||||
$user_time = !empty($row['user_time']) ? sprintf('%s <span class="signature">(%s)</span>', bb_date($row['user_time']), delta_time($row['user_time'])) : $lang['NOSELECT'];
|
||||
$posts = '<a href="search.php?search_author=1&uid=' . $row['user_id'] . '" target="_blank">' . $row['user_posts'] ?: 0 . '</a>';
|
||||
|
@ -2157,6 +2157,20 @@ function readUpdaterFile(): array|bool
|
|||
return json_decode(file_get_contents(UPDATER_FILE), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Version formatter
|
||||
*
|
||||
* @param string $version
|
||||
* @return string
|
||||
*/
|
||||
function versionFormatter(string $version): string
|
||||
{
|
||||
$version = trim($version);
|
||||
$version = mb_strtolower($version, 'UTF-8');
|
||||
|
||||
return str_replace('v', '', $version);
|
||||
}
|
||||
|
||||
/**
|
||||
* IP Geolocation API
|
||||
*
|
||||
|
|
|
@ -90,7 +90,7 @@ foreach ($m3uData as $entry) {
|
|||
'FILE_INDEX' => $urlParams['index'],
|
||||
'ROW_CLASS' => $rowClass,
|
||||
'IS_VALID' => in_array($getExtension, array_merge($validFormats['audio'], $validFormats['video'])),
|
||||
'IS_AUDIO' => in_array($getExtension, $validFormats['audio']),
|
||||
'IS_AUDIO' => (int)in_array($getExtension, $validFormats['audio']),
|
||||
'STREAM_LINK' => $streamLink,
|
||||
'M3U_DL_LINK' => DL_URL . $row['attach_id'] . '&m3u=1',
|
||||
'TITLE' => $title,
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<td width="40%"><b>{m3ulist.TITLE}</b>
|
||||
<div id="ffprobe_{m3ulist.FILE_INDEX}">
|
||||
<hr/>
|
||||
<input onclick="ajax.ffprobe_info({m3ulist.FILE_INDEX}, '{m3ulist.IS_AUDIO}');" type="button" value="{L_SHOW_MORE_INFORMATION_FILE}">
|
||||
<input onclick="ajax.ffprobe_info({m3ulist.FILE_INDEX}, {m3ulist.IS_AUDIO});" type="button" value="{L_SHOW_MORE_INFORMATION_FILE}">
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue