Skip to content

Commit

Permalink
fix: (regression 0.55.0) admin/logs/console: first lines were not logged
Browse files Browse the repository at this point in the history
  • Loading branch information
rejetto committed Jan 3, 2025
1 parent 8f7dc1b commit 015276f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/argv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import minimist from 'minimist'

export const argv = minimist(process.argv.slice(2))
3 changes: 2 additions & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import _ from 'lodash'
import { getUpdates, update } from './update'
import { openAdmin } from './listen'
import yaml from 'yaml'
import { argv, BUILD_TIMESTAMP, VERSION } from './const'
import { BUILD_TIMESTAMP, VERSION } from './const'
import { createInterface } from 'readline'
import { getAvailablePlugins, mapPlugins, startPlugin, stopPlugin } from './plugins'
import { purgeFileAttr } from './fileAttr'
import { downloadPlugin } from './github'
import { Dict, formatBytes, formatSpeed, formatTimestamp, makeMatcher } from './cross'
import apiMonitor from './api.monitor'
import { argv } from './argv'

if (!argv.updating)
try {
Expand Down
3 changes: 2 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <[email protected]> - License https://www.gnu.org/licenses/gpl-3.0.txt

import { argv, ORIGINAL_CWD, VERSION, CONFIG_FILE } from './const'
import { ORIGINAL_CWD, VERSION, CONFIG_FILE } from './const'
import { watchLoad } from './watchLoad'
import yaml from 'yaml'
import _ from 'lodash'
Expand All @@ -10,6 +10,7 @@ import { join, resolve } from 'path'
import events from './events'
import { copyFile, stat } from 'fs/promises'
import produce, { setAutoFreeze } from 'immer'
import { argv } from './argv'

setAutoFreeze(false) // we still want to mess with objects later (eg: account.belongs)

Expand Down
2 changes: 1 addition & 1 deletion src/consoleLog.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import events from './events'
import { formatTime, formatTimestamp } from './cross'
import { createWriteStream } from 'fs'
import { argv } from './const'
import { argv } from './argv'

export const consoleLog: Array<{ ts: Date, k: string, msg: string }> = []
const f = argv.consoleFile ? createWriteStream(argv.consoleFile, 'utf-8') : null
Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { homedir } from 'os'
import _ from 'lodash'
import { basename, dirname, join } from 'path'
import { formatTimestamp } from './cross'
import { argv } from './argv'
export * from './cross-const'

export const API_VERSION = 10.3
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

export const argv = minimist(process.argv.slice(2))
// you can add arguments with this file, currently used for the update process on mac/linux
export const ARGS_FILE = join(homedir(), 'hfs-args')
try {
Expand Down
3 changes: 2 additions & 1 deletion src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import {
import { ApiError } from './apiMiddleware'
import _ from 'lodash'
import {
argv, HFS_REPO, HFS_REPO_BRANCH, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_NOT_ACCEPTABLE,
HFS_REPO, HFS_REPO_BRANCH, HTTP_BAD_REQUEST, HTTP_CONFLICT, HTTP_FORBIDDEN, HTTP_NOT_ACCEPTABLE,
HTTP_SERVER_ERROR, VERSION
} from './const'
import { rename, rm } from 'fs/promises'
import { join } from 'path'
import { readFileSync } from 'fs'
import { storedMap } from './persistence'
import { argv } from './argv'

const DIST_ROOT = 'dist'

Expand Down
3 changes: 2 additions & 1 deletion src/listen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import open from 'open'
import {
CFG, debounceAsync, ipForUrl, makeNetMatcher, MINUTE, objSameKeys, onlyTruthy, prefix, runAt, wait, xlate
} from './misc'
import { PORT_DISABLED, ADMIN_URI, argv, DEV, IS_WINDOWS } from './const'
import { PORT_DISABLED, ADMIN_URI, DEV, IS_WINDOWS } from './const'
import findProcess from 'find-process'
import { anyAccountCanLoginAdmin } from './adminApis'
import _ from 'lodash'
Expand All @@ -20,6 +20,7 @@ import events from './events'
import { isIPv6 } from 'net'
import { defaultBaseUrl } from './nat'
import { storedMap } from './persistence'
import { argv } from './argv'

interface ServerExtra { name: string, error?: string, busy?: Promise<string> }
let httpSrv: undefined | http.Server & ServerExtra
Expand Down
3 changes: 2 additions & 1 deletion src/update.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is part of HFS - Copyright 2021-2023, Massimo Melina <[email protected]> - License https://www.gnu.org/licenses/gpl-3.0.txt

import { getProjectInfo, getRepoInfo } from './github'
import { ARGS_FILE, argv, HFS_REPO, IS_BINARY, IS_WINDOWS, RUNNING_BETA } from './const'
import { ARGS_FILE, HFS_REPO, IS_BINARY, IS_WINDOWS, RUNNING_BETA } from './const'
import { dirname, join } from 'path'
import { spawn, spawnSync } from 'child_process'
import { DAY, exists, debounceAsync, httpStream, unzip, prefix, xlate, HOUR } from './misc'
Expand All @@ -15,6 +15,7 @@ import { cmdEscape, RUNNING_AS_SERVICE } from './util-os'
import { onProcessExit } from './first'
import { storedMap } from './persistence'
import _ from 'lodash'
import { argv } from './argv'

const updateToBeta = defineConfig('update_to_beta', false)
const autoCheckUpdate = defineConfig('auto_check_update', true)
Expand Down

0 comments on commit 015276f

Please sign in to comment.