Initial commit

This commit is contained in:
Akshay Kolli
2026-02-08 02:32:45 -05:00
commit 3f72118348
26 changed files with 6355 additions and 0 deletions

23
app/api/rss/route.ts Normal file
View File

@@ -0,0 +1,23 @@
import { NextResponse } from 'next/server';
import Parser from 'rss-parser';
export const dynamic = 'force-dynamic';
export async function GET() {
const parser = new Parser();
try {
const feed = await parser.parseURL('https://news.ycombinator.com/rss');
const items = feed.items.slice(0, 10).map(item => ({
title: item.title,
link: item.link,
pubDate: item.pubDate,
creator: item.creator || 'Unknown',
contentSnippet: item.contentSnippet,
}));
return NextResponse.json(items);
} catch (error) {
return NextResponse.json({ error: 'Failed to parse RSS' }, { status: 500 });
}
}

53
app/api/status/route.ts Normal file
View File

@@ -0,0 +1,53 @@
import { NextResponse } from 'next/server';
// Configuration - Update these URLs to match your actual services
const SERVICES = [
{ name: 'Website', url: 'https://www.akkolli.net' },
{ name: 'Gitea', url: 'https://code.akkolli.net' },
{ name: 'Nextcloud', url: 'http://localhost:6060' },
];
export const dynamic = 'force-dynamic';
export async function GET() {
const results = await Promise.all(
SERVICES.map(async (service) => {
const start = performance.now();
try {
// Set a short timeout (e.g., 5 seconds)
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
const response = await fetch(service.url, {
method: 'HEAD',
signal: controller.signal,
cache: 'no-store',
});
clearTimeout(timeoutId);
const end = performance.now();
const latency = Math.round(end - start);
return {
name: service.name,
url: service.url,
status: response.ok ? 'up' : 'down',
latency: latency,
timestamp: new Date().toISOString(),
};
} catch (error) {
return {
name: service.name,
url: service.url,
status: 'down',
latency: 0,
timestamp: new Date().toISOString(),
error: 'Unreachable'
};
}
})
);
return NextResponse.json(results);
}