diff --git a/assets/css/fonts/merriweather.css b/assets/css/fonts/merriweather.css new file mode 100644 index 0000000..25ced3d --- /dev/null +++ b/assets/css/fonts/merriweather.css @@ -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; +} diff --git a/assets/css/layout.css b/assets/css/layout.css new file mode 100644 index 0000000..a9afe8b --- /dev/null +++ b/assets/css/layout.css @@ -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; +} diff --git a/assets/css/themes/default-light.css b/assets/css/themes/default-light.css new file mode 100644 index 0000000..687c02c --- /dev/null +++ b/assets/css/themes/default-light.css @@ -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; +} diff --git a/assets/fonts/Merriweather-Bold.woff b/assets/fonts/Merriweather-Bold.woff new file mode 100644 index 0000000..7a6271b Binary files /dev/null and b/assets/fonts/Merriweather-Bold.woff differ diff --git a/assets/fonts/Merriweather-Bold.woff2 b/assets/fonts/Merriweather-Bold.woff2 new file mode 100644 index 0000000..0cf9358 Binary files /dev/null and b/assets/fonts/Merriweather-Bold.woff2 differ diff --git a/assets/fonts/Merriweather-BoldItalic.woff b/assets/fonts/Merriweather-BoldItalic.woff new file mode 100644 index 0000000..264d947 Binary files /dev/null and b/assets/fonts/Merriweather-BoldItalic.woff differ diff --git a/assets/fonts/Merriweather-BoldItalic.woff2 b/assets/fonts/Merriweather-BoldItalic.woff2 new file mode 100644 index 0000000..f776ee2 Binary files /dev/null and b/assets/fonts/Merriweather-BoldItalic.woff2 differ diff --git a/assets/fonts/Merriweather-Italic.woff b/assets/fonts/Merriweather-Italic.woff new file mode 100644 index 0000000..cc4ec60 Binary files /dev/null and b/assets/fonts/Merriweather-Italic.woff differ diff --git a/assets/fonts/Merriweather-Italic.woff2 b/assets/fonts/Merriweather-Italic.woff2 new file mode 100644 index 0000000..b105004 Binary files /dev/null and b/assets/fonts/Merriweather-Italic.woff2 differ diff --git a/assets/fonts/Merriweather-Regular.woff b/assets/fonts/Merriweather-Regular.woff new file mode 100644 index 0000000..213ce67 Binary files /dev/null and b/assets/fonts/Merriweather-Regular.woff differ diff --git a/assets/fonts/Merriweather-Regular.woff2 b/assets/fonts/Merriweather-Regular.woff2 new file mode 100644 index 0000000..c7f8a60 Binary files /dev/null and b/assets/fonts/Merriweather-Regular.woff2 differ diff --git a/config.ts b/config.ts index 6046e06..f9985e9 100644 --- a/config.ts +++ b/config.ts @@ -11,7 +11,7 @@ const config = { bindDN: Deno.env.get("LDAP_BIND_DN"), password: Deno.env.get("LDAP_PASSWORD"), searchDN: Deno.env.get("LDAP_SEARCH_DN"), - } + }, }; export default config; diff --git a/html.ts b/html.ts index 048f70f..a825e44 100644 --- a/html.ts +++ b/html.ts @@ -12,121 +12,8 @@ export function htmlLayout(title: string, body: string, profile: Profile) { ${title} - - - - + + ${body} diff --git a/server.ts b/server.ts index f133bae..69f7a05 100644 --- a/server.ts +++ b/server.ts @@ -1,5 +1,5 @@ -import { Application, Router } from "@oak/oak"; -import { log } from "./log.ts"; +import { Application, Router, send } from "@oak/oak"; +import config from "./config.ts"; import naddrHandler from "./handlers/naddr.ts"; import nprofileHandler from "./handlers/nprofile.ts"; import npubHandler from "./handlers/npub.ts"; @@ -46,7 +46,19 @@ router.get("/:user/:identifier", async (ctx: ctx) => { ctx.response.status = 404; 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();