Skip to content

Commit

Permalink
fix: add RSSService to App
Browse files Browse the repository at this point in the history
  • Loading branch information
OXeu committed Jun 8, 2024
1 parent b890896 commit 57a5ed8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 3 additions & 1 deletion server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { TagService } from './services/tag';
import { UserService } from './services/user';
import { StorageService } from './services/storage';
import { SEOService } from './services/seo';
import { RSSService } from './services/rss';

export const app = (db: DB, env: Env) => new Elysia({ aot: false })
.use(cors({
Expand All @@ -33,7 +34,8 @@ export const app = (db: DB, env: Env) => new Elysia({ aot: false })
.use(TagService(db))
.use(StorageService(db, env))
.use(FriendService(db, env))
.use(SEOService(db, env))
.use(SEOService(env))
.use(RSSService(env))
.get('/', () => `Hi`)
.onError(({ path, params, code }) => {
if (code === 'NOT_FOUND')
Expand Down
7 changes: 2 additions & 5 deletions server/src/services/rss.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import { PutObjectCommand } from "@aws-sdk/client-s3";
import { and, desc, eq } from "drizzle-orm";
import { drizzle } from "drizzle-orm/d1";
import Elysia from "elysia";
import { Feed } from "feed";
import path from 'path';
import type { Env } from "../db/db";
import * as schema from "../db/schema";
import { feeds, users } from "../db/schema";
import { extractImage } from "../utils/image";
import { createS3Client } from "../utils/s3";
import Elysia from "elysia";
import type { DB } from "../_worker";
import { setup } from "../setup";

export const RSSService = (db: DB, env: Env) => {
export const RSSService = (env: Env) => {
const endpoint = env.S3_ENDPOINT;
const accessHost = env.S3_ACCESS_HOST || endpoint;
const folder = env.S3_CACHE_FOLDER || 'cache/';
return new Elysia({ aot: false })
.use(setup(db, env))
.get('/sub/:name', async ({ set, params: { name } }) => {
if (!accessHost) {
set.status = 500;
Expand Down
5 changes: 1 addition & 4 deletions server/src/services/seo.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import Elysia from "elysia";
import path from "node:path";
import type { DB } from "../_worker";
import type { Env } from "../db/db";
import { setup } from "../setup";

export const SEOService = (db: DB, env: Env) => {
export const SEOService = (env: Env) => {
const endpoint = env.S3_ENDPOINT;
const accessHost = env.S3_ACCESS_HOST || endpoint;
const folder = env.S3_CACHE_FOLDER || 'cache/';
return new Elysia({ aot: false })
.use(setup(db, env))
.get('/seo/*', async ({ set, params, query }) => {
if (!accessHost) {
set.status = 500;
Expand Down

0 comments on commit 57a5ed8

Please sign in to comment.