feat: PeerTube integration — alternate audio/video labels, FilePond pools, shared SMTP credentials, channel by name, test button, resumable upload, embed improvements, fix alt labels/curl_close/deprecation

This commit is contained in:
Pontoporeia
2026-05-11 10:47:33 +02:00
parent 28ef35dce5
commit 83a5a508ea
18 changed files with 748 additions and 261 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
* peertube-test.php
*
* HTMX endpoint: tests PeerTube connectivity using the form's current values.
* Reads POST fields, performs a temporary settings update, tests, then returns
* an HTMX fragment with the result.
*/
require_once __DIR__ . '/../../../bootstrap.php';
require_once __DIR__ . '/../../../src/AdminAuth.php';
AdminAuth::requireLogin();
require_once APP_ROOT . '/src/Database.php';
require_once APP_ROOT . '/src/SmtpRelay.php';
require_once APP_ROOT . '/src/PeerTubeService.php';
if (!isset($_POST['csrf_token'], $_SESSION['csrf_token'])
|| !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {
http_response_code(403);
echo '<span style="color:var(--color-error);">Token CSRF invalide.</span>';
exit;
}
$db = new Database();
// Save current settings so we can test with the form values
$data = [
'instance_url' => $_POST['peertube_instance_url'] ?? '',
'channel_name' => $_POST['peertube_channel_name'] ?? '',
'privacy' => $_POST['peertube_privacy'] ?? 1,
];
PeerTubeService::updateSettings($db, $data);
$test = PeerTubeService::test($db);
if ($test['ok']) {
echo '<span style="color:var(--color-success);">✓ Connexion réussie — authentification et résolution de la chaîne OK.</span>';
} else {
echo '<span style="color:var(--color-error);">✗ ' . htmlspecialchars($test['error']) . '</span>';
}