File tree Expand file tree Collapse file tree 5 files changed +5
-38
lines changed
app/middleware/(site)/(core)/~gitbook/icon Expand file tree Collapse file tree 5 files changed +5
-38
lines changed Original file line number Diff line number Diff line change @@ -72,17 +72,6 @@ export function createLinker(
72
72
73
73
const siteBasePath = withTrailingSlash ( withLeadingSlash ( servedOn . siteBasePath ) ) ;
74
74
const spaceBasePath = withTrailingSlash ( withLeadingSlash ( servedOn . spaceBasePath ) ) ;
75
- const protocol = ( ( ) => {
76
- if ( servedOn . protocol ) {
77
- return servedOn . protocol ;
78
- }
79
-
80
- if ( servedOn . host ) {
81
- return servedOn . host . startsWith ( 'localhost' ) ? 'http:' : 'https:' ;
82
- }
83
-
84
- return 'https:' ;
85
- } ) ( ) ;
86
75
87
76
const linker : GitBookLinker = {
88
77
toPathInSpace ( relativePath : string ) : string {
@@ -108,7 +97,7 @@ export function createLinker(
108
97
return absolutePath ;
109
98
}
110
99
111
- return `${ protocol } //${ joinPaths ( servedOn . host , absolutePath ) } ` ;
100
+ return `${ servedOn . protocol ?? 'https:' } //${ joinPaths ( servedOn . host , absolutePath ) } ` ;
112
101
} ,
113
102
114
103
toPathForPage ( { pages, page, anchor } ) {
Original file line number Diff line number Diff line change @@ -7,21 +7,8 @@ import { serveIcon } from '@/routes/icon';
7
7
export const runtime = 'edge' ;
8
8
9
9
export async function GET ( req : NextRequest ) {
10
- try {
11
- console . log ( 'icon: getSiteContentPointer' ) ;
12
- const pointer = await getSiteContentPointer ( ) ;
13
- console . log ( 'icon: fetchV1context' ) ;
14
- const context = await fetchV1ContextForSitePointer ( pointer ) ;
10
+ const pointer = await getSiteContentPointer ( ) ;
11
+ const context = await fetchV1ContextForSitePointer ( pointer ) ;
15
12
16
- // biome-ignore lint/suspicious/noConsole: we want to log here
17
- console . log ( `serving icon for ${ context . site . id } ` ) ;
18
-
19
- return await serveIcon ( context , req ) ;
20
- } catch ( err ) {
21
- if ( err instanceof Error ) {
22
- console . error ( `icon: ${ err . toString ( ) } ` , err . stack ) ;
23
- }
24
-
25
- throw err ;
26
- }
13
+ return serveIcon ( context , req ) ;
27
14
}
Original file line number Diff line number Diff line change @@ -26,12 +26,7 @@ export const cloudflareDOCache: CacheBackend = {
26
26
return null ;
27
27
}
28
28
29
- try {
30
- return ( await stub . get < CacheEntry > ( key ) ) ?? null ;
31
- } catch ( err ) {
32
- console . error ( 'cloudflareDO.get' , err ) ;
33
- return null ;
34
- }
29
+ return ( await stub . get < CacheEntry > ( key ) ) ?? null ;
35
30
}
36
31
) ;
37
32
} ,
Original file line number Diff line number Diff line change @@ -285,7 +285,6 @@ async function getDataFetcherV1(): Promise<GitBookDataFetcher> {
285
285
export async function fetchV1ContextForSitePointer ( pointer : SiteContentPointer ) {
286
286
const baseContext = await getV1BaseContext ( ) ;
287
287
288
- console . log ( 'icon: baseContext success' ) ;
289
288
const context = await fetchSiteContextByIds ( baseContext , {
290
289
organization : pointer . organizationId ,
291
290
site : pointer . siteId ,
@@ -296,10 +295,8 @@ export async function fetchV1ContextForSitePointer(pointer: SiteContentPointer)
296
295
changeRequest : pointer . changeRequestId ,
297
296
revision : pointer . revisionId ,
298
297
} ) ;
299
- console . log ( 'icon: context inner success' ) ;
300
298
301
299
context . customization = await getDynamicCustomizationSettings ( context . customization ) ;
302
- console . log ( 'icon: customization success' ) ;
303
300
304
301
return context ;
305
302
}
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ const SIZES = {
27
27
* Generate an icon for a site content.
28
28
*/
29
29
export async function serveIcon ( context : GitBookSiteContext , req : Request ) {
30
- console . log ( 'icon: serveIcon' , req . url ) ;
31
30
const options = getOptions ( req . url ) ;
32
31
const size = SIZES [ options . size ] ;
33
32
You can’t perform that action at this time.
0 commit comments