Upload via GUI (267 Dateien)
This commit is contained in:
@@ -59,9 +59,25 @@ function update_find_assets(array $release, string $tag): array
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Zugangstoken für den Update-Server (nur nötig, wenn das Repository privat ist; Gitea antwortet sonst mit "404").
|
||||
* Quelle: config/config.php ('update' => ['token' => '…']) hat Vorrang, sonst das in den Einstellungen der Update-Seite
|
||||
* gespeicherte (verschlüsselt). Gibt [Token, Quelle] zurück, Quelle 'config', 'einstellungen' oder ''.
|
||||
*
|
||||
* @return array{0: string, 1: string}
|
||||
*/
|
||||
function update_token_info(): array
|
||||
{
|
||||
$fromConfig = trim((string) (config()['update']['token'] ?? ''));
|
||||
if ($fromConfig !== '') return [$fromConfig, 'config'];
|
||||
$stored = (string) get_setting('update_token', '');
|
||||
$fromSettings = $stored !== '' ? trim(decrypt_secret($stored)) : '';
|
||||
return $fromSettings !== '' ? [$fromSettings, 'einstellungen'] : ['', ''];
|
||||
}
|
||||
|
||||
/** Kopfzeilen für Abrufe beim Update-Server; ein Zugangstoken ist nur nötig, wenn das Repository nicht öffentlich ist. */
|
||||
function update_http_headers(): array
|
||||
{
|
||||
$token = (string) (config()['update']['token'] ?? '');
|
||||
[$token] = update_token_info();
|
||||
return $token !== '' ? ['Authorization: token ' . $token] : [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user