All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m48s
Implement a rich file preview interface to allow users to view file contents directly in the browser. Changes include: - Exposing raw file size (`SizeBytes`) in the download handler's file view. - Adding comprehensive CSS styling for the preview layout and cards. - Integrating Prism.js for syntax highlighting of code files. - Updating Content Security Policy (CSP) headers to permit inline styles and frame sources required by the preview components. - Adding unit tests to ensure preview metadata attributes are correctly rendered on the download page.
300 lines
6.3 KiB
CSS
300 lines
6.3 KiB
CSS
:root {
|
|
color-scheme: dark;
|
|
--md-bg: #0b0b16;
|
|
--md-fg: #f5f3ff;
|
|
--md-muted: #aaa4d6;
|
|
--md-panel: #17142d;
|
|
--md-panel-2: #211b3e;
|
|
--md-border: rgba(168, 150, 255, 0.24);
|
|
--md-link: #67e8f9;
|
|
--md-accent: #a78bfa;
|
|
--md-code-bg: #1b1724;
|
|
--md-block-code-bg: #0f111a;
|
|
--md-block-code-fg: #f8fafc;
|
|
--md-block-code-border: rgba(248, 250, 252, 0.16);
|
|
--md-shadow: rgba(0, 0, 0, 0.28);
|
|
--md-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
--md-mono: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
|
|
}
|
|
|
|
:root[data-theme="classic"] {
|
|
--md-bg: #09090b;
|
|
--md-fg: #fafafa;
|
|
--md-muted: #a1a1aa;
|
|
--md-panel: #18181b;
|
|
--md-panel-2: #27272a;
|
|
--md-border: rgba(255, 255, 255, 0.13);
|
|
--md-link: #e4e4e7;
|
|
--md-accent: #d4d4d8;
|
|
--md-code-bg: #111113;
|
|
--md-block-code-bg: #09090b;
|
|
--md-block-code-fg: #fafafa;
|
|
--md-block-code-border: rgba(250, 250, 250, 0.15);
|
|
--md-shadow: rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
:root[data-theme="retro"] {
|
|
color-scheme: light;
|
|
--md-bg: #c0c0c0;
|
|
--md-fg: #000000;
|
|
--md-muted: #404040;
|
|
--md-panel: #ffffff;
|
|
--md-panel-2: #dfdfdf;
|
|
--md-border: #000000;
|
|
--md-link: #000078;
|
|
--md-accent: #000078;
|
|
--md-code-bg: #ffffff;
|
|
--md-block-code-bg: #000000;
|
|
--md-block-code-fg: #f5f5f5;
|
|
--md-block-code-border: #808080;
|
|
--md-shadow: transparent;
|
|
--md-font: "PixeloidSans", "PixelOperator", "Microsoft Sans Serif", Tahoma, sans-serif;
|
|
--md-mono: "PixelOperatorMono", Consolas, monospace;
|
|
}
|
|
|
|
:root[data-theme="gruvbox"] {
|
|
--md-bg: #1d2021;
|
|
--md-fg: #ebdbb2;
|
|
--md-muted: #bdae93;
|
|
--md-panel: #282828;
|
|
--md-panel-2: #32302f;
|
|
--md-border: rgba(235, 219, 178, 0.2);
|
|
--md-link: #fabd2f;
|
|
--md-accent: #d79921;
|
|
--md-code-bg: #1b1d1e;
|
|
--md-block-code-bg: #161819;
|
|
--md-block-code-fg: #fbf1c7;
|
|
--md-block-code-border: rgba(251, 241, 199, 0.18);
|
|
--md-shadow: rgba(0, 0, 0, 0.26);
|
|
}
|
|
|
|
:root[data-theme="cyberpunk"] {
|
|
--md-bg: #08070d;
|
|
--md-fg: #fff36f;
|
|
--md-muted: #9bfaff;
|
|
--md-panel: #16131f;
|
|
--md-panel-2: #251d34;
|
|
--md-border: rgba(255, 242, 0, 0.34);
|
|
--md-link: #00f0ff;
|
|
--md-accent: #ff2a6d;
|
|
--md-code-bg: #100d18;
|
|
--md-block-code-bg: #07060b;
|
|
--md-block-code-fg: #f8fafc;
|
|
--md-block-code-border: rgba(0, 240, 255, 0.26);
|
|
--md-shadow: rgba(255, 42, 109, 0.14);
|
|
}
|
|
|
|
@font-face {
|
|
font-family: "PixeloidSans";
|
|
src: url("/static/fonts/pixeloid_sans/PixeloidSans.ttf") format("truetype");
|
|
font-weight: normal;
|
|
font-display: swap;
|
|
}
|
|
|
|
@font-face {
|
|
font-family: "PixeloidSans";
|
|
src: url("/static/fonts/pixeloid_sans/PixeloidSans-Bold.ttf") format("truetype");
|
|
font-weight: bold;
|
|
font-display: swap;
|
|
}
|
|
|
|
@font-face {
|
|
font-family: "PixelOperatorMono";
|
|
src: url("/static/fonts/pixel_operator/PixelOperatorMono.ttf") format("truetype");
|
|
font-weight: normal;
|
|
font-display: swap;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
html {
|
|
min-height: 100%;
|
|
background:
|
|
radial-gradient(circle at 18% -10%, color-mix(in srgb, var(--md-accent) 18%, transparent), transparent 24rem),
|
|
var(--md-bg);
|
|
color: var(--md-fg);
|
|
font-family: var(--md-font);
|
|
}
|
|
|
|
html[data-theme="retro"] {
|
|
background-color: #000000;
|
|
background-image: url("/static/backgrounds/stars1.gif");
|
|
background-repeat: repeat;
|
|
image-rendering: pixelated;
|
|
}
|
|
|
|
html[data-theme="cyberpunk"] {
|
|
background:
|
|
linear-gradient(rgba(255, 242, 0, 0.035) 1px, transparent 1px),
|
|
linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px),
|
|
var(--md-bg);
|
|
background-size: 100% 3px, 3rem 100%, auto;
|
|
}
|
|
|
|
body {
|
|
min-height: 100vh;
|
|
margin: 0;
|
|
padding: clamp(1rem, 4vw, 2.25rem);
|
|
font-size: 16px;
|
|
line-height: 1.65;
|
|
}
|
|
|
|
main {
|
|
max-width: 54rem;
|
|
margin: 0 auto;
|
|
padding: clamp(1rem, 3vw, 2rem);
|
|
border: 1px solid var(--md-border);
|
|
border-radius: 10px;
|
|
background: color-mix(in srgb, var(--md-panel) 90%, transparent);
|
|
box-shadow: 0 20px 60px var(--md-shadow);
|
|
}
|
|
|
|
html[data-theme="retro"] main {
|
|
border-radius: 0;
|
|
background: var(--md-panel);
|
|
box-shadow:
|
|
inset -1px -1px 0 #404040,
|
|
inset 1px 1px 0 #ffffff,
|
|
inset -2px -2px 0 #808080,
|
|
inset 2px 2px 0 #dfdfdf;
|
|
}
|
|
|
|
html[data-theme="cyberpunk"] main {
|
|
border-radius: 0;
|
|
box-shadow: 4px 4px 0 rgba(255, 42, 109, 0.5), 0 0 24px rgba(0, 240, 255, 0.12);
|
|
clip-path: polygon(0 0, calc(100% - 0.9rem) 0, 100% 0.9rem, 100% 100%, 0.9rem 100%, 0 calc(100% - 0.9rem));
|
|
}
|
|
|
|
h1,
|
|
h2,
|
|
h3,
|
|
h4,
|
|
h5,
|
|
h6 {
|
|
margin: 1.4em 0 0.55em;
|
|
color: var(--md-fg);
|
|
line-height: 1.2;
|
|
}
|
|
|
|
h1:first-child,
|
|
h2:first-child,
|
|
h3:first-child {
|
|
margin-top: 0;
|
|
}
|
|
|
|
h1 {
|
|
font-size: clamp(1.75rem, 5vw, 2.45rem);
|
|
}
|
|
|
|
h2 {
|
|
padding-bottom: 0.35rem;
|
|
border-bottom: 1px solid var(--md-border);
|
|
font-size: 1.45rem;
|
|
}
|
|
|
|
p,
|
|
ul,
|
|
ol,
|
|
blockquote,
|
|
pre,
|
|
table {
|
|
margin: 0 0 1rem;
|
|
}
|
|
|
|
a {
|
|
color: var(--md-link);
|
|
text-underline-offset: 0.18em;
|
|
}
|
|
|
|
a:hover {
|
|
color: var(--md-accent);
|
|
}
|
|
|
|
img,
|
|
video {
|
|
max-width: 100%;
|
|
height: auto;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
html[data-theme="retro"] img,
|
|
html[data-theme="retro"] video {
|
|
border-radius: 0;
|
|
image-rendering: pixelated;
|
|
}
|
|
|
|
hr {
|
|
height: 1px;
|
|
border: 0;
|
|
background: var(--md-border);
|
|
}
|
|
|
|
blockquote {
|
|
margin-left: 0;
|
|
padding: 0.75rem 1rem;
|
|
border-left: 4px solid var(--md-accent);
|
|
background: color-mix(in srgb, var(--md-panel-2) 58%, transparent);
|
|
color: var(--md-muted);
|
|
}
|
|
|
|
pre {
|
|
overflow: auto;
|
|
padding: 1rem;
|
|
border: 1px solid var(--md-block-code-border) !important;
|
|
border-radius: 8px;
|
|
background: var(--md-block-code-bg) !important;
|
|
color: var(--md-block-code-fg) !important;
|
|
}
|
|
|
|
code {
|
|
font-family: var(--md-mono);
|
|
}
|
|
|
|
pre code,
|
|
pre > code,
|
|
pre code[class*="language-"] {
|
|
padding: 0 !important;
|
|
border: 0 !important;
|
|
background: transparent !important;
|
|
color: inherit !important;
|
|
}
|
|
|
|
:not(pre) > code {
|
|
padding: 0.12rem 0.28rem;
|
|
border: 1px solid var(--md-border);
|
|
border-radius: 0.25rem;
|
|
background: color-mix(in srgb, var(--md-code-bg) 82%, transparent);
|
|
}
|
|
|
|
html[data-theme="retro"] pre,
|
|
html[data-theme="retro"] :not(pre) > code {
|
|
border-radius: 0;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
th,
|
|
td {
|
|
padding: 0.5rem 0.65rem;
|
|
border: 1px solid var(--md-border);
|
|
}
|
|
|
|
th {
|
|
background: color-mix(in srgb, var(--md-panel-2) 70%, transparent);
|
|
color: var(--md-fg);
|
|
}
|
|
|
|
tr:nth-child(even) td {
|
|
background: color-mix(in srgb, var(--md-panel-2) 28%, transparent);
|
|
}
|
|
|
|
::selection {
|
|
background: var(--md-accent);
|
|
color: var(--md-bg);
|
|
}
|