initTrackerUrl when fresh install

This commit is contained in:
xiaomlove
2025-10-31 19:51:08 +07:00
parent e37f40f20f
commit 60f7a81ef5
3 changed files with 21 additions and 13 deletions
+19
View File
@@ -3,6 +3,7 @@
namespace Nexus\Install;
use App\Models\Setting;
use App\Models\TrackerUrl;
use App\Models\User;
use App\Repositories\SearchBoxRepository;
use App\Repositories\UserRepository;
@@ -763,4 +764,22 @@ class Install
$searchBoxRep->migrateToModeRelated();
}
public function initTrackerUrl(): void
{
$announceUrl = get_setting("security.https_announce_url");
if (empty($announceUrl)) {
$announceUrl = get_setting("basic.announce_url");
}
if (!str_starts_with($announceUrl, "http")) {
$announceUrl = (isHttps() ? "https://" : "http://"). $announceUrl;
}
TrackerUrl::query()->create([
"url" => $announceUrl,
"enabled" => 1,
"is_default" => 1,
]);
TrackerUrl::saveUrlCache();
$this->doLog("[initTrackerUrl] $announceUrl success.");
}
}