fix: (regression 0.55.0) admin/logs/console: first lines were not logged
Massimo Melina committed
Jan 3, 2025 at 14:52 UTC
015276f84189dbb702805042e0a433011a459140
8 files changed
+15
-7
src/argv.ts
new
+3
@@ -0,0 +1,3 @@
1
+import minimist from 'minimist'
2
+
3
+export const argv = minimist(process.argv.slice(2))
src/commands.ts
+2
-1
@@ -6,13 +6,14 @@ import _ from 'lodash'
6
import { getUpdates, update } from './update'
7
import { openAdmin } from './listen'
8
import yaml from 'yaml'
9
-import { argv, BUILD_TIMESTAMP, VERSION } from './const'
9
+import { BUILD_TIMESTAMP, VERSION } from './const'
10
import { createInterface } from 'readline'
11
import { getAvailablePlugins, mapPlugins, startPlugin, stopPlugin } from './plugins'
12
import { purgeFileAttr } from './fileAttr'
13
import { downloadPlugin } from './github'
14
import { Dict, formatBytes, formatSpeed, formatTimestamp, makeMatcher } from './cross'
15
import apiMonitor from './api.monitor'
16
+import { argv } from './argv'
17
18
if (!argv.updating)
19
try {
src/config.ts
+2
-1
@@ -1,6 +1,6 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
-import { argv, ORIGINAL_CWD, VERSION, CONFIG_FILE } from './const'
3
+import { ORIGINAL_CWD, VERSION, CONFIG_FILE } from './const'
4
import { watchLoad } from './watchLoad'
5
import yaml from 'yaml'
6
import _ from 'lodash'
@@ -10,6 +10,7 @@ import { join, resolve } from 'path'
10
import events from './events'
11
import { copyFile, stat } from 'fs/promises'
12
import produce, { setAutoFreeze } from 'immer'
13
+import { argv } from './argv'
14
15
setAutoFreeze(false) // we still want to mess with objects later (eg: account.belongs)
16
src/consoleLog.ts
+1
-1
@@ -1,7 +1,7 @@
1
import events from './events'
2
import { formatTime, formatTimestamp } from './cross'
3
import { createWriteStream } from 'fs'
4
-import { argv } from './const'
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
src/const.ts
+1
-1
@@ -6,12 +6,12 @@ import { homedir } from 'os'
6
import _ from 'lodash'
7
import { basename, dirname, join } from 'path'
8
import { formatTimestamp } from './cross'
9
+import { argv } from './argv'
10
export * from './cross-const'
11
12
export const API_VERSION = 10.3
13
export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
14
14
-export const argv = minimist(process.argv.slice(2))
15
// you can add arguments with this file, currently used for the update process on mac/linux
16
export const ARGS_FILE = join(homedir(), 'hfs-args')
17
try {
src/github.ts
+2
-1
@@ -11,13 +11,14 @@ import {
11
import { ApiError } from './apiMiddleware'
12
import _ from 'lodash'
13
import {
14
- argv, HFS_REPO, HFS_REPO_BRANCH, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_NOT_ACCEPTABLE,
14
+ HFS_REPO, HFS_REPO_BRANCH, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_NOT_ACCEPTABLE,
15
HTTP_SERVER_ERROR, VERSION
16
} from './const'
17
import { rename, rm } from 'fs/promises'
18
import { join } from 'path'
19
import { readFileSync } from 'fs'
20
import { storedMap } from './persistence'
21
+import { argv } from './argv'
22
23
const DIST_ROOT = 'dist'
24
src/listen.ts
+2
-1
@@ -11,7 +11,7 @@ import open from 'open'
11
import {
12
CFG, debounceAsync, ipForUrl, makeNetMatcher, MINUTE, objSameKeys, onlyTruthy, prefix, runAt, wait, xlate
13
} from './misc'
14
-import { PORT_DISABLED, ADMIN_URI, argv, DEV, IS_WINDOWS } from './const'
14
+import { PORT_DISABLED, ADMIN_URI, DEV, IS_WINDOWS } from './const'
15
import findProcess from 'find-process'
16
import { anyAccountCanLoginAdmin } from './adminApis'
17
import _ from 'lodash'
@@ -20,6 +20,7 @@ import events from './events'
20
import { isIPv6 } from 'net'
21
import { defaultBaseUrl } from './nat'
22
import { storedMap } from './persistence'
23
+import { argv } from './argv'
24
25
interface ServerExtra { name: string, error?: string, busy?: Promise<string> }
26
let httpSrv: undefined | http.Server & ServerExtra
src/update.ts
+2
-1
@@ -1,7 +1,7 @@
1
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
2
3
import { getProjectInfo, getRepoInfo } from './github'
4
-import { ARGS_FILE, argv, HFS_REPO, IS_BINARY, IS_WINDOWS, RUNNING_BETA } from './const'
4
+import { ARGS_FILE, HFS_REPO, IS_BINARY, IS_WINDOWS, RUNNING_BETA } from './const'
5
import { dirname, join } from 'path'
6
import { spawn, spawnSync } from 'child_process'
7
import { DAY, exists, debounceAsync, httpStream, unzip, prefix, xlate, HOUR } from './misc'
@@ -15,6 +15,7 @@ import { cmdEscape, RUNNING_AS_SERVICE } from './util-os'
15
import { onProcessExit } from './first'
16
import { storedMap } from './persistence'
17
import _ from 'lodash'
18
+import { argv } from './argv'
19
20
const updateToBeta = defineConfig('update_to_beta', false)
21
const autoCheckUpdate = defineConfig('auto_check_update', true)