Compare commits
No commits in common. "5ab1167d38449ccef84c8f2e06da3598e286060e" and "4e7196182c99692880886f1d4b78e7313a47c775" have entirely different histories.
5ab1167d38
...
4e7196182c
@ -6,7 +6,6 @@ MASTODON_INSTANCE = 'metalhead.club'
|
||||
BASE_URL = 'https://moshingmammut.phlaym.net'
|
||||
VERBOSE = false
|
||||
IGNORE_USERS = @moshhead@metalhead.club
|
||||
WEBSUB_HUB = 'http://pubsubhubbub.superfeedr.com'
|
||||
|
||||
PUBLIC_REFRESH_INTERVAL = 10000
|
||||
PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME = 'Metalhead.club'
|
@ -15,7 +15,6 @@
|
||||
<meta name="theme-color" content="#17063b" media="(prefers-color-scheme: dark)" />
|
||||
<meta name="theme-color" content="#BCB9B2" media="(prefers-color-scheme: light)" />
|
||||
<link rel="alternate" type="application/atom+xml" href="/feed.xml" title="Atom Feed" />
|
||||
<link rel="hub" href="https://pubsubhubbub.superfeedr.com" />
|
||||
%sveltekit.head%
|
||||
<style>
|
||||
body {
|
||||
|
@ -196,7 +196,7 @@ export async function savePost(post: Post): Promise<undefined> {
|
||||
if (!databaseReady) {
|
||||
await waitReady();
|
||||
}
|
||||
return await new Promise<undefined>((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.debug(`Saving post ${post.url}`);
|
||||
const account = post.account;
|
||||
db.run(
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BASE_URL, WEBSUB_HUB } from '$env/static/private';
|
||||
import { BASE_URL } from '$env/static/private';
|
||||
import { PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME } from '$env/static/public';
|
||||
import type { Post } from '$lib//mastodon/response';
|
||||
import { Feed } from 'feed';
|
||||
@ -6,7 +6,6 @@ import fs from 'fs/promises';
|
||||
|
||||
export function createFeed(posts: Post[]): Feed {
|
||||
const baseUrl = BASE_URL.endsWith('/') ? BASE_URL : BASE_URL + '/';
|
||||
const hub = WEBSUB_HUB ? WEBSUB_HUB : undefined;
|
||||
const feed = new Feed({
|
||||
title: `${PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME} music feed`,
|
||||
description: `Posts about music on ${PUBLIC_MASTODON_INSTANCE_DISPLAY_NAME}`,
|
||||
@ -20,7 +19,6 @@ export function createFeed(posts: Post[]): Feed {
|
||||
feedLinks: {
|
||||
atom: `${BASE_URL}/feed.xml`
|
||||
},
|
||||
hub: hub,
|
||||
author: {
|
||||
name: '@aymm',
|
||||
link: 'https://metalhead.club/@aymm'
|
||||
@ -42,23 +40,8 @@ export function createFeed(posts: Post[]): Feed {
|
||||
});
|
||||
});
|
||||
feed.addCategory('Music');
|
||||
|
||||
return feed;
|
||||
}
|
||||
export async function saveAtomFeed(feed: Feed) {
|
||||
await fs.writeFile('feed.xml', feed.atom1(), { encoding: 'utf8' });
|
||||
if (!WEBSUB_HUB) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const params = new URLSearchParams();
|
||||
params.append('hub.mode', 'publish');
|
||||
params.append('hub.url', `${BASE_URL}/feed.xml`);
|
||||
await fetch(WEBSUB_HUB, {
|
||||
method: 'POST',
|
||||
body: params
|
||||
});
|
||||
} catch (e) {
|
||||
console.error('Failed to update WebSub hub', e);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user