@@ -14,37 +14,6 @@ const web = express()
14
14
web . use ( compress ( { level : 1 } ) )
15
15
16
16
// Main
17
- web . use ( ( req , res , next ) => {
18
- // Check if the response is HTML
19
- if ( res . getHeader ( 'Content-Type' ) && res . getHeader ( 'Content-Type' ) . includes ( 'text/html' ) ) {
20
- // Define the meta tags
21
- const metaTags = `
22
- <link rel="icon" href="/favicon.png">
23
- <meta property="og:title" content="CSPI Unrestricted">
24
- <meta property="og:description" content="Unrestricted information about CSPI.">
25
- <meta name="theme-color" content="#232425">
26
- ` ;
27
-
28
- // Function to inject the meta tags into the response
29
- const injectMetaTags = ( body ) => {
30
- // Look for the </head> tag in the HTML response and inject the meta tags before it
31
- return body . replace ( '<link rel="icon" sizes="96x96" href="https://publish-01.obsidian.md/access/f786db9fac45774fa4f0d8112e232d67/favicon-96x96.png">' , metaTags ) ;
32
- } ;
33
-
34
- // Wrap the res.send method to intercept the response and inject the meta tags
35
- const originalSend = res . send ;
36
- res . send = function ( body ) {
37
- if ( body && typeof body === 'string' ) {
38
- // If the response body is a string, inject the meta tags
39
- body = injectMetaTags ( body ) ;
40
- }
41
- originalSend . call ( this , body ) ;
42
- } ;
43
- }
44
-
45
- next ( ) ;
46
- } ) ;
47
-
48
17
web . use ( express . static ( path . join ( __dirname , "public" ) ) )
49
18
web . use ( "*" , ( req , res ) => res . redirect ( "/" ) )
50
19
web . listen ( port , ( ) => { console . log ( `Server is running. Port: ${ port } ` ) } )
0 commit comments