data endpoint for entity 90008 (aka. a website)

refactor: fix a bunch of lint errors / warnings

ptr.pet 3fd42bea 0e0ceb63

verified
+1 -1
.forgejo/workflows/build.yaml
··· 19 19 - run: nix build . -L --show-trace 20 20 deploy: 21 21 runs-on: lixpine 22 - depends-on: build 22 + needs: build 23 23 steps: 24 24 - name: trigger deploy 25 25 env:
+1 -1
src/lib/activity.ts
··· 36 36 if (description === null) continue; 37 37 results.push({ 38 38 source, 39 - description: description.split('</a>').pop(), 39 + description: description.split('</a>').pop() || '', 40 40 link: item.url, 41 41 date: item.published 42 42 });
+2
src/routes/+page.server.ts
··· 4 4 import { noteFromBskyPost } from '../components/note.svelte'; 5 5 import { pushNotification } from '$lib/pushnotif'; 6 6 import { getLastActivity } from '$lib/activity.js'; 7 + import type { RequestEvent } from '@sveltejs/kit'; 7 8 8 9 export const load = async () => { 9 10 const lastTrack = getNowPlaying(); ··· 23 24 default: async ({ request }: RequestEvent) => { 24 25 const form = await request.formData(); 25 26 const content = form.get('content')?.toString().substring(0, 100); 27 + if (content === undefined) return; 26 28 pushNotification(content); 27 29 } 28 30 };
+3 -1
src/routes/about/_layout.svelte
··· 1 1 <script lang="ts"> 2 2 import Window from '../../components/window.svelte'; 3 + // @ts-expect-error "mdsvex include is broken" 3 4 import Stuff from './stuff.md'; 5 + // @ts-expect-error "mdsvex include is broken" 4 6 import Media from './media.md'; 5 7 import '../../styles/app.css'; 6 8 7 9 interface Props { 8 - title: any; 10 + title: string; 9 11 children?: import('svelte').Snippet; 10 12 } 11 13
+1
src/routes/entries/+layout.server.ts
··· 6 6 metadata: Record<string, string>; 7 7 } 8 8 9 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 9 10 const allPostFiles: Record<string, any> = import.meta.glob('./*/+page.md', { eager: true }); 10 11 const allPosts: PostData[] = Object.entries(allPostFiles) 11 12 .map(([path, post]) => {
+8 -6
src/routes/entries/+page.svelte
··· 1 1 <script lang="ts"> 2 2 import Window from '../../components/window.svelte'; 3 - import type { PostData } from './+layout.server.js'; 3 + import type { PostData } from './+layout.server.ts'; 4 4 import LogPage from '../log/+page.svelte'; 5 + import type { NoteData } from '../../components/note.svelte'; 5 6 6 7 interface Props { 7 - data: any; 8 + data: { 9 + posts: PostData[]; 10 + feedPosts: NoteData[]; 11 + }; 8 12 } 9 13 10 14 let { data }: Props = $props(); 11 - 12 - let posts: PostData[] = data.posts as PostData[]; 13 15 </script> 14 16 15 17 <div class="mx-auto md:max-w-fit flex flex-col-reverse md:flex-row gap-y-4 gap-x-16"> 16 18 <div class="flex flex-col gap-y-4"> 17 - {#each posts as post} 19 + {#each data.posts as post} 18 20 <Window title={post.metadata.title} iconUri="/icons/entry.webp"> 19 21 <a 20 22 href="/entries/{post.path}" ··· 34 36 </Window> 35 37 {/each} 36 38 </div> 37 - <LogPage {data} /> 39 + <LogPage data={{ feedPosts: data.feedPosts }} /> 38 40 </div>
+4 -9
src/routes/entries/_layout.svelte
··· 5 5 import { page } from '$app/state'; 6 6 7 7 interface Props { 8 - title: any; 9 - date: any; 10 - excerpt: any; 8 + title: string; 9 + date: Date; 10 + excerpt: string; 11 11 children?: import('svelte').Snippet; 12 12 } 13 13 14 - let { 15 - title, 16 - date, 17 - excerpt, 18 - children 19 - }: Props = $props(); 14 + let { title, date, excerpt, children }: Props = $props(); 20 15 21 16 let showMetadata = $derived(excerpt !== undefined && excerpt !== null); 22 17 </script>
+4 -2
src/routes/guestbook/+page.server.ts
··· 51 51 } 52 52 }; 53 53 54 - export async function load({ url, cookies }) { 54 + export async function load({ cookies }) { 55 55 const scopedCookies = scopeCookies(cookies); 56 - let data = { 56 + const data = { 57 57 entries: [] as NoteData[], 58 58 sendError: scopedCookies.get('sendError') || '', 59 59 getError: '', ··· 91 91 await ( 92 92 await getBskyClient() 93 93 ).post({ text: content, threadgate: { allowMentioned: false, allowFollowing: false } }); 94 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 94 95 } catch (err: any) { 95 96 scopedCookies.set('sendError', err.toString()); 96 97 redirect(303, callbackUrl); ··· 104 105 try { 105 106 const { posts } = await getUserPosts('did:web:guestbook.gaze.systems', 16); 106 107 data.entries = posts.map(noteFromBskyPost); 108 + // eslint-disable-next-line @typescript-eslint/no-explicit-any 107 109 } catch (err: any) { 108 110 data.getError = err.toString(); 109 111 }
+9 -2
src/routes/guestbook/+page.svelte
··· 1 1 <script lang="ts"> 2 - import Note from '../../components/note.svelte'; 2 + import Note, { type NoteData } from '../../components/note.svelte'; 3 3 import Token from '../../components/token.svelte'; 4 4 import Window from '../../components/window.svelte'; 5 5 6 6 interface Props { 7 - data: any; 7 + data: { 8 + entries: NoteData[]; 9 + sendError: string; 10 + getError: string; 11 + sendRatelimited: string; 12 + getRatelimited: boolean; 13 + fillText: string; 14 + }; 8 15 } 9 16 10 17 let { data }: Props = $props();
+4 -4
src/routes/robots.txt/+server.ts
··· 1 - import { getRobotsTxt } from "$lib/robots" 1 + import { getRobotsTxt } from '$lib/robots'; 2 2 3 - export const GET = async ({ }) => { 4 - return new Response(await getRobotsTxt()) 5 - } 3 + export const GET = async () => { 4 + return new Response(await getRobotsTxt()); 5 + };
+3 -3
tailwind.config.js
··· 1 - const colors = require('tailwindcss/colors'); 2 - const plugin = require('tailwindcss/plugin'); 1 + import typography from '@tailwindcss/typography'; 2 + import forms from '@tailwindcss/forms'; 3 3 4 4 /** @type {import('tailwindcss').Config} */ 5 5 export default { ··· 53 53 monospace: ['"Fusion Pixel 10px Monospaced zh_hans", monospace'] 54 54 } 55 55 }, 56 - plugins: [require('@tailwindcss/typography'), require('@tailwindcss/forms')] 56 + plugins: [typography, forms] 57 57 };