This commit is contained in:
jarek committed 2026-06-27 15:15:54 +02:00
1 parent ce12d7ae9f
commit 685132ff89
63 files changed
+1324 -281

No files matched your search

+1 -1
View File
@@ -852,7 +852,7 @@
{:else if column.id === 'actions'}
<div class="flex items-center justify-end">
<Button variant="ghost" size="icon" class="h-6 w-6" onclick={(e) => { e.stopPropagation(); showDetails(event); }}>
<Eye class="w-3.5 h-3.5" />
<Eye class="grid-action-icon grid-action-info" />
</Button>
</div>
{/if}
@@ -2,6 +2,7 @@ import { json, redirect } from '@sveltejs/kit';
import type { RequestHandler } from '@sveltejs/kit';
import { buildOidcAuthorizationUrl, isAuthEnabled } from '$lib/server/auth';
import { getOidcConfig } from '$lib/server/db';
import { safeRedirectOrRoot } from '$lib/utils/safe-redirect';
// GET /api/auth/oidc/[id]/initiate - Start OIDC authentication flow
export const GET: RequestHandler = async ({ params, url }) => {
@@ -15,8 +16,8 @@ export const GET: RequestHandler = async ({ params, url }) => {
return json({ error: 'Invalid configuration ID' }, { status: 400 });
}
// Get redirect URL from query params
const redirectUrl = url.searchParams.get('redirect') || '/';
// Get redirect URL from query params (validated path-relative only)
const redirectUrl = safeRedirectOrRoot(url.searchParams.get('redirect'));
try {
const config = await getOidcConfig(id);
@@ -56,7 +57,7 @@ export const POST: RequestHandler = async ({ params, request }) => {
try {
const body = await request.json().catch(() => ({}));
const redirectUrl = body.redirect || '/';
const redirectUrl = safeRedirectOrRoot(body.redirect);
const config = await getOidcConfig(id);
if (!config || !config.enabled) {
+3 -2
View File
@@ -3,6 +3,7 @@ import type { RequestHandler } from '@sveltejs/kit';
import { handleOidcCallback, createUserSession, isAuthEnabled } from '$lib/server/auth';
import { auditAuth } from '$lib/server/audit';
import { getClientIp } from '$lib/server/client-ip';
import { safeRedirectOrRoot } from '$lib/utils/safe-redirect';
// GET /api/auth/oidc/callback - Handle OIDC callback from IdP
export const GET: RequestHandler = async (event) => {
@@ -54,8 +55,8 @@ export const GET: RequestHandler = async (event) => {
providerName: result.providerName
});
// Redirect to the original destination or home
const redirectUrl = result.redirectUrl || '/';
// Redirect to the original destination or home (validated path-relative)
const redirectUrl = safeRedirectOrRoot(result.redirectUrl);
throw redirect(302, redirectUrl);
} catch (error: any) {
// Re-throw redirect
@@ -9,12 +9,20 @@ import {
import { registerSchedule, unregisterSchedule } from '$lib/server/scheduler';
import { authorize } from '$lib/server/authorize';
export const GET: RequestHandler = async ({ params, url }) => {
export const GET: RequestHandler = async ({ params, url, cookies }) => {
const auth = await authorize(cookies);
const permDenied = await auth.requirePermission('schedules', 'view');
if (permDenied) return permDenied;
try {
const containerName = decodeURIComponent(params.containerName);
const envIdParam = url.searchParams.get('env');
const envId = envIdParam ? parseInt(envIdParam) : undefined;
const envDenied = await auth.requireEnvAccess(envId);
if (envDenied) return envDenied;
const setting = await getAutoUpdateSetting(containerName, envId);
if (!setting) {
@@ -41,15 +49,18 @@ export const GET: RequestHandler = async ({ params, url }) => {
export const POST: RequestHandler = async ({ params, url, request, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('schedules', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
const permDenied = await auth.requirePermission('schedules', 'edit');
if (permDenied) return permDenied;
try {
const containerName = decodeURIComponent(params.containerName);
const envIdParam = url.searchParams.get('env');
const envId = envIdParam ? parseInt(envIdParam) : undefined;
const envDenied = await auth.requireEnvAccess(envId);
if (envDenied) return envDenied;
const body = await request.json();
// Accept both camelCase and snake_case for backward compatibility
const enabled = body.enabled;
@@ -109,15 +120,18 @@ export const POST: RequestHandler = async ({ params, url, request, cookies }) =>
export const DELETE: RequestHandler = async ({ params, url, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('schedules', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
const permDenied = await auth.requirePermission('schedules', 'edit');
if (permDenied) return permDenied;
try {
const containerName = decodeURIComponent(params.containerName);
const envIdParam = url.searchParams.get('env');
const envId = envIdParam ? parseInt(envIdParam) : undefined;
const envDenied = await auth.requireEnvAccess(envId);
if (envDenied) return envDenied;
// Get the setting ID before deleting
const setting = await getAutoUpdateSetting(containerName, envId);
const settingId = setting?.id;
@@ -3,7 +3,7 @@ import type { RequestHandler } from './$types';
import { authorize } from '$lib/server/authorize';
import { listContainers, inspectContainer, checkImageUpdateAvailable } from '$lib/server/docker';
import { clearPendingContainerUpdates, addPendingContainerUpdate } from '$lib/server/db';
import { isSystemContainer } from '$lib/server/scheduler/tasks/update-utils';
import { isSystemContainer, isPodmanInfraContainer } from '$lib/server/scheduler/tasks/update-utils';
import { isUpdateDisabledByLabel, isHiddenByLabel } from '$lib/server/container-labels';
import { createJobResponse } from '$lib/server/sse';
@@ -42,9 +42,12 @@ export const POST: RequestHandler = async ({ url, cookies, request }) => {
}
const allContainers = await listContainers(true, envIdNum);
// Containers labeled dockhand.hidden=true are excluded from update checks —
// they're invisible to the user, so we won't alert on updates for them either (#1083).
const containers = allContainers.filter(c => !isHiddenByLabel(c.labels));
// Skip:
// - dockhand.hidden=true (invisible to user, so no update alerts) (#1083)
// - Podman pod-infra containers (localhost/podman-pause, never published) (#1221)
const containers = allContainers.filter(
(c) => !isHiddenByLabel(c.labels) && !isPodmanInfraContainer(c.image, c.labels)
);
send('progress', { checked: 0, total: containers.length });
+6 -4
View File
@@ -258,11 +258,13 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
envStats.stacks.partial = stacks.filter((s: any) => s.status === 'partial').length;
envStats.stacks.stopped = stacks.filter((s: any) => s.status === 'stopped').length;
// Get latest metrics, event stats, and pending updates in parallel
// Get latest metrics, event stats, and pending updates in parallel.
// Each call has its own catch so one failed DB query (e.g. a corrupt
// container_events index, #1210) doesn't poison the whole tile.
const [latestMetrics, eventStats, pendingUpdates] = await Promise.all([
getLatestHostMetrics(env.id),
getContainerEventStats(env.id),
getPendingContainerUpdates(env.id)
getLatestHostMetrics(env.id).catch(() => null),
getContainerEventStats(env.id).catch(() => ({ total: 0, today: 0, byAction: {} })),
getPendingContainerUpdates(env.id).catch(() => [])
]);
if (latestMetrics) {
@@ -195,13 +195,15 @@ async function getEnvironmentStatsProgressive(
// Get all database stats in parallel for better performance
// NOTE: We do NOT block on getDockerInfo() here - slow environments would block all others
// Instead, we determine online status from whether listContainers succeeds
// Instead, we determine online status from whether listContainers succeeds.
// Each call has its own catch so one failed DB query (e.g. a corrupt
// container_events index, #1210) doesn't poison the whole tile.
const [latestMetrics, eventStats, recentEventsResult, metricsHistory, pendingUpdates] = await Promise.all([
getLatestHostMetrics(env.id),
getContainerEventStats(env.id),
getContainerEvents({ environmentId: env.id, limit: 10 }),
getHostMetrics(metricsPointCount, env.id),
getPendingContainerUpdates(env.id)
getLatestHostMetrics(env.id).catch(() => null),
getContainerEventStats(env.id).catch(() => ({ total: 0, today: 0, byAction: {} })),
getContainerEvents({ environmentId: env.id, limit: 10 }).catch(() => ({ events: [], total: 0, limit: 10, offset: 0 })),
getHostMetrics(metricsPointCount, env.id).catch(() => []),
getPendingContainerUpdates(env.id).catch(() => [])
]);
if (latestMetrics) {
+10 -1
View File
@@ -1,11 +1,20 @@
import type { RequestHandler } from './$types';
import { getDockerEvents, EnvironmentNotFoundError } from '$lib/server/docker';
import { getEnvironment } from '$lib/server/db';
import { authorize } from '$lib/server/authorize';
export const GET: RequestHandler = async ({ url, cookies }) => {
const auth = await authorize(cookies);
const permDenied = await auth.requirePermission('activity', 'view');
if (permDenied) return permDenied;
export const GET: RequestHandler = async ({ url }) => {
const envId = url.searchParams.get('env');
const envIdNum = envId ? parseInt(envId) : undefined;
const envDenied = await auth.requireEnvAccess(envIdNum);
if (envDenied) return envDenied;
// Early return if no environment specified
if (!envIdNum) {
return new Response(
+26 -21
View File
@@ -1,38 +1,43 @@
/**
* Database Health Check Endpoint
*
* Returns detailed information about the database schema state,
* including migration status, table existence, and connection info.
* Public endpoint suitable for external monitoring. The public payload reports
* enough detail to detect schema drift and table loss without exposing
* connection details (host, port, db name, user) or the running migration tag.
*
* Authenticated callers with settings:view get the full payload — connection
* string (password masked) and schema version included — which is useful for
* operators debugging from the admin UI.
*
* GET /api/health/database
*
* Response:
* {
* healthy: boolean,
* database: 'sqlite' | 'postgresql',
* connection: string,
* migrationsTable: boolean,
* appliedMigrations: number,
* pendingMigrations: number,
* schemaVersion: string | null,
* tables: {
* expected: number,
* found: number,
* missing: string[]
* },
* timestamp: string
* }
*/
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { checkSchemaHealth } from '$lib/server/db/drizzle';
import { authorize } from '$lib/server/authorize';
export const GET: RequestHandler = async () => {
export const GET: RequestHandler = async ({ cookies }) => {
try {
const health = await checkSchemaHealth();
return json(health, {
const auth = await authorize(cookies);
const showFullDetail = !auth.authEnabled
|| (auth.isAuthenticated && await auth.can('settings', 'view'));
const payload = showFullDetail
? health
: {
healthy: health.healthy,
database: health.database,
migrationsTable: health.migrationsTable,
appliedMigrations: health.appliedMigrations,
pendingMigrations: health.pendingMigrations,
tables: health.tables,
timestamp: health.timestamp
};
return json(payload, {
status: health.healthy ? 200 : 503,
headers: {
'Cache-Control': 'no-cache, no-store, must-revalidate'
+17 -1
View File
@@ -45,7 +45,9 @@ export const PUT: RequestHandler = async ({ request, cookies }) => {
const validTerminalFontIds = monospaceFonts.map(f => f.id);
const validFontSizes = ['xsmall', 'small', 'normal', 'medium', 'large', 'xlarge'];
const updates: { lightTheme?: string; darkTheme?: string; font?: string; fontSize?: string; gridFontSize?: string; terminalFont?: string; editorFont?: string; animateIcons?: boolean } = {};
const validActionIconSizes = ['small', 'normal', 'large', 'xlarge'];
const updates: { lightTheme?: string; darkTheme?: string; font?: string; fontSize?: string; gridFontSize?: string; terminalFont?: string; editorFont?: string; animateIcons?: boolean; coloredActionButtons?: boolean; actionIconSize?: string } = {};
if (data.lightTheme !== undefined) {
if (!validLightThemeIds.includes(data.lightTheme)) {
@@ -103,6 +105,20 @@ export const PUT: RequestHandler = async ({ request, cookies }) => {
updates.animateIcons = data.animateIcons;
}
if (data.coloredActionButtons !== undefined) {
if (typeof data.coloredActionButtons !== 'boolean') {
return json({ error: 'Invalid coloredActionButtons' }, { status: 400 });
}
updates.coloredActionButtons = data.coloredActionButtons;
}
if (data.actionIconSize !== undefined) {
if (!validActionIconSizes.includes(data.actionIconSize)) {
return json({ error: 'Invalid actionIconSize' }, { status: 400 });
}
updates.actionIconSize = data.actionIconSize;
}
await setUserThemePreferences(currentUser.id, updates);
// Return updated preferences
@@ -1,8 +1,14 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { setDefaultRegistry, getRegistry } from '$lib/server/db';
import { authorize } from '$lib/server/authorize';
export const POST: RequestHandler = async ({ params, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('settings', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
export const POST: RequestHandler = async ({ params }) => {
try {
const id = parseInt(params.id);
if (isNaN(id)) {
+7 -1
View File
@@ -2,6 +2,7 @@ import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { getRegistry } from '$lib/server/db';
import { getRegistryAuth } from '$lib/server/docker';
import { authorize } from '$lib/server/authorize';
function isDockerHub(url: string): boolean {
const lower = url.toLowerCase();
@@ -18,7 +19,12 @@ const MANIFEST_TYPES = [
'application/vnd.oci.image.index.v1+json'
];
export const DELETE: RequestHandler = async ({ url }) => {
export const DELETE: RequestHandler = async ({ url, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('settings', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
try {
const registryId = url.searchParams.get('registry');
const imageName = url.searchParams.get('image');
+19 -3
View File
@@ -22,6 +22,7 @@ import {
} from '$lib/server/db';
import { getNextRun, getSystemSchedules } from '$lib/server/scheduler';
import { getGlobalScannerDefaults, getScannerSettingsWithDefaults } from '$lib/server/scanner';
import { authorize } from '$lib/server/authorize';
export interface ScheduleInfo {
id: number;
@@ -43,7 +44,12 @@ export interface ScheduleInfo {
vulnerabilityCriteria?: VulnerabilityCriteria | null;
}
export const GET: RequestHandler = async () => {
export const GET: RequestHandler = async ({ cookies }) => {
const auth = await authorize(cookies);
const permDenied = await auth.requirePermission('schedules', 'view');
if (permDenied) return permDenied;
try {
const schedules: ScheduleInfo[] = [];
@@ -233,13 +239,23 @@ export const GET: RequestHandler = async () => {
);
schedules.push(...sysSchedules);
// Filter by per-env access (enterprise): caller sees only schedules
// for envs they can access, plus all system schedules (env null).
// Free edition / admin: getAccessibleEnvironmentIds returns null,
// no filtering applied.
const accessibleEnvIds = await auth.getAccessibleEnvironmentIds();
const filtered = accessibleEnvIds === null
? schedules
: schedules.filter(s =>
s.environmentId === null || accessibleEnvIds.includes(s.environmentId));
// Sort: system jobs last, then by name
schedules.sort((a, b) => {
filtered.sort((a, b) => {
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1;
return a.name.localeCompare(b.name);
});
return json({ schedules });
return json({ schedules: filtered });
} catch (error: any) {
console.error('Failed to get schedules:', error);
return json({ error: error.message }, { status: 500 });
@@ -8,6 +8,7 @@ import type { RequestHandler } from './$types';
import {
getAutoUpdateSettingById,
deleteAutoUpdateSchedule,
getGitStack,
updateGitStack,
deleteEnvUpdateCheckSettings,
deleteImagePruneSettings
@@ -17,9 +18,9 @@ import { authorize } from '$lib/server/authorize';
export const DELETE: RequestHandler = async ({ params, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('schedules', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
const permDenied = await auth.requirePermission('schedules', 'edit');
if (permDenied) return permDenied;
try {
const { type, id } = params;
@@ -33,6 +34,8 @@ export const DELETE: RequestHandler = async ({ params, cookies }) => {
// Hard delete container schedule
const schedule = await getAutoUpdateSettingById(scheduleId);
if (schedule) {
const envDenied = await auth.requireEnvAccess(schedule.environmentId);
if (envDenied) return envDenied;
await deleteAutoUpdateSchedule(schedule.containerName, schedule.environmentId ?? undefined);
// Unregister from croner
unregisterSchedule(scheduleId, 'container_update');
@@ -40,6 +43,12 @@ export const DELETE: RequestHandler = async ({ params, cookies }) => {
return json({ success: true });
} else if (type === 'git_stack_sync') {
const stack = await getGitStack(scheduleId);
if (!stack) {
return json({ error: 'Schedule not found' }, { status: 404 });
}
const envDenied = await auth.requireEnvAccess(stack.environmentId);
if (envDenied) return envDenied;
// Disable auto-update for git stack (don't delete the stack itself)
await updateGitStack(scheduleId, {
autoUpdate: false,
@@ -52,12 +61,16 @@ export const DELETE: RequestHandler = async ({ params, cookies }) => {
} else if (type === 'env_update_check') {
// Delete env update check settings (scheduleId is environmentId)
const envDenied = await auth.requireEnvAccess(scheduleId);
if (envDenied) return envDenied;
await deleteEnvUpdateCheckSettings(scheduleId);
unregisterSchedule(scheduleId, 'env_update_check');
return json({ success: true });
} else if (type === 'image_prune') {
// Delete image prune settings (scheduleId is environmentId)
const envDenied = await auth.requireEnvAccess(scheduleId);
if (envDenied) return envDenied;
await deleteImagePruneSettings(scheduleId);
unregisterSchedule(scheduleId, 'image_prune');
return json({ success: true });
@@ -12,12 +12,13 @@ import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { triggerContainerUpdate, triggerGitStackSync, triggerSystemJob, triggerEnvUpdateCheck, triggerImagePrune } from '$lib/server/scheduler';
import { authorize } from '$lib/server/authorize';
import { getAutoUpdateSettingById, getGitStack } from '$lib/server/db';
export const POST: RequestHandler = async ({ params, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('schedules', 'run')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
const permDenied = await auth.requirePermission('schedules', 'run');
if (permDenied) return permDenied;
try {
const { type, id } = params;
@@ -27,6 +28,37 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
return json({ error: 'Invalid schedule ID' }, { status: 400 });
}
// Resolve schedule → environmentId so we can enforce per-env access
// before triggering. System schedules (env null) are gated only by
// the global schedules:run check above.
let scheduleEnvId: number | null = null;
switch (type) {
case 'container_update': {
const setting = await getAutoUpdateSettingById(scheduleId);
if (!setting) return json({ error: 'Schedule not found' }, { status: 404 });
scheduleEnvId = setting.environmentId;
break;
}
case 'git_stack_sync': {
const stack = await getGitStack(scheduleId);
if (!stack) return json({ error: 'Schedule not found' }, { status: 404 });
scheduleEnvId = stack.environmentId;
break;
}
case 'env_update_check':
case 'image_prune':
scheduleEnvId = scheduleId;
break;
case 'system_cleanup':
scheduleEnvId = null;
break;
default:
return json({ error: 'Invalid schedule type' }, { status: 400 });
}
const envDenied = await auth.requireEnvAccess(scheduleEnvId);
if (envDenied) return envDenied;
let result: { success: boolean; executionId?: number; error?: string };
switch (type) {
@@ -46,6 +78,7 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
result = await triggerImagePrune(scheduleId);
break;
default:
// Unreachable — validated in the resolution switch above.
return json({ error: 'Invalid schedule type' }, { status: 400 });
}
@@ -11,9 +11,9 @@ import { authorize } from '$lib/server/authorize';
export const POST: RequestHandler = async ({ params, cookies }) => {
const auth = await authorize(cookies);
if (auth.authEnabled && !await auth.can('schedules', 'edit')) {
return json({ error: 'Permission denied' }, { status: 403 });
}
const permDenied = await auth.requirePermission('schedules', 'edit');
if (permDenied) return permDenied;
try {
const { type, id } = params;
@@ -28,6 +28,8 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
if (!setting) {
return json({ error: 'Schedule not found' }, { status: 404 });
}
const envDenied = await auth.requireEnvAccess(setting.environmentId);
if (envDenied) return envDenied;
const newEnabled = !setting.enabled;
await updateAutoUpdateSettingById(scheduleId, {
@@ -47,6 +49,8 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
if (!stack) {
return json({ error: 'Schedule not found' }, { status: 404 });
}
const envDenied = await auth.requireEnvAccess(stack.environmentId);
if (envDenied) return envDenied;
const newEnabled = !stack.autoUpdate;
await updateGitStack(scheduleId, {
@@ -63,6 +67,8 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
return json({ success: true, enabled: newEnabled });
} else if (type === 'env_update_check') {
// scheduleId is environmentId for env update check
const envDenied = await auth.requireEnvAccess(scheduleId);
if (envDenied) return envDenied;
const config = await getEnvUpdateCheckSettings(scheduleId);
if (!config) {
return json({ error: 'Schedule not found' }, { status: 404 });
@@ -84,6 +90,8 @@ export const POST: RequestHandler = async ({ params, cookies }) => {
return json({ success: true, enabled: newEnabled });
} else if (type === 'image_prune') {
// scheduleId is environmentId for image prune
const envDenied = await auth.requireEnvAccess(scheduleId);
if (envDenied) return envDenied;
const config = await getImagePruneSettings(scheduleId);
if (!config) {
return json({ error: 'Schedule not found' }, { status: 404 });
+81 -7
View File
@@ -40,11 +40,16 @@ export type TimeFormat = '12h' | '24h';
export type DateFormat = 'MM/DD/YYYY' | 'DD/MM/YYYY' | 'YYYY-MM-DD' | 'DD.MM.YYYY';
export type DownloadFormat = 'tar' | 'tar.gz' | 'raw';
export type EventCollectionMode = 'stream' | 'poll';
export type ActionIconSize = 'small' | 'normal' | 'large' | 'xlarge';
const VALID_ACTION_ICON_SIZES: ActionIconSize[] = ['small', 'normal', 'large', 'xlarge'];
export interface GeneralSettings {
confirmDestructive: boolean;
showStoppedContainers: boolean;
highlightUpdates: boolean;
coloredActionButtons: boolean;
actionIconSize: ActionIconSize;
timeFormat: TimeFormat;
dateFormat: DateFormat;
downloadFormat: DownloadFormat;
@@ -102,12 +107,17 @@ export interface GeneralSettings {
animateIcons: boolean;
// Skip Dockhand's scanner images (grype, trivy) during 'prune all unused' (#625)
protectScannerImages: boolean;
// Scanner Advanced settings (#1219). Empty = use auto-detection.
defaultScannerNetworkMode: string;
defaultScannerDns: string[];
}
const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRetentionDays' | 'scheduleCleanupCron' | 'eventCleanupCron' | 'scheduleCleanupEnabled' | 'eventCleanupEnabled' | 'scannerCleanupCron' | 'scannerCleanupEnabled'> = {
confirmDestructive: true,
showStoppedContainers: true,
highlightUpdates: true,
coloredActionButtons: false,
actionIconSize: 'normal' as const,
timeFormat: '24h',
dateFormat: 'DD.MM.YYYY',
downloadFormat: 'tar',
@@ -138,6 +148,8 @@ const DEFAULT_SETTINGS: Omit<GeneralSettings, 'scheduleRetentionDays' | 'eventRe
showImageChangelogLinks: true,
animateIcons: true,
protectScannerImages: true,
defaultScannerNetworkMode: '',
defaultScannerDns: [],
defaultComposeTemplate: `version: "3.8"
services:
@@ -167,6 +179,24 @@ const VALID_EDITOR_FONTS = VALID_TERMINAL_FONTS;
const VALID_DATE_FORMATS: DateFormat[] = ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY-MM-DD', 'DD.MM.YYYY'];
// Scanner DNS is stored as a JSON-stringified array in the settings KV store
// (consistent with externalStackPaths). Tolerate the legacy/hand-edited
// comma-separated form too.
function parseScannerDnsStorage(raw: string | null | undefined): string[] {
if (!raw) return [];
const trimmed = raw.trim();
if (!trimmed) return [];
if (trimmed.startsWith('[')) {
try {
const parsed = JSON.parse(trimmed);
return Array.isArray(parsed) ? parsed.filter((v) => typeof v === 'string') : [];
} catch {
return [];
}
}
return trimmed.split(',').map((s) => s.trim()).filter(Boolean);
}
export const GET: RequestHandler = async ({ cookies }) => {
const auth = await authorize(cookies);
// UI preferences (time format, date format) should be available to all authenticated users
@@ -181,6 +211,8 @@ export const GET: RequestHandler = async ({ cookies }) => {
confirmDestructive,
showStoppedContainers,
highlightUpdates,
coloredActionButtons,
actionIconSize,
timeFormat,
dateFormat,
downloadFormat,
@@ -219,11 +251,15 @@ export const GET: RequestHandler = async ({ cookies }) => {
honorProxyLabels,
showImageChangelogLinks,
animateIcons,
protectScannerImages
protectScannerImages,
defaultScannerNetworkMode,
defaultScannerDnsRaw
] = await Promise.all([
getSetting('confirm_destructive'),
getSetting('show_stopped_containers'),
getSetting('highlight_updates'),
getSetting('colored_action_buttons'),
getSetting('action_icon_size'),
getSetting('time_format'),
getSetting('date_format'),
getSetting('download_format'),
@@ -262,13 +298,17 @@ export const GET: RequestHandler = async ({ cookies }) => {
getSetting('honor_proxy_labels'),
getSetting('show_image_changelog_links'),
getSetting('animate_icons'),
getSetting('protect_scanner_images')
getSetting('protect_scanner_images'),
getSetting('default_scanner_network_mode'),
getSetting('default_scanner_dns')
]);
const settings: GeneralSettings = {
confirmDestructive: confirmDestructive ?? DEFAULT_SETTINGS.confirmDestructive,
showStoppedContainers: showStoppedContainers ?? DEFAULT_SETTINGS.showStoppedContainers,
highlightUpdates: highlightUpdates ?? DEFAULT_SETTINGS.highlightUpdates,
coloredActionButtons: coloredActionButtons ?? DEFAULT_SETTINGS.coloredActionButtons,
actionIconSize: (VALID_ACTION_ICON_SIZES.includes(actionIconSize as ActionIconSize) ? actionIconSize : DEFAULT_SETTINGS.actionIconSize) as ActionIconSize,
timeFormat: timeFormat ?? DEFAULT_SETTINGS.timeFormat,
dateFormat: dateFormat ?? DEFAULT_SETTINGS.dateFormat,
downloadFormat: downloadFormat ?? DEFAULT_SETTINGS.downloadFormat,
@@ -309,7 +349,9 @@ export const GET: RequestHandler = async ({ cookies }) => {
honorProxyLabels: honorProxyLabels ?? DEFAULT_SETTINGS.honorProxyLabels,
showImageChangelogLinks: showImageChangelogLinks ?? DEFAULT_SETTINGS.showImageChangelogLinks,
animateIcons: animateIcons ?? DEFAULT_SETTINGS.animateIcons,
protectScannerImages: protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages
protectScannerImages: protectScannerImages ?? DEFAULT_SETTINGS.protectScannerImages,
defaultScannerNetworkMode: defaultScannerNetworkMode ?? DEFAULT_SETTINGS.defaultScannerNetworkMode,
defaultScannerDns: parseScannerDnsStorage(defaultScannerDnsRaw)
};
return json(settings);
@@ -327,7 +369,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
try {
const body = await request.json();
const { confirmDestructive, showStoppedContainers, highlightUpdates, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, honorProxyLabels, showImageChangelogLinks, animateIcons, protectScannerImages } = body;
const { confirmDestructive, showStoppedContainers, highlightUpdates, coloredActionButtons, actionIconSize, timeFormat, dateFormat, downloadFormat, defaultGrypeArgs, defaultTrivyArgs, scheduleRetentionDays, eventRetentionDays, scheduleCleanupCron, eventCleanupCron, scheduleCleanupEnabled, eventCleanupEnabled, scannerCleanupCron, scannerCleanupEnabled, logBufferSizeKb, logMaxLines, defaultTimezone, eventCollectionMode, eventPollInterval, metricsCollectionInterval, lightTheme, darkTheme, font, fontSize, gridFontSize, terminalFont, editorFont, compactPorts, showExposedPorts, formatLogTimestamps, externalStackPaths, primaryStackLocation, defaultGrypeImage, defaultTrivyImage, defaultComposeTemplate, labelFilterMode, honorProxyLabels, showImageChangelogLinks, animateIcons, protectScannerImages, defaultScannerNetworkMode, defaultScannerDns } = body;
if (confirmDestructive !== undefined) {
await setSetting('confirm_destructive', confirmDestructive);
@@ -338,6 +380,12 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
if (highlightUpdates !== undefined) {
await setSetting('highlight_updates', highlightUpdates);
}
if (coloredActionButtons !== undefined) {
await setSetting('colored_action_buttons', coloredActionButtons);
}
if (actionIconSize !== undefined && VALID_ACTION_ICON_SIZES.includes(actionIconSize)) {
await setSetting('action_icon_size', actionIconSize);
}
if (timeFormat !== undefined && (timeFormat === '12h' || timeFormat === '24h')) {
await setSetting('time_format', timeFormat);
}
@@ -479,12 +527,28 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
if (protectScannerImages !== undefined && typeof protectScannerImages === 'boolean') {
await setSetting('protect_scanner_images', protectScannerImages);
}
if (defaultScannerNetworkMode !== undefined && typeof defaultScannerNetworkMode === 'string') {
// Free-form network mode (host / bridge / none / custom-network-name / '').
// Trim and cap length to avoid pathological values from a corrupted UI.
const trimmed = defaultScannerNetworkMode.trim().slice(0, 200);
await setSetting('default_scanner_network_mode', trimmed);
}
if (defaultScannerDns !== undefined && Array.isArray(defaultScannerDns)) {
const cleaned = defaultScannerDns
.filter((d) => typeof d === 'string')
.map((d: string) => d.trim())
.filter((d) => d.length > 0)
.slice(0, 10); // sane upper bound; Docker accepts more but no one needs it
await setSetting('default_scanner_dns', JSON.stringify(cleaned));
}
// Fetch all settings in parallel for the response
const [
confirmDestructiveVal,
showStoppedContainersVal,
highlightUpdatesVal,
coloredActionButtonsVal,
actionIconSizeVal,
timeFormatVal,
dateFormatVal,
downloadFormatVal,
@@ -523,11 +587,15 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
honorProxyLabelsVal,
showImageChangelogLinksVal,
animateIconsVal,
protectScannerImagesVal
protectScannerImagesVal,
defaultScannerNetworkModeVal,
defaultScannerDnsRawVal
] = await Promise.all([
getSetting('confirm_destructive'),
getSetting('show_stopped_containers'),
getSetting('highlight_updates'),
getSetting('colored_action_buttons'),
getSetting('action_icon_size'),
getSetting('time_format'),
getSetting('date_format'),
getSetting('download_format'),
@@ -566,13 +634,17 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
getSetting('honor_proxy_labels'),
getSetting('show_image_changelog_links'),
getSetting('animate_icons'),
getSetting('protect_scanner_images')
getSetting('protect_scanner_images'),
getSetting('default_scanner_network_mode'),
getSetting('default_scanner_dns')
]);
const settings: GeneralSettings = {
confirmDestructive: confirmDestructiveVal ?? DEFAULT_SETTINGS.confirmDestructive,
showStoppedContainers: showStoppedContainersVal ?? DEFAULT_SETTINGS.showStoppedContainers,
highlightUpdates: highlightUpdatesVal ?? DEFAULT_SETTINGS.highlightUpdates,
coloredActionButtons: coloredActionButtonsVal ?? DEFAULT_SETTINGS.coloredActionButtons,
actionIconSize: (VALID_ACTION_ICON_SIZES.includes(actionIconSizeVal as ActionIconSize) ? actionIconSizeVal : DEFAULT_SETTINGS.actionIconSize) as ActionIconSize,
timeFormat: timeFormatVal ?? DEFAULT_SETTINGS.timeFormat,
dateFormat: dateFormatVal ?? DEFAULT_SETTINGS.dateFormat,
downloadFormat: downloadFormatVal ?? DEFAULT_SETTINGS.downloadFormat,
@@ -613,7 +685,9 @@ export const POST: RequestHandler = async ({ request, cookies }) => {
honorProxyLabels: honorProxyLabelsVal ?? DEFAULT_SETTINGS.honorProxyLabels,
protectScannerImages: protectScannerImagesVal ?? DEFAULT_SETTINGS.protectScannerImages,
showImageChangelogLinks: showImageChangelogLinksVal ?? DEFAULT_SETTINGS.showImageChangelogLinks,
animateIcons: animateIconsVal ?? DEFAULT_SETTINGS.animateIcons
animateIcons: animateIconsVal ?? DEFAULT_SETTINGS.animateIcons,
defaultScannerNetworkMode: defaultScannerNetworkModeVal ?? DEFAULT_SETTINGS.defaultScannerNetworkMode,
defaultScannerDns: parseScannerDnsStorage(defaultScannerDnsRawVal)
};
return json(settings);
+12 -4
View File
@@ -14,7 +14,9 @@ const DEFAULT_THEME_SETTINGS = {
gridFontSize: 'normal',
terminalFont: 'system-mono',
editorFont: 'system-mono',
animateIcons: true
animateIcons: true,
coloredActionButtons: false,
actionIconSize: 'normal'
};
export const GET: RequestHandler = async () => {
@@ -27,7 +29,9 @@ export const GET: RequestHandler = async () => {
gridFontSize,
terminalFont,
editorFont,
animateIcons
animateIcons,
coloredActionButtons,
actionIconSize
] = await Promise.all([
getSetting('theme_light'),
getSetting('theme_dark'),
@@ -36,7 +40,9 @@ export const GET: RequestHandler = async () => {
getSetting('theme_grid_font_size'),
getSetting('theme_terminal_font'),
getSetting('theme_editor_font'),
getSetting('animate_icons')
getSetting('animate_icons'),
getSetting('colored_action_buttons'),
getSetting('action_icon_size')
]);
return json({
@@ -47,7 +53,9 @@ export const GET: RequestHandler = async () => {
gridFontSize: gridFontSize ?? DEFAULT_THEME_SETTINGS.gridFontSize,
terminalFont: terminalFont ?? DEFAULT_THEME_SETTINGS.terminalFont,
editorFont: editorFont ?? DEFAULT_THEME_SETTINGS.editorFont,
animateIcons: animateIcons ?? DEFAULT_THEME_SETTINGS.animateIcons
animateIcons: animateIcons ?? DEFAULT_THEME_SETTINGS.animateIcons,
coloredActionButtons: coloredActionButtons ?? DEFAULT_THEME_SETTINGS.coloredActionButtons,
actionIconSize: actionIconSize ?? DEFAULT_THEME_SETTINGS.actionIconSize
});
} catch (error) {
console.error('Failed to get theme settings:', error);
+55 -2
View File
@@ -20,6 +20,47 @@ export interface TemplateItem {
stars?: number;
pulls?: number;
network?: string;
/** Free-form maintainer / install notes from the upstream catalog. */
note?: string;
/** Project / homepage URL the user can click to learn more or report issues (#1211). */
projectUrl?: string;
}
/**
* Best-effort first-URL extraction from a template's description or note.
* Order matters: markdown link first, then HTML href, then a bare URL.
*/
function extractFirstUrl(text: string | undefined | null): string | null {
if (!text) return null;
const md = text.match(/\[[^\]]+\]\((https?:\/\/[^)]+)\)/);
if (md) return md[1];
const html = text.match(/<a\s+[^>]*href=["']([^"']+)["']/i);
if (html) return html[1];
const plain = text.match(/(https?:\/\/[^\s<>"')]+)/);
if (plain) return plain[1];
return null;
}
/**
* Resolve the "Project" URL surfaced on the card.
* Priority:
* 1. URL embedded in `description` — LSIO-style templates have a markdown
* link to the actual project repo here, which is what users want most.
* 2. URL embedded in `note` — Portainer v3 catalogs often put a homepage
* link in the install notes.
* 3. `maintainer` field — Lissy93's templates carry a per-template
* maintainer URL; not always the project itself but usually close.
* 4. `repository.url` — only for stack-type templates, points to the repo
* hosting the compose file (closest thing we have).
*/
function resolveProjectUrl(entry: any, description: string, note: string): string | undefined {
return (
extractFirstUrl(description) ||
extractFirstUrl(note) ||
(typeof entry.maintainer === 'string' ? entry.maintainer.trim() : null) ||
(entry.repository && typeof entry.repository.url === 'string' ? entry.repository.url : null) ||
undefined
);
}
// Server-side cache: url → { data, fetchedAt }
@@ -43,14 +84,18 @@ function normalizePortainerTemplate(entry: any, sourceName: string): TemplateIte
if (entry.type === 2) return null;
const title = entry.title || entry.name || '';
const description = entry.description || '';
const note = typeof entry.note === 'string' ? entry.note : '';
const template: TemplateItem = {
id: hashId(sourceName, title),
type: entry.type === 3 ? 'stack' : 'container',
title,
description: entry.description || '',
description,
logo: entry.logo || '',
categories: Array.isArray(entry.categories) ? entry.categories : [],
source: sourceName,
note: note || undefined,
projectUrl: resolveProjectUrl(entry, description, note)
};
if (entry.type === 3 && entry.repository) {
@@ -77,11 +122,18 @@ function normalizePortainerTemplate(entry: any, sourceName: string): TemplateIte
function normalizeLinuxServerTemplate(entry: any): TemplateItem | null {
if (!entry.name || entry.deprecated) return null;
const description = entry.description || '';
// LSIO fleet entries sometimes carry a project_url; prefer it over regex sniffing.
const projectUrl =
(typeof entry.project_url === 'string' && entry.project_url) ||
extractFirstUrl(description) ||
`https://github.com/linuxserver/docker-${entry.name}`;
return {
id: hashId('LinuxServer.io', entry.name),
type: 'container',
title: entry.name,
description: entry.description || '',
description,
logo: entry.project_logo || '',
categories: entry.category ? entry.category.split(',').map((c: string) => c.trim()).filter(Boolean) : [],
source: 'LinuxServer.io',
@@ -94,6 +146,7 @@ function normalizeLinuxServerTemplate(entry: any): TemplateItem | null {
restartPolicy: 'unless-stopped',
stars: entry.stars,
pulls: entry.monthly_pulls,
projectUrl
};
}
+1 -1
View File
@@ -906,7 +906,7 @@
{:else if column.id === 'actions'}
<div class="flex items-center justify-end">
<Button variant="ghost" size="icon" class="h-6 w-6" onclick={(e) => { e.stopPropagation(); showDetails(log); }}>
<Info class="w-3.5 h-3.5" />
<Info class="grid-action-icon grid-action-info" />
</Button>
</div>
{/if}
+12 -12
View File
@@ -2091,7 +2091,7 @@
onOpenChange={(open) => confirmUpdateId = open ? container.id : null}
>
{#snippet children({ open })}
<CircleArrowUp class="w-3 h-3 text-amber-500 {$appSettings.highlightUpdates ? 'glow-amber' : ''}" />
<CircleArrowUp class="grid-action-icon text-amber-500 {$appSettings.highlightUpdates ? 'glow-amber' : ''}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -2112,7 +2112,7 @@
title="Open logs"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<FileText class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<FileText class="grid-action-icon grid-action-logs text-muted-foreground hover:text-foreground" />
</button>
{/if}
{/if}
@@ -2135,7 +2135,7 @@
onclick={(e: MouseEvent) => e.stopPropagation()}
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Terminal class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Terminal class="grid-action-icon grid-action-terminal text-muted-foreground hover:text-foreground" />
</Popover.Trigger>
<Popover.Content class="w-56 p-0" align="end" sideOffset={5}>
<div class="px-3 py-2 border-b bg-muted/50">
@@ -2244,7 +2244,7 @@
title="Browse files"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<FolderOpen class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<FolderOpen class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
{/if}
<button
@@ -2253,7 +2253,7 @@
title="View details"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Eye class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Eye class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
{#if $canAccess('containers', 'create')}
<button
@@ -2262,7 +2262,7 @@
title="Edit"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Pencil class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Pencil class="grid-action-icon grid-action-edit text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if !container.systemContainer}
@@ -2274,7 +2274,7 @@
title="Unpause"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Play class="w-3 h-3 text-muted-foreground hover:text-green-500" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-500" />
</button>
{/if}
{:else if container.state !== 'running' && container.state !== 'restarting'}
@@ -2285,7 +2285,7 @@
title="Start"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Play class="w-3 h-3 text-muted-foreground hover:text-green-500" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-500" />
</button>
{/if}
{/if}
@@ -2301,7 +2301,7 @@
onOpenChange={(open) => confirmRestartId = open ? container.id : null}
>
{#snippet children({ open })}
<RotateCw class="w-3 h-3 {open ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'} {restartingId === container.id ? 'animate-spin text-foreground' : ''}" />
<RotateCw class="grid-action-icon grid-action-restart {open ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'} {restartingId === container.id ? 'animate-spin text-foreground' : ''}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -2313,7 +2313,7 @@
title="Pause"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Pause class="w-3 h-3 text-muted-foreground hover:text-yellow-500" />
<Pause class="grid-action-icon grid-action-pause text-muted-foreground hover:text-yellow-500" />
</button>
{/if}
{#if $canAccess('containers', 'stop')}
@@ -2327,7 +2327,7 @@
onOpenChange={(open) => confirmStopId = open ? container.id : null}
>
{#snippet children({ open })}
<Square class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'} {stoppingId === container.id ? 'animate-pulse text-destructive' : ''}" />
<Square class="grid-action-icon grid-action-stop {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'} {stoppingId === container.id ? 'animate-pulse text-destructive' : ''}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -2344,7 +2344,7 @@
onOpenChange={(open) => confirmDeleteId = open ? container.id : null}
>
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
{/if}
+17 -17
View File
@@ -589,14 +589,14 @@
}
async function tagImage() {
if (!tagNewRepo.trim()) return;
if (!tagNewRepo.trim() || !tagNewTag.trim()) return;
tagging = true;
const newTag = `${tagNewRepo.trim()}:${tagNewTag.trim() || 'latest'}`;
const newTag = `${tagNewRepo.trim()}:${tagNewTag.trim()}`;
try {
const response = await fetch(appendEnvParam(`/api/images/${encodeURIComponent(tagImageId)}/tag`, envId), {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ repo: tagNewRepo.trim(), tag: tagNewTag.trim() || 'latest' })
body: JSON.stringify({ repo: tagNewRepo.trim(), tag: tagNewTag.trim() })
});
if (response.ok) {
toast.success(`Tagged as ${newTag}`);
@@ -1007,7 +1007,7 @@
title="Run container"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Play class="w-3.5 h-3.5 text-muted-foreground hover:text-green-600" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-600" />
</button>
{/if}
{#if scannerEnabled && $canAccess('images', 'inspect')}
@@ -1017,7 +1017,7 @@
title="Scan for vulnerabilities"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<ShieldCheck class="w-3.5 h-3.5 text-muted-foreground hover:text-blue-500" />
<ShieldCheck class="grid-action-icon grid-action-info text-muted-foreground hover:text-blue-500" />
</button>
{/if}
{#if $canAccess('images', 'push')}
@@ -1027,7 +1027,7 @@
title="Push to registry"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Upload class="w-3.5 h-3.5 text-muted-foreground hover:text-foreground" />
<Upload class="grid-action-icon grid-action-transfer text-muted-foreground hover:text-foreground" />
</button>
{/if}
</div>
@@ -1092,7 +1092,7 @@
title="View layers"
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer"
>
<Layers class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Layers class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('containers', 'create')}
@@ -1102,7 +1102,7 @@
title="Run container"
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer"
>
<Play class="w-3 h-3 text-muted-foreground hover:text-green-600" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-600" />
</button>
{/if}
{#if scannerEnabled && $canAccess('images', 'inspect')}
@@ -1112,7 +1112,7 @@
title="Scan for vulnerabilities"
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer"
>
<ShieldCheck class="w-3 h-3 text-muted-foreground hover:text-blue-500" />
<ShieldCheck class="grid-action-icon grid-action-info text-muted-foreground hover:text-blue-500" />
</button>
{/if}
{#if $canAccess('images', 'push')}
@@ -1122,7 +1122,7 @@
title="Push to registry"
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer"
>
<Upload class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Upload class="grid-action-icon grid-action-transfer text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('images', 'inspect')}
@@ -1133,7 +1133,7 @@
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer {exportingId === tagInfo.fullRef ? 'animate-pulse' : ''}"
disabled={exportingId === tagInfo.fullRef}
>
<Download class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Download class="grid-action-icon grid-action-transfer text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('images', 'build')}
@@ -1143,7 +1143,7 @@
title="Tag image"
class="p-1 rounded hover:bg-muted transition-colors cursor-pointer"
>
<Tag class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Tag class="grid-action-icon grid-action-edit text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('images', 'remove') && tagInfo.containers === 0}
@@ -1158,7 +1158,7 @@
onOpenChange={(open) => confirmDeleteId = open ? tagInfo.fullRef : null}
>
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
</div>
@@ -1235,14 +1235,14 @@
<!-- Tag Image Dialog -->
<Dialog.Root bind:open={showTagModal}>
<Dialog.Content class="max-w-md">
<Dialog.Content class="max-w-2xl">
<Dialog.Header>
<Dialog.Title class="flex items-center gap-2">
<Tag class="w-5 h-5" />
Tag image
</Dialog.Title>
<Dialog.Description>
Add a new tag to <span class="font-mono text-foreground">{tagImageCurrentName}</span>
Add a new tag to <span class="font-mono text-foreground truncate" title={tagImageCurrentName}>{tagImageCurrentName.startsWith('sha256:') ? tagImageCurrentName.slice(0, 19) : tagImageCurrentName}</span>
</Dialog.Description>
</Dialog.Header>
<div class="py-4 space-y-4">
@@ -1263,7 +1263,7 @@
placeholder="e.g., latest, v1.0.0"
class="mt-2"
onkeydown={(e: KeyboardEvent) => {
if (e.key === 'Enter' && !tagging && tagNewRepo.trim()) {
if (e.key === 'Enter' && !tagging && tagNewRepo.trim() && tagNewTag.trim()) {
tagImage();
}
}}
@@ -1276,7 +1276,7 @@
</Button>
<Button
onclick={tagImage}
disabled={tagging || !tagNewRepo.trim()}
disabled={tagging || !tagNewRepo.trim() || !tagNewTag.trim()}
>
{#if tagging}
<RefreshCw class="w-4 h-4 mr-2 animate-spin" />
+3 -2
View File
@@ -12,6 +12,7 @@
import { appSettings } from '$lib/stores/settings';
import * as Alert from '$lib/components/ui/alert';
import { themeStore, applyTheme } from '$lib/stores/theme';
import { safeRedirectOrRoot } from '$lib/utils/safe-redirect';
interface AuthProvider {
id: string;
@@ -31,8 +32,8 @@
let selectedProvider = $state('local');
let loadingProviders = $state(true);
// Get redirect URL from query params
const redirectUrl = $derived($page.url.searchParams.get('redirect') || '/');
// Get redirect URL from query params (validated path-relative only)
const redirectUrl = $derived(safeRedirectOrRoot($page.url.searchParams.get('redirect')));
// Get error from query params (from OIDC callback)
const urlError = $derived($page.url.searchParams.get('error'));
+5 -5
View File
@@ -670,7 +670,7 @@
title="View details"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Eye class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Eye class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if !isProtected && $canAccess('networks', 'connect')}
@@ -680,7 +680,7 @@
title="Connect container"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Link class="w-3 h-3 text-muted-foreground hover:text-green-600" />
<Link class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-600" />
</button>
{/if}
<button
@@ -689,7 +689,7 @@
title="Copy network ID"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Copy class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Copy class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
{#if !isProtected && $canAccess('networks', 'create')}
<button
@@ -698,7 +698,7 @@
title="Duplicate network"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<CopyPlus class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<CopyPlus class="grid-action-icon grid-action-edit text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if !isProtected && $canAccess('networks', 'remove')}
@@ -712,7 +712,7 @@
onOpenChange={(open) => confirmDeleteId = open ? network.id : null}
>
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
{/if}
+2
View File
@@ -39,6 +39,7 @@
import * as Table from '$lib/components/ui/table';
import ThemeSelector from '$lib/components/ThemeSelector.svelte';
import AnimateIconsToggle from '$lib/components/AnimateIconsToggle.svelte';
import ColoredActionsToggle from '$lib/components/ColoredActionsToggle.svelte';
import { themeStore } from '$lib/stores/theme';
import PageHeader from '$lib/components/PageHeader.svelte';
@@ -726,6 +727,7 @@
</Card.Header>
<Card.Content class="space-y-4">
<ThemeSelector userId={profile.id} />
<ColoredActionsToggle userId={profile.id} />
<AnimateIconsToggle userId={profile.id} />
</Card.Content>
</Card.Root>
+5 -7
View File
@@ -6,6 +6,7 @@
import * as Select from '$lib/components/ui/select';
import * as Alert from '$lib/components/ui/alert';
import { KeyRound, Copy, Check, TriangleAlert } from 'lucide-svelte';
import { copyToClipboard } from '$lib/utils/clipboard';
let {
open = $bindable(false),
@@ -100,13 +101,10 @@
}
async function copyToken() {
try {
await navigator.clipboard.writeText(createdToken);
copied = true;
setTimeout(() => copied = false, 2000);
} catch {
// Fallback: select the input text
}
const ok = await copyToClipboard(createdToken);
if (!ok) return;
copied = true;
setTimeout(() => copied = false, 2000);
}
function handleClose() {
@@ -84,7 +84,10 @@
const urlObj = new URL(sourceRegistry.url);
// Include both host and path (e.g., registry.example.com/organization)
const hostWithPath = urlObj.host + (urlObj.pathname !== '/' ? urlObj.pathname.replace(/\/$/, '') : '');
return `${hostWithPath}/${imageWithTag}`;
// Caller (e.g. registry browser) may already pass an image name with the host prefixed (#1220).
return imageWithTag.startsWith(hostWithPath + '/')
? imageWithTag
: `${hostWithPath}/${imageWithTag}`;
}
return imageWithTag;
});
+6 -6
View File
@@ -1305,7 +1305,7 @@
title="View last execution logs"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<FileText class="w-3 h-3 text-muted-foreground hover:text-blue-500" />
<FileText class="grid-action-icon grid-action-logs text-muted-foreground hover:text-blue-500" />
</button>
{/if}
{#if canEditSchedules}
@@ -1316,9 +1316,9 @@
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
{#if schedule.enabled}
<Pause class="w-3 h-3 text-muted-foreground hover:text-amber-500" />
<Pause class="grid-action-icon grid-action-pause text-muted-foreground hover:text-amber-500" />
{:else}
<PlayCircle class="w-3 h-3 text-muted-foreground hover:text-green-500" />
<PlayCircle class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-500" />
{/if}
</button>
{/if}
@@ -1329,7 +1329,7 @@
title="Run now"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Play class="w-3 h-3 text-muted-foreground hover:text-green-500" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-500" />
</button>
{/if}
{#if canEditSchedules && !schedule.isSystem}
@@ -1344,7 +1344,7 @@
onOpenChange={(open) => confirmDeleteId = open ? scheduleKey : null}
>
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-red-500'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-red-500'}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -1435,7 +1435,7 @@
title="View logs"
class="p-0.5 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<FileText class="w-3 h-3 text-muted-foreground hover:text-blue-500" />
<FileText class="grid-action-icon grid-action-logs text-muted-foreground hover:text-blue-500" />
</button>
{#if canEditSchedules}
<button
@@ -8,6 +8,7 @@
import * as Tabs from '$lib/components/ui/tabs';
import { onMount, onDestroy } from 'svelte';
import { licenseStore } from '$lib/stores/license';
import { selfUpdate as selfUpdateStore } from '$lib/stores/self-update';
import { formatBytes } from '$lib/utils/format';
import { browser } from '$app/environment';
import LicenseModal from './LicenseModal.svelte';
@@ -308,6 +309,10 @@
updateAvailable = data.updateAvailable;
updateCheckDone = true;
// Mirror into the shared store so the sidebar indicator stays
// in sync with the result of a manual "Check now" (#1146).
selfUpdateStore.setFromResponse(data);
if (data.updateAvailable) {
updateInfo = {
currentImage: data.currentImage,
@@ -893,7 +893,8 @@
if (!formName.trim()) {
formErrors.name = 'Name is required';
hasErrors = true;
} else {
} else if (formName.trim() !== environment.name) {
// Only validate name format on rename — existing names with legacy characters are allowed
const nameCheck = validateEnvName(formName.trim());
if (!nameCheck.ok) {
formErrors.name = nameCheck.reason!;
+74 -1
View File
@@ -8,13 +8,14 @@
import { TogglePill, ToggleSwitch } from '$lib/components/ui/toggle-pill';
import CronEditor from '$lib/components/cron-editor.svelte';
import TimezoneSelector from '$lib/components/TimezoneSelector.svelte';
import { Eye, Bell, Database, Calendar, ShieldCheck, FileText, AlertTriangle, HelpCircle, Globe, Activity, Clock, Info, Save, RotateCcw, LayoutDashboard, Tags } from 'lucide-svelte';
import { Eye, Bell, Database, Calendar, ShieldCheck, FileText, AlertTriangle, HelpCircle, Globe, Activity, Clock, Info, Save, RotateCcw, LayoutDashboard, Tags, ChevronRight, ChevronDown } from 'lucide-svelte';
import CodeEditor from '$lib/components/CodeEditor.svelte';
import { appSettings, type DateFormat, type DownloadFormat, type EventCollectionMode, type LabelFilterMode } from '$lib/stores/settings';
import { canAccess, authStore } from '$lib/stores/auth';
import { toast } from 'svelte-sonner';
import ThemeSelector from '$lib/components/ThemeSelector.svelte';
import AnimateIconsToggle from '$lib/components/AnimateIconsToggle.svelte';
import ColoredActionsToggle from '$lib/components/ColoredActionsToggle.svelte';
import * as Tooltip from '$lib/components/ui/tooltip';
// General settings state - these derive from the store
@@ -32,6 +33,9 @@
let defaultTrivyArgs = $derived($appSettings.defaultTrivyArgs);
let defaultGrypeImage = $derived($appSettings.defaultGrypeImage);
let defaultTrivyImage = $derived($appSettings.defaultTrivyImage);
let defaultScannerNetworkMode = $derived($appSettings.defaultScannerNetworkMode);
let defaultScannerDns = $derived($appSettings.defaultScannerDns);
let showAdvancedScannerSettings = $state(false);
let defaultComposeTemplate = $derived($appSettings.defaultComposeTemplate);
let labelFilterMode = $derived($appSettings.labelFilterMode);
let composeTemplateWIP = $state('');
@@ -207,6 +211,29 @@ services:
}
}
function handleScannerNetworkModeChange(value: string) {
const trimmed = (value ?? '').trim();
if (trimmed !== defaultScannerNetworkMode) {
appSettings.setDefaultScannerNetworkMode(trimmed);
toast.success(trimmed ? `Scanner network mode set to ${trimmed}` : 'Scanner network mode cleared');
}
}
function handleScannerDnsBlur(e: Event) {
const raw = (e.target as HTMLInputElement).value.trim();
const cleaned = raw
.split(',')
.map((s) => s.trim())
.filter(Boolean);
const sameAsCurrent =
cleaned.length === defaultScannerDns.length &&
cleaned.every((v, i) => v === defaultScannerDns[i]);
if (!sameAsCurrent) {
appSettings.setDefaultScannerDns(cleaned);
toast.success(cleaned.length ? `Scanner DNS set to ${cleaned.join(', ')}` : 'Scanner DNS cleared');
}
}
// Anything above 2K starts feeling laggy in browsers without virtualized rendering.
const logMaxLinesOptions = [
{ value: '500', label: '500 lines' },
@@ -434,6 +461,7 @@ services:
<!-- Right column: Theme settings (always shown, with hint when auth enabled) -->
<div class="space-y-4">
<ThemeSelector />
<ColoredActionsToggle />
<AnimateIconsToggle />
{#if $authStore.authEnabled}
<div class="text-xs text-muted-foreground flex items-start gap-1.5 mt-2 p-2 bg-muted/50 rounded-md">
@@ -671,6 +699,51 @@ services:
/>
<p class="text-xs text-muted-foreground">Use <code class="bg-muted px-1 rounded">{'{image}'}</code> as placeholder for the image name</p>
</div>
<div class="pt-2">
<button
type="button"
class="text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-1 select-none"
onclick={() => (showAdvancedScannerSettings = !showAdvancedScannerSettings)}
>
{#if showAdvancedScannerSettings}
<ChevronDown class="w-3.5 h-3.5" />
{:else}
<ChevronRight class="w-3.5 h-3.5" />
{/if}
Advanced settings
</button>
</div>
{#if showAdvancedScannerSettings}
<div class="space-y-2">
<Label for="scanner-network-mode">Network mode</Label>
<Select.Root
type="single"
value={defaultScannerNetworkMode}
onValueChange={handleScannerNetworkModeChange}
>
<Select.Trigger id="scanner-network-mode" class="w-full" disabled={!$canAccess('settings', 'edit')}>
<span>{defaultScannerNetworkMode || 'Default (auto-detect)'}</span>
</Select.Trigger>
<Select.Content>
<Select.Item value="">Default (auto-detect)</Select.Item>
<Select.Item value="host">host</Select.Item>
<Select.Item value="bridge">bridge</Select.Item>
<Select.Item value="none">none</Select.Item>
</Select.Content>
</Select.Root>
<p class="text-xs text-muted-foreground">Override the Docker network mode for vulnerability scanner containers. Use <code class="bg-muted px-1 rounded">host</code> on hosts where the default bridge can't reach the internet (e.g. iptables disabled, SELinux restricted).</p>
</div>
<div class="space-y-2">
<Label for="scanner-dns">DNS servers</Label>
<Input
id="scanner-dns"
value={defaultScannerDns.join(', ')}
onblur={handleScannerDnsBlur}
disabled={!$canAccess('settings', 'edit')}
/>
<p class="text-xs text-muted-foreground">Comma-separated DNS IPs for scanner containers. Empty = inherit from the Docker daemon.</p>
</div>
{/if}
<div class="pt-2 border-t">
<div class="flex items-center justify-between">
<div>
+13 -13
View File
@@ -1750,7 +1750,7 @@
title="Edit git stack"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Pencil class="w-3 h-3 text-muted-foreground hover:text-purple-500" />
<Pencil class="grid-action-icon grid-action-edit text-muted-foreground hover:text-purple-500" />
</button>
<GitDeployProgressPopover
stackId={source.gitStack.id}
@@ -1763,7 +1763,7 @@
title="Deploy"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Rocket class="w-3 h-3 text-muted-foreground hover:text-violet-500" />
<Rocket class="grid-action-icon grid-action-start text-muted-foreground hover:text-violet-500" />
</button>
{/snippet}
</GitDeployProgressPopover>
@@ -1780,7 +1780,7 @@
title="Sync from Git"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<RefreshCw class="w-3 h-3 text-muted-foreground hover:text-purple-500" />
<RefreshCw class="grid-action-icon grid-action-restart text-muted-foreground hover:text-purple-500" />
</button>
{/snippet}
</GitDeployProgressPopover>
@@ -1793,7 +1793,7 @@
title="Edit git stack"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Pencil class="w-3 h-3 text-muted-foreground hover:text-purple-500" />
<Pencil class="grid-action-icon grid-action-edit text-muted-foreground hover:text-purple-500" />
</button>
{:else}
<!-- Internal stacks (including those needing file location) -->
@@ -1803,7 +1803,7 @@
title="Edit"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Pencil class="w-3 h-3 text-muted-foreground hover:text-blue-500" />
<Pencil class="grid-action-icon grid-action-edit text-muted-foreground hover:text-blue-500" />
</button>
{/if}
{/if}
@@ -1814,7 +1814,7 @@
title="View logs"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<ScrollText class="w-3 h-3 text-muted-foreground hover:text-blue-500" />
<ScrollText class="grid-action-icon grid-action-logs text-muted-foreground hover:text-blue-500" />
</button>
{/if}
{#if source.sourceType !== 'git' && source.sourceType !== 'external' && $canAccess('stacks', 'start')}
@@ -1825,13 +1825,13 @@
onDeploy={(options) => redeployStack(stack.name, options)}
>
{#snippet children()}
<Rocket class="w-3 h-3 text-muted-foreground hover:text-violet-500" />
<Rocket class="grid-action-icon grid-action-start text-muted-foreground hover:text-violet-500" />
{/snippet}
</RedeployPopover>
{/if}
{#if stackActionLoading === stack.name}
<div class="p-1">
<Loader2 class="w-3 h-3 animate-spin text-muted-foreground" />
<Loader2 class="grid-action-icon animate-spin text-muted-foreground" />
</div>
{:else if stack.status !== 'running' && stack.status !== 'partial' && stack.status !== 'restarting'}
{#if $canAccess('stacks', 'start')}
@@ -1841,7 +1841,7 @@
title="Start"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Play class="w-3 h-3 text-muted-foreground hover:text-green-500" />
<Play class="grid-action-icon grid-action-start text-muted-foreground hover:text-green-500" />
</button>
{/if}
{:else}
@@ -1856,7 +1856,7 @@
onclick={(e) => { e.stopPropagation(); restartPopoverOpen[stack.name] = !restartPopoverOpen[stack.name]; }}
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer inline-flex items-center"
>
<RotateCcw class="w-3 h-3 {restartPopoverOpen[stack.name] ? 'text-amber-500' : 'text-muted-foreground hover:text-amber-500'}" />
<RotateCcw class="grid-action-icon grid-action-restart {restartPopoverOpen[stack.name] ? 'text-amber-500' : 'text-muted-foreground hover:text-amber-500'}" />
</button>
{/snippet}
</Popover.Trigger>
@@ -1891,7 +1891,7 @@
onOpenChange={(open) => confirmStopName = open ? stack.name : null}
>
{#snippet children({ open })}
<Square class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Square class="grid-action-icon grid-action-stop {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -1908,7 +1908,7 @@
onOpenChange={(open) => confirmDownName = open ? stack.name : null}
>
{#snippet children({ open })}
<ArrowBigDown class="w-3 h-3 {stackDownLoading === stack.name ? 'animate-bounce text-orange-500' : open ? 'text-orange-500' : 'text-muted-foreground hover:text-orange-500'}" />
<ArrowBigDown class="grid-action-icon grid-action-stop {stackDownLoading === stack.name ? 'animate-bounce text-orange-500' : open ? 'text-orange-500' : 'text-muted-foreground hover:text-orange-500'}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -1929,7 +1929,7 @@
</label>
{/snippet}
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
{/if}
@@ -22,6 +22,7 @@
import type { Snippet } from 'svelte';
import { appSettings } from '$lib/stores/settings';
import { watchJob } from '$lib/utils/sse-fetch';
import { copyToClipboard } from '$lib/utils/clipboard';
interface Props {
stackId: number;
@@ -155,7 +156,8 @@
async function copyLogs() {
const lines = steps.map(s => s.message || s.status);
if (errorMessage) lines.push(`Error: ${errorMessage}`);
await navigator.clipboard.writeText(lines.join('\n'));
const ok = await copyToClipboard(lines.join('\n'));
if (!ok) return;
copied = true;
setTimeout(() => { copied = false; }, 2000);
}
+38 -20
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import * as Card from '$lib/components/ui/card';
import { Badge } from '$lib/components/ui/badge';
import { Package, Star, Download, Loader2 } from 'lucide-svelte';
import { Package, Star, Download, Loader2, ExternalLink } from 'lucide-svelte';
import type { TemplateItem } from '../api/templates/+server';
interface Props {
@@ -71,13 +71,17 @@
</div>
</Card.Header>
<!-- svelte-ignore a11y_click_events_have_key_events -->
<Card.Content class="px-3 pb-2 pt-0" onclick={(e: MouseEvent) => { if ((e.target as HTMLElement).tagName === 'A') e.stopPropagation(); }}>
<Card.Content class="px-3 pb-2 pt-0" onclick={(e: MouseEvent) => { if ((e.target as HTMLElement).closest('a')) e.stopPropagation(); }}>
<!-- eslint-disable-next-line svelte/no-at-html-tags -->
<p class="text-xs text-muted-foreground line-clamp-2">
{@html renderDescription(template.description) || 'No description available'}
</p>
</Card.Content>
<Card.Footer class="px-3 pb-3 pt-0 flex items-center gap-1.5 flex-wrap">
<!-- svelte-ignore a11y_click_events_have_key_events -->
<Card.Footer
class="px-3 pb-3 pt-0 flex items-center gap-1.5 flex-wrap"
onclick={(e: MouseEvent) => { if ((e.target as HTMLElement).closest('a')) e.stopPropagation(); }}
>
{#each visibleCategories as category}
<Badge variant="secondary" class="text-2xs px-1.5 py-0">
{category}
@@ -86,23 +90,37 @@
{#if overflowCount > 0}
<span class="text-2xs text-muted-foreground">+{overflowCount}</span>
{/if}
<!-- LinuxServer metadata -->
{#if template.stars || template.pulls}
<div class="ml-auto flex items-center gap-2 text-2xs text-muted-foreground">
{#if template.stars}
<span class="flex items-center gap-0.5">
<Star class="w-3 h-3" />
{template.stars}
</span>
{/if}
{#if template.pulls}
<span class="flex items-center gap-0.5">
<Download class="w-3 h-3" />
{formatPulls(template.pulls)}
</span>
{/if}
</div>
{/if}
<div class="ml-auto flex items-center gap-2 text-2xs text-muted-foreground">
{#if template.projectUrl}
<a
href={template.projectUrl}
target="_blank"
rel="noopener"
class="flex items-center gap-0.5 hover:text-primary hover:underline"
title={`Open project page: ${template.projectUrl}`}
onclick={(e: MouseEvent) => {
e.stopPropagation();
e.preventDefault();
window.open(template.projectUrl, '_blank', 'noopener');
}}
>
<ExternalLink class="w-3 h-3" />
Project
</a>
{/if}
{#if template.stars}
<span class="flex items-center gap-0.5">
<Star class="w-3 h-3" />
{template.stars}
</span>
{/if}
{#if template.pulls}
<span class="flex items-center gap-0.5">
<Download class="w-3 h-3" />
{formatPulls(template.pulls)}
</span>
{/if}
</div>
</Card.Footer>
</Card.Root>
</button>
+5 -5
View File
@@ -599,7 +599,7 @@
title="View details"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Eye class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Eye class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
<button
type="button"
@@ -607,7 +607,7 @@
title="Browse files"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<FolderOpen class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<FolderOpen class="grid-action-icon grid-action-info text-muted-foreground hover:text-foreground" />
</button>
<button
type="button"
@@ -616,7 +616,7 @@
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer {exportingVolume === volume.name ? 'animate-pulse' : ''}"
disabled={exportingVolume === volume.name}
>
<Download class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Download class="grid-action-icon grid-action-transfer text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('volumes', 'create')}
@@ -626,7 +626,7 @@
title="Clone volume"
class="p-1 rounded hover:bg-muted transition-colors opacity-70 hover:opacity-100 cursor-pointer"
>
<Stamp class="w-3 h-3 text-muted-foreground hover:text-foreground" />
<Stamp class="grid-action-icon grid-action-edit text-muted-foreground hover:text-foreground" />
</button>
{/if}
{#if $canAccess('volumes', 'remove')}
@@ -641,7 +641,7 @@
onOpenChange={(open) => confirmDeleteName = open ? volume.name : null}
>
{#snippet children({ open })}
<Trash2 class="w-3 h-3 {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
<Trash2 class="grid-action-icon grid-action-delete {open ? 'text-destructive' : 'text-muted-foreground hover:text-destructive'}" />
{/snippet}
</ConfirmPopover>
{#if deleteError?.name === volume.name}