Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

refactor(extensions): own remote access styles

Juan Denisaa3407750c90
diff --git a/builtin-extensions/serverkit-remote-access/frontend/index.jsx b/builtin-extensions/serverkit-remote-access/frontend/index.jsx
index 77691b57..3d665db2 100644
--- a/builtin-extensions/serverkit-remote-access/frontend/index.jsx
+++ b/builtin-extensions/serverkit-remote-access/frontend/index.jsx
@@ -8,6 +8,7 @@
//
// After sync this file lives at frontend/src/plugins/serverkit-remote-access/
// so the relative import resolves against the host's pages directory.
+import './styles/remote-access.scss';
import RemoteAccess from '../../pages/RemoteAccess';
export function RemoteAccessPage() {
diff --git a/frontend/src/styles/pages/_remote-access.scss b/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
similarity index 95%
rename from frontend/src/styles/pages/_remote-access.scss
rename to builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
index d14c3e5a..2401ad23 100644
--- a/frontend/src/styles/pages/_remote-access.scss
+++ b/builtin-extensions/serverkit-remote-access/frontend/styles/remote-access.scss
@@ -1,6 +1,11 @@
// ============================================
// REMOTE ACCESS (/remote-access — a tab in the Servers group)
// ============================================
+// Compiled through the extension's module graph (imported by index.jsx).
+// The baked copy lives at frontend/src/plugins/serverkit-remote-access/, so
+// this sync-safe path resolves to the host's Sass design-token partial.
+@import '../../../styles/variables';
+
// WireGuard tunnels between two agents + the services published over them.
// Page-local `.ra-*` classes built on the infra-console tokens (sk-* siblings).
// Deliberately NOT the shadcn <Card>: its unlayered `.ui-card-content` zeroes
diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjs
index 4fd5f405..0c445ee3 100644
--- a/frontend/scripts/check-frontend-boundaries.mjs
+++ b/frontend/scripts/check-frontend-boundaries.mjs
@@ -6,13 +6,27 @@
// baseline so this can land without a risky all-at-once UI rewrite; the exact
// counts deliberately make every cleanup update (and shrink) the baseline.
-import { readFileSync, readdirSync } from 'node:fs';
+import { existsSync, readFileSync, readdirSync } from 'node:fs';
import { dirname, extname, join, relative, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const root = resolve(here, '..');
const src = resolve(root, 'src');
+const repoRoot = resolve(root, '..');
+
+// Styles owned by a builtin extension must enter the bundle through that
+// extension's module graph, not through core styles/main.scss. Keeping this
+// declaration here makes ownership executable: both the source-of-truth and
+// its checked-in pre-bundled copy must expose the same style entry, while core
+// is forbidden from quietly taking the page partial back.
+const EXTENSION_OWNED_STYLES = [
+ {
+ slug: 'serverkit-remote-access',
+ importPath: './styles/remote-access.scss',
+ forbiddenCoreImports: ['pages/_remote-access', 'pages/remote-access'],
+ },
+];
const LEGACY_CLIPBOARD = new Map(Object.entries({
'components/cloudflare/TunnelsPanel.jsx': 1,
@@ -125,6 +139,41 @@ for (const file of LEGACY_CLIPBOARD.keys()) {
}
}
+const mainStylesPath = resolve(src, 'styles', 'main.scss');
+const mainStyles = readFileSync(mainStylesPath, 'utf8');
+for (const ownership of EXTENSION_OWNED_STYLES) {
+ for (const importPath of ownership.forbiddenCoreImports) {
+ const escaped = importPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ if (new RegExp(`@(?:import|use)\\s+['\"]${escaped}['\"]`).test(mainStyles)) {
+ failures.push(
+ `styles/main.scss: ${ownership.slug} owns ${importPath}; import its styles from the extension entry instead.`,
+ );
+ }
+ }
+
+ const entryPaths = [
+ resolve(repoRoot, 'builtin-extensions', ownership.slug, 'frontend', 'index.jsx'),
+ resolve(src, 'plugins', ownership.slug, 'index.jsx'),
+ ];
+ for (const entryPath of entryPaths) {
+ const displayPath = relative(repoRoot, entryPath).replaceAll('\\', '/');
+ if (!existsSync(entryPath)) {
+ failures.push(`${displayPath}: missing extension frontend entry.`);
+ continue;
+ }
+ const entry = readFileSync(entryPath, 'utf8');
+ const escaped = ownership.importPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+ if (!new RegExp(`import\\s+['\"]${escaped}['\"]`).test(entry)) {
+ failures.push(`${displayPath}: must import ${ownership.importPath}.`);
+ }
+
+ const stylePath = resolve(dirname(entryPath), ownership.importPath);
+ if (!existsSync(stylePath)) {
+ failures.push(`${relative(repoRoot, stylePath).replaceAll('\\', '/')}: missing extension-owned stylesheet.`);
+ }
+ }
+}
+
if (failures.length) {
console.error('\nFrontend boundary check failed:\n');
failures.forEach((failure) => console.error(` - ${failure}`));
@@ -132,4 +181,4 @@ if (failures.length) {
process.exit(1);
}
-console.log(`✓ frontend boundaries: no browser confirm/raw UI fetch/token or workspace persistence reads/new clipboard or dialog bypasses (${LEGACY_CLIPBOARD.size} clipboard files remain ratcheted).`);
+console.log(`✓ frontend boundaries: browser/API/dialog boundaries and ${EXTENSION_OWNED_STYLES.length} extension style ownership rule(s) hold (${LEGACY_CLIPBOARD.size} clipboard files remain ratcheted).`);
diff --git a/frontend/src/plugins/serverkit-remote-access/index.jsx b/frontend/src/plugins/serverkit-remote-access/index.jsx
index 77691b57..3d665db2 100644
--- a/frontend/src/plugins/serverkit-remote-access/index.jsx
+++ b/frontend/src/plugins/serverkit-remote-access/index.jsx
@@ -8,6 +8,7 @@
//
// After sync this file lives at frontend/src/plugins/serverkit-remote-access/
// so the relative import resolves against the host's pages directory.
+import './styles/remote-access.scss';
import RemoteAccess from '../../pages/RemoteAccess';
export function RemoteAccessPage() {
diff --git a/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss b/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss
new file mode 100644
index 00000000..2401ad23
--- /dev/null
+++ b/frontend/src/plugins/serverkit-remote-access/styles/remote-access.scss
@@ -0,0 +1,256 @@
+// ============================================
+// REMOTE ACCESS (/remote-access — a tab in the Servers group)
+// ============================================
+// Compiled through the extension's module graph (imported by index.jsx).
+// The baked copy lives at frontend/src/plugins/serverkit-remote-access/, so
+// this sync-safe path resolves to the host's Sass design-token partial.
+@import '../../../styles/variables';
+
+// WireGuard tunnels between two agents + the services published over them.
+// Page-local `.ra-*` classes built on the infra-console tokens (sk-* siblings).
+// Deliberately NOT the shadcn <Card>: its unlayered `.ui-card-content` zeroes
+// top padding and can't be reliably overridden by Tailwind utilities, which sit
+// in a lower-priority @layer — that's what made the old page look unpadded.
+
+.ra-page {
+ display: flex;
+ flex-direction: column;
+ gap: $space-5;
+}
+
+.ra-intro {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: $space-4;
+ margin: -2px 0 0;
+ max-width: 72ch;
+ font-size: 13.5px;
+ line-height: 1.55;
+ color: var(--text-dim);
+
+ p { margin: 0; }
+
+ .ra-intro__actions {
+ flex-shrink: 0;
+ }
+}
+
+@media (max-width: $breakpoint-md) {
+ .ra-intro {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: $space-3;
+ }
+}
+
+.ra-loading {
+ display: flex;
+ justify-content: center;
+ padding: $space-10 0;
+}
+
+.ra-list {
+ display: flex;
+ flex-direction: column;
+ gap: $space-4;
+}
+
+// ---- Tunnel card --------------------------------------------------
+.ra-tunnel {
+ background: var(--surface);
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius-lg);
+ overflow: hidden;
+ transition: border-color 0.15s;
+
+ &:hover { border-color: var(--border-strong); }
+}
+
+.ra-tunnel__head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: $space-4;
+ padding: $space-4 $space-5;
+}
+
+.ra-tunnel__info { min-width: 0; }
+
+.ra-tunnel__route {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 9px;
+ font-size: 14.5px;
+ font-weight: 600;
+ color: var(--text);
+
+ .ra-node {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+
+ a {
+ color: inherit;
+ text-decoration: none;
+
+ &:hover {
+ color: var(--accent-bright);
+ text-decoration: underline;
+ }
+ }
+
+ .ra-node__tag {
+ flex-shrink: 0;
+ padding: 1px 6px;
+ border-radius: 999px;
+ background: var(--accent-bg);
+ color: var(--accent-bright);
+ font-size: 10px;
+ font-weight: 600;
+ text-transform: uppercase;
+ letter-spacing: 0.03em;
+ }
+ }
+
+ .ra-node__ico {
+ width: 27px;
+ height: 27px;
+ border-radius: 8px;
+ display: grid;
+ place-items: center;
+ flex-shrink: 0;
+ background: var(--surface-2);
+ color: var(--text-dim);
+ }
+
+ .ra-arrow {
+ color: var(--text-faint);
+ flex-shrink: 0;
+ }
+}
+
+.ra-tunnel__meta {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 7px;
+ margin-top: 9px;
+ font-family: var(--mono);
+ font-size: 11.5px;
+ color: var(--text-faint);
+
+ .ra-dot { opacity: 0.55; }
+}
+
+.ra-tunnel__actions {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+}
+
+.ra-tunnel__warn {
+ display: flex;
+ align-items: flex-start;
+ gap: 8px;
+ margin: 0 $space-5 $space-4;
+ padding: 9px 12px;
+ border-radius: 9px;
+ background: var(--amber-bg);
+ color: var(--amber);
+ font-size: 12px;
+ line-height: 1.45;
+
+ svg { flex-shrink: 0; margin-top: 1px; }
+}
+
+// ---- Published services -------------------------------------------
+.ra-svcs {
+ border-top: 1px solid var(--border-soft);
+}
+
+.ra-svc {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: $space-4;
+ padding: 12px $space-5;
+ transition: background 0.12s;
+
+ & + .ra-svc { border-top: 1px solid var(--border-soft); }
+ &:hover { background: var(--surface-2); }
+}
+
+.ra-svc__main {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ min-width: 0;
+}
+
+.ra-svc__ico {
+ color: var(--text-faint);
+ flex-shrink: 0;
+}
+
+.ra-svc__host {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ min-width: 0;
+ font-size: 13.5px;
+ font-weight: 550;
+ color: var(--text);
+ text-decoration: none;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+
+ svg { color: var(--text-faint); flex-shrink: 0; }
+
+ // Only linkable (published) hosts get the hover affordance.
+ &:where(a):hover {
+ color: var(--accent-bright);
+ text-decoration: underline;
+ svg { color: var(--accent-bright); }
+ }
+}
+
+.ra-svc__port {
+ font-family: var(--mono);
+ font-size: 12px;
+ color: var(--text-faint);
+ flex-shrink: 0;
+}
+
+.ra-svc__flags {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+ color: var(--text-faint);
+
+ .ra-flag--ssl { color: var(--green); }
+}
+
+.ra-svc__right {
+ display: inline-flex;
+ align-items: center;
+ gap: $space-3;
+ flex-shrink: 0;
+}
+
+@media (max-width: $breakpoint-md) {
+ .ra-tunnel__head { flex-direction: column; gap: $space-3; }
+ .ra-tunnel__actions { width: 100%; }
+
+ .ra-svc {
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 10px;
+ }
+ .ra-svc__right { width: 100%; justify-content: space-between; }
+}
diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scss
index e05add83..a7dd77e7 100644
--- a/frontend/src/styles/main.scss
+++ b/frontend/src/styles/main.scss
@@ -136,7 +136,6 @@
@import 'pages/_server-templates';
@import 'pages/_server-packages';
@import 'pages/_server-services';
-@import 'pages/_remote-access';
@import 'pages/_workspaces';
@import 'pages/_cloudflare-zone';
@import 'pages/_status-pages';