Add docker publish flow, node blocklist & API updates
Replace docker/metadata GH Action with a docker-publish.sh driven workflow (supports auto-versioning, extra tags, multi-arch builds and optional builder). Update docs and READMEs to use the updater and new publish flow. Add server-side swarm/node blocklist support and admin nodes API. Improve auth endpoints (me, logout, switch, session accounts) and support account switching. Extend bots API to support custom LLM provider and optional endpoint. Enforce node blocklist on chat send/receive, refactor link preview handling into dedicated preview modules, and enhance notifications and posts like/repost handlers to accept both signed actions and regular auth flows. Misc: remove admin update UI details, add helper libs (media previews, node-blocklist, reposts, notifications, etc.), and minor housekeeping (pyc, workflow tweaks).
This commit is contained in:
@@ -41,6 +41,7 @@ export interface ContentItemInput {
|
||||
title: string;
|
||||
content: string | null;
|
||||
url: string;
|
||||
url_overridden_by_dest?: string;
|
||||
publishedAt: Date;
|
||||
}
|
||||
|
||||
@@ -325,16 +326,39 @@ export async function fetchRedditPosts(
|
||||
subreddit: string,
|
||||
options: FetchOptions = {}
|
||||
): Promise<FeedItem[]> {
|
||||
// Use RSS feed instead of JSON API - more reliable and doesn't require auth
|
||||
const rssUrl = `https://www.reddit.com/r/${subreddit}/hot.rss`;
|
||||
|
||||
const requestedMaxItems = options.maxItems ?? DEFAULT_MAX_ITEMS;
|
||||
const fetchLimit = Math.min(Math.max(requestedMaxItems + 10, requestedMaxItems), 100);
|
||||
const url = new URL(`${REDDIT_API_BASE}/r/${subreddit}/hot.json`);
|
||||
url.searchParams.set('raw_json', '1');
|
||||
url.searchParams.set('limit', String(fetchLimit));
|
||||
|
||||
const responseText = await fetchUrl(url.toString(), {
|
||||
timeout: options.timeout,
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
});
|
||||
|
||||
let response: RedditListingResponse;
|
||||
try {
|
||||
return await fetchRSSFeed(rssUrl, options);
|
||||
} catch (error) {
|
||||
// If RSS fails, try the old.reddit.com RSS which sometimes works better
|
||||
const oldRedditUrl = `https://old.reddit.com/r/${subreddit}/hot.rss`;
|
||||
return await fetchRSSFeed(oldRedditUrl, options);
|
||||
response = JSON.parse(responseText) as RedditListingResponse;
|
||||
} catch {
|
||||
throw new ParseError('Failed to parse Reddit JSON response');
|
||||
}
|
||||
|
||||
const posts = response.data?.children
|
||||
?.map((child) => child.data)
|
||||
.filter((post): post is RedditListingChildData => Boolean(post)) || [];
|
||||
|
||||
const filteredPosts = posts.filter((post) => !shouldExcludeRedditPost(post));
|
||||
|
||||
return filteredPosts.slice(0, requestedMaxItems).map((post): FeedItem => ({
|
||||
id: post.name || post.id,
|
||||
title: post.title,
|
||||
content: post.selftext || '',
|
||||
url: `${REDDIT_API_BASE}${post.permalink}`,
|
||||
publishedAt: new Date(post.created_utc * 1000),
|
||||
}));
|
||||
}
|
||||
|
||||
// ============================================
|
||||
@@ -384,6 +408,31 @@ interface BraveNewsResponse {
|
||||
results?: BraveNewsResult[];
|
||||
}
|
||||
|
||||
interface RedditListingChildData {
|
||||
id: string;
|
||||
name?: string;
|
||||
title: string;
|
||||
selftext?: string;
|
||||
permalink: string;
|
||||
url: string;
|
||||
url_overridden_by_dest?: string;
|
||||
created_utc: number;
|
||||
stickied?: boolean;
|
||||
pinned?: boolean;
|
||||
}
|
||||
|
||||
interface RedditListingResponse {
|
||||
data?: {
|
||||
children?: Array<{
|
||||
data?: RedditListingChildData;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
export function shouldExcludeRedditPost(post: RedditListingChildData): boolean {
|
||||
return Boolean(post.stickied || post.pinned);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch articles from a news API.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user