commit 8bda86b24ad9939eb87b032b9df581b38a86c3cc Author: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Mon Jan 2 23:19:14 2023 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/Manrope[wght].woff2 b/Manrope[wght].woff2 new file mode 100644 index 0000000..4d677aa Binary files /dev/null and b/Manrope[wght].woff2 differ diff --git a/build.js b/build.js new file mode 100644 index 0000000..c013965 --- /dev/null +++ b/build.js @@ -0,0 +1,67 @@ +const fs = require("node:fs/promises"); + +let meta; + +const chooseFortune = () => { + const authors = Object.keys(meta.fortune); + const chosenAuthor = authors[Math.floor(Math.random()*authors.length)]; + const fortunes = meta.fortune[chosenAuthor]; + const chosenFortune = fortunes[Math.floor(Math.random()*fortunes.length)]; + return { + text: chosenFortune, + name: chosenAuthor + }; +}; + +const getPosts = async () => { + const posts = []; + for (let i = 0; i < meta.targets.length; i++) { + const t = meta.targets[i]; + const data = JSON.parse(await fs.readFile(`./~${t}/manifest.rolsf.json`)); + if (!data.document || data.document !== "xyz.rolsf.manifest.own.1") { + throw new Error(`unsupported own manifest for target: '${t}'`); + } + data.posts.forEach(post => { + post.user = t; + posts.push(post); + }); + } + posts.sort((a, b) => b.unix_time - a.unix_time); + return posts; +}; + +const Post = ({ href="#", user, date, title }) => + ` + ${user} + ${date} + ${title} + `; + +const Fortune = ({text, name}) => + `
“${text}” -- ${name}
`; + +const MainPage = async () => + ` + + + + + ${meta.brand} + + + +
+ ${meta.brand} + ${Fortune(chooseFortune())} + ${(await getPosts()).map(Post).join("")} +
+ + `; + + +const main = async () => { + meta = JSON.parse((await fs.readFile("./meta.json"))); + await fs.writeFile("./main.html", await MainPage()); +}; + +main(); diff --git a/meta.json b/meta.json new file mode 100644 index 0000000..35a3b89 --- /dev/null +++ b/meta.json @@ -0,0 +1,35 @@ +{ + "document": "xyz.rolsf.manifest.meta.1", + "brand": "rolsf", + "targets": [], + "fortune": { + "hippoz": [ + "and i somehow lost my pants, which caused me to be naked and run home, which may or may not have been caused by pulseaudio", + "🩲ronliv", + "forgot to mention i literally woke up laughing and continued laughing long after waking up", + "YOUR COMPUTER. IT NEVER TURNS OFF.", + "we can tie this into the idea of biocentrism", + "it spends 500ms in busy javascript computing some lovecraftian DOM tree", + "react literally has preemptive multitasking built in", + "yes!!! i need lib-xdg-gtk-gnome-flatpak-portal-systemd!!!! you dont understand!!!", + "have i been brainwashed by big terminal or something", + "im still debating whether or not it's a troll" + ], + "alan": [ + "What you view as insane is my sanity." + ], + "rot": [ + "make a song using samples from linux sound themes", + "the joke is so overdone you might as well just not post it" + ], + "tuna": [ + "this code is fucked up bruh" + ], + "kemal": [ + "6ac minecraft.jar", + "if someone gets the joke here, congrats", + "the joke literally went over from your head", + "sadly it's a troll" + ] + } +} \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..ff88441 --- /dev/null +++ b/style.css @@ -0,0 +1,139 @@ +@font-face { + font-family: "Manrope"; + src: url("Manrope[wght].woff2") format('woff2'); + font-weight: 125 950; + font-stretch: 75% 125%; + font-style: normal; +} + +:root { + --bg-1: #dad4c9; + --bg: #eeeeee; + --fg-1: hsl(154, 0%, 40%); + --fg: #1c2420; + + --space-unit: 1rem; + --space-xxs: calc(0.25 * var(--space-unit)); + --space-xs: calc(0.5 * var(--space-unit)); + --space-sm: calc(0.75 * var(--space-unit)); + --space-md: calc(1.25 * var(--space-unit)); + --space-lg: calc(2 * var(--space-unit)); + --space-xl: calc(3.25 * var(--space-unit)); + --space-xxl: calc(5.25 * var(--space-unit)); + + --h1: 3.052rem; + --h2: 2.441rem; + --h3: 1.953rem; + --h4: 1.563rem; + --h5: 1.25rem; + --small: 0.8rem; +} + +body, html { + margin: 0; + padding: 0; + font-size: 100%; + background-color: var(--bg); + color: var(--fg); + font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; +} + +main { + margin: 30px auto; + width: clamp(200px, 100%, 800px); +} + +/* text */ + +.h1 { font-size: var(--h1); } +.h2 { font-size: var(--h2); } +.h3 { font-size: var(--h3); } +.h4 { font-size: var(--h4); } +.h5 { font-size: var(--h5); } +.small { font-size: var(--small); } + +/* card */ + +.card-accent { + padding: var(--space-md); + margin: var(--space-md); + margin-top: 0; + background-color: var(--bg-1); + border-radius: var(--space-md); +} + +/* post */ + +.post-link { + display: block; + text-decoration: none; + color: currentColor; + margin-bottom: var(--space-lg); +} + +.post-link .user { + font-weight: 500; +} + +.post-link .date { + font-weight: normal; + color: var(--fg-1); +} + +.post-link .title { + display: block; + font-size: var(--h4); + line-height: 0.9; +} + +.post-link .title::after { + display: inline; + content: " ->"; + color: var(--fg-1); +} + +/* fortune */ + +@keyframes fortune-drop { + from { + opacity: 0; + visibility: hidden; + transform: translateY(-12px); + } + to { + opacity: 1; + visibility: visible; + transform: translateY(0); + } +} + +.fortune { + animation: fortune-drop 0.3s cubic-bezier(0.46,0.03,0.52,0.96) forwards; + display: block; + margin-bottom: var(--space-lg); + font-size: var(--h5); +} + +#fortune-name { + color: var(--fg-1); +} + +/* all */ + +* { + box-sizing: border-box; +} + +p {margin-bottom: 1rem;} + +h1, h2, h3, h4, h5 { + margin: var(--space-sm) 0 var(--space-xs); + font-family: 'Poppins', sans-serif; + font-weight: 400; + line-height: 1.3; +} + +h1 { + margin-top: 0; + font-size: var(--h1); +}