Move CSS and fonts to separate static asset dir
This commit is contained in:
parent
48fcb7eac5
commit
74f7b89c15
35
assets/css/fonts/merriweather.css
Normal file
35
assets/css/fonts/merriweather.css
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: "Merriweather";
|
||||||
|
src:
|
||||||
|
url("/assets/fonts/Merriweather-Regular.woff2") format("woff2"),
|
||||||
|
url("/assets/fonts/Merriweather-Regular.woff") format("woff");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Merriweather";
|
||||||
|
src:
|
||||||
|
url("/assets/fonts/Merriweather-Italic.woff2") format("woff2"),
|
||||||
|
url("/assets/fonts/Merriweather-Italic.woff") format("woff");
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Merriweather";
|
||||||
|
src:
|
||||||
|
url("/assets/fonts/Merriweather-Bold.woff2") format("woff2"),
|
||||||
|
url("/assets/fonts/Merriweather-Bold.woff") format("woff");
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: "Merriweather";
|
||||||
|
src:
|
||||||
|
url("/assets/fonts/Merriweather-BoldItalic.woff2") format("woff2"),
|
||||||
|
url("/assets/fonts/Merriweather-BoldItalic.woff") format("woff");
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
89
assets/css/layout.css
Normal file
89
assets/css/layout.css
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@import url("/assets/css/fonts/merriweather.css");
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-size: 18px;
|
||||||
|
font-family: "Merriweather", serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
img.avatar {
|
||||||
|
height: 48px;
|
||||||
|
width: 48px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.profile-page img.avatar {
|
||||||
|
height: 128px;
|
||||||
|
width: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 2em 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2, h3, h4 {
|
||||||
|
margin-top: 2em;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
line-height: 1.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p, pre, ul, ol, blockquote {
|
||||||
|
line-height: 1.6em;
|
||||||
|
margin-bottom: 1.6em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.anchor {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
font-size: 1rem;
|
||||||
|
padding: 0.1em 0.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
display: block;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
display: block;
|
||||||
|
max-width: 728px;
|
||||||
|
margin: 12rem auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
main header {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
main header h1 {
|
||||||
|
margin-bottom: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meta {
|
||||||
|
display: flex;
|
||||||
|
column-gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meta .content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meta .name a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-list .item {
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-list .item h3 {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
34
assets/css/themes/default-light.css
Normal file
34
assets/css/themes/default-light.css
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
body {
|
||||||
|
background-color: #f5f2eb;
|
||||||
|
color: #3b3a38;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4 {
|
||||||
|
color: #191818;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #023b77;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited {
|
||||||
|
color: #3b0277;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
background-color: #e8e3da;
|
||||||
|
color: #027739;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
background-color: #333;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meta .date {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.meta .name a {
|
||||||
|
color: #3b3a38;
|
||||||
|
}
|
BIN
assets/fonts/Merriweather-Bold.woff
Normal file
BIN
assets/fonts/Merriweather-Bold.woff
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-Bold.woff2
Normal file
BIN
assets/fonts/Merriweather-Bold.woff2
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-BoldItalic.woff
Normal file
BIN
assets/fonts/Merriweather-BoldItalic.woff
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-BoldItalic.woff2
Normal file
BIN
assets/fonts/Merriweather-BoldItalic.woff2
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-Italic.woff
Normal file
BIN
assets/fonts/Merriweather-Italic.woff
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-Italic.woff2
Normal file
BIN
assets/fonts/Merriweather-Italic.woff2
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-Regular.woff
Normal file
BIN
assets/fonts/Merriweather-Regular.woff
Normal file
Binary file not shown.
BIN
assets/fonts/Merriweather-Regular.woff2
Normal file
BIN
assets/fonts/Merriweather-Regular.woff2
Normal file
Binary file not shown.
@ -11,7 +11,7 @@ const config = {
|
|||||||
bindDN: Deno.env.get("LDAP_BIND_DN"),
|
bindDN: Deno.env.get("LDAP_BIND_DN"),
|
||||||
password: Deno.env.get("LDAP_PASSWORD"),
|
password: Deno.env.get("LDAP_PASSWORD"),
|
||||||
searchDN: Deno.env.get("LDAP_SEARCH_DN"),
|
searchDN: Deno.env.get("LDAP_SEARCH_DN"),
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default config;
|
export default config;
|
||||||
|
117
html.ts
117
html.ts
@ -12,121 +12,8 @@ export function htmlLayout(title: string, body: string, profile: Profile) {
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
<title>${title}</title>
|
<title>${title}</title>
|
||||||
<link rel="alternate" type="application/atom+xml" href="/@${profile.username}/articles.atom" title="Articles by ${profile.name}" />
|
<link rel="alternate" type="application/atom+xml" href="/@${profile.username}/articles.atom" title="Articles by ${profile.name}" />
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="stylesheet" type="text/css" href="/assets/css/layout.css" />
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="stylesheet" type="text/css" href="/assets/css/themes/default-light.css" />
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,400;0,700;0,900;1,400;1,700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background-color: #f5f2eb;
|
|
||||||
color: #3b3a38;
|
|
||||||
font-size: 18px;
|
|
||||||
font-family: "Merriweather", serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
img {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.avatar {
|
|
||||||
height: 48px;
|
|
||||||
width: 48px;
|
|
||||||
border-radius: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profile-page img.avatar {
|
|
||||||
height: 128px;
|
|
||||||
width: 128px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.anchor {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin: 2em 0 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2, h3, h4 {
|
|
||||||
margin-top: 2em;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
line-height: 1.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3, h4 {
|
|
||||||
color: #191818;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, pre, ul, ol, blockquote {
|
|
||||||
line-height: 1.6em;
|
|
||||||
margin-bottom: 1.6em;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #023b77
|
|
||||||
}
|
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #3b0277
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-size: 1rem;
|
|
||||||
background-color: #e8e3da;
|
|
||||||
color: #027739;
|
|
||||||
padding: 0.1em 0.3em;
|
|
||||||
}
|
|
||||||
|
|
||||||
pre code {
|
|
||||||
display: block;
|
|
||||||
padding: 0.6rem 1rem;
|
|
||||||
background-color: #333;
|
|
||||||
color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
display: block;
|
|
||||||
max-width: 728px;
|
|
||||||
margin: 12rem auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
main header {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
main header h1 {
|
|
||||||
margin-bottom: 1.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.meta {
|
|
||||||
display: flex;
|
|
||||||
column-gap: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.meta .content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
line-height: 1.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.meta .date {
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
|
|
||||||
p.meta .name a {
|
|
||||||
color: #3b3a38;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-list .item {
|
|
||||||
margin-bottom: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-list .item h3 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
${body}
|
${body}
|
||||||
|
16
server.ts
16
server.ts
@ -1,5 +1,5 @@
|
|||||||
import { Application, Router } from "@oak/oak";
|
import { Application, Router, send } from "@oak/oak";
|
||||||
import { log } from "./log.ts";
|
import config from "./config.ts";
|
||||||
import naddrHandler from "./handlers/naddr.ts";
|
import naddrHandler from "./handlers/naddr.ts";
|
||||||
import nprofileHandler from "./handlers/nprofile.ts";
|
import nprofileHandler from "./handlers/nprofile.ts";
|
||||||
import npubHandler from "./handlers/npub.ts";
|
import npubHandler from "./handlers/npub.ts";
|
||||||
@ -46,7 +46,19 @@ router.get("/:user/:identifier", async (ctx: ctx) => {
|
|||||||
ctx.response.status = 404;
|
ctx.response.status = 404;
|
||||||
ctx.response.body = "Not Found";
|
ctx.response.body = "Not Found";
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
router.get("/assets/:path*", async (ctx) => {
|
||||||
|
try {
|
||||||
|
const filePath = ctx.params.path;
|
||||||
|
|
||||||
|
await send(ctx, filePath, {
|
||||||
|
root: `${Deno.cwd()}/assets`,
|
||||||
|
});
|
||||||
|
} catch (_e) {
|
||||||
|
ctx.response.status = 404;
|
||||||
|
ctx.response.body = "Not Found";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = new Application();
|
const app = new Application();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user