File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -5,20 +5,24 @@ import { setup } from "../setup";
5
5
import { createS3Client } from "../utils/s3" ;
6
6
import path from "path" ;
7
7
8
- const env = getEnv ( ) ;
9
8
// @see https://developers.cloudflare.com/images/url-format#supported-formats-and-limitations
10
9
export const FAVICON_ALLOWED_TYPES : { [ key : string ] : string } = {
11
10
"image/jpeg" : ".jpg" ,
12
11
"image/png" : ".png" ,
13
12
"image/gif" : ".gif" ,
14
13
"image/webp" : ".webp" ,
15
14
} ;
16
- export const faviconKey = path . join ( env . S3_FOLDER || "" , "favicon.webp" ) ;
15
+ export function getFaviconKey ( ) {
16
+ const env = getEnv ( ) ;
17
+ return path . join ( env . S3_FOLDER || "" , "favicon.webp" ) ;
18
+ }
17
19
18
20
export function FaviconService ( ) {
21
+ const env = getEnv ( ) ;
19
22
const s3 = createS3Client ( ) ;
20
23
const bucket = env . S3_BUCKET ;
21
24
const accessHost = env . S3_ACCESS_HOST || env . S3_ENDPOINT ;
25
+ const faviconKey = getFaviconKey ( ) ;
22
26
return new Elysia ( { aot : false } )
23
27
. use ( setup ( ) )
24
28
. get ( "/favicon" , async ( { set } ) => {
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { PutObjectCommand } from "@aws-sdk/client-s3";
2
2
import { and , desc , eq } from "drizzle-orm" ;
3
3
import { drizzle } from "drizzle-orm/d1" ;
4
4
import Elysia from "elysia" ;
5
- import { FAVICON_ALLOWED_TYPES , faviconKey } from "./favicon" ;
5
+ import { FAVICON_ALLOWED_TYPES , getFaviconKey } from "./favicon" ;
6
6
import { Feed } from "feed" ;
7
7
import path from 'path' ;
8
8
import rehypeStringify from "rehype-stringify" ;
@@ -62,6 +62,7 @@ export async function rssCrontab(env: Env) {
62
62
const frontendUrl = `${ env . FRONTEND_URL . startsWith ( "http://" ) || env . FRONTEND_URL . startsWith ( "https://" ) ? "" : "https://" } ${ env . FRONTEND_URL } ` ;
63
63
const db = drizzle ( env . DB , { schema : schema } ) ;
64
64
const accessHost = env . S3_ACCESS_HOST || env . S3_ENDPOINT ;
65
+ const faviconKey = getFaviconKey ( ) ;
65
66
66
67
let feedConfig : any = {
67
68
title : env . RSS_TITLE ,
You can’t perform that action at this time.
0 commit comments