Compare commits
9
Commits
e6ec9c901b
...
0e9370891f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e9370891f | ||
|
|
def1a6a9f3 | ||
|
|
1e1b50d61c | ||
|
|
aa607a9230 | ||
|
|
6b9882ca04 | ||
|
|
e2239fbcd2 | ||
|
|
1bee77d5fb | ||
|
|
cc4d9dea10 | ||
|
|
5d1fdb86eb |
@@ -31,7 +31,7 @@ describe('DC-077: i18n system', () => {
|
||||
});
|
||||
|
||||
it('falls back to English for unsupported language', () => {
|
||||
expect(i18n.t('dashboard.title', 'zh')).toBe('Dashboard');
|
||||
expect(i18n.t('dashboard.title', 'klingon')).toBe('Dashboard');
|
||||
});
|
||||
|
||||
it('falls back to key if not found in any language', () => {
|
||||
@@ -58,8 +58,8 @@ describe('DC-077: i18n system', () => {
|
||||
});
|
||||
|
||||
it('returns false for unsupported languages', () => {
|
||||
expect(i18n.isSupported('zh')).toBe(false);
|
||||
expect(i18n.isSupported('ja')).toBe(false);
|
||||
expect(i18n.isSupported('klingon')).toBe(false);
|
||||
expect(i18n.isSupported('xx')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -81,8 +81,8 @@ describe('DC-077: i18n system', () => {
|
||||
});
|
||||
|
||||
it('defaults to English for unsupported languages', () => {
|
||||
expect(i18n.detectLanguage('zh-CN,zh;q=0.9')).toBe('en');
|
||||
expect(i18n.detectLanguage('ja-JP,ja;q=0.9')).toBe('en');
|
||||
expect(i18n.detectLanguage('klingon-KR,klingon;q=0.9')).toBe('en');
|
||||
expect(i18n.detectLanguage('xx-XX,xx;q=0.9')).toBe('en');
|
||||
});
|
||||
|
||||
it('strips region codes before matching', () => {
|
||||
|
||||
@@ -14,13 +14,13 @@ function createI18nApp() {
|
||||
}
|
||||
|
||||
describe('DC-077: i18n Routes', () => {
|
||||
it('GET /i18n/languages returns 5 languages', async () => {
|
||||
it('GET /i18n/languages returns supported languages', async () => {
|
||||
const app = createI18nApp();
|
||||
const res = await request(app).get('/api/v1/i18n/languages');
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.success).toBe(true);
|
||||
expect(res.body.languages).toHaveLength(5);
|
||||
expect(res.body.languages.length).toBeGreaterThanOrEqual(5);
|
||||
expect(res.body.default).toBe('en');
|
||||
});
|
||||
|
||||
|
||||
@@ -1764,6 +1764,42 @@ const APP_TEMPLATES = {
|
||||
]
|
||||
},
|
||||
|
||||
"vintage-radio": {
|
||||
name: "Vintage Radio",
|
||||
description: "Tune a beautiful retro radio through real internet stations (SomaFM, KEXP, BBC, Radio Paradise, and more)",
|
||||
icon: "📻",
|
||||
logo: "/assets/vintage-radio.png",
|
||||
category: "Media",
|
||||
popularity: 72,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "nginx:alpine",
|
||||
ports: ["{{PORT}}:80"],
|
||||
volumes: [
|
||||
"/opt/vintage-radio/web:/usr/share/nginx/html:ro"
|
||||
],
|
||||
environment: {}
|
||||
},
|
||||
subdomain: "radio",
|
||||
defaultPort: 8090,
|
||||
healthCheck: "/",
|
||||
subpathSupport: 'none',
|
||||
staticSite: true,
|
||||
features: [
|
||||
"Vintage wooden-cabinet radio UI with analog dial",
|
||||
"Curated list of real public internet-radio streams",
|
||||
"Smooth tuner animation with frequency scanning",
|
||||
"Live VU meter and station-name display",
|
||||
"Add your own streams by editing stations.json"
|
||||
],
|
||||
setupInstructions: [
|
||||
"Open radio.sami (or your configured subdomain)",
|
||||
"Drag the dial or click a station card to tune in",
|
||||
"To add stations, edit /opt/vintage-radio/web/stations.json on the host and restart the container"
|
||||
],
|
||||
tags: ["radio", "music", "streaming", "audio", "vintage", "retro", "media"]
|
||||
},
|
||||
|
||||
"airsonic": {
|
||||
name: "Airsonic Advanced",
|
||||
description: "Free web-based media streamer",
|
||||
@@ -2541,7 +2577,386 @@ const APP_TEMPLATES = {
|
||||
fix: "Check that uvicorn is binding 127.0.0.1:8765 (not 0.0.0.0). Use `ss -tlnp | grep 8765` to confirm."
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"authelia": {
|
||||
name: "Authelia",
|
||||
description: "Single sign-on portal and authentication gateway for web apps",
|
||||
icon: "\u{1F6E1}\u{FE0F}",
|
||||
category: "Security",
|
||||
popularity: 82,
|
||||
difficulty: "Advanced",
|
||||
docker: {
|
||||
image: "authelia/authelia:latest",
|
||||
ports: ["{{PORT}}:9091"],
|
||||
volumes: ["/opt/authelia/config:/config"],
|
||||
environment: {
|
||||
"AUTHELIA_STORAGE": "local",
|
||||
"AUTHELIA_STORAGE_LOCAL_PATH": "/config/db.sqlite3"
|
||||
}
|
||||
},
|
||||
subdomain: "authelia",
|
||||
defaultPort: 9091,
|
||||
healthCheck: "/api/health",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: [
|
||||
"Edit /opt/authelia/config/configuration.yml with your domain and settings",
|
||||
"Configure users in /opt/authelia/config/users_database.yml",
|
||||
"Set up Caddy forward_auth to protect your services behind Authelia",
|
||||
"Configure 2FA (TOTP, WebAuthn) in the Authelia portal"
|
||||
],
|
||||
dashcaddyIntegration: {
|
||||
ssoCompatible: true,
|
||||
forwardAuth: true,
|
||||
caddySnippet: "forward_auth authelia.<domain>:9091 { uri /api/verify?rd=https://authelia.<domain> copy_headers Remote-User Remote-Groups Remote-Name Remote-Email }"
|
||||
}
|
||||
},
|
||||
|
||||
"keycloak": {
|
||||
name: "Keycloak",
|
||||
description: "Open source identity and access management with SSO, OIDC, and SAML",
|
||||
icon: "\u{1F511}",
|
||||
category: "Security",
|
||||
popularity: 85,
|
||||
difficulty: "Advanced",
|
||||
docker: {
|
||||
image: "quay.io/keycloak/keycloak:latest",
|
||||
ports: ["{{PORT}}:8080"],
|
||||
volumes: ["/opt/keycloak/data:/opt/keycloak/data"],
|
||||
environment: {
|
||||
"KEYCLOAK_ADMIN": "admin",
|
||||
"KEYCLOAK_ADMIN_PASSWORD": "{{GENERATED_SECRET}}",
|
||||
"KC_DB": "dev-file",
|
||||
"KC_HOSTNAME": "{{SUBDOMAIN}}.{{TLD}}"
|
||||
},
|
||||
command: ["start-dev"]
|
||||
},
|
||||
subdomain: "keycloak",
|
||||
defaultPort: 8090,
|
||||
healthCheck: "/health/ready",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: [
|
||||
"Log in with admin / generated password",
|
||||
"Create a realm for your applications",
|
||||
"Configure OIDC clients for each app you want to protect",
|
||||
"Set up identity providers (Google, GitHub, etc.) for social login"
|
||||
],
|
||||
secrets: [{
|
||||
envVar: "GENERATED_SECRET",
|
||||
label: "Keycloak Admin Password",
|
||||
description: "Initial admin password",
|
||||
type: "password",
|
||||
required: true,
|
||||
generate: "alphanumeric",
|
||||
length: 32
|
||||
}]
|
||||
},
|
||||
|
||||
"vikunja": {
|
||||
name: "Vikunja",
|
||||
description: "Self-hosted to-do app with lists, kanban boards, and teams",
|
||||
icon: "\u2705",
|
||||
category: "Productivity",
|
||||
popularity: 72,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "vikunja/vikunja:latest",
|
||||
ports: ["{{PORT}}:3456"],
|
||||
volumes: ["/opt/vikunja/files:/app/vikunja/files", "/opt/vikunja/db:/app/vikunja/database"],
|
||||
environment: {
|
||||
"VIKUNJA_SERVICE_JWTSECRET": "{{GENERATED_SECRET}}",
|
||||
"VIKUNJA_SERVICE_FRONTENDURL": "https://{{SUBDOMAIN}}.{{TLD}}"
|
||||
}
|
||||
},
|
||||
subdomain: "vikunja",
|
||||
defaultPort: 3456,
|
||||
healthCheck: "/api/v1/info",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Register the first user account", "Create projects and tasks", "Set up teams for shared task management"],
|
||||
secrets: [{
|
||||
envVar: "GENERATED_SECRET",
|
||||
label: "JWT Secret",
|
||||
description: "Secret for signing auth tokens",
|
||||
type: "password",
|
||||
required: true,
|
||||
generate: "alphanumeric",
|
||||
length: 48
|
||||
}]
|
||||
},
|
||||
|
||||
"openproject": {
|
||||
name: "OpenProject",
|
||||
description: "Project management with Gantt charts, time tracking, and Scrum boards",
|
||||
icon: "\u{1F4CB}",
|
||||
category: "Productivity",
|
||||
popularity: 75,
|
||||
difficulty: "Intermediate",
|
||||
docker: {
|
||||
image: "openproject/openproject:latest",
|
||||
ports: ["{{PORT}}:80"],
|
||||
volumes: ["/opt/openproject/pgdata:/var/openproject/pgdata", "/opt/openproject/assets:/var/openproject/assets"],
|
||||
environment: { "OPENPROJECT_HOST__NAME": "{{SUBDOMAIN}}.{{TLD}}", "OPENPROJECT_HTTPS": "true" }
|
||||
},
|
||||
subdomain: "projects",
|
||||
defaultPort: 8091,
|
||||
healthCheck: "/",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Complete the initial setup wizard", "Create your first project", "Add team members and configure permissions"]
|
||||
},
|
||||
|
||||
"plane": {
|
||||
name: "Plane",
|
||||
description: "Open-source Jira alternative with issues, cycles, and modules",
|
||||
icon: "\u2708\uFE0F",
|
||||
category: "Productivity",
|
||||
popularity: 70,
|
||||
difficulty: "Intermediate",
|
||||
docker: {
|
||||
image: "makeplane/plane-frontend:latest",
|
||||
ports: ["{{PORT}}:3000"],
|
||||
volumes: ["/opt/plane/data:/app/data"],
|
||||
environment: { "NEXT_PUBLIC_API_BASE_URL": "https://{{SUBDOMAIN}}.{{TLD}}/api" }
|
||||
},
|
||||
subdomain: "plane",
|
||||
defaultPort: 8092,
|
||||
healthCheck: "/",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Plane requires multiple containers - use the recipe for full stack deploy", "Create an organization and invite team members", "Set up cycles and modules for project tracking"]
|
||||
},
|
||||
|
||||
"hedgedoc": {
|
||||
name: "HedgeDoc",
|
||||
description: "Collaborative markdown editor with real-time editing",
|
||||
icon: "\u{1F4DD}",
|
||||
category: "Productivity",
|
||||
popularity: 68,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "quay.io/hedgedoc/hedgedoc:latest",
|
||||
ports: ["{{PORT}}:3000"],
|
||||
volumes: ["/opt/hedgedoc/uploads:/hedgedoc/public/uploads"],
|
||||
environment: {
|
||||
"CMD_DOMAIN": "{{SUBDOMAIN}}.{{TLD}}",
|
||||
"CMD_URL_ADDPORT": "false",
|
||||
"CMD_PROTOCOL_USESSL": "true",
|
||||
"CMD_DB_URL": "sqlite:/hedgedoc/database.sqlite"
|
||||
}
|
||||
},
|
||||
subdomain: "notes",
|
||||
defaultPort: 8093,
|
||||
healthCheck: "/status",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Register an account or use guest mode", "Create collaborative markdown documents", "Share links for real-time co-editing"]
|
||||
},
|
||||
|
||||
"yacht": {
|
||||
name: "Yacht",
|
||||
description: "Web-based Docker container manager with template support",
|
||||
icon: "\u26F5",
|
||||
category: "Management",
|
||||
popularity: 65,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "selfhostedpro/yacht:latest",
|
||||
ports: ["{{PORT}}:8000"],
|
||||
volumes: ["/opt/yacht/config:/config", "/var/run/docker.sock:/var/run/docker.sock"],
|
||||
environment: { "PUID": "1000", "PGID": "1000" }
|
||||
},
|
||||
subdomain: "yacht",
|
||||
defaultPort: 8094,
|
||||
healthCheck: "/",
|
||||
subpathSupport: 'strip',
|
||||
setupInstructions: ["Set up admin account on first launch", "Add compose templates for one-click deployments", "Manage containers through the web interface"]
|
||||
},
|
||||
|
||||
"openvpn": {
|
||||
name: "OpenVPN",
|
||||
description: "Virtual private network server for secure remote access",
|
||||
icon: "\u{1F512}",
|
||||
category: "Security",
|
||||
popularity: 78,
|
||||
difficulty: "Intermediate",
|
||||
docker: {
|
||||
image: "kylemanna/openvpn:latest",
|
||||
ports: ["{{PORT}}:1194/udp"],
|
||||
volumes: ["/opt/openvpn:/etc/openvpn"],
|
||||
environment: {},
|
||||
cap_add: ["NET_ADMIN"]
|
||||
},
|
||||
subdomain: "openvpn",
|
||||
defaultPort: 1194,
|
||||
healthCheck: null,
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Initialize the PKI: docker exec openvpn ovpn_initpki", "Generate client certificates for each device", "Download client configs and import into OpenVPN client"]
|
||||
},
|
||||
|
||||
"forgejo": {
|
||||
name: "Forgejo",
|
||||
description: "Self-hosted Git service - soft fork of Gitea with enhanced features",
|
||||
icon: "\u{1F527}",
|
||||
category: "Development",
|
||||
popularity: 73,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "codeberg.org/forgejo/forgejo:latest",
|
||||
ports: ["{{PORT}}:3000", "2222:22"],
|
||||
volumes: ["/opt/forgejo/data:/data", "/etc/localtime:/etc/localtime:ro"],
|
||||
environment: { "USER_UID": "1000", "USER_GID": "1000" }
|
||||
},
|
||||
subdomain: "forgejo",
|
||||
defaultPort: 8095,
|
||||
healthCheck: "/api/v1/version",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Configure database on first run", "Create admin account and disable open registration", "Migrate repos from GitHub/GitLab via the built-in migration tool", "Set up Actions for CI/CD pipelines"]
|
||||
},
|
||||
|
||||
"gitlab": {
|
||||
name: "GitLab",
|
||||
description: "Complete DevOps platform with Git, CI/CD, and project management",
|
||||
icon: "\u{1F99A}",
|
||||
category: "Development",
|
||||
popularity: 88,
|
||||
difficulty: "Advanced",
|
||||
docker: {
|
||||
image: "gitlab/gitlab-ce:latest",
|
||||
ports: ["{{PORT}}:80", "8443:443", "2223:22"],
|
||||
volumes: ["/opt/gitlab/config:/etc/gitlab", "/opt/gitlab/logs:/var/log/gitlab", "/opt/gitlab/data:/var/opt/gitlab"],
|
||||
environment: { "GITLAB_OMNIBUS_CONFIG": "external_url https://{{SUBDOMAIN}}.{{TLD}}" },
|
||||
shm_size: "256m"
|
||||
},
|
||||
subdomain: "gitlab",
|
||||
defaultPort: 8096,
|
||||
healthCheck: "/-/health",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Requires at least 4GB RAM and 2 CPU cores", "Wait 5-10 minutes for first boot", "Set root password on first login", "Configure runners for CI/CD pipelines"],
|
||||
resourceWarning: { minMemoryMB: 4096, minCpuCores: 2, message: "GitLab requires at least 4GB RAM. Deploying on a smaller server may cause instability." }
|
||||
},
|
||||
|
||||
"prometheus": {
|
||||
name: "Prometheus",
|
||||
description: "Monitoring system with time-series database and alerting",
|
||||
icon: "\u{1F525}",
|
||||
category: "Monitoring",
|
||||
popularity: 85,
|
||||
difficulty: "Intermediate",
|
||||
docker: {
|
||||
image: "prom/prometheus:latest",
|
||||
ports: ["{{PORT}}:9090"],
|
||||
volumes: ["/opt/prometheus/data:/prometheus", "/opt/prometheus/config:/etc/prometheus"],
|
||||
environment: {},
|
||||
command: ["--config.file=/etc/prometheus/prometheus.yml", "--storage.tsdb.path=/prometheus", "--web.enable-lifecycle"]
|
||||
},
|
||||
subdomain: "prometheus",
|
||||
defaultPort: 9090,
|
||||
healthCheck: "/-/healthy",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Edit /opt/prometheus/config/prometheus.yml to add scrape targets", "Add DashCaddy /api/v1/metrics/prometheus as a scrape target", "Pair with Grafana for dashboards", "Configure alert rules"]
|
||||
},
|
||||
|
||||
"netdata": {
|
||||
name: "Netdata",
|
||||
description: "Real-time system metrics with zero configuration monitoring",
|
||||
icon: "\u{1F4C8}",
|
||||
category: "Monitoring",
|
||||
popularity: 82,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "netdata/netdata:latest",
|
||||
ports: ["{{PORT}}:19999"],
|
||||
volumes: ["/opt/netdata/config:/etc/netdata", "/opt/netdata/lib:/var/lib/netdata", "/opt/netdata/cache:/var/cache/netdata", "/proc:/host/proc:ro", "/sys:/host/sys:ro", "/etc/os-release:/host/etc/os-release:ro"],
|
||||
environment: { "NETDATA_CLAIM_URL": "https://app.netdata.cloud" },
|
||||
cap_add: ["SYS_PTRACE"],
|
||||
security_opt: ["apparmor:unconfined"]
|
||||
},
|
||||
subdomain: "netdata",
|
||||
defaultPort: 19999,
|
||||
healthCheck: "/api/v1/info",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Dashboard is immediately available with zero configuration", "Monitor CPU, RAM, disk, network, Docker in real-time", "Configure alarms for resource thresholds", "Optional: claim to Netdata Cloud for centralized monitoring"]
|
||||
},
|
||||
|
||||
"kibana": {
|
||||
name: "Kibana",
|
||||
description: "Visualization dashboard for Elasticsearch data analytics",
|
||||
icon: "\u{1F4C9}",
|
||||
category: "Monitoring",
|
||||
popularity: 70,
|
||||
difficulty: "Advanced",
|
||||
docker: {
|
||||
image: "kibana:8.12.0",
|
||||
ports: ["{{PORT}}:5601"],
|
||||
volumes: ["/opt/kibana/config:/usr/share/kibana/config"],
|
||||
environment: { "ELASTICSEARCH_HOSTS": "http://elasticsearch:9200" }
|
||||
},
|
||||
subdomain: "kibana",
|
||||
defaultPort: 5601,
|
||||
healthCheck: "/api/status",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Requires an Elasticsearch instance running first", "Consider deploying via the ELK Stack recipe", "Create index patterns for your data", "Build dashboards and visualizations"]
|
||||
},
|
||||
|
||||
"openhab": {
|
||||
name: "OpenHAB",
|
||||
description: "Open source home automation platform with broad device support",
|
||||
icon: "\u2699\uFE0F",
|
||||
category: "Home Automation",
|
||||
popularity: 72,
|
||||
difficulty: "Intermediate",
|
||||
docker: {
|
||||
image: "openhab/openhab:latest",
|
||||
ports: ["{{PORT}}:8080", "8444:8443"],
|
||||
volumes: ["/opt/openhab/conf:/openhab/conf", "/opt/openhab/userdata:/openhab/userdata", "/opt/openhab/addons:/openhab/addons", "/etc/localtime:/etc/localtime:ro"],
|
||||
environment: { "OPENHAB_HTTP_PORT": "8080", "OPENHAB_HTTPS_PORT": "8443", "EXTRA_JAVA_OPTS": "-Duser.timezone={{TIMEZONE}}" }
|
||||
},
|
||||
subdomain: "openhab",
|
||||
defaultPort: 8097,
|
||||
healthCheck: "/start/index",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Choose your preferred package (Standard, Demo, or Minimal)", "Install bindings for your smart home devices", "Create items, sitemaps, and rules", "Access the Paper UI for configuration"]
|
||||
},
|
||||
|
||||
"bitwarden": {
|
||||
name: "Bitwarden",
|
||||
description: "Official Bitwarden password manager server (unified self-hosted)",
|
||||
icon: "\u{1F510}",
|
||||
category: "Security",
|
||||
popularity: 80,
|
||||
difficulty: "Advanced",
|
||||
docker: {
|
||||
image: "bitwarden/self-host:latest",
|
||||
ports: ["{{PORT}}:8080"],
|
||||
volumes: ["/opt/bitwarden/data:/etc/bitwarden"],
|
||||
environment: { "BW_DOMAIN": "{{SUBDOMAIN}}.{{TLD}}" }
|
||||
},
|
||||
subdomain: "bitwarden",
|
||||
defaultPort: 8098,
|
||||
healthCheck: "/health",
|
||||
subpathSupport: 'none',
|
||||
setupInstructions: ["Complete the Bitwarden unified installation", "Generate installation ID and key at bitwarden.com/host", "Configure SMTP for email verification", "Note: Vaultwarden is recommended for smaller deployments"],
|
||||
resourceWarning: { minMemoryMB: 2048, message: "Official Bitwarden requires 2GB+ RAM. For lightweight deployments, use Vaultwarden instead." }
|
||||
},
|
||||
|
||||
"subsonic": {
|
||||
name: "Subsonic",
|
||||
description: "Web-based media streamer for music with wide client support",
|
||||
icon: "\u{1F3B5}",
|
||||
category: "Media",
|
||||
popularity: 60,
|
||||
difficulty: "Easy",
|
||||
docker: {
|
||||
image: "linuxserver/subsonic:latest",
|
||||
ports: ["{{PORT}}:4040"],
|
||||
volumes: ["/opt/subsonic/config:/config", "/opt/subsonic/music:/music", "/opt/subsonic/podcasts:/podcasts", "/opt/subsonic/playlists:/playlists"],
|
||||
environment: { "PUID": "1000", "PGID": "1000", "TZ": "{{TIMEZONE}}" }
|
||||
},
|
||||
subdomain: "subsonic",
|
||||
defaultPort: 4040,
|
||||
healthCheck: "/",
|
||||
subpathSupport: 'native',
|
||||
setupInstructions: ["Set admin password on first launch", "Add music folders in Settings", "Install Subsonic-compatible apps on your devices", "Note: Airsonic Advanced is also available as a fully open-source alternative"],
|
||||
mediaMount: { required: true, containerPath: "/music", label: "Music Library", description: "Folder containing your music files", defaultPath: "/media/music" }
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
// Template categories for organization
|
||||
|
||||
@@ -529,9 +529,22 @@ function isSupported(lang) { return SUPPORTED_LANGUAGES.indexOf(lang) >= 0; }
|
||||
function detectLanguage(acceptLanguage) {
|
||||
if (!acceptLanguage) return DEFAULT_LANGUAGE;
|
||||
var parts = acceptLanguage.split(',');
|
||||
var parsed = [];
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var code = parts[i].trim().split(';')[0].split('-')[0].toLowerCase();
|
||||
if (isSupported(code)) return code;
|
||||
var raw = parts[i].trim();
|
||||
var langParts = raw.split(';');
|
||||
var code = langParts[0].split('-')[0].toLowerCase();
|
||||
var q = 1.0;
|
||||
for (var j = 1; j < langParts.length; j++) {
|
||||
var kv = langParts[j].trim().split('=');
|
||||
if (kv[0] === 'q' && kv[1]) q = parseFloat(kv[1]);
|
||||
}
|
||||
parsed.push({ code: code, q: isNaN(q) ? 1.0 : q });
|
||||
}
|
||||
// Sort by q-value descending so the highest-priority language is tried first
|
||||
parsed.sort(function (a, b) { return b.q - a.q; });
|
||||
for (var k = 0; k < parsed.length; k++) {
|
||||
if (isSupported(parsed[k].code)) return parsed[k].code;
|
||||
}
|
||||
return DEFAULT_LANGUAGE;
|
||||
}
|
||||
|
||||
@@ -504,6 +504,45 @@ module.exports = function configureMiddleware(app, {
|
||||
return errorResponse(res, 401, '[DC-110] Authentication required', { requiresTotp: true });
|
||||
};
|
||||
|
||||
|
||||
// ── Sensitive routes: block external access when TOTP is off ──
|
||||
// When TOTP is not enabled, all routes are open by design. But certain routes
|
||||
// expose infrastructure details (config, tailscale, license keys, service
|
||||
// manifests with container IDs, deployment manifests, port mappings) that
|
||||
// should not be accessible from the public internet. Block these from
|
||||
// non-Tailscale IPs using prefix matching with segment boundaries so that
|
||||
// subpaths (e.g. /api/v1/services/dc9201) are also protected.
|
||||
//
|
||||
// Each entry is matched as: path === prefix || path.startsWith(prefix + '/')
|
||||
const SENSITIVE_ROUTE_PREFIXES = [
|
||||
'/api/v1/config',
|
||||
'/api/v1/services',
|
||||
'/api/v1/tailscale',
|
||||
'/api/v1/updates',
|
||||
'/api/v1/license',
|
||||
'/api/v1/credentials',
|
||||
'/api/v1/health-checks',
|
||||
'/api/v1/disaster',
|
||||
'/api/v1/fleet',
|
||||
'/api/v1/disk',
|
||||
];
|
||||
|
||||
const sensitiveRouteMiddleware = (req, res, next) => {
|
||||
if (!totpConfig.enabled) {
|
||||
const isSensitive = SENSITIVE_ROUTE_PREFIXES.some(
|
||||
prefix => req.path === prefix || req.path.startsWith(prefix + '/')
|
||||
);
|
||||
if (isSensitive && !isTailscaleIP(getClientIP(req))) {
|
||||
return errorResponse(res, 403, '[DC-122] Access denied. This endpoint requires TOTP authentication or Tailscale access.', {
|
||||
requiresTotp: true
|
||||
});
|
||||
}
|
||||
}
|
||||
next();
|
||||
};
|
||||
|
||||
app.use(sensitiveRouteMiddleware);
|
||||
|
||||
app.use(totpAuthMiddleware);
|
||||
|
||||
// ── JWT/API Key authentication middleware ──
|
||||
|
||||
@@ -77,6 +77,7 @@ const bundles = {
|
||||
// window.wireModal + window.injectModal + window.escapeHtml helpers
|
||||
// defined in globals.js (already in core.js).
|
||||
JS('share-modal.js'),
|
||||
JS('i18n.js'),
|
||||
],
|
||||
'onboarding.js': [
|
||||
JS('driver.min.js'),
|
||||
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+293
-251
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+61
-1
@@ -654,6 +654,23 @@
|
||||
<!-- Will be filled dynamically -->
|
||||
</div>
|
||||
|
||||
<!-- Disk safety info: health checks accumulate data over time -->
|
||||
<div style="margin-top: 16px; padding: 14px 16px; background: color-mix(in srgb, var(--warn-fg, #f39c12) 10%, transparent); border-radius: 8px; border: 1px solid var(--warn-fg, #f39c12);">
|
||||
<div style="display: flex; gap: 10px; align-items: flex-start;">
|
||||
<span style="font-size: 1.2rem; line-height: 1;">💾</span>
|
||||
<div>
|
||||
<strong style="color: var(--warn-fg, #f39c12);">Disk Usage & Health-Check Data</strong>
|
||||
<div style="font-size: 0.85rem; margin-top: 4px; color: var(--muted); line-height: 1.45;">
|
||||
DashCaddy's health checks log response times, uptime history, and incidents for every monitored service.
|
||||
Over time this data accumulates and can consume significant disk space — especially on small VPS or
|
||||
SD-card installs. After setup, open <strong>Health → Configure → Global Settings</strong> to set a
|
||||
<strong>data retention period</strong> (default 30 days), adjust the <strong>polling interval</strong>,
|
||||
and configure a <strong>disk-usage warning threshold</strong> so you're alerted before storage runs low.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 24px; padding: 16px; background: color-mix(in srgb, var(--ok-fg) 10%, transparent); border-radius: 8px; border: 1px solid var(--ok-fg);">
|
||||
<strong style="color: var(--ok-fg);">✓ You can change these settings later</strong>
|
||||
<div style="font-size: 0.85rem; margin-top: 4px; color: var(--muted);">
|
||||
@@ -663,7 +680,47 @@
|
||||
|
||||
<div class="setup-wizard-buttons">
|
||||
<button id="setup-summary-back">← Back</button>
|
||||
<button id="setup-finish" class="setup-btn-primary" style="background: var(--ok-bg); border-color: var(--ok-fg); color: var(--ok-fg);">✓ Finish Setup</button>
|
||||
<button id="setup-summary-next" class="setup-btn-primary">Continue →</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Disk Safety Warning step (shown after the configuration summary) -->
|
||||
<div class="setup-step" id="setup-step-disk-safety" style="display: none;">
|
||||
<h2 style="margin: 0 0 8px;">⚠️ Disk Usage Note</h2>
|
||||
<p class="setup-desc">Important information about storage before you finish</p>
|
||||
|
||||
<div style="margin-top: 8px; padding: 18px 20px; background: color-mix(in srgb, var(--warn-fg, #f39c12) 12%, transparent); border-radius: 10px; border: 1px solid var(--warn-fg, #f39c12);">
|
||||
<div style="display: flex; gap: 12px; align-items: flex-start;">
|
||||
<span style="font-size: 1.5rem; line-height: 1.2;">⚠️</span>
|
||||
<div style="font-size: 0.92rem; line-height: 1.55; color: var(--text);">
|
||||
<strong style="color: var(--warn-fg, #f39c12);">Disk Usage Note:</strong>
|
||||
DashCaddy stores health check history, container statistics, and event logs.
|
||||
On a busy server, this data can accumulate over time.
|
||||
Set appropriate retention limits in <strong>Settings → Health</strong> to prevent disk fill.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 16px; padding: 14px 16px; background: var(--card-bg); border-radius: 8px; border: 1px solid var(--border);">
|
||||
<strong style="font-size: 0.9rem;">📋 Recommended after setup</strong>
|
||||
<ul style="margin: 8px 0 0; padding-left: 20px; font-size: 0.85rem; color: var(--muted); line-height: 1.6;">
|
||||
<li>Open <strong>Health → Configure → Global Settings</strong></li>
|
||||
<li>Set a <strong>data retention period</strong> (default: 30 days)</li>
|
||||
<li>Cap <strong>max entries per service</strong> (default: 500)</li>
|
||||
<li>Set a <strong>disk-usage warning threshold</strong> (default: 80%)</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 24px; padding: 16px; background: color-mix(in srgb, var(--ok-fg) 10%, transparent); border-radius: 8px; border: 1px solid var(--ok-fg);">
|
||||
<strong style="color: var(--ok-fg);">✓ You can change these settings later</strong>
|
||||
<div style="font-size: 0.85rem; margin-top: 4px; color: var(--muted);">
|
||||
Go to Settings → System Configuration to edit your setup anytime
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setup-wizard-buttons">
|
||||
<button id="setup-disk-safety-back">← Back</button>
|
||||
<button id="setup-disk-safety-finish" class="setup-btn-primary" style="background: var(--ok-bg); border-color: var(--ok-fg); color: var(--ok-fg);">✓ Finish Setup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -959,6 +1016,9 @@
|
||||
<script src="/js/language-selector.js" defer></script>
|
||||
|
||||
<!-- Bundled JS (built with: npm run build) -->
|
||||
<!-- i18n (language selector + translation system) -->
|
||||
<script src="/js/i18n.js" defer></script>
|
||||
|
||||
<script src="/dist/core.js" defer></script>
|
||||
<script src="/dist/features.js" defer></script>
|
||||
<script src="/dist/onboarding.js" defer></script>
|
||||
|
||||
@@ -34,6 +34,39 @@
|
||||
<div class="panel-empty"><span class="empty-icon">⚙️</span> Loading configuration...</div>
|
||||
</div>
|
||||
|
||||
<!-- Global Settings: retention, polling interval, disk-usage threshold -->
|
||||
<div id="health-global-settings" style="margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-base);">
|
||||
<h4 style="margin: 0 0 4px;">🌍 Global Settings</h4>
|
||||
<p class="text-muted-sm" style="margin: 0 0 12px;">Applies to all health checks. Settings are stored locally in this browser.</p>
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;">
|
||||
<div>
|
||||
<label class="text-muted-sm">Data Retention (days)</label>
|
||||
<input type="number" id="health-setting-retention" value="30" min="1" max="3650" class="form-input" />
|
||||
<div style="font-size: 0.72rem; color: var(--muted); margin-top: 2px;">Health history older than this is pruned.</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-muted-sm">Polling Interval (seconds)</label>
|
||||
<input type="number" id="health-setting-interval" value="30" min="5" max="3600" class="form-input" />
|
||||
<div style="font-size: 0.72rem; color: var(--muted); margin-top: 2px;">How often each service is checked.</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-muted-sm">Max Entries Per Service</label>
|
||||
<input type="number" id="health-setting-max-entries" value="500" min="10" max="100000" class="form-input" />
|
||||
<div style="font-size: 0.72rem; color: var(--muted); margin-top: 2px;">Cap on stored history records per service.</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-muted-sm">Disk-Usage Warning (%)</label>
|
||||
<input type="number" id="health-setting-disk-threshold" value="80" min="50" max="99" class="form-input" />
|
||||
<div style="font-size: 0.72rem; color: var(--muted); margin-top: 2px;">Warn when disk usage exceeds this level.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 12px; display: flex; gap: 8px; align-items: center;">
|
||||
<button id="health-global-save" class="btn-accent-solid">Save Global Settings</button>
|
||||
<button id="health-global-reset" class="btn-sm">Reset to Defaults</button>
|
||||
<span id="health-global-status" style="font-size: 0.8rem; color: var(--muted);"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add/Edit Health Check Form -->
|
||||
<div id="health-config-form" style="display: none; margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-base);">
|
||||
<h4 id="health-form-title" style="margin: 0 0 12px;">Add Health Check</h4>
|
||||
@@ -103,6 +136,74 @@
|
||||
const formCancel = document.getElementById('health-form-cancel');
|
||||
const formSave = document.getElementById('health-form-save');
|
||||
|
||||
// ---- Global health settings (retention, polling interval, disk threshold) ----
|
||||
const HEALTH_SETTINGS_KEY = 'dashcaddy-health-settings';
|
||||
const HEALTH_DEFAULTS = { retentionDays: 30, pollingInterval: 30, maxEntriesPerService: 500, diskUsageThreshold: 80 };
|
||||
const globalSaveBtn = document.getElementById('health-global-save');
|
||||
const globalResetBtn = document.getElementById('health-global-reset');
|
||||
const globalStatusSpan = document.getElementById('health-global-status');
|
||||
const retentionInput = document.getElementById('health-setting-retention');
|
||||
const intervalInput = document.getElementById('health-setting-interval');
|
||||
const maxEntriesInput = document.getElementById('health-setting-max-entries');
|
||||
const diskThresholdInput = document.getElementById('health-setting-disk-threshold');
|
||||
|
||||
function loadHealthSettings() {
|
||||
try {
|
||||
const raw = safeGet(HEALTH_SETTINGS_KEY);
|
||||
const saved = raw ? JSON.parse(raw) : {};
|
||||
return Object.assign({}, HEALTH_DEFAULTS, saved);
|
||||
} catch (_) {
|
||||
return Object.assign({}, HEALTH_DEFAULTS);
|
||||
}
|
||||
}
|
||||
|
||||
function applyHealthSettingsToUI() {
|
||||
const s = loadHealthSettings();
|
||||
if (retentionInput) retentionInput.value = s.retentionDays;
|
||||
if (intervalInput) intervalInput.value = s.pollingInterval;
|
||||
if (maxEntriesInput) maxEntriesInput.value = s.maxEntriesPerService;
|
||||
if (diskThresholdInput) diskThresholdInput.value = s.diskUsageThreshold;
|
||||
}
|
||||
|
||||
function saveHealthSettings() {
|
||||
const settings = {
|
||||
retentionDays: Math.max(1, Math.min(3650, parseInt(retentionInput?.value) || HEALTH_DEFAULTS.retentionDays)),
|
||||
pollingInterval: Math.max(5, Math.min(3600, parseInt(intervalInput?.value) || HEALTH_DEFAULTS.pollingInterval)),
|
||||
maxEntriesPerService: Math.max(10, Math.min(100000, parseInt(maxEntriesInput?.value) || HEALTH_DEFAULTS.maxEntriesPerService)),
|
||||
diskUsageThreshold: Math.max(50, Math.min(99, parseInt(diskThresholdInput?.value) || HEALTH_DEFAULTS.diskUsageThreshold))
|
||||
};
|
||||
try {
|
||||
safeSet(HEALTH_SETTINGS_KEY, JSON.stringify(settings));
|
||||
applyHealthSettingsToUI();
|
||||
if (globalStatusSpan) {
|
||||
globalStatusSpan.textContent = 'Saved ✓';
|
||||
globalStatusSpan.style.color = 'var(--ok-fg)';
|
||||
setTimeout(() => { if (globalStatusSpan) globalStatusSpan.textContent = ''; }, 2500);
|
||||
}
|
||||
if (typeof showNotification === 'function') showNotification('Global health settings saved', 'success');
|
||||
} catch (e) {
|
||||
if (globalStatusSpan) { globalStatusSpan.textContent = 'Save failed'; globalStatusSpan.style.color = 'var(--bad-fg)'; }
|
||||
if (typeof showNotification === 'function') showNotification('Failed to save settings: ' + e.message, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
function resetHealthSettings() {
|
||||
try {
|
||||
safeSet(HEALTH_SETTINGS_KEY, JSON.stringify(HEALTH_DEFAULTS));
|
||||
} catch (_) { /* ignore */ }
|
||||
applyHealthSettingsToUI();
|
||||
if (globalStatusSpan) {
|
||||
globalStatusSpan.textContent = 'Reset to defaults ✓';
|
||||
globalStatusSpan.style.color = 'var(--ok-fg)';
|
||||
setTimeout(() => { if (globalStatusSpan) globalStatusSpan.textContent = ''; }, 2500);
|
||||
}
|
||||
}
|
||||
|
||||
applyHealthSettingsToUI();
|
||||
globalSaveBtn?.addEventListener('click', saveHealthSettings);
|
||||
globalResetBtn?.addEventListener('click', resetHealthSettings);
|
||||
// ---- End global health settings ----
|
||||
|
||||
let editingId = null;
|
||||
|
||||
function uptimeColor(pct) {
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
/**
|
||||
* DC-077: i18n Frontend — Language selector and translation system
|
||||
*
|
||||
* Provides window.DCI18n.t(key) for the dashboard frontend.
|
||||
* Loads translations from /api/v1/i18n/translations/:lang
|
||||
* Language preference stored in localStorage.
|
||||
* Handles RTL for Arabic.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
const STORAGE_KEY = 'dashcaddy-language';
|
||||
const DEFAULT_LANG = 'en';
|
||||
const SUPPORTED_LANGS = ['en', 'es', 'fr', 'de', 'ar'];
|
||||
const LANG_NAMES = {
|
||||
en: 'English', es: 'Español', fr: 'Français', de: 'Deutsch', ar: 'العربية',
|
||||
};
|
||||
|
||||
let currentLang = localStorage.getItem(STORAGE_KEY) || DEFAULT_LANG;
|
||||
let translations = {};
|
||||
let loaded = false;
|
||||
|
||||
async function loadTranslations(lang) {
|
||||
if (lang === DEFAULT_LANG) {
|
||||
translations = {}; // English is the default — no translation needed
|
||||
loaded = true;
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const res = await fetch(`/api/v1/i18n/translations/${lang}`);
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
translations = data.translations || {};
|
||||
loaded = true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[i18n] Failed to load translations for', lang, e);
|
||||
}
|
||||
}
|
||||
|
||||
function t(key) {
|
||||
if (currentLang === DEFAULT_LANG) return key;
|
||||
return translations[key] || key;
|
||||
}
|
||||
|
||||
function setLanguage(lang) {
|
||||
if (!SUPPORTED_LANGS.includes(lang)) return;
|
||||
currentLang = lang;
|
||||
localStorage.setItem(STORAGE_KEY, lang);
|
||||
|
||||
// RTL handling
|
||||
const isRtl = lang === 'ar';
|
||||
document.documentElement.dir = isRtl ? 'rtl' : 'ltr';
|
||||
document.documentElement.lang = lang;
|
||||
|
||||
loadTranslations(lang).then(() => {
|
||||
applyTranslations();
|
||||
});
|
||||
}
|
||||
|
||||
function getLanguage() {
|
||||
return currentLang;
|
||||
}
|
||||
|
||||
function applyTranslations() {
|
||||
// Apply translations to elements with data-i18n attributes
|
||||
document.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n');
|
||||
const translated = t(key);
|
||||
if (translated && translated !== key) {
|
||||
el.textContent = translated;
|
||||
}
|
||||
});
|
||||
// Apply to placeholders
|
||||
document.querySelectorAll('[data-i18n-placeholder]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n-placeholder');
|
||||
const translated = t(key);
|
||||
if (translated && translated !== key) {
|
||||
el.placeholder = translated;
|
||||
}
|
||||
});
|
||||
// Apply to titles
|
||||
document.querySelectorAll('[data-i18n-title]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n-title');
|
||||
const translated = t(key);
|
||||
if (translated && translated !== key) {
|
||||
el.title = translated;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createLanguageSelector() {
|
||||
// Find the top bar area to insert the selector
|
||||
// Look for the auth-settings area or the header actions
|
||||
const targetContainer = document.querySelector('.header-actions') ||
|
||||
document.querySelector('#auth-settings-btn')?.parentElement ||
|
||||
document.querySelector('.top-bar-actions');
|
||||
|
||||
if (!targetContainer) {
|
||||
// If we can't find a target, try to add it near the settings button
|
||||
const settingsBtn = document.getElementById('auth-settings-btn');
|
||||
if (settingsBtn && settingsBtn.parentElement) {
|
||||
return createDropdown(settingsBtn.parentElement);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return createDropdown(targetContainer);
|
||||
}
|
||||
|
||||
function createDropdown(container) {
|
||||
// Check if selector already exists
|
||||
if (document.getElementById('dc-lang-selector')) return;
|
||||
|
||||
const wrapper = document.createElement('div');
|
||||
wrapper.id = 'dc-lang-selector';
|
||||
wrapper.style.cssText = 'display: inline-flex; align-items: center; gap: 4px; margin: 0 8px; position: relative;';
|
||||
|
||||
const btn = document.createElement('button');
|
||||
btn.id = 'dc-lang-btn';
|
||||
btn.className = 'lang-selector-btn';
|
||||
btn.style.cssText = 'background: var(--card-base, #2a2a3e); border: 1px solid var(--border, #3a3a4e); color: var(--text-primary, #e0e0e0); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; gap: 4px;';
|
||||
btn.innerHTML = `🌐 <span class="lang-current">${currentLang.toUpperCase()}</span>`;
|
||||
btn.title = 'Language / Idioma / Langue / Sprache / اللغة';
|
||||
|
||||
const dropdown = document.createElement('div');
|
||||
dropdown.id = 'dc-lang-dropdown';
|
||||
dropdown.style.cssText = 'display: none; position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--card-base, #2a2a3e); border: 1px solid var(--border, #3a3a4e); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.3); z-index: 9999; min-width: 140px; overflow: hidden;';
|
||||
|
||||
SUPPORTED_LANGS.forEach(lang => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'lang-option';
|
||||
item.style.cssText = 'padding: 8px 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-primary, #e0e0e0);';
|
||||
item.onmouseenter = () => item.style.background = 'var(--card-hover, rgba(255,255,255,0.05))';
|
||||
item.onmouseleave = () => item.style.background = 'transparent';
|
||||
|
||||
const flag = document.createElement('span');
|
||||
flag.textContent = lang === currentLang ? '✓' : '';
|
||||
flag.style.cssText = 'width: 16px; color: var(--ok-fg, #4ade80);';
|
||||
|
||||
const name = document.createElement('span');
|
||||
name.textContent = LANG_NAMES[lang];
|
||||
|
||||
item.appendChild(flag);
|
||||
item.appendChild(name);
|
||||
item.onclick = () => {
|
||||
setLanguage(lang);
|
||||
dropdown.style.display = 'none';
|
||||
// Update button text
|
||||
btn.querySelector('.lang-current').textContent = lang.toUpperCase();
|
||||
// Update checkmarks
|
||||
dropdown.querySelectorAll('.lang-option').forEach((opt, i) => {
|
||||
opt.querySelector('span').textContent = SUPPORTED_LANGS[i] === lang ? '✓' : '';
|
||||
});
|
||||
// Show notification
|
||||
if (window.showNotification) {
|
||||
window.showNotification(`Language: ${LANG_NAMES[lang]}`, 'info');
|
||||
}
|
||||
};
|
||||
dropdown.appendChild(item);
|
||||
});
|
||||
|
||||
btn.onclick = (e) => {
|
||||
e.stopPropagation();
|
||||
dropdown.style.display = dropdown.style.display === 'none' ? 'block' : 'none';
|
||||
};
|
||||
|
||||
// Close on outside click
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!wrapper.contains(e.target)) {
|
||||
dropdown.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.appendChild(btn);
|
||||
wrapper.appendChild(dropdown);
|
||||
container.insertBefore(wrapper, container.firstChild);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
// Initialize on page load
|
||||
function init() {
|
||||
// Set initial RTL if needed
|
||||
if (currentLang === 'ar') {
|
||||
document.documentElement.dir = 'rtl';
|
||||
document.documentElement.lang = 'ar';
|
||||
}
|
||||
|
||||
// Create the language selector after DOM is ready
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
createLanguageSelector();
|
||||
if (currentLang !== DEFAULT_LANG) loadTranslations(currentLang).then(applyTranslations);
|
||||
});
|
||||
} else {
|
||||
createLanguageSelector();
|
||||
if (currentLang !== DEFAULT_LANG) loadTranslations(currentLang).then(applyTranslations);
|
||||
}
|
||||
}
|
||||
|
||||
// Expose globally
|
||||
window.DCI18n = { t, setLanguage, getLanguage, applyTranslations, loadTranslations };
|
||||
|
||||
// Auto-init
|
||||
init();
|
||||
})();
|
||||
@@ -377,8 +377,26 @@ window.populateTimezoneSelect = function(selectEl, selectedTz) {
|
||||
};
|
||||
}
|
||||
|
||||
// Finish setup button
|
||||
const finishBtn = document.getElementById('setup-finish');
|
||||
// Summary "Continue →" — advance to the disk-safety warning step
|
||||
const summaryNext = document.getElementById('setup-summary-next');
|
||||
if (summaryNext) {
|
||||
summaryNext.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
showStep('setup-step-disk-safety');
|
||||
};
|
||||
}
|
||||
|
||||
// Disk-safety step navigation
|
||||
const diskSafetyBack = document.getElementById('setup-disk-safety-back');
|
||||
if (diskSafetyBack) {
|
||||
diskSafetyBack.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
showStep('setup-step-summary');
|
||||
};
|
||||
}
|
||||
|
||||
// Finish setup button (now on the disk-safety step)
|
||||
const finishBtn = document.getElementById('setup-disk-safety-finish');
|
||||
if (finishBtn) {
|
||||
finishBtn.onclick = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const CACHE = 'dashcaddy-shell-c4c69c2c4c';
|
||||
const CACHE = 'dashcaddy-shell-c775f8444e';
|
||||
const PRECACHE = [
|
||||
'/',
|
||||
'/index.html',
|
||||
|
||||
Reference in New Issue
Block a user