--consoleFile won't overwrite existing files
Massimo Melina committed
Feb 10, 2026 at 23:54 UTC
8e0a5f420413796d2ddc569a29a5bb7348eeff41
2 files changed
+3
-3
src/consoleLog.ts
+1
-1
@@ -4,7 +4,7 @@ import { createWriteStream } from 'fs'
4
import { argv } from './argv'
5
6
export const consoleLog: Array<{ ts: Date, k: string, msg: string }> = []
7
-const f = argv.consoleFile ? createWriteStream(argv.consoleFile, 'utf-8') : null
7
+const f = argv.consoleFile ? createWriteStream(argv.consoleFile, { flags: 'a', encoding: 'utf8' }) : null
8
for (const k of ['log','warn','error','debug']) {
9
const original = console[k as 'log']
10
console[k as 'log'] = (...args: any[]) => {
src/middlewares.ts
+2
-2
@@ -2,8 +2,8 @@
2
3
import compress from 'koa-compress'
4
import Koa from 'koa'
5
-import { API_URI, DEV, HTTP_FOOL } from './const'
6
-import { ALLOW_SESSION_IP_CHANGE, DAY, hasDirTraversal, isLocalHost, netMatches, splitAt, stream2string, tryJson } from './misc'
5
+import { API_URI, DEV } from './const'
6
+import { ALLOW_SESSION_IP_CHANGE, DAY, isLocalHost, netMatches, splitAt, stream2string, tryJson } from './misc'
7
import { Readable } from 'stream'
8
import { applyBlock } from './block'
9
import { Account, accountCanLogin, getAccount, getFromAccount } from './perm'