minor refactors and additional logs
This commit is contained in:
parent
498b1d82d9
commit
d39ccba927
21
src/app.html
21
src/app.html
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
@ -54,9 +54,22 @@
|
||||
|
||||
color: var(--color-text);
|
||||
background-color: var(--color-bg);
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans,
|
||||
Ubuntu, Cantarell, 'Helvetica Neue', Helvetica, Arial, sans-serif, 'Apple Color Emoji',
|
||||
'Segoe UI Emoji', 'Segoe UI Symbol';
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
BlinkMacSystemFont,
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Oxygen-Sans,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
'Helvetica Neue',
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif,
|
||||
'Apple Color Emoji',
|
||||
'Segoe UI Emoji',
|
||||
'Segoe UI Symbol';
|
||||
}
|
||||
|
||||
a {
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { log } from '$lib/log';
|
||||
import { TimelineReader } from '$lib/server/timeline';
|
||||
import type { HandleServerError } from '@sveltejs/kit';
|
||||
import type { Handle, HandleServerError } from '@sveltejs/kit';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import fs from 'fs/promises';
|
||||
|
||||
log.log('App startup');
|
||||
TimelineReader.init();
|
||||
|
||||
export const handleError = (({ error }) => {
|
||||
@ -16,8 +17,6 @@ export const handleError = (({ error }) => {
|
||||
};
|
||||
}) satisfies HandleServerError;
|
||||
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
|
||||
export const handle = (async ({ event, resolve }) => {
|
||||
// Reeder *insists* on checking /feed instead of /feed.xml
|
||||
if (event.url.pathname === '/feed') {
|
||||
|
@ -479,11 +479,11 @@ function saveSongInfoData(postUrl: string, songs: SongInfo[]): Promise<void> {
|
||||
}
|
||||
|
||||
export async function savePost(post: Post, songs: SongInfo[]) {
|
||||
log.debug(`Saving post ${post.url}`);
|
||||
if (!databaseReady) {
|
||||
await waitReady();
|
||||
}
|
||||
|
||||
log.debug(`Saving post ${post.url}`);
|
||||
const account = post.account;
|
||||
await saveAccountData(account);
|
||||
log.debug(`Saved account data ${post.url}`);
|
||||
|
@ -224,7 +224,7 @@ export class TimelineReader {
|
||||
accountUrl: accountUrl,
|
||||
file: fn,
|
||||
sizeDescriptor: `${i}x`
|
||||
} as AccountAvatar)
|
||||
}) as AccountAvatar
|
||||
)
|
||||
.then(saveAvatar)
|
||||
)
|
||||
@ -261,7 +261,7 @@ export class TimelineReader {
|
||||
file: fn,
|
||||
sizeDescriptor: `${i}x`,
|
||||
kind: kind
|
||||
} as SongThumbnailImage)
|
||||
}) as SongThumbnailImage
|
||||
)
|
||||
.then(saveSongThumbnail)
|
||||
)
|
||||
@ -363,6 +363,7 @@ export class TimelineReader {
|
||||
try {
|
||||
const data: TimelineEvent = JSON.parse(event.data.toString());
|
||||
if (data.event !== 'update') {
|
||||
log.log('Ignoring ES event', data.event);
|
||||
return;
|
||||
}
|
||||
const post: Post = JSON.parse(data.payload);
|
||||
@ -410,10 +411,12 @@ export class TimelineReader {
|
||||
}
|
||||
|
||||
private constructor() {
|
||||
log.log('Constructing timeline object');
|
||||
this.startWebsocket();
|
||||
}
|
||||
|
||||
public static init() {
|
||||
log.log('Timeline object init');
|
||||
if (this._instance === undefined) {
|
||||
this._instance = new TimelineReader();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user