atproto pastebin service: https://plonk.li

better fonts, several bug fixes

+1 -1
flake.nix
··· 81 81 description = "Port to run plonk on"; 82 82 }; 83 83 cookie_secret = mkOption { 84 - type = types.string; 84 + type = types.str; 85 85 default = "00000000000000000000000000000000"; 86 86 description = "Cookie secret"; 87 87 };
+2 -1
package.json
··· 50 50 "!src/**/*.test.*" 51 51 ], 52 52 "loader": { 53 - ".pug": "copy" 53 + ".pug": "copy", 54 + ".woff2": "copy" 54 55 }, 55 56 "splitting": false, 56 57 "sourcemap": true,
src/assets/NerdIosevka-Regular.woff2

This is a binary file and will not be displayed.

+1 -1
src/auth/client.ts
··· 5 5 6 6 export const createClient = async (db: Database) => { 7 7 const publicUrl = env.PLONK_PUBLIC_URL; 8 - const url = publicUrl || `http://${env.PLONK_HOST}:${env.PLONK_PORT}`; 8 + const url = publicUrl || `http://127.0.0.1:${env.PLONK_PORT}`; 9 9 const enc = encodeURIComponent; 10 10 return new NodeOAuthClient({ 11 11 clientMetadata: {
+1 -1
src/mixins/head.pug
··· 2 2 head 3 3 meta(name="viewport" content="width=device-width, initial-scale=1.0") 4 4 meta(charset='UTF-8') 5 - title #{title} 5 + title #{title} · plonk.li 6 6 link(rel="stylesheet", href="/styles.css") 7 7 link(rel="preconnect" href="https://rsms.me/") 8 8 link(rel="stylesheet" href="https://rsms.me/inter/inter.css")
-2
src/mixins/header.pug
··· 1 1 mixin header(ownDid, didHandleMap) 2 2 div.header 3 3 div.left-side 4 - if ownDid 5 - | logged in as @#{didHandleMap[ownDid]} 6 4 div.right-side 7 5 p 8 6 a(href="/") home
+13 -2
src/public/styles.css
··· 1 - @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap'); 1 + @font-face { 2 + font-family: 'NerdIosevka'; 3 + src: url('../assets/NerdIosevka-Regular.woff2') format('woff2'); 4 + font-weight: normal; 5 + font-style: monospace; 6 + } 2 7 3 8 :root { 4 9 /* Light mode colors */ ··· 28 33 } 29 34 30 35 * { 31 - font-family: 'IBM Plex Mono', monospace; 36 + font-family: 'NerdIosevka', monospace; 37 + font-size: 0.9rem; 32 38 } 33 39 34 40 body { ··· 55 61 background-color: var(--bg-color-muted); 56 62 padding: 1rem; 57 63 overflow-x: auto; 64 + } 65 + 66 + .comment-body { 67 + background-color: var(--bg-color); 68 + padding: 0; 58 69 } 59 70 60 71 input, textarea, select, button {
+11 -8
src/routes.ts
··· 49 49 export const createRouter = (ctx: Ctx) => { 50 50 const router = express.Router(); 51 51 52 + router.use("/assets", express.static(path.join(__dirname, "assets"))); 52 53 // OAuth metadata 53 54 router.get("/client-metadata.json", async (_req, res) => { 54 55 return res.json(ctx.oauthClient.clientMetadata); ··· 193 194 authorDid: pasteAuthorDid, 194 195 }; 195 196 196 - const comments = ret.map((row) => { 197 - return { 198 - uri: row.commentUri, 199 - authorDid: row.commentAuthorDid, 200 - body: row.commentBody, 201 - createdAt: row.commentCreatedAt, 202 - }; 203 - }); 197 + const comments = ret 198 + .filter((row) => row.commentUri) 199 + .map((row) => { 200 + return { 201 + uri: row.commentUri, 202 + authorDid: row.commentAuthorDid, 203 + body: row.commentBody, 204 + createdAt: row.commentCreatedAt, 205 + }; 206 + }); 204 207 205 208 const ownAgent = await getSessionAgent(req, res, ctx); 206 209 if (!ownAgent) {
+3 -8
src/views/login.pug
··· 1 + include ../mixins/head 2 + 1 3 doctype html 2 4 html 3 - head 4 - meta(name="viewport" content="width=device-width, initial-scale=1.0") 5 - meta(charset='UTF-8') 6 - title login 7 - link(rel="stylesheet", href="/styles.css") 8 - link(rel="preconnect" href="https://rsms.me/") 9 - link(rel="stylesheet" href="https://rsms.me/inter/inter.css") 10 - script(src="https://cdn.dashjs.org/latest/dash.all.min.js") 5 + +head("login") 11 6 body 12 7 main#content 13 8 h1 login
+15 -11
src/views/paste.pug
··· 4 4 include ../mixins/utils 5 5 doctype html 6 6 html 7 - +head(paste.title) 7 + +head(`${paste.title} · ${didHandleMap[paste.authorDid]}`) 8 8 body 9 9 main#content 10 10 +header(ownDid, didHandleMap) 11 11 h1 #{paste.title} 12 12 p 13 - | by @#{didHandleMap[paste.authorDid]} · 13 + | @#{didHandleMap[paste.authorDid]} · 14 14 | #{timeDifference(now, Date.parse(paste.createdAt))} ago · 15 15 | #{paste.lang} · 16 16 | #{paste.code.split('\n').length} loc · ··· 19 19 | #{paste.code} 20 20 hr 21 21 22 - div.comments 23 - each comment in comments 24 - div.comment(id=`${encodeURIComponent(comment.uri)}`) 25 - p 26 - | by @#{didHandleMap[comment.authorDid]} · 27 - | #{timeDifference(now, Date.parse(paste.createdAt))} ago 28 - p 29 - | #{comment.body} 30 - hr 22 + if comments.length != 0 23 + h1 comments 24 + div.comments 25 + each comment in comments 26 + div.comment(id=`${encodeURIComponent(comment.uri)}`) 27 + p 28 + a(href=`/u/${comment.authorDid}`) 29 + | @#{didHandleMap[comment.authorDid]} 30 + |  · 31 + | #{timeDifference(now, Date.parse(paste.createdAt))} ago 32 + p 33 + pre.comment-body #{comment.body} 34 + hr 31 35 32 36 form(action=`/${encodeURIComponent(paste.uri)}/comment` method="post").post-form 33 37 div.post-row