adasd
This commit is contained in:
@@ -18,36 +18,6 @@ return [
|
||||
'installable' => false,
|
||||
'summary' => 'Startpunkt der Desktop-Shell mit Status zur Architektur, Skin-Umschaltung und naechsten Schritten.',
|
||||
],
|
||||
[
|
||||
'app_id' => 'public-dashboard',
|
||||
'title' => 'Public Dashboard',
|
||||
'icon' => 'PD',
|
||||
'entry_route' => '/public-home',
|
||||
'window_mode' => 'window',
|
||||
'default_width' => 540,
|
||||
'default_height' => 360,
|
||||
'supports_widget' => true,
|
||||
'supports_tray' => false,
|
||||
'module_name' => 'desktop',
|
||||
'app_scope' => 'core',
|
||||
'installable' => false,
|
||||
'summary' => 'Oeffentliche Startansicht fuer nicht eingeloggte Nutzer.',
|
||||
],
|
||||
[
|
||||
'app_id' => 'workspace-manager',
|
||||
'title' => 'Workspaces',
|
||||
'icon' => 'WS',
|
||||
'entry_route' => '/workspaces',
|
||||
'window_mode' => 'window',
|
||||
'default_width' => 520,
|
||||
'default_height' => 380,
|
||||
'supports_widget' => false,
|
||||
'supports_tray' => false,
|
||||
'module_name' => 'desktop',
|
||||
'app_scope' => 'core',
|
||||
'installable' => false,
|
||||
'summary' => 'Vorbereitung fuer mehrere persoenliche Dashboards und Workspace-Verwaltung.',
|
||||
],
|
||||
[
|
||||
'app_id' => 'user-self-management',
|
||||
'title' => 'User Self Management',
|
||||
@@ -81,16 +51,33 @@ return [
|
||||
'app_id' => 'admin-apps',
|
||||
'title' => 'Admin Apps',
|
||||
'icon' => 'AA',
|
||||
'entry_route' => '/admin/apps',
|
||||
'entry_route' => '/admin/apps/',
|
||||
'window_mode' => 'window',
|
||||
'default_width' => 560,
|
||||
'default_height' => 380,
|
||||
'content_mode' => 'native-module',
|
||||
'default_width' => 1180,
|
||||
'default_height' => 760,
|
||||
'show_on_desktop' => false,
|
||||
'supports_widget' => false,
|
||||
'supports_tray' => true,
|
||||
'module_name' => 'admin',
|
||||
'app_scope' => 'core',
|
||||
'app_scope' => 'system_tool',
|
||||
'installable' => false,
|
||||
'summary' => 'Platzhalter fuer globale Verwaltung von Apps, Widgets, Integrationen und Suchmaschinen.',
|
||||
'required_groups' => ['administrators'],
|
||||
'summary' => 'Zentrale Admin-App fuer App-Bestand, Widgets und erste Integrations-Einstellungen wie den Gitea-Deploy-Status.',
|
||||
'native_module' => [
|
||||
'initializer' => 'initAdminAppsApp',
|
||||
'options' => [
|
||||
'entryRoute' => '/admin/apps/',
|
||||
],
|
||||
'assets' => [
|
||||
'styles' => [
|
||||
['href' => '/system-app-assets/index.php?app=admin-apps&path=assets/app.css'],
|
||||
],
|
||||
'scripts' => [
|
||||
['src' => '/system-app-assets/index.php?app=admin-apps&path=assets/app.js'],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'app_id' => 'user-management',
|
||||
@@ -156,19 +143,4 @@ return [
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'app_id' => 'desktop-login',
|
||||
'title' => 'Desktop Login',
|
||||
'icon' => 'DL',
|
||||
'entry_route' => '/auth/keycloak',
|
||||
'window_mode' => 'modal',
|
||||
'default_width' => 460,
|
||||
'default_height' => 320,
|
||||
'supports_widget' => false,
|
||||
'supports_tray' => false,
|
||||
'module_name' => 'auth',
|
||||
'app_scope' => 'core',
|
||||
'installable' => false,
|
||||
'summary' => 'Uebergabepunkt fuer das spaetere Keycloak-Theme im Desktop-Look.',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -16,7 +16,7 @@ return [
|
||||
'extra_authorize_params' => [],
|
||||
'branding' => [
|
||||
'product_name' => 'Kusche.Berlin',
|
||||
'headline' => 'Desktop Login',
|
||||
'headline' => 'Anmeldung',
|
||||
'subheadline' => 'Geschuetzter Zugang zur Desktop-Shell und kuenftigen Modulen.',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -20,7 +20,7 @@ Custom-App-Assets werden nicht direkt aus `public/` geladen, sondern ueber den g
|
||||
## Trennung zwischen Systemtools und Modulen
|
||||
|
||||
- `Systemtools` sind globale Verwaltungs- und Setup-Apps und nicht installierbar
|
||||
- aktuelle Beispiele: `User Management`, `User Self Management`, `Cron Tool`
|
||||
- aktuelle Beispiele: `Admin Apps`, `User Management`, `User Self Management`, `Cron Tool`
|
||||
- `Custom Apps` sind installierbare Fachanwendungen
|
||||
- aktuelle Beispiele: `Mining-Checker`, `Waehrungs-Checker`, `Boersenchecker`, `Pi-hole`
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ Dort koennen derzeit insbesondere verwaltet werden:
|
||||
- sichtbare Apps
|
||||
- Inhalte des `Infobereichs`
|
||||
|
||||
Administratoren nutzen zusaetzlich `Admin Apps` fuer den globalen App-Bestand, die Widget-Uebersicht und erste Integrations-Einstellungen wie den Gitea-Deploy-Status.
|
||||
|
||||
## Module
|
||||
|
||||
Installierbare Fach-Apps liegen unter `custom/apps/<app>/` und koennen als normale `App` im Desktop erscheinen.
|
||||
|
||||
@@ -83,6 +83,7 @@ Stand dieser Datei:
|
||||
- Startmenue mit `User Setting Bereich`, `Funktion-Bereich` und `Auswahlbereich`
|
||||
- rechter `Infobereich` mit benutzerbezogener Sichtbarkeit
|
||||
- `User Self Management` als Setup-App
|
||||
- `Admin Apps` als zentrale Admin-App fuer App-Bestand, Widgets und erste Integrations-Einstellungen
|
||||
- erster echter App-Pfad fuer installierbare Fach-Apps mit Discovery aus `custom/apps/<app>/`
|
||||
- `Mining-Checker` als erstes angebundenes klassisches Modul
|
||||
- `Waehrungs-Checker` als zweites angebundenes klassisches Modul mit Desktop-Widget fuer Kursaktualisierung
|
||||
|
||||
@@ -63,6 +63,7 @@ Aktuell wichtig:
|
||||
- das gemeinsame Admin-Debug-Widget neben der Uhr ist der Standard fuer Live-Debugging in Desktop und Native-Apps
|
||||
- der Waehrungs-Checker stellt zusaetzlich ein Desktop-Widget fuer manuelle Kursaktualisierung bereit
|
||||
- der Gitea-Deploy-Status liegt als optionales Addon unter `system/addons/gitea-deploy-status/` und wird serverseitig ueber `config/gitea.php` angebunden
|
||||
- `Admin Apps` ist als globales `Systemtool` fuer App-Bestand, Widgets und erste Integrations-Einstellungen vorhanden
|
||||
- das Oeffnen des Waehrungs-Checkers darf keinen externen Kursabruf ausloesen; Refreshes laufen nur nach Altersregel oder mit `force`
|
||||
- `Systemtools` und installierbare `Module` werden getrennt behandelt; Systemtools sind nicht Teil der Benutzer-Installationsauswahl
|
||||
- das `Cron Tool` ist als globales Systemtool vorhanden und sammelt Modul-Cronjobs automatisch ueber Manifest-Metadaten
|
||||
|
||||
@@ -189,7 +189,7 @@ Phase 5 Admin-Bereiche:
|
||||
- `OFFEN`: Widget-Verwaltung
|
||||
- `OFFEN`: Integrationen
|
||||
- `OFFEN`: Suchmaschinen
|
||||
- `TEILWEISE`: Apps nur als Placeholder-App
|
||||
- `TEILWEISE`: `Admin Apps` als echte System-App fuer App-Inventar, Widget-Uebersicht und erste Gitea-Integrations-Einstellungen vorhanden
|
||||
- `OFFEN`: oeffentliches Home-Dashboard-Verwaltung
|
||||
|
||||
Phase 6 Modul-Anbindung:
|
||||
|
||||
@@ -18,7 +18,7 @@ Diese Datei beschreibt die Uebergabepunkte zwischen der Desktop-Shell und dem sp
|
||||
|
||||
## Technische Schnittstellen
|
||||
|
||||
- Desktop-Shell verweist auf die Login-App `desktop-login`.
|
||||
- Desktop-Shell verweist fuer die Anmeldung direkt auf `/auth/keycloak`.
|
||||
- Root `/` kann jetzt vor der Desktop-Shell auf einen eigenen Login-Screen umleiten.
|
||||
- Login-Handoff zu Keycloak laeuft ueber `/auth/keycloak`.
|
||||
- Callback-Endpunkt ist unter `/auth/callback` vorbereitet.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
$productName = (string) ($loginScreen['branding']['product_name'] ?? 'Kusche.Berlin');
|
||||
$headline = (string) ($loginScreen['branding']['headline'] ?? 'Desktop Login');
|
||||
$headline = (string) ($loginScreen['branding']['headline'] ?? 'Anmeldung');
|
||||
$subheadline = (string) ($loginScreen['branding']['subheadline'] ?? '');
|
||||
$loginUrl = $loginScreen['login_url'] ?? null;
|
||||
$registerUrl = $loginScreen['register_url'] ?? null;
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
return [
|
||||
'title' => 'Desktop Login',
|
||||
'title' => 'Anmeldung',
|
||||
'description' => 'Spaeterer Uebergabepunkt fuer das Keycloak-Theme im Desktop-Look.',
|
||||
];
|
||||
|
||||
9
public/admin/apps/index.php
Normal file
9
public/admin/apps/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\AppPaths;
|
||||
|
||||
require AppPaths::systemAppPath(dirname(__DIR__, 3), 'admin-apps') . '/page.php';
|
||||
@@ -1970,15 +1970,6 @@ if (payloadNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionId === 'open-public-dashboard') {
|
||||
const publicDashboard = findAppById('public-dashboard');
|
||||
if (publicDashboard) {
|
||||
openApp(publicDashboard);
|
||||
closeStartMenu();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (actionId === 'toggle-all-widgets') {
|
||||
const shouldShowAll = activeWidgets.size !== payload.widgets.registry.length;
|
||||
|
||||
@@ -2157,10 +2148,7 @@ if (payloadNode) {
|
||||
|
||||
if (action === 'login') {
|
||||
event.preventDefault();
|
||||
const loginApp = findAppById('desktop-login');
|
||||
if (loginApp) {
|
||||
openApp(loginApp);
|
||||
}
|
||||
window.location.href = '/auth/keycloak';
|
||||
setAccountMenuOpen(false);
|
||||
}
|
||||
});
|
||||
@@ -2177,10 +2165,7 @@ if (payloadNode) {
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
const loginApp = findAppById('desktop-login');
|
||||
if (loginApp) {
|
||||
openApp(loginApp);
|
||||
}
|
||||
window.location.href = '/auth/keycloak';
|
||||
closeStartMenu();
|
||||
});
|
||||
|
||||
|
||||
235
src/App/AdminAppsService.php
Normal file
235
src/App/AdminAppsService.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App;
|
||||
|
||||
use Desktop\AppRegistry;
|
||||
use Desktop\WidgetRegistry;
|
||||
use ModulesCore\ModuleRegistry;
|
||||
use SystemAddons\GiteaDeployStatus\GiteaDeployStatusService;
|
||||
|
||||
final class AdminAppsService
|
||||
{
|
||||
public function __construct(
|
||||
private readonly string $projectRoot,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function bootstrap(bool $isAdmin): array
|
||||
{
|
||||
require_once AppPaths::systemAddonPath($this->projectRoot, 'gitea-deploy-status') . '/GiteaDeployStatusService.php';
|
||||
|
||||
$moduleRegistry = new ModuleRegistry(AppPaths::customAppsRoot($this->projectRoot));
|
||||
$appRegistry = new AppRegistry($this->projectRoot . '/config/apps.php', $moduleRegistry->desktopApps());
|
||||
$widgetRegistry = new WidgetRegistry($this->projectRoot . '/config/widgets.php', $moduleRegistry->widgets());
|
||||
|
||||
$apps = $this->normalizeApps($appRegistry->all());
|
||||
$widgets = $this->normalizeWidgets($widgetRegistry->all());
|
||||
$giteaConfig = ConfigLoader::load($this->projectRoot, 'gitea');
|
||||
$giteaService = new GiteaDeployStatusService($giteaConfig);
|
||||
$currentEnvironment = ConfigLoader::currentEnvironment();
|
||||
|
||||
return [
|
||||
'meta' => [
|
||||
'environment' => $currentEnvironment,
|
||||
'gitea_config_path' => $this->environmentConfigPath('gitea', $currentEnvironment),
|
||||
],
|
||||
'stats' => [
|
||||
'apps_total' => count($apps),
|
||||
'installable_apps' => count(array_filter($apps, static fn (array $app): bool => !empty($app['installable']))),
|
||||
'system_tools' => count(array_filter($apps, static fn (array $app): bool => ($app['app_scope'] ?? '') === 'system_tool')),
|
||||
'widgets_total' => count($widgets),
|
||||
'admin_only_apps' => count(array_filter($apps, static fn (array $app): bool => !empty($app['admin_only']))),
|
||||
],
|
||||
'apps' => $apps,
|
||||
'widgets' => $widgets,
|
||||
'gitea' => [
|
||||
'config' => [
|
||||
'base_url' => (string) ($giteaConfig['base_url'] ?? ''),
|
||||
'token' => (string) ($giteaConfig['token'] ?? ''),
|
||||
'owner' => (string) ($giteaConfig['owner'] ?? ''),
|
||||
'repositories' => array_values(array_map('strval', (array) ($giteaConfig['repositories'] ?? []))),
|
||||
'poll_idle_seconds' => max(1, (int) ($giteaConfig['poll_idle_seconds'] ?? 5)),
|
||||
'poll_running_seconds' => max(1, (int) ($giteaConfig['poll_running_seconds'] ?? 3)),
|
||||
'visibility' => (string) ($giteaConfig['visibility'] ?? 'admins'),
|
||||
],
|
||||
'diagnostics' => $giteaService->diagnostics(),
|
||||
'tray_visible_for_current_user' => $giteaService->shouldShowInTray($isAdmin),
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $input
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function saveGiteaConfig(array $input): array
|
||||
{
|
||||
$environment = ConfigLoader::currentEnvironment();
|
||||
$config = [
|
||||
'base_url' => $this->sanitizeBaseUrl((string) ($input['base_url'] ?? '')),
|
||||
'token' => trim((string) ($input['token'] ?? '')),
|
||||
'owner' => trim((string) ($input['owner'] ?? '')),
|
||||
'repositories' => $this->sanitizeRepositories((string) ($input['repositories'] ?? '')),
|
||||
'poll_idle_seconds' => $this->sanitizePositiveInt($input['poll_idle_seconds'] ?? 5, 5),
|
||||
'poll_running_seconds' => $this->sanitizePositiveInt($input['poll_running_seconds'] ?? 3, 3),
|
||||
'visibility' => $this->sanitizeVisibility((string) ($input['visibility'] ?? 'admins')),
|
||||
];
|
||||
|
||||
$this->writeEnvironmentConfig('gitea', $environment, $config);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, array<string, mixed>> $apps
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private function normalizeApps(array $apps): array
|
||||
{
|
||||
$normalized = array_map(static function (array $app): array {
|
||||
$requiredGroups = array_values(array_map('strval', (array) ($app['required_groups'] ?? [])));
|
||||
|
||||
return [
|
||||
'app_id' => (string) ($app['app_id'] ?? ''),
|
||||
'title' => (string) ($app['title'] ?? ''),
|
||||
'summary' => trim((string) ($app['summary'] ?? '')),
|
||||
'entry_route' => (string) ($app['entry_route'] ?? ''),
|
||||
'app_scope' => (string) ($app['app_scope'] ?? 'module'),
|
||||
'module_name' => (string) ($app['module_name'] ?? ''),
|
||||
'installable' => !array_key_exists('installable', $app) || (bool) $app['installable'],
|
||||
'show_on_desktop' => !empty($app['show_on_desktop']),
|
||||
'supports_widget' => !empty($app['supports_widget']),
|
||||
'supports_tray' => !empty($app['supports_tray']),
|
||||
'enabled_by_default' => !empty($app['enabled_by_default']),
|
||||
'required_groups' => $requiredGroups,
|
||||
'admin_only' => in_array('administrators', array_map(
|
||||
static fn (string $group): string => strtolower(trim($group, '/')),
|
||||
$requiredGroups
|
||||
), true),
|
||||
'source' => isset($app['module_id']) ? 'custom_app' : 'system',
|
||||
];
|
||||
}, $apps);
|
||||
|
||||
usort($normalized, static fn (array $left, array $right): int => [$left['title'], $left['app_id']] <=> [$right['title'], $right['app_id']]);
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, array<string, mixed>> $widgets
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private function normalizeWidgets(array $widgets): array
|
||||
{
|
||||
$normalized = array_map(static function (array $widget): array {
|
||||
return [
|
||||
'widget_id' => (string) ($widget['widget_id'] ?? ''),
|
||||
'title' => (string) ($widget['title'] ?? ''),
|
||||
'summary' => trim((string) ($widget['summary'] ?? '')),
|
||||
'zone' => (string) ($widget['zone'] ?? 'sidebar'),
|
||||
'default_enabled' => !empty($widget['default_enabled']),
|
||||
'source_app_id' => (string) ($widget['source_app_id'] ?? ''),
|
||||
'source_module_id' => (string) ($widget['source_module_id'] ?? ''),
|
||||
'launch_app_id' => (string) ($widget['launch_app_id'] ?? ''),
|
||||
'status_api' => isset($widget['status_api']) ? (string) $widget['status_api'] : '',
|
||||
];
|
||||
}, $widgets);
|
||||
|
||||
usort($normalized, static fn (array $left, array $right): int => [$left['title'], $left['widget_id']] <=> [$right['title'], $right['widget_id']]);
|
||||
|
||||
return $normalized;
|
||||
}
|
||||
|
||||
private function sanitizeBaseUrl(string $value): string
|
||||
{
|
||||
return rtrim(trim($value), '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
private function sanitizeRepositories(string $value): array
|
||||
{
|
||||
$entries = preg_split('/[\r\n,;]+/', $value) ?: [];
|
||||
$result = [];
|
||||
|
||||
foreach ($entries as $entry) {
|
||||
$normalized = trim($entry);
|
||||
if ($normalized === '' || !preg_match('/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/', $normalized)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$normalized] = $normalized;
|
||||
}
|
||||
|
||||
return array_values($result);
|
||||
}
|
||||
|
||||
private function sanitizePositiveInt(mixed $value, int $fallback): int
|
||||
{
|
||||
$normalized = (int) $value;
|
||||
|
||||
return $normalized > 0 ? $normalized : $fallback;
|
||||
}
|
||||
|
||||
private function sanitizeVisibility(string $value): string
|
||||
{
|
||||
$normalized = strtolower(trim($value));
|
||||
|
||||
return in_array($normalized, ['all', 'admins', 'disabled'], true) ? $normalized : 'admins';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $config
|
||||
*/
|
||||
private function writeEnvironmentConfig(string $name, string $environment, array $config): void
|
||||
{
|
||||
$directory = $this->projectRoot . '/config/' . $environment;
|
||||
if (!is_dir($directory) && !mkdir($directory, 0775, true) && !is_dir($directory)) {
|
||||
throw new \RuntimeException('Konfigurationsverzeichnis konnte nicht angelegt werden.');
|
||||
}
|
||||
|
||||
$path = $this->environmentConfigPath($name, $environment);
|
||||
$content = "<?php\n\n";
|
||||
$content .= "declare(strict_types=1);\n\n";
|
||||
$content .= 'return ' . $this->exportPhpValue($config) . ";\n";
|
||||
|
||||
if (file_put_contents($path, $content) === false) {
|
||||
throw new \RuntimeException('Konfigurationsdatei konnte nicht geschrieben werden.');
|
||||
}
|
||||
}
|
||||
|
||||
private function environmentConfigPath(string $name, string $environment): string
|
||||
{
|
||||
return $this->projectRoot . '/config/' . $environment . '/' . $name . '.php';
|
||||
}
|
||||
|
||||
private function exportPhpValue(mixed $value, int $depth = 0): string
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value === []) {
|
||||
return '[]';
|
||||
}
|
||||
|
||||
$indent = str_repeat(' ', $depth);
|
||||
$childIndent = str_repeat(' ', $depth + 1);
|
||||
$lines = ['['];
|
||||
|
||||
foreach ($value as $key => $item) {
|
||||
$prefix = is_int($key) ? '' : $this->exportPhpValue($key) . ' => ';
|
||||
$lines[] = $childIndent . $prefix . $this->exportPhpValue($item, $depth + 1) . ',';
|
||||
}
|
||||
|
||||
$lines[] = $indent . ']';
|
||||
|
||||
return implode("\n", $lines);
|
||||
}
|
||||
|
||||
return var_export($value, true);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,33 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if (!function_exists('desktop_configure_session_storage')) {
|
||||
function desktop_configure_session_storage(): void
|
||||
{
|
||||
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ini_get('session.save_handler') !== 'files') {
|
||||
return;
|
||||
}
|
||||
|
||||
$sessionPath = dirname(__DIR__, 2) . '/data/system/sessions';
|
||||
|
||||
if (!is_dir($sessionPath) && !mkdir($sessionPath, 0775, true) && !is_dir($sessionPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_writable($sessionPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ini_set('session.save_path', $sessionPath);
|
||||
}
|
||||
}
|
||||
|
||||
desktop_configure_session_storage();
|
||||
|
||||
spl_autoload_register(static function (string $class): void {
|
||||
$prefixes = [
|
||||
'App\\' => __DIR__ . '/',
|
||||
|
||||
@@ -37,29 +37,20 @@ final class AppIconResolver
|
||||
return match ($skin) {
|
||||
'windows' => [
|
||||
'welcome-center' => '/assets/desktop/skin-icons/windows/welcome-center.ico',
|
||||
'public-dashboard' => '/assets/desktop/skin-icons/windows/public-dashboard.ico',
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/windows/workspace-manager.ico',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/windows/admin-apps.ico',
|
||||
'user-self-management' => '/assets/desktop/skin-icons/windows/admin-apps.ico',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/windows/desktop-login.ico',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/windows/admin-apps.ico',
|
||||
],
|
||||
'apple' => [
|
||||
'welcome-center' => '/assets/desktop/skin-icons/apple/welcome-center.svg',
|
||||
'public-dashboard' => '/assets/desktop/skin-icons/apple/public-dashboard.svg',
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/apple/workspace-manager.svg',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/apple/admin-apps.svg',
|
||||
'user-self-management' => '/assets/desktop/skin-icons/apple/admin-apps.svg',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/apple/desktop-login.svg',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/apple/admin-apps.svg',
|
||||
],
|
||||
'linux' => [
|
||||
'welcome-center' => '/assets/desktop/skin-icons/linux/welcome-center.svg',
|
||||
'public-dashboard' => '/assets/desktop/skin-icons/linux/public-dashboard.svg',
|
||||
'workspace-manager' => '/assets/desktop/skin-icons/linux/workspace-manager.svg',
|
||||
'admin-apps' => '/assets/desktop/skin-icons/linux/admin-apps.svg',
|
||||
'user-self-management' => '/assets/desktop/skin-icons/linux/admin-apps.svg',
|
||||
'desktop-login' => '/assets/desktop/skin-icons/linux/desktop-login.svg',
|
||||
'mining-checker' => '/assets/desktop/skin-icons/linux/admin-apps.svg',
|
||||
],
|
||||
default => [],
|
||||
|
||||
@@ -48,11 +48,6 @@ final class DesktopState
|
||||
'label' => 'Setup',
|
||||
'description' => 'Oeffnet die persoenlichen Desktop-Einstellungen.',
|
||||
],
|
||||
[
|
||||
'action_id' => 'open-public-dashboard',
|
||||
'label' => 'Public Dashboard',
|
||||
'description' => 'Oeffnet die oeffentliche Startansicht als Fenster.',
|
||||
],
|
||||
[
|
||||
'action_id' => 'toggle-all-widgets',
|
||||
'label' => 'Infobereich umschalten',
|
||||
|
||||
@@ -17,6 +17,7 @@ Typische Bestandteile einer System-App:
|
||||
|
||||
Aktuelle Beispiele:
|
||||
|
||||
- `admin-apps`
|
||||
- `user-management`
|
||||
- `user-self-management`
|
||||
- `cron-management`
|
||||
|
||||
221
system/apps/admin-apps/assets/app.css
Normal file
221
system/apps/admin-apps/assets/app.css
Normal file
@@ -0,0 +1,221 @@
|
||||
#admin-apps-app {
|
||||
color: #102033;
|
||||
}
|
||||
|
||||
#admin-apps-app,
|
||||
#admin-apps-app * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#admin-apps-app.is-loading {
|
||||
opacity: 0.72;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-shell,
|
||||
#admin-apps-app .aa-frame,
|
||||
#admin-apps-app .aa-main,
|
||||
#admin-apps-app .aa-panel {
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-brand,
|
||||
#admin-apps-app .aa-copy,
|
||||
#admin-apps-app .aa-meta,
|
||||
#admin-apps-app .aa-table-copy,
|
||||
#admin-apps-app .aa-message,
|
||||
#admin-apps-app .aa-side-metric span,
|
||||
#admin-apps-app .aa-field span,
|
||||
#admin-apps-app .aa-inline-card p {
|
||||
color: #4a6079;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-kicker {
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.72rem;
|
||||
color: #6d84a0;
|
||||
margin: 0 0 0.45rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-sidebar {
|
||||
background: linear-gradient(180deg, rgba(10, 32, 58, 0.96), rgba(21, 52, 90, 0.92));
|
||||
color: #f3f7fb;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-sidebar .aa-copy,
|
||||
#admin-apps-app .aa-sidebar .aa-meta,
|
||||
#admin-apps-app .aa-sidebar .aa-side-metric span,
|
||||
#admin-apps-app .aa-sidebar .aa-kicker {
|
||||
color: rgba(232, 241, 250, 0.78);
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-sidebar .aa-card {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-nav-button.is-active {
|
||||
background: rgba(255, 255, 255, 0.16);
|
||||
border-color: rgba(255, 255, 255, 0.18);
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-grid {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-grid--stats,
|
||||
#admin-apps-app .aa-grid--diag {
|
||||
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-stat-card,
|
||||
#admin-apps-app .aa-diag-card {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-stat-card strong,
|
||||
#admin-apps-app .aa-diag-card strong,
|
||||
#admin-apps-app .aa-side-metric strong {
|
||||
font-size: 1.35rem;
|
||||
color: #102033;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-side-title,
|
||||
#admin-apps-app .aa-section-title {
|
||||
font-size: 1rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-side-metric,
|
||||
#admin-apps-app .aa-field,
|
||||
#admin-apps-app .aa-inline-card {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-form {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-field--full {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-field input,
|
||||
#admin-apps-app .aa-field textarea,
|
||||
#admin-apps-app .aa-field select {
|
||||
width: 100%;
|
||||
border: 1px solid #c9d4e0;
|
||||
border-radius: 12px;
|
||||
padding: 0.8rem 0.95rem;
|
||||
background: #f8fbfd;
|
||||
color: #102033;
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-field textarea {
|
||||
resize: vertical;
|
||||
min-height: 8rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-section-head,
|
||||
#admin-apps-app .aa-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-primary {
|
||||
background: #153d68;
|
||||
color: #f7fbff;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table-wrap {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
min-width: 760px;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table th,
|
||||
#admin-apps-app .aa-table td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
padding: 0.85rem 0.75rem;
|
||||
border-bottom: 1px solid #dde6ee;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table th {
|
||||
font-size: 0.78rem;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: #6d84a0;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table code,
|
||||
#admin-apps-app .aa-inline-card code {
|
||||
display: inline-block;
|
||||
font-size: 0.86rem;
|
||||
background: #eef4f8;
|
||||
color: #153d68;
|
||||
border-radius: 10px;
|
||||
padding: 0.18rem 0.45rem;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-flag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-inline-card {
|
||||
align-self: end;
|
||||
background: #f4f8fb;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-message {
|
||||
border-radius: 14px;
|
||||
padding: 0.9rem 1rem;
|
||||
background: #eef4f8;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-message.is-success {
|
||||
background: #e7f6ec;
|
||||
color: #1e6a3c;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-message.is-error {
|
||||
background: #fdecec;
|
||||
color: #9b263a;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-list {
|
||||
margin: 0.65rem 0 0;
|
||||
padding-left: 1.1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
#admin-apps-app .aa-form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
#admin-apps-app .aa-table {
|
||||
min-width: 640px;
|
||||
}
|
||||
}
|
||||
120
system/apps/admin-apps/assets/app.js
Normal file
120
system/apps/admin-apps/assets/app.js
Normal file
@@ -0,0 +1,120 @@
|
||||
(() => {
|
||||
const normalizeUrl = (url) => {
|
||||
const next = new URL(url, window.location.origin);
|
||||
next.searchParams.set('partial', '1');
|
||||
return next.toString();
|
||||
};
|
||||
|
||||
const renderError = (host, message) => {
|
||||
host.innerHTML = `
|
||||
<div class="window-app-shell aa-shell">
|
||||
<div class="window-app-frame aa-frame">
|
||||
<main class="window-app-main aa-main">
|
||||
<div class="window-app-panel aa-panel">
|
||||
<section class="window-app-card aa-card">
|
||||
<p class="aa-message is-error">${String(message || 'Admin Apps konnte nicht geladen werden.')}</p>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
const bindInteractions = (host, loadRoute) => {
|
||||
host.querySelectorAll('a[href]').forEach((link) => {
|
||||
if (link.dataset.aaBound === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
const href = String(link.getAttribute('href') || '');
|
||||
if (!href.startsWith('/admin/apps/')) {
|
||||
return;
|
||||
}
|
||||
|
||||
link.dataset.aaBound = '1';
|
||||
link.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
loadRoute(href);
|
||||
});
|
||||
});
|
||||
|
||||
host.querySelectorAll('form[action]').forEach((form) => {
|
||||
if (form.dataset.aaBound === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
const action = String(form.getAttribute('action') || '');
|
||||
if (!action.startsWith('/admin/apps/')) {
|
||||
return;
|
||||
}
|
||||
|
||||
form.dataset.aaBound = '1';
|
||||
form.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
try {
|
||||
host.classList.add('is-loading');
|
||||
const response = await fetch(normalizeUrl(action), {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: new FormData(form),
|
||||
});
|
||||
|
||||
const html = await response.text();
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
host.innerHTML = html;
|
||||
bindInteractions(host, loadRoute);
|
||||
} catch (error) {
|
||||
renderError(host, error?.message || 'Admin Apps konnte nicht gespeichert werden.');
|
||||
} finally {
|
||||
host.classList.remove('is-loading');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.initAdminAppsApp = function initAdminAppsApp(host, options = {}) {
|
||||
if (!(host instanceof Element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (host.dataset.aaAppBound === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
host.dataset.aaAppBound = '1';
|
||||
|
||||
const entryRoute = String(options.entryRoute || '/admin/apps/');
|
||||
const loadRoute = async (route) => {
|
||||
try {
|
||||
host.classList.add('is-loading');
|
||||
const response = await fetch(normalizeUrl(route), {
|
||||
credentials: 'same-origin',
|
||||
headers: { Accept: 'text/html' },
|
||||
});
|
||||
const html = await response.text();
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
host.innerHTML = html;
|
||||
bindInteractions(host, loadRoute);
|
||||
} catch (error) {
|
||||
renderError(host, error?.message || 'Admin Apps konnte nicht geladen werden.');
|
||||
} finally {
|
||||
host.classList.remove('is-loading');
|
||||
}
|
||||
};
|
||||
|
||||
if (options.standalone) {
|
||||
bindInteractions(host, loadRoute);
|
||||
return;
|
||||
}
|
||||
|
||||
loadRoute(entryRoute);
|
||||
};
|
||||
})();
|
||||
416
system/apps/admin-apps/page.php
Normal file
416
system/apps/admin-apps/page.php
Normal file
@@ -0,0 +1,416 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\AdminAppsService;
|
||||
use ModulesCore\ModuleHttp;
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
ModuleHttp::requireDesktopAccess($projectRoot);
|
||||
|
||||
$currentUser = is_array($_SESSION['desktop_auth']['user'] ?? null) ? $_SESSION['desktop_auth']['user'] : [];
|
||||
$currentGroups = array_map(
|
||||
static fn (string $group): string => strtolower(trim($group, '/')),
|
||||
array_values(array_map('strval', (array) ($currentUser['groups'] ?? [])))
|
||||
);
|
||||
$isPartial = !empty($_GET['partial']);
|
||||
|
||||
if (!in_array('administrators', $currentGroups, true)) {
|
||||
http_response_code(403);
|
||||
$forbidden = '<div class="window-app-shell aa-shell"><div class="window-app-frame aa-frame"><main class="window-app-main aa-main"><div class="window-app-panel aa-panel"><section class="window-app-card aa-card"><p class="aa-message is-error">Kein Zugriff auf Admin Apps.</p></section></div></main></div></div>';
|
||||
if ($isPartial) {
|
||||
echo $forbidden;
|
||||
return;
|
||||
}
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Apps</title>
|
||||
<link rel="stylesheet" href="/assets/desktop/desktop.css">
|
||||
<link rel="stylesheet" href="/system-app-assets/index.php?app=admin-apps&path=assets/app.css">
|
||||
</head>
|
||||
<body><?= $forbidden ?></body>
|
||||
</html><?php
|
||||
return;
|
||||
}
|
||||
|
||||
$csrfToken = (string) ($_SESSION['admin_apps_token'] ?? '');
|
||||
if ($csrfToken === '') {
|
||||
$csrfToken = bin2hex(random_bytes(16));
|
||||
$_SESSION['admin_apps_token'] = $csrfToken;
|
||||
}
|
||||
|
||||
$service = new AdminAppsService($projectRoot);
|
||||
$messages = [];
|
||||
$errors = [];
|
||||
$section = trim((string) ($_GET['section'] ?? $_POST['active_section'] ?? 'overview'));
|
||||
$allowedSections = ['overview', 'widgets', 'integrations'];
|
||||
if (!in_array($section, $allowedSections, true)) {
|
||||
$section = 'overview';
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$postedToken = (string) ($_POST['csrf_token'] ?? '');
|
||||
if ($postedToken === '' || !hash_equals($csrfToken, $postedToken)) {
|
||||
$errors[] = 'Die Formularpruefung ist fehlgeschlagen.';
|
||||
} else {
|
||||
$action = (string) ($_POST['action'] ?? '');
|
||||
|
||||
try {
|
||||
if ($action === 'save-gitea') {
|
||||
$service->saveGiteaConfig([
|
||||
'base_url' => (string) ($_POST['base_url'] ?? ''),
|
||||
'token' => (string) ($_POST['token'] ?? ''),
|
||||
'owner' => (string) ($_POST['owner'] ?? ''),
|
||||
'repositories' => (string) ($_POST['repositories'] ?? ''),
|
||||
'poll_idle_seconds' => (string) ($_POST['poll_idle_seconds'] ?? ''),
|
||||
'poll_running_seconds' => (string) ($_POST['poll_running_seconds'] ?? ''),
|
||||
'visibility' => (string) ($_POST['visibility'] ?? ''),
|
||||
]);
|
||||
$messages[] = 'Gitea-Deploy-Status-Konfiguration gespeichert.';
|
||||
$section = 'integrations';
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
$errors[] = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$bootstrap = $service->bootstrap(true);
|
||||
$apps = is_array($bootstrap['apps'] ?? null) ? $bootstrap['apps'] : [];
|
||||
$widgets = is_array($bootstrap['widgets'] ?? null) ? $bootstrap['widgets'] : [];
|
||||
$stats = is_array($bootstrap['stats'] ?? null) ? $bootstrap['stats'] : [];
|
||||
$meta = is_array($bootstrap['meta'] ?? null) ? $bootstrap['meta'] : [];
|
||||
$gitea = is_array($bootstrap['gitea'] ?? null) ? $bootstrap['gitea'] : [];
|
||||
$giteaConfig = is_array($gitea['config'] ?? null) ? $gitea['config'] : [];
|
||||
$giteaDiagnostics = is_array($gitea['diagnostics'] ?? null) ? $gitea['diagnostics'] : [];
|
||||
|
||||
$h = static fn (?string $value): string => htmlspecialchars($value ?? '', ENT_QUOTES);
|
||||
$sectionUrl = static fn (string $targetSection): string => '/admin/apps/?section=' . rawurlencode($targetSection);
|
||||
$sectionMeta = [
|
||||
'overview' => [
|
||||
'label' => 'Apps',
|
||||
'title' => 'App-Bestand und Scope',
|
||||
'description' => 'Installierbare Fach-Apps, Systemtools und Core-Eintraege der Desktop-Shell im aktuellen Registry-Stand.',
|
||||
'nav' => 'Registry und Freigaben pruefen.',
|
||||
],
|
||||
'widgets' => [
|
||||
'label' => 'Widgets',
|
||||
'title' => 'Widget-Bereich und Quellen',
|
||||
'description' => 'Widget-Inventar aus globaler Registry und Modul-Manifesten mit Quellen, Launch-App und Sichtbarkeit.',
|
||||
'nav' => 'Widget-Quellen und Startpunkte pruefen.',
|
||||
],
|
||||
'integrations' => [
|
||||
'label' => 'Integrationen',
|
||||
'title' => 'Gitea-Deploy-Status',
|
||||
'description' => 'Erste echte Admin-Einstellung fuer das Deploy-Status-Addon inklusive Environment-Datei und Tray-Sichtbarkeit.',
|
||||
'nav' => 'Addon-Konfiguration bearbeiten.',
|
||||
],
|
||||
];
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div id="admin-apps-app" class="window-app-shell aa-shell">
|
||||
<div class="window-app-frame aa-frame">
|
||||
<aside class="window-app-sidebar aa-sidebar">
|
||||
<div class="window-app-brand aa-brand">
|
||||
<p class="window-app-kicker aa-kicker">Administration</p>
|
||||
<h1>Admin Apps</h1>
|
||||
<p class="window-app-copy aa-copy">Zentrale Verwaltungs-App fuer Desktop-Apps, Widgets und erste Integrations-Einstellungen.</p>
|
||||
</div>
|
||||
|
||||
<div class="window-app-nav-list aa-nav-list">
|
||||
<?php foreach ($sectionMeta as $sectionId => $metaItem): ?>
|
||||
<a class="window-app-nav-button aa-nav-button<?= $section === $sectionId ? ' is-active' : '' ?>" href="<?= $h($sectionUrl($sectionId)) ?>">
|
||||
<strong><?= $h($metaItem['label']) ?></strong>
|
||||
<span class="window-app-meta aa-meta"><?= $h($metaItem['nav']) ?></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<section class="window-app-card aa-card">
|
||||
<strong class="aa-side-title">Schnellstatus</strong>
|
||||
<div class="aa-side-metric">
|
||||
<span>Environment</span>
|
||||
<strong><?= $h((string) ($meta['environment'] ?? 'local')) ?></strong>
|
||||
</div>
|
||||
<div class="aa-side-metric">
|
||||
<span>Apps gesamt</span>
|
||||
<strong><?= (int) ($stats['apps_total'] ?? 0) ?></strong>
|
||||
</div>
|
||||
<div class="aa-side-metric">
|
||||
<span>Widgets</span>
|
||||
<strong><?= (int) ($stats['widgets_total'] ?? 0) ?></strong>
|
||||
</div>
|
||||
<div class="aa-side-metric">
|
||||
<span>Admin-only</span>
|
||||
<strong><?= (int) ($stats['admin_only_apps'] ?? 0) ?></strong>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<main class="window-app-main aa-main">
|
||||
<div class="window-app-panel aa-panel">
|
||||
<section class="window-app-hero aa-hero">
|
||||
<div>
|
||||
<p class="window-app-kicker aa-kicker">Admin Registry</p>
|
||||
<h2 class="window-app-title"><?= $h($sectionMeta[$section]['title']) ?></h2>
|
||||
<p class="window-app-copy aa-copy"><?= $h($sectionMeta[$section]['description']) ?></p>
|
||||
</div>
|
||||
<div class="window-app-pill-row aa-pill-row">
|
||||
<span class="window-app-pill">Administrators only</span>
|
||||
<span class="window-app-pill">Desktop Auth</span>
|
||||
<span class="window-app-pill">Section: <?= $h($sectionMeta[$section]['label']) ?></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ($messages !== []): ?>
|
||||
<section class="window-app-card aa-card">
|
||||
<div class="aa-message is-success">
|
||||
<strong>Ergebnis</strong>
|
||||
<ul class="aa-list">
|
||||
<?php foreach ($messages as $message): ?>
|
||||
<li><?= $h($message) ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($errors !== []): ?>
|
||||
<section class="window-app-card aa-card">
|
||||
<div class="aa-message is-error">
|
||||
<strong>Bitte pruefen</strong>
|
||||
<ul class="aa-list">
|
||||
<?php foreach ($errors as $error): ?>
|
||||
<li><?= $h($error) ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($section === 'overview'): ?>
|
||||
<section class="aa-grid aa-grid--stats">
|
||||
<article class="window-app-card aa-card aa-stat-card">
|
||||
<span>Installierbare Apps</span>
|
||||
<strong><?= (int) ($stats['installable_apps'] ?? 0) ?></strong>
|
||||
</article>
|
||||
<article class="window-app-card aa-card aa-stat-card">
|
||||
<span>Systemtools</span>
|
||||
<strong><?= (int) ($stats['system_tools'] ?? 0) ?></strong>
|
||||
</article>
|
||||
<article class="window-app-card aa-card aa-stat-card">
|
||||
<span>Core-Apps</span>
|
||||
<strong><?= (int) (($stats['apps_total'] ?? 0) - ($stats['installable_apps'] ?? 0) - ($stats['system_tools'] ?? 0)) ?></strong>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="window-app-card aa-card">
|
||||
<div class="aa-section-head">
|
||||
<div>
|
||||
<p class="window-app-kicker aa-kicker">Registry</p>
|
||||
<h3 class="aa-section-title">Desktop-Apps</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="aa-table-wrap">
|
||||
<table class="aa-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Titel</th>
|
||||
<th>Scope</th>
|
||||
<th>Typ</th>
|
||||
<th>Route</th>
|
||||
<th>Flags</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($apps as $app): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $h((string) ($app['title'] ?? '')) ?></strong>
|
||||
<div class="aa-table-copy"><?= $h((string) ($app['summary'] ?? '')) ?></div>
|
||||
</td>
|
||||
<td><?= $h((string) ($app['app_scope'] ?? '')) ?></td>
|
||||
<td><?= $h(!empty($app['installable']) ? 'Custom App' : 'System') ?></td>
|
||||
<td><code><?= $h((string) ($app['entry_route'] ?? '')) ?></code></td>
|
||||
<td>
|
||||
<div class="aa-flag-list">
|
||||
<?php if (!empty($app['show_on_desktop'])): ?><span class="window-app-pill">Desktop</span><?php endif; ?>
|
||||
<?php if (!empty($app['supports_widget'])): ?><span class="window-app-pill">Widget</span><?php endif; ?>
|
||||
<?php if (!empty($app['supports_tray'])): ?><span class="window-app-pill">Tray</span><?php endif; ?>
|
||||
<?php if (!empty($app['enabled_by_default'])): ?><span class="window-app-pill">Default</span><?php endif; ?>
|
||||
<?php if (!empty($app['admin_only'])): ?><span class="window-app-pill">Admin only</span><?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($section === 'widgets'): ?>
|
||||
<section class="window-app-card aa-card">
|
||||
<div class="aa-section-head">
|
||||
<div>
|
||||
<p class="window-app-kicker aa-kicker">Widget Registry</p>
|
||||
<h3 class="aa-section-title">Alle Widgets</h3>
|
||||
<p class="aa-copy">Globale Widgets und modulbasierte Widgets werden hier gemeinsam sichtbar. Modul-Widgets kommen bevorzugt aus `module.json`.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="aa-table-wrap">
|
||||
<table class="aa-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Widget</th>
|
||||
<th>Zone</th>
|
||||
<th>Quelle</th>
|
||||
<th>Launch-App</th>
|
||||
<th>Status-API</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($widgets as $widget): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<strong><?= $h((string) ($widget['title'] ?? '')) ?></strong>
|
||||
<div class="aa-table-copy"><?= $h((string) ($widget['summary'] ?? '')) ?></div>
|
||||
</td>
|
||||
<td><?= $h((string) ($widget['zone'] ?? 'sidebar')) ?></td>
|
||||
<td>
|
||||
<code><?= $h((string) (($widget['source_app_id'] ?? '') !== '' ? $widget['source_app_id'] : 'global')) ?></code>
|
||||
<?php if (($widget['source_module_id'] ?? '') !== ''): ?>
|
||||
<div class="aa-table-copy">Modul: <?= $h((string) $widget['source_module_id']) ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><code><?= $h((string) ($widget['launch_app_id'] ?? '')) ?></code></td>
|
||||
<td><code><?= $h((string) ($widget['status_api'] ?? '')) ?></code></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($section === 'integrations'): ?>
|
||||
<section class="window-app-card aa-card">
|
||||
<div class="aa-section-head">
|
||||
<div>
|
||||
<p class="window-app-kicker aa-kicker">Addon</p>
|
||||
<h3 class="aa-section-title">Gitea-Deploy-Status</h3>
|
||||
<p class="aa-copy">Die Werte werden in der aktuellen Environment-Datei gespeichert und beim Deploy in das gemischte `config/`-Verzeichnis uebernommen.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form class="aa-form aa-form--gitea" method="post" action="/admin/apps/">
|
||||
<input type="hidden" name="csrf_token" value="<?= $h($csrfToken) ?>">
|
||||
<input type="hidden" name="action" value="save-gitea">
|
||||
<input type="hidden" name="active_section" value="integrations">
|
||||
|
||||
<div class="aa-form-grid">
|
||||
<label class="aa-field">
|
||||
<span>Gitea API Base URL</span>
|
||||
<input type="text" name="base_url" value="<?= $h((string) ($giteaConfig['base_url'] ?? '')) ?>" placeholder="https://gitea.example.tld/api/v1">
|
||||
</label>
|
||||
<label class="aa-field">
|
||||
<span>Owner oder Organisation</span>
|
||||
<input type="text" name="owner" value="<?= $h((string) ($giteaConfig['owner'] ?? '')) ?>" placeholder="private">
|
||||
</label>
|
||||
<label class="aa-field">
|
||||
<span>Idle Polling (Sek.)</span>
|
||||
<input type="number" min="1" name="poll_idle_seconds" value="<?= $h((string) ($giteaConfig['poll_idle_seconds'] ?? '5')) ?>">
|
||||
</label>
|
||||
<label class="aa-field">
|
||||
<span>Running Polling (Sek.)</span>
|
||||
<input type="number" min="1" name="poll_running_seconds" value="<?= $h((string) ($giteaConfig['poll_running_seconds'] ?? '3')) ?>">
|
||||
</label>
|
||||
<label class="aa-field aa-field--full">
|
||||
<span>Token</span>
|
||||
<input type="password" name="token" value="<?= $h((string) ($giteaConfig['token'] ?? '')) ?>" placeholder="Persoenlicher API-Token">
|
||||
</label>
|
||||
<label class="aa-field aa-field--full">
|
||||
<span>Repositories</span>
|
||||
<textarea name="repositories" rows="5" placeholder="owner/repo owner/zweites-repo"><?= $h(implode("\n", array_values(array_map('strval', (array) ($giteaConfig['repositories'] ?? []))))) ?></textarea>
|
||||
</label>
|
||||
<label class="aa-field">
|
||||
<span>Tray-Sichtbarkeit</span>
|
||||
<select name="visibility">
|
||||
<?php foreach (['admins' => 'Nur Admins', 'all' => 'Alle Benutzer', 'disabled' => 'Deaktiviert'] as $value => $label): ?>
|
||||
<option value="<?= $h($value) ?>"<?= (string) ($giteaConfig['visibility'] ?? 'admins') === $value ? ' selected' : '' ?>><?= $h($label) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<div class="window-app-card aa-card aa-inline-card">
|
||||
<strong>Aktuelle Datei</strong>
|
||||
<code><?= $h((string) ($meta['gitea_config_path'] ?? '')) ?></code>
|
||||
<p>Der Tray ist fuer den aktuellen Benutzer <?= !empty($gitea['tray_visible_for_current_user']) ? 'sichtbar' : 'nicht sichtbar' ?>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="aa-actions">
|
||||
<button class="window-app-nav-button aa-primary" type="submit">Gitea-Einstellungen speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="aa-grid aa-grid--diag">
|
||||
<article class="window-app-card aa-card aa-diag-card">
|
||||
<span>Konfiguriert</span>
|
||||
<strong><?= !empty($giteaDiagnostics['configured']) ? 'Ja' : 'Nein' ?></strong>
|
||||
</article>
|
||||
<article class="window-app-card aa-card aa-diag-card">
|
||||
<span>Token vorhanden</span>
|
||||
<strong><?= !empty($giteaDiagnostics['token_present']) ? 'Ja' : 'Nein' ?></strong>
|
||||
</article>
|
||||
<article class="window-app-card aa-card aa-diag-card">
|
||||
<span>Repos konfiguriert</span>
|
||||
<strong><?= count((array) ($giteaDiagnostics['repositories_configured'] ?? [])) ?></strong>
|
||||
</article>
|
||||
<article class="window-app-card aa-card aa-diag-card">
|
||||
<span>Visibility</span>
|
||||
<strong><?= $h((string) ($giteaDiagnostics['visibility'] ?? 'admins')) ?></strong>
|
||||
</article>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
|
||||
if ($isPartial) {
|
||||
echo $content;
|
||||
return;
|
||||
}
|
||||
?><!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Admin Apps</title>
|
||||
<link rel="stylesheet" href="/assets/desktop/desktop.css">
|
||||
<link rel="stylesheet" href="/system-app-assets/index.php?app=admin-apps&path=assets/app.css">
|
||||
</head>
|
||||
<body style="margin:0;background:#d7dde5;">
|
||||
<?= $content ?>
|
||||
<script src="/system-app-assets/index.php?app=admin-apps&path=assets/app.js"></script>
|
||||
<script>
|
||||
window.initAdminAppsApp?.(document.getElementById('admin-apps-app'), { standalone: true });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user