mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
initTrackerUrl when fresh install
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user