diff --git a/bun.lockb b/bun.lockb index 1d52390..907b478 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/index.ts b/index.ts index df9db0b..ff5ee76 100644 --- a/index.ts +++ b/index.ts @@ -1,12 +1,15 @@ -import SSSG from "sssg"; +import SSSG, { Plugin } from "sssg"; import Variables from "sssg/src/plugins/variables"; import Dev from "sssg/src/plugins/dev"; import TSCompiler from "sssg/src/plugins/ts-compiler"; -import MarkdownMetadata, {parseMetadata} from "sssg/src/plugins/markdown-metadata"; +import MarkdownMetadata, { + parseMetadata, +} from "sssg/src/plugins/markdown-metadata"; import MarkdownCompiler from "sssg/src/plugins/markdown-compiler"; import CompileTimeJS from "sssg/src/plugins/compile-time-js"; +import ImageOptimization from "sssg/src/plugins/image-optimization"; -import {$} from "bun" +import { $ } from "bun"; import * as path from "path"; import * as fs from "fs"; @@ -16,19 +19,27 @@ const sssg = new SSSG({ inputFolder: path.join(__dirname, "website"), }); -const gitLogShell = await $`git log --pretty=format:'commit=%H%nauthor=%aN <%aE>%ndate=%ad%nmessage=%s%n=========' -1`.quiet() +const gitLogShell = + await $`git log --pretty=format:'commit=%H%nauthor=%aN <%aE>%ndate=%ad%nmessage=%s%n=========' -1`.quiet(); const gitLogOutput = gitLogShell.text("utf8"); const gitLog = JSON.stringify(parseMetadata(gitLogOutput)); +const plugins: Plugin[] = []; + +if (process.argv.includes("--dev")) { + plugins.push(new Dev(sssg)); +} else { + plugins.push(new ImageOptimization()); +} await sssg.run({ - plugins: [ + plugins: plugins.concat([ new CompileTimeJS(), new Variables(() => { const variables: Record = { __BLOG_POSTS__: JSON.stringify( fs.readdirSync("./website/blogs").map((z) => z.replace(".md", "")) ), - __GIT_LOG_OUTPUT__: gitLog + __GIT_LOG_OUTPUT__: gitLog, }; if (fs.existsSync("./website/templates")) { @@ -44,8 +55,7 @@ await sssg.run({ new TSCompiler(), new MarkdownMetadata(), new MarkdownCompiler(), - new Dev(sssg), - ], + ]), }); await sssg.build(); diff --git a/package.json b/package.json index 1ae75ee..393e5c4 100644 --- a/package.json +++ b/package.json @@ -2,10 +2,10 @@ "name": "website2", "module": "index.ts", "devDependencies": { - "@types/bun": "latest" + "@types/bun": "^1.1.8" }, "peerDependencies": { - "typescript": "^5.0.0" + "typescript": "^5.5.3" }, "scripts": { "prod": "bun index.ts --prod", @@ -14,6 +14,6 @@ "type": "module", "dependencies": { "@zip.js/zip.js": "^2.7.52", - "sssg": "git+https://git.sad.ovh/sophie/sssg#47ac0b329c1617498fc8e795cbb3d7d36483ff67" + "sssg": "git+https://git.sad.ovh/sophie/sssg#7b04c35c946e0fc746eb23b7dbd8f5fe22757ce2" } } \ No newline at end of file diff --git a/website/assets/binkies/2rin.gif b/website/assets/binkies/2rin.gif index 67661db..6051e63 100644 Binary files a/website/assets/binkies/2rin.gif and b/website/assets/binkies/2rin.gif differ diff --git a/website/assets/tapir.jpg b/website/assets/tapir.jpg new file mode 100644 index 0000000..014c3cf Binary files /dev/null and b/website/assets/tapir.jpg differ diff --git a/website/scripts/binkies.ts b/website/scripts/binkies.ts index b06bfca..920b181 100644 --- a/website/scripts/binkies.ts +++ b/website/scripts/binkies.ts @@ -22,20 +22,18 @@ const binky = [ ["https://windigone.nekoweb.org", "windigone.gif"], ["https://eye.nekoweb.org", "eye.gif"], ["https://yumeo.nekoweb.org", "yumeo.gif"], - ["insane.gif", "piracy.gif", "dsb.gif", "universe.gif"] + ["insane.gif", "piracy.gif", "dsb.gif", "universe.gif"], ]; binky.forEach((z, i) => { - if(i == binky.length-1) { - z.forEach(g => { + if (i == binky.length - 1) { + z.forEach((g) => { const img = document.createElement("img"); - + img.src = `/assets/binkies/${g}`; - img.width = 88; - img.height = 31; img.alt = `!! binkie !!`; binkies.appendChild(img); - }) + }); return; } @@ -45,7 +43,7 @@ binky.forEach((z, i) => { a.className = "hasBadge"; const img = document.createElement("img"); - + img.src = `/assets/binkies/${z[1]}`; img.width = 88; img.height = 31; diff --git a/website/scripts/commit.ts b/website/scripts/commit.ts index 2846325..ffafd37 100644 --- a/website/scripts/commit.ts +++ b/website/scripts/commit.ts @@ -8,21 +8,20 @@ const commit = document.getElementById("commit"); const a = document.createElement("a"); a.href = `https://git.sad.ovh/sophie/website/commit/${git.commit}`; -const h2 = document.createElement("h2") +const h2 = document.createElement("h2"); h2.innerText = git.message; a.appendChild(h2); const p = document.createElement("p"); -p.innerText = `${timeAgo(date)} -- ${git.date}` +p.innerText = `${timeAgo(date)} -- ${git.date}`; const p2 = document.createElement("p"); -p2.innerText = `commit by ${git.author.replace(/[^ ]*@.*/, "")}` - -commit?.appendChild(a) -commit?.appendChild(p) -commit?.appendChild(p2) +p2.innerText = `commit by ${git.author.replace(/[^ ]*@.*/, "")}`; +commit?.appendChild(a); +commit?.appendChild(p); +commit?.appendChild(p2); //

More binkies + thinliquid's logo!! tysm :3

//

20 minutes ago -- 2024-08-29 22:00:36 GMT+3

diff --git a/website/scripts/lastfm.ts b/website/scripts/lastfm.ts index 3f592ee..3596656 100644 --- a/website/scripts/lastfm.ts +++ b/website/scripts/lastfm.ts @@ -47,54 +47,60 @@ const lastFM = { apiKey: "816cfe50ddeeb73c9987b85de5c19e71", constructUrl: (method: string, parameters: Record) => { const defaultParams = { - format: "json", - api_key: lastFM.apiKey, - method - } - + format: "json", + api_key: lastFM.apiKey, + method, + }; + Object.assign(parameters, defaultParams); - - return "https://ws.audioscrobbler.com/2.0/?" + new URLSearchParams(parameters).toString() + + return ( + "https://ws.audioscrobbler.com/2.0/?" + + new URLSearchParams(parameters).toString() + ); }, getRecentTracks: async (user: string): Promise => { - const request = await fetch(lastFM.constructUrl("User.getrecenttracks", {user, limit: 1})); + const request = await fetch( + lastFM.constructUrl("User.getrecenttracks", { user, limit: 1 }) + ); return await request.json(); }, }; (async () => { - const recentTracks = await lastFM.getRecentTracks("yourfriendoss"); - const track = recentTracks.recenttracks.track[0]; - if(!track) return; - const lastFMElement = document.getElementById("lastfm")! - lastFMElement.innerHTML = ""; - const img = document.createElement("img"); - img.width = 174 - img.height = 174 - img.alt = "last.fm album art" - let imageUrl = track.image.find(z => z.size == "large")?.["#text"]; - if(!imageUrl) imageUrl = track.image.at(-1)?.["#text"]!; - - img.src = imageUrl; - lastFMElement?.appendChild(img); + const recentTracks = await lastFM.getRecentTracks("yourfriendoss"); + const track = recentTracks.recenttracks.track[0]; + if (!track) return; + const lastFMElement = document.getElementById("lastfm")!; + lastFMElement.innerHTML = ""; + const img = document.createElement("img"); + img.width = 174; + img.height = 174; + img.alt = "last.fm album art"; + let imageUrl = track.image.find((z) => z.size == "large")?.["#text"]; + if (!imageUrl) imageUrl = track.image.at(-1)?.["#text"]!; - const div = document.createElement("div"); - const h1 = document.createElement("h1"); - const spanArtist = document.createElement("span"); - const spanTitle = document.createElement("span"); + img.src = imageUrl; + lastFMElement?.appendChild(img); - h1.innerText = track["@attr"]?.nowplaying ? "listening to Now" : "listened to " + timeAgo((+track.date?.uts!)*1000) - h1.style.margin = "0"; + const div = document.createElement("div"); + const h1 = document.createElement("h1"); + const spanArtist = document.createElement("span"); + const spanTitle = document.createElement("span"); - spanArtist.style.fontSize = "xx-large"; - spanTitle.style.fontSize = "x-large"; + h1.innerText = track["@attr"]?.nowplaying + ? "listening to Now" + : "listened to " + timeAgo(+track.date?.uts! * 1000); + h1.style.margin = "0"; - spanArtist.innerText = track.artist["#text"]; - spanTitle.innerText = track.name; - - div.appendChild(h1) - div.appendChild(spanArtist) - div.appendChild(spanTitle) - lastFMElement?.appendChild(div); + spanArtist.style.fontSize = "xx-large"; + spanTitle.style.fontSize = "x-large"; -})(); \ No newline at end of file + spanArtist.innerText = track.artist["#text"]; + spanTitle.innerText = track.name; + + div.appendChild(h1); + div.appendChild(spanArtist); + div.appendChild(spanTitle); + lastFMElement?.appendChild(div); +})(); diff --git a/website/scripts/particles.ts b/website/scripts/particles.ts index cd5e7de..cebbba7 100644 --- a/website/scripts/particles.ts +++ b/website/scripts/particles.ts @@ -94,17 +94,21 @@ document.documentElement.addEventListener("mousemove", (event) => { particles.push(particle); }); -document.documentElement.addEventListener("touchmove", function(e) { - for(let i = 0; i < e.touches.length; i++) { - if (Date.now() - lastMoveTimestamp < 50) { - return; - } - - lastMoveTimestamp = Date.now(); - const touch = e.touches.item(i); - if(!touch) return; +document.documentElement.addEventListener( + "touchmove", + function (e) { + for (let i = 0; i < e.touches.length; i++) { + if (Date.now() - lastMoveTimestamp < 50) { + return; + } - const particle = new Particle(touch.pageX, touch.pageY); - particles.push(particle); - } -}, false); + lastMoveTimestamp = Date.now(); + const touch = e.touches.item(i); + if (!touch) return; + + const particle = new Particle(touch.pageX, touch.pageY); + particles.push(particle); + } + }, + false +);