A userscript-based client mod for Bluesky
0

Configure Feed

Select the types of activity you want to include in your feed.

metadata

+18 -6
+9
scripts/build.ts
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 */ 6 6 7 + import { execSync } from "child_process"; 7 8 import { build, type BuildOptions, context } from "esbuild"; 8 9 10 + const version = execSync("git describe --always", { encoding: "utf8" }) 11 + .replace(/^v/, "") 12 + .replace(/-(\d+)-g/, "-git.$1+") 13 + .trim(); 9 14 const watch = process.argv.includes("--watch") || process.argv.includes("-w"); 10 15 11 16 function userscriptBanner(meta: Record<string, string | string[]>) { ··· 29 34 30 35 const banner = userscriptBanner({ 31 36 name: "UserSky", 37 + version, 38 + description: "A client modification for Bluesky", 39 + author: "rini (@rini.tngl.sh)", 40 + namespace: "https://usersky.wisp.place", 32 41 match: [ 33 42 "https://bsky.app/*", 34 43 // "https://deer.social/*", FIXME older build with less module splitting. sad for snitching modules
+9 -6
scripts/fetchSources.ts
··· 4 4 * SPDX-License-Identifier: GPL-3.0-or-later 5 5 */ 6 6 7 - import { mkdir, rm, writeFile } from "node:fs/promises"; 7 + import { writeFile } from "node:fs/promises"; 8 8 import * as pathlib from "node:path"; 9 9 10 10 console.log("Fetching https://bsky.app"); 11 11 12 12 const html = await fetch("https://bsky.app").then(r => r.text()); 13 - 14 - await rm("dist/bsky", { recursive: true, force: true }); 15 - await mkdir("dist/bsky", { recursive: true }); 13 + const sources = html.matchAll(/https:\/\/web-cdn\.bsky\.app\/[^"']*\.js/g).map(([url]) => url).toArray(); 16 14 17 - await Promise.all(html.matchAll(/https:\/\/web-cdn\.bsky\.app\/[^"']*\.js/g).map(async ([url]) => { 15 + await Promise.all(sources.map(async url => { 18 16 console.log(`Fetching ${url}`); 19 17 20 18 const filename = pathlib.basename(url); 21 19 const script = await fetch(url).then(r => r.text()); 22 20 23 - await writeFile(pathlib.join("dist/bsky", filename), script); 21 + await writeFile(pathlib.join("bluesky", filename), script); 24 22 })); 23 + 24 + await writeFile(pathlib.join("bluesky", "sources.json"), JSON.stringify({ 25 + fetchedAt: new Date(), 26 + sources, 27 + }, null, 4));