feat: numerous other pages

This commit is contained in:
Cory Dransfeldt 2024-11-16 22:03:37 -08:00
parent 159b60b3fb
commit ca34a11ad4
No known key found for this signature in database
54 changed files with 1074 additions and 101 deletions

View file

@ -0,0 +1,46 @@
import { fetchGlobals } from "@utils/data/globals";
export async function GET() {
try {
const globals = await fetchGlobals();
const webfingerResponse = {
subject: `acct:${globals.webfinger_username}@${globals.webfinger_hostname}`,
aliases: [
`https://${globals.webfinger_hostname}/@${globals.webfinger_username}`,
`https://${globals.webfinger_hostname}/users/${globals.webfinger_username}`,
],
links: [
{
rel: "http://webfinger.net/rel/profile-page",
type: "text/html",
href: `https://${globals.webfinger_hostname}/@${globals.webfinger_username}`,
},
{
rel: "self",
type: "application/activity+json",
href: `https://${globals.webfinger_hostname}/users/${globals.webfinger_username}`,
},
{
rel: "http://ostatus.org/schema/1.0/subscribe",
template: `https://${globals.webfinger_hostname}/authorize_interaction?uri={uri}`,
},
{
rel: "http://webfinger.net/rel/avatar",
type: "image/png",
href: `${globals.cdn_url}${globals.avatar}?class=squarebase`,
},
],
};
return new Response(JSON.stringify(webfingerResponse), {
status: 200,
headers: {
"Content-Type": "application/jrd+json",
},
});
} catch (error) {
console.error("Error generating WebFinger response:", error);
return new Response("Error generating WebFinger response", { status: 500 });
}
}

View file

@ -1,6 +1,6 @@
---
import Layout from '@layouts/Layout.astro';
import BlockRenderer from '@components/BlockRenderer.astro';
import BlockRenderer from '@components/blocks/BlockRenderer.astro';
import { fetchGlobals } from '@utils/data/globals.js';
import { fetchPages } from '@utils/data/pages';

View file

@ -0,0 +1,22 @@
import { generateJsonFeed } from '@utils/generateJsonFeed';
import { fetchGlobals } from '@utils/data/globals';
import { fetchActivity } from '@utils/data/activity';
export async function GET() {
const globals = await fetchGlobals();
const activity = await fetchActivity();
const feed = generateJsonFeed({
permalink: "/feeds/all.json",
title: "All activity / Cory Dransfeldt",
globals,
data: activity,
});
return new Response(feed, {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateJsonFeed } from '@utils/generateJsonFeed';
import { fetchGlobals } from '@utils/data/globals';
import { fetchBooks } from '@utils/data/books';
export async function GET() {
const globals = await fetchGlobals();
const books = await fetchBooks();
const feed = generateJsonFeed({
permalink: "/feeds/books.json",
title: "Books / Cory Dransfeldt",
globals,
data: books.feed,
});
return new Response(feed, {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateJsonFeed } from '@utils/generateJsonFeed';
import { fetchGlobals } from '@utils/data/globals';
import { fetchLinks } from '@utils/data/links';
export async function GET() {
const globals = await fetchGlobals();
const links = await fetchLinks();
const feed = generateJsonFeed({
permalink: "/feeds/links.json",
title: "Links / Cory Dransfeldt",
globals,
data: links,
});
return new Response(feed, {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateJsonFeed } from '@utils/generateJsonFeed';
import { fetchGlobals } from '@utils/data/globals';
import { fetchMovies } from '@utils/data/movies';
export async function GET() {
const globals = await fetchGlobals();
const movies = await fetchMovies();
const feed = generateJsonFeed({
permalink: "/feeds/movies.json",
title: "Movies / Cory Dransfeldt",
globals,
data: movies.feed,
});
return new Response(feed, {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateJsonFeed } from '@utils/generateJsonFeed';
import { fetchGlobals } from '@utils/data/globals';
import { fetchAllPosts } from '@utils/data/posts';
export async function GET() {
const globals = await fetchGlobals();
const posts = await fetchAllPosts();
const feed = generateJsonFeed({
permalink: "/feeds/posts.json",
title: "Posts / Cory Dransfeldt",
globals,
data: posts,
});
return new Response(feed, {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateRssFeed } from "@utils/generateRssFeed";
import { fetchGlobals } from "@utils/data/globals";
import { fetchActivity } from "@utils/data/activity";
export async function GET() {
const globals = await fetchGlobals();
const activity = await fetchActivity();
const rss = generateRssFeed({
permalink: "/feeds/all.xml",
title: "All activity / Cory Dransfeldt",
globals,
data: activity,
});
return new Response(rss, {
status: 200,
headers: {
"Content-Type": "application/rss+xml",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateRssFeed } from "@utils/generateRssFeed";
import { fetchGlobals } from "@utils/data/globals";
import { fetchBooks } from '@utils/data/books';
export async function GET() {
const globals = await fetchGlobals();
const books = await fetchBooks();
const rss = generateRssFeed({
permalink: "/feeds/books.xml",
title: "Books / Cory Dransfeldt",
globals,
data: books.feed,
});
return new Response(rss, {
status: 200,
headers: {
"Content-Type": "application/rss+xml",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateRssFeed } from "@utils/generateRssFeed";
import { fetchGlobals } from "@utils/data/globals";
import { fetchLinks } from '@utils/data/links';
export async function GET() {
const globals = await fetchGlobals();
const links = await fetchLinks();
const rss = generateRssFeed({
permalink: "/feeds/links.xml",
title: "Links / Cory Dransfeldt",
globals,
data: links,
});
return new Response(rss, {
status: 200,
headers: {
"Content-Type": "application/rss+xml",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateRssFeed } from "@utils/generateRssFeed";
import { fetchGlobals } from "@utils/data/globals";
import { fetchMovies } from '@utils/data/movies';
export async function GET() {
const globals = await fetchGlobals();
const movies = await fetchMovies();
const rss = generateRssFeed({
permalink: "/feeds/movies.xml",
title: "Movies / Cory Dransfeldt",
globals,
data: movies.feed,
});
return new Response(rss, {
status: 200,
headers: {
"Content-Type": "application/rss+xml",
},
});
}

View file

@ -0,0 +1,22 @@
import { generateRssFeed } from "@utils/generateRssFeed";
import { fetchGlobals } from "@utils/data/globals";
import { fetchAllPosts } from '@utils/data/posts';
export async function GET() {
const globals = await fetchGlobals();
const posts = await fetchAllPosts();
const rss = generateRssFeed({
permalink: "/feeds/posts.xml",
title: "Posts / Cory Dransfeldt",
globals,
data: posts,
});
return new Response(rss, {
status: 200,
headers: {
"Content-Type": "application/rss+xml",
},
});
}

View file

@ -1,5 +1,5 @@
import fetchSyndication from '../../utils/data/syndication.js';
import { fetchGlobals } from '../../utils/data/globals.js';
import fetchSyndication from '@utils/data/syndication.js';
import { fetchGlobals } from '@utils/data/globals.js';
export async function GET() {
const globals = await fetchGlobals();

29
src/pages/humans.txt.js Normal file
View file

@ -0,0 +1,29 @@
import { fetchGlobals } from '@utils/data/globals';
export async function GET() {
try {
const globals = await fetchGlobals();
const humansTxt = `
## team
${globals.site_name}
${globals.url}
${globals.mastodon}
## colophon
${globals.url}/colophon
`.trim();
return new Response(humansTxt, {
status: 200,
headers: {
'Content-Type': 'text/plain',
},
});
} catch (error) {
console.error('Error generating humans.txt:', error);
return new Response('Error generating humans.txt', { status: 500 });
}
}

View file

@ -1,9 +1,9 @@
---
import Layout from '../layouts/Layout.astro';
import Intro from '../components/Intro.astro';
import { fetchGlobals } from '../utils/data/globals';
import RecentActivity from '../components/RecentActivity.astro';
import RecentPosts from '../components/RecentPosts.astro';
import { fetchGlobals } from '@utils/data/globals';
import Layout from '@layouts/Layout.astro';
import Intro from '@components/home/Intro.astro';
import RecentActivity from '@components/home/RecentActivity.astro';
import RecentPosts from '@components/home/RecentPosts.astro';
const globals = await fetchGlobals();
const schema = 'blog';

View file

@ -0,0 +1,24 @@
import { albumReleasesCalendar } from '@utils/albumReleasesCalendar';
import { fetchAlbumReleases } from '@utils/data/albumReleases';
export async function GET() {
try {
const { all: albumReleases } = await fetchAlbumReleases();
const icsContent = await albumReleasesCalendar(albumReleases);
if (!icsContent) return new Response('Error generating ICS file', { status: 500 });
return new Response(icsContent, {
status: 200,
headers: {
'Content-Type': 'text/calendar',
'Content-Disposition': 'attachment; filename="releases.ics"',
},
});
} catch (error) {
console.error('Error generating album releases ICS file:', error);
return new Response('Error generating album releases ICS file', {
status: 500,
});
}
}

View file

@ -55,5 +55,5 @@ const pagination = {
</article>
))}
<Paginator pagination={pagination} appVersion="1.0.0" />
<Paginator pagination={pagination} />
</Layout>

View file

@ -1,14 +1,26 @@
---
import { IconStar } from "@tabler/icons-react";
import { fetchAllPosts } from "@data/posts.js";
import { fetchAnalyticsData } from "@data/analytics.js";
import { fetchGlobals } from "@data/globals.js";
import { fetchLinks } from "@data/links.js";
import { md } from '@utils/helpers.js';
import OldPost from "@components/blocks/banners/OldPost.astro";
import BlockRenderer from "@components/BlockRenderer.astro";
import { getPopularPosts } from '@utils/getPopularPosts.js';
const analytics = await fetchAnalyticsData();
const links = await fetchLinks();
const posts = await fetchAllPosts();
const popularPosts = getPopularPosts(posts, analytics);
import AddonLinks from '@components/blocks/links/AddonLinks.astro';
import AssociatedMedia from "@components/blocks/AssociatedMedia.astro";
import MastodonPost from "@components/blocks/MastodonPost.astro";
import Layout from "@layouts/Layout.astro";
import BlockRenderer from "@components/blocks/BlockRenderer.astro";
import Coffee from "@components/blocks/banners/Coffee.astro";
import Layout from "@layouts/Layout.astro";
import Mastodon from "@components/blocks/banners/Mastodon.astro";
import OldPost from "@components/blocks/banners/OldPost.astro";
export const prerender = true;
@ -87,7 +99,7 @@ const htmlContent = md(post.content);
post.blocks &&
post.blocks.map((block) => <BlockRenderer block={block} />)
}
<!-- {post.mastodon_url && <MastodonPost url={post.mastodon_url} />} -->
{post.mastodon_url && <Mastodon url={post.mastodon_url} />}
<AssociatedMedia
artists={post.artists}
books={post.books}
@ -97,6 +109,7 @@ const htmlContent = md(post.content);
shows={post.shows}
/>
<Coffee />
<AddonLinks popularPosts={popularPosts} links={links} />
</div>
</article>
</Layout>

View file

@ -1,4 +1,4 @@
import { fetchAllRobots } from '../utils//data/robots.js';
import { fetchAllRobots } from '@utils//data/robots.js';
export async function GET() {
try {