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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(fonts): replace corrupted IBM Plex Sans assets (#132)
Rebertt Rodrigues763f555d9aca
diff --git a/frontend/package.json b/frontend/package.jsonindex 4bc94a51..360c790a 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -7,8 +7,9 @@"dev": "vite","build": "vite build","test": "node --test",- "lint": "eslint . && node scripts/check-settings-index.mjs && node scripts/check-theme-tokens.mjs && node scripts/check-frontend-boundaries.mjs && node scripts/check-style-ownership.mjs && node scripts/check-status-one-door.mjs && node scripts/check-status-scss.mjs && node scripts/check-i18n-literals.mjs && node scripts/check-intl-door.mjs && node scripts/extract-i18n.mjs --check && node scripts/check-i18n.mjs && node scripts/check-logical-properties.mjs && node scripts/generate-vendor-shims.mjs --check && node ../scripts/check-html-sinks.mjs",+ "lint": "eslint . && node scripts/check-font-integrity.mjs && node scripts/check-settings-index.mjs && node scripts/check-theme-tokens.mjs && node scripts/check-frontend-boundaries.mjs && node scripts/check-style-ownership.mjs && node scripts/check-status-one-door.mjs && node scripts/check-status-scss.mjs && node scripts/check-i18n-literals.mjs && node scripts/check-intl-door.mjs && node scripts/extract-i18n.mjs --check && node scripts/check-i18n.mjs && node scripts/check-logical-properties.mjs && node scripts/generate-vendor-shims.mjs --check && node ../scripts/check-html-sinks.mjs","lint:settings-index": "node scripts/check-settings-index.mjs",+ "lint:fonts": "node scripts/check-font-integrity.mjs","lint:status": "node scripts/check-status-one-door.mjs","lint:i18n": "node scripts/check-i18n-literals.mjs","lint:intl": "node scripts/check-intl-door.mjs",diff --git a/frontend/public/fonts/LICENSE-IBM-PLEX.txt b/frontend/public/fonts/LICENSE-IBM-PLEX.txtnew file mode 100644index 00000000..f821ee27--- /dev/null+++ b/frontend/public/fonts/LICENSE-IBM-PLEX.txt@@ -0,0 +1,92 @@+Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"++This Font Software is licensed under the SIL Open Font License, Version 1.1.+This license is copied below, and is also available with a FAQ at:+http://scripts.sil.org/OFL++-----------------------------------------------------------+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007+-----------------------------------------------------------++PREAMBLE+The goals of the Open Font License (OFL) are to stimulate worldwide+development of collaborative font projects, to support the font creation+efforts of academic and linguistic communities, and to provide a free and+open framework in which fonts may be shared and improved in partnership+with others.++The OFL allows the licensed fonts to be used, studied, modified and+redistributed freely as long as they are not sold by themselves. The+fonts, including any derivative works, can be bundled, embedded,+redistributed and/or sold with any software provided that any reserved+names are not used by derivative works. The fonts and derivatives,+however, cannot be released under any other type of license. The+requirement for fonts to remain under this license does not apply+to any document created using the fonts or their derivatives.++DEFINITIONS+"Font Software" refers to the set of files released by the Copyright+Holder(s) under this license and clearly marked as such. This may+include source files, build scripts and documentation.++"Reserved Font Name" refers to any names specified as such after the+copyright statement(s).++"Original Version" refers to the collection of Font Software components as+distributed by the Copyright Holder(s).++"Modified Version" refers to any derivative made by adding to, deleting,+or substituting -- in part or in whole -- any of the components of the+Original Version, by changing formats or by porting the Font Software to a+new environment.++"Author" refers to any designer, engineer, programmer, technical+writer or other person who contributed to the Font Software.++PERMISSION & CONDITIONS+Permission is hereby granted, free of charge, to any person obtaining+a copy of the Font Software, to use, study, copy, merge, embed, modify,+redistribute, and sell modified and unmodified copies of the Font+Software, subject to the following conditions:++1) Neither the Font Software nor any of its individual components,+in Original or Modified Versions, may be sold by itself.++2) Original or Modified Versions of the Font Software may be bundled,+redistributed and/or sold with any software, provided that each copy+contains the above copyright notice and this license. These can be+included either as stand-alone text files, human-readable headers or+in the appropriate machine-readable metadata fields within text or+binary files as long as those fields can be easily viewed by the user.++3) No Modified Version of the Font Software may use the Reserved Font+Name(s) unless explicit written permission is granted by the corresponding+Copyright Holder. This restriction only applies to the primary font name as+presented to the users.++4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font+Software shall not be used to promote, endorse or advertise any+Modified Version, except to acknowledge the contribution(s) of the+Copyright Holder(s) and the Author(s) or with their explicit written+permission.++5) The Font Software, modified or unmodified, in part or in whole,+must be distributed entirely under this license, and must not be+distributed under any other license. The requirement for fonts to+remain under this license does not apply to any document created+using the Font Software.++TERMINATION+This license becomes null and void if any of the above conditions are+not met.++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.diff --git a/frontend/public/fonts/ibm-plex-sans-500.woff2 b/frontend/public/fonts/ibm-plex-sans-500.woff2index 46616aa6..b142a66f 100644Binary files a/frontend/public/fonts/ibm-plex-sans-500.woff2 and b/frontend/public/fonts/ibm-plex-sans-500.woff2 differdiff --git a/frontend/public/fonts/ibm-plex-sans-600.woff2 b/frontend/public/fonts/ibm-plex-sans-600.woff2index 93b51159..b96a19c2 100644Binary files a/frontend/public/fonts/ibm-plex-sans-600.woff2 and b/frontend/public/fonts/ibm-plex-sans-600.woff2 differdiff --git a/frontend/public/fonts/ibm-plex-sans-700.woff2 b/frontend/public/fonts/ibm-plex-sans-700.woff2index 114fd6ad..0d0b09ae 100644Binary files a/frontend/public/fonts/ibm-plex-sans-700.woff2 and b/frontend/public/fonts/ibm-plex-sans-700.woff2 differdiff --git a/frontend/scripts/check-font-integrity.mjs b/frontend/scripts/check-font-integrity.mjsnew file mode 100644index 00000000..f297a3a0--- /dev/null+++ b/frontend/scripts/check-font-integrity.mjs@@ -0,0 +1,37 @@+#!/usr/bin/env node++import { readFile } from 'node:fs/promises';+import { fileURLToPath } from 'node:url';+import { dirname, join } from 'node:path';+++const FRONTEND = join(dirname(fileURLToPath(import.meta.url)), '..');+const FONT_DIR = join(FRONTEND, 'public', 'fonts');+const FONT_STYLES = join(FRONTEND, 'src', 'styles', 'base', '_fonts.scss');+const FONTS = [+ ['ibm-plex-sans-500.woff2', 500],+ ['ibm-plex-sans-600.woff2', 600],+ ['ibm-plex-sans-700.woff2', 700],+];++const styles = await readFile(FONT_STYLES, 'utf8');+const fontFaces = [...styles.matchAll(/@font-face\s*\{([\s\S]*?)\}/g)]+ .map((match) => match[1]);++for (const [filename, weight] of FONTS) {+ const font = await readFile(join(FONT_DIR, filename));+ if (font.length === 0) throw new Error(`${filename} is empty`);+ if (font.subarray(0, 4).toString('ascii') !== 'wOF2') {+ throw new Error(`${filename} does not have a WOFF2 signature`);+ }+ if (!font.some((byte) => byte !== 0)) {+ throw new Error(`${filename} contains only zero bytes`);+ }++ const face = fontFaces.find((block) => block.includes(filename));+ if (!face || !face.includes(`font-weight: ${weight};`)) {+ throw new Error(`${filename} is not declared as CSS weight ${weight}`);+ }+}++console.log('✓ font integrity: IBM Plex Sans 500/600/700 are valid WOFF2 assets');diff --git a/frontend/scripts/fetch-fonts.mjs b/frontend/scripts/fetch-fonts.mjsindex 57eba459..c3fa0b80 100644--- a/frontend/scripts/fetch-fonts.mjs+++ b/frontend/scripts/fetch-fonts.mjs@@ -4,8 +4,10 @@// ============================================================// ServerKit self-hosts its fonts for privacy (no Google Fonts CDN — that would// leak every visitor's IP + usage to a third party). This script downloads the-// OFL-licensed IBM Plex faces once, from the @fontsource jsDelivr mirror, into-// the repo's public/fonts/ folder so they're served from our own origin.+// OFL-licensed IBM Plex faces once into the repo's public/fonts/ folder so+// they're served from our own origin. The Sans 500/600/700 faces come directly+// from the official IBM/plex repository; existing valid faces retain their+// original @fontsource jsDelivr source.//// node frontend/scripts/fetch-fonts.mjs//@@ -13,38 +15,41 @@// Requires Node 18+ (global fetch). No network at build/runtime — only here.// ============================================================-import { mkdir, writeFile, access } from 'node:fs/promises';+import { mkdir, readFile, writeFile } from 'node:fs/promises';import { fileURLToPath } from 'node:url';import { dirname, join } from 'node:path';const __dirname = dirname(fileURLToPath(import.meta.url));const OUT = join(__dirname, '..', 'public', 'fonts');-const BASE = 'https://cdn.jsdelivr.net/npm';+const FONTSOURCE_BASE = 'https://cdn.jsdelivr.net/npm';+const IBM_PLEX_REVISION = 'bf260093582f04622aacc1e9f9ca604d7ccd0c42';+const IBM_PLEX_BASE = `https://raw.githubusercontent.com/IBM/plex/${IBM_PLEX_REVISION}`;-// local filename -> @fontsource source path+// local filename -> source URLconst FONTS = {- 'ibm-plex-sans-400.woff2': '@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2',- 'ibm-plex-sans-500.woff2': '@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-500-normal.woff2',- 'ibm-plex-sans-600.woff2': '@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-600-normal.woff2',- 'ibm-plex-sans-700.woff2': '@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-700-normal.woff2',- 'ibm-plex-mono-400.woff2': '@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-400-normal.woff2',- 'ibm-plex-mono-500.woff2': '@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-500-normal.woff2',- 'ibm-plex-mono-600.woff2': '@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-600-normal.woff2',+ 'ibm-plex-sans-400.woff2': `${FONTSOURCE_BASE}/@fontsource/ibm-plex-sans/files/ibm-plex-sans-latin-400-normal.woff2`,+ 'ibm-plex-sans-500.woff2': `${IBM_PLEX_BASE}/packages/plex-sans/fonts/complete/woff2/IBMPlexSans-Medium.woff2`,+ 'ibm-plex-sans-600.woff2': `${IBM_PLEX_BASE}/packages/plex-sans/fonts/complete/woff2/IBMPlexSans-SemiBold.woff2`,+ 'ibm-plex-sans-700.woff2': `${IBM_PLEX_BASE}/packages/plex-sans/fonts/complete/woff2/IBMPlexSans-Bold.woff2`,+ 'ibm-plex-mono-400.woff2': `${FONTSOURCE_BASE}/@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-400-normal.woff2`,+ 'ibm-plex-mono-500.woff2': `${FONTSOURCE_BASE}/@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-500-normal.woff2`,+ 'ibm-plex-mono-600.woff2': `${FONTSOURCE_BASE}/@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-600-normal.woff2`,};async function main() {await mkdir(OUT, { recursive: true });let ok = 0;- for (const [name, path] of Object.entries(FONTS)) {+ for (const [name, url] of Object.entries(FONTS)) {const dest = join(OUT, name);try {- await access(dest);- console.log(`✓ ${name} (already present)`);- ok++;- continue;+ const existing = await readFile(dest);+ if (existing.subarray(0, 4).toString('ascii') === 'wOF2') {+ console.log(`✓ ${name} (already present)`);+ ok++;+ continue;+ }} catch { /* not present — download */ }- const url = `${BASE}/${path}`;try {const res = await fetch(url);if (!res.ok) throw new Error(`HTTP ${res.status}`);diff --git a/frontend/src/styles/base/_fonts.scss b/frontend/src/styles/base/_fonts.scssindex ed23869e..66fdf806 100644--- a/frontend/src/styles/base/_fonts.scss+++ b/frontend/src/styles/base/_fonts.scss@@ -7,8 +7,8 @@//// The files live in frontend/public/fonts/ — fetch them once with:// node frontend/scripts/fetch-fonts.mjs-// (they're OFL-licensed, vendored from the @fontsource mirror). Until they-// exist the stack falls back to system-ui, so the app never breaks.+// They are OFL-licensed; the applicable license is vendored beside the fonts.+// Until they exist the stack falls back to system-ui, so the app never breaks.//// IBM Plex publishes weights in steps of 100; the prototype's 450/550 requests// round to the nearest available face (400/500) automatically.