Fix #14 make mastodon instance configurable

This commit is contained in:
Max Nuding 2023-04-04 12:45:27 +02:00
parent 5dd20cd6a0
commit a3751c985b
Signed by: phlaym
GPG Key ID: A06651BAB6777237
3 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,8 @@
HASHTAG_FILTER = ichlausche,music,musik,nowplaying,tunetuesday,nowlistening
URL_FILTER = song.link,album.link,spotify.com,music.apple.com,bandcamp.com
YOUTUBE_API_KEY = CHANGE_ME
MASTODON_INSTANCE = 'metalhead.club'
VERBOSE = false
PUBLIC_REFRESH_INTERVAL = 10000
PUBLIC_REFRESH_INTERVAL = 10000
PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME = 'Metalhead.club'

View File

@ -1,4 +1,4 @@
import { HASHTAG_FILTER, URL_FILTER, YOUTUBE_API_KEY } from '$env/static/private';
import { HASHTAG_FILTER, MASTODON_INSTANCE, URL_FILTER, YOUTUBE_API_KEY } from '$env/static/private';
import type { Post, Tag, TimelineEvent } from '$lib/mastodon/response';
import { savePost } from '$lib/server/db';
import { WebSocket } from "ws";
@ -55,7 +55,7 @@ export class TimelineReader {
}
private constructor() {
const socket = new WebSocket("wss://metalhead.club/api/v1/streaming")
const socket = new WebSocket(`wss://${MASTODON_INSTANCE}/api/v1/streaming`);
socket.onopen = (_event) => {
socket.send('{ "type": "subscribe", "stream": "public:local"}');
};

View File

@ -2,7 +2,7 @@
import { onMount } from "svelte";
import type { PageData } from './$types';
import type { Post } from '$lib/mastodon/response';
import { PUBLIC_REFRESH_INTERVAL } from '$env/static/public';
import { PUBLIC_REFRESH_INTERVAL, PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME } from '$env/static/public';
import PostComponent from '$lib/components/PostComponent.svelte';
import LoadMoreComponent from '$lib/components/LoadMoreComponent.svelte';
@ -76,9 +76,9 @@ async function loadOlderPosts() {
</script>
<svelte:head>
<title>Metalhead.club music list</title>
<title>{PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME} music list</title>
</svelte:head>
<h2>Metalhead.club music list</h2>
<h2>{PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME} music list</h2>
<div class="wrapper">
<div></div>
<div class="posts">