Initial-bootstrap failure stopped the poll interval from ever starting, and even once running, refresh() never reset the indicator back to 'polling' on success — so a single upstream blip pinned the plugin in an error state until the user reloaded the page. refresh() now loads namespaces on demand (absorbs bootstrap), the interval is started unconditionally on show(), and every successful poll flips the indicator back to green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
29 lines
1.5 KiB
PHP
29 lines
1.5 KiB
PHP
<?php
|
|
|
|
define('APP_NAME', 'hyprcrd');
|
|
define('APP_VERSION', '2.0.14');
|
|
|
|
// APP_DEBUG: gates verbose error responses (curl traces, upstream bodies).
|
|
// Off by default; enable via env for local troubleshooting only.
|
|
define('APP_DEBUG', getenv('APP_DEBUG') === '1' || getenv('APP_DEBUG') === 'true');
|
|
|
|
// Database path — writable directory, outside webroot
|
|
// DB_PATH / UPLOAD_DIR can be pre-defined by the Electron router for app isolation
|
|
if (!defined('DB_PATH')) define('DB_PATH', __DIR__ . '/data/hyprcrd.db');
|
|
if (!defined('UPLOAD_DIR')) define('UPLOAD_DIR', __DIR__ . '/public/uploads');
|
|
|
|
// Base URL auto-detection (works in Docker and hosted environments)
|
|
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
|
$host = $_SERVER['HTTP_HOST'] ?? 'localhost';
|
|
$scriptDir = dirname($_SERVER['SCRIPT_NAME']);
|
|
$basePath = ($scriptDir === '/' || $scriptDir === '\\') ? '' : $scriptDir;
|
|
define('BASE_URL', $protocol . '://' . $host . $basePath);
|
|
|
|
// Oumta dashboard upstream. The browser only talks to /api/dashboard/*
|
|
// same-origin; the PHP proxy below forwards to this URL. Override via env
|
|
// for remote deployments. Inside Docker on Linux, localhost points at the
|
|
// container itself — use http://host.docker.internal:8085 (needs
|
|
// extra_hosts) or a routable URL to reach a host-side dashboard.
|
|
define('OUMTA_DASHBOARD_URL', getenv('OUMTA_DASHBOARD_URL') ?: 'http://localhost:8085');
|
|
define('OUMTA_DASHBOARD_TOKEN', getenv('OUMTA_DASHBOARD_TOKEN') ?: '');
|