Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions server/src/_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,11 @@ export default {

// Handle RSS feeds directly (native RSS support at root path)
// Matches: /rss.xml, /atom.xml, /rss.json, /feed.json, /feed.xml
if (path.match(/^\/(rss\.xml|atom\.xml|rss\.json|feed\.json|feed\.xml)$/)) {
if (path.match(/^\/(rss\.xml|atom\.xml|rss\.json|feed\.json|feed\.xml)$/) || path.startsWith('/api/') || path.startsWith('/favicon.ico')) {
const honoApp = getApp();
return await honoApp.fetch(request, env);
}

// Try API routes first (all APIs are under /api/)
if (path.startsWith('/api/')) {
const honoApp = getApp();
// Pass the original request - Hono will handle the routing
return await honoApp.fetch(request, env);
}

// Serve static assets (for files with extensions)
if (path.match(/\.\w+$/) && env.ASSETS) {
try {
Expand Down
2 changes: 1 addition & 1 deletion server/src/core/hono-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function createHonoApp(): Hono<{
app.route('/', RSSService());

// Favicon service
app.route('/favicon', FaviconService());
app.route('/', FaviconService());

// 404 handler
app.notFound((c) => {
Expand Down
12 changes: 6 additions & 6 deletions server/src/services/__tests__/favicon.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('FaviconService', () => {

describe('GET / - Get favicon', () => {
it('should return favicon from S3', async () => {
const res = await app.request('/', { method: 'GET' }, env);
const res = await app.request('/favicon.ico', { method: 'GET' }, env);

// Will fail due to S3 not being available, but verifies route is registered
expect(res.status).not.toBe(404);
Expand All @@ -143,7 +143,7 @@ describe('FaviconService', () => {

describe('GET /original - Get original favicon', () => {
it('should return original favicon from S3', async () => {
const res = await app.request('/original', { method: 'GET' }, env);
const res = await app.request('/favicon/original', { method: 'GET' }, env);

// Will fail due to S3 not being available, but verifies route is registered
expect(res.status).not.toBe(404);
Expand All @@ -156,7 +156,7 @@ describe('FaviconService', () => {
const formData = new FormData();
formData.append('file', file);

const res = await app.request('/', {
const res = await app.request('/favicon', {
method: 'POST',
body: formData,
}, env);
Expand All @@ -171,7 +171,7 @@ describe('FaviconService', () => {
const formData = new FormData();
formData.append('file', file);

const res = await app.request('/', {
const res = await app.request('/favicon', {
method: 'POST',
headers: { 'Authorization': 'Bearer mock_token_1' },
body: formData,
Expand All @@ -185,7 +185,7 @@ describe('FaviconService', () => {
const formData = new FormData();
formData.append('file', file);

const res = await app.request('/', {
const res = await app.request('/favicon', {
method: 'POST',
headers: { 'Authorization': 'Bearer mock_token_1' },
body: formData,
Expand All @@ -199,7 +199,7 @@ describe('FaviconService', () => {
const formData = new FormData();
formData.append('file', file);

const res = await app.request('/', {
const res = await app.request('/favicon', {
method: 'POST',
headers: { 'Authorization': 'Bearer mock_token_1' },
body: formData,
Expand Down
8 changes: 4 additions & 4 deletions server/src/services/favicon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function getFaviconKey(env: Env) {
export function FaviconService(): Hono {
const app = new Hono();

// GET /favicon
app.get("/", async (c: AppContext) => {
// GET /favicon.ico
app.get("/favicon.ico", async (c: AppContext) => {
startTime(c, 'favicon-get');
const env = c.get('env');
const accessHost = env.S3_ACCESS_HOST || env.S3_ENDPOINT;
Expand Down Expand Up @@ -54,7 +54,7 @@ export function FaviconService(): Hono {
});

// GET /favicon/original
app.get("/original", async (c: AppContext) => {
app.get("/favicon/original", async (c: AppContext) => {
startTime(c, 'favicon-original-get');
const env = c.get('env');
const accessHost = env.S3_ACCESS_HOST || env.S3_ENDPOINT;
Expand Down Expand Up @@ -90,7 +90,7 @@ export function FaviconService(): Hono {
});

// POST /favicon
app.post("/", async (c: AppContext) => {
app.post("/favicon", async (c: AppContext) => {
startTime(c, 'favicon-upload');
const env = c.get('env');
const admin = c.get('admin');
Expand Down
Loading