@@ -5,7 +5,11 @@ import { authenticator } from 'otplib'
55import QRCode from 'qrcode'
66import { writeFile } from 'node:fs/promises'
77import { readFileSync , existsSync } from 'node:fs'
8- import { html } from '@elysiajs/html'
8+ // Helper to return HTML responses with proper Content-Type
9+ const htmlResponse = content =>
10+ new Response ( content , {
11+ headers : { 'Content-Type' : 'text/html; charset=utf-8' } ,
12+ } )
913
1014// Import core modules
1115import { createSessionManager } from './core/session.js'
@@ -76,7 +80,7 @@ export const r2Backup = initialConfig => app => {
7680 // Setup initial cron schedule
7781 scheduler . setup ( config . cronSchedule , config . cronEnabled !== false )
7882
79- return app . use ( html ( { autoDoctype : 'full' } ) ) . group ( '/backup' , app => {
83+ return app . group ( '/backup' , app => {
8084 // Authentication Middleware
8185 const authMiddleware = context => {
8286 // Skip auth entirely if no valid config (needs onboarding)
@@ -138,7 +142,7 @@ export const r2Backup = initialConfig => app => {
138142 return
139143 }
140144
141- return LoginPage ( { totpEnabled : ! ! config . auth ?. totpSecret } )
145+ return htmlResponse ( LoginPage ( { totpEnabled : ! ! config . auth ?. totpSecret } ) )
142146 } )
143147
144148 // AUTH: Login Endpoint
@@ -452,7 +456,7 @@ export const r2Backup = initialConfig => app => {
452456 set . headers [ 'Location' ] = '/backup'
453457 return
454458 }
455- return OnboardingPage ( { sourceDir : config . sourceDir } )
459+ return htmlResponse ( OnboardingPage ( { sourceDir : config . sourceDir } ) )
456460 } )
457461
458462 // ONBOARDING: Save Initial Config
@@ -535,7 +539,7 @@ export const r2Backup = initialConfig => app => {
535539
536540 const jobStatus = scheduler . getStatus ( config . cronEnabled )
537541 const hasAuth = ! ! ( config . auth && config . auth . username && config . auth . password )
538- return DashboardPage ( { config, jobStatus, hasAuth } )
542+ return htmlResponse ( DashboardPage ( { config, jobStatus, hasAuth } ) )
539543 } )
540544 )
541545 } )
0 commit comments