removed support for legacy option "custom header"

Massimo Melina committed Aug 29, 2023 at 12:27 UTC 46ae025c9d85b8afababc18e7cdb9c3ec0d0786c
2 files changed -13
src/customHtml.ts
-10
@@ -1,7 +1,4 @@
1 -import { existsSync, writeFileSync } from 'fs'
2 -import events from './events'
1 import { prefix } from './misc'
4 -import { customHeader } from './frontEndApis'
2 import { watchLoad } from './watchLoad'
3 import { proxy } from 'valtio/vanilla' // without /vanilla we trigger react dependency
4 import Dict = NodeJS.Dict
@@ -22,13 +19,6 @@ export function newCustomHtmlState() {
19
20 const FILE = 'custom.html'
21
25 -if (!existsSync(FILE))
26 - events.once('config ready', () => {
27 - const legacy = prefix('[beforeHeader]\n', customHeader.get())
28 - writeFileSync(FILE, legacy)
29 - customHeader.set('') // get rid of it
30 - })
31 -
22 watchLoadCustomHtml(customHtmlState.sections)
23
24 export function watchLoadCustomHtml(state: CustomHtml, folder='') {
src/frontEndApis.ts
-3
@@ -3,7 +3,6 @@
3 import { ApiError, ApiHandlers, SendListReadable } from './apiMiddleware'
4 import { get_file_list } from './api.file_list'
5 import * as api_auth from './api.auth'
6 -import { defineConfig } from './config'
6 import events from './events'
7 import Koa from 'koa'
8 import { dirTraversal, isValidFileName } from './util-files'
@@ -20,8 +19,6 @@ import { mkdir, rename, rm } from 'fs/promises'
19 import { dirname, join } from 'path'
20 import { getUploadMeta } from './upload'
21
23 -export const customHeader = defineConfig('custom_header', '')
24 -
22 export const frontEndApis: ApiHandlers = {
23 get_file_list,
24 ...api_auth,