Deploy on 2026-06-05 15:59:38

This commit is contained in:
Hamza-Ayed
2026-06-05 15:59:38 +03:00
parent 669254ccd2
commit c0da60069f
2 changed files with 17 additions and 5 deletions

View File

@@ -77,13 +77,19 @@ $app->router->group([
// Settings // Settings
$r->get('/settings', [SettingsController::class, 'index']); $r->get('/settings', [SettingsController::class, 'index']);
$r->post('/settings/save', [SettingsController::class, 'save']); $r->post('/settings/save', [SettingsController::class, 'save']);
$r->post('/settings/test-telegram', [SettingsController::class, 'testTelegram']);
// Language switch (no CSRF needed for GET)
$r->get('/lang/{lang}', [SettingsController::class, 'switchLang']);
}); });
// Logout endpoint // Logout endpoint
$router->get('/logout', [AuthController::class, 'logout']); $router->get('/logout', [AuthController::class, 'logout']);
// Language switch (no middleware needed for GET, but needs session)
$router->group([
'prefix' => '/admin',
'middleware' => [Authenticate::class]
], function($r) {
$r->get('/lang/{lang}', [SettingsController::class, 'switchLang']);
});
}); });
// API Routes (no CSRF, uses JWT) // API Routes (no CSRF, uses JWT)

View File

@@ -31,11 +31,17 @@
<label class="form-label" style="margin: 0;"><?= $t['telegram_enabled'] ?? 'Enable' ?></label> <label class="form-label" style="margin: 0;"><?= $t['telegram_enabled'] ?? 'Enable' ?></label>
<input type="checkbox" name="telegram_enabled" value="1" <?= $tg_enabled === '1' ? 'checked' : '' ?> style="width: 20px; height: 20px;"> <input type="checkbox" name="telegram_enabled" value="1" <?= $tg_enabled === '1' ? 'checked' : '' ?> style="width: 20px; height: 20px;">
</div> </div>
<div style="display: flex; gap: 12px; margin-top: 16px;"> <div style="display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap;">
<button type="submit" name="action" value="save" class="btn btn-primary"><?= $t['save'] ?? 'Save' ?></button> <button type="submit" name="action" value="save" class="btn btn-primary"><?= $t['save'] ?? 'Save' ?></button>
<button type="submit" name="action" value="test" class="btn btn-secondary"><?= $t['test_notification'] ?? 'Send Test' ?></button>
</div> </div>
</form> </form>
<form action="/admin/settings/test-telegram" method="POST" style="margin-top: 12px;">
<input type="hidden" name="_csrf" value="<?= $this->session->getCsrfToken() ?>">
<input type="hidden" name="telegram_bot_token" value="<?= $this->escape($tg_token) ?>">
<input type="hidden" name="telegram_chat_id" value="<?= $this->escape($tg_chat_id) ?>">
<button type="submit" class="btn btn-secondary"><?= $t['test_notification'] ?? 'Send Test' ?></button>
</form>
</div> </div>
<!-- Help Info --> <!-- Help Info -->