added bit more advanced file existance checking, removed vhosts in favor or routes

This commit is contained in:
mrfry
2023-03-29 19:10:44 +02:00
parent ba89f4a342
commit 113a114821
24 changed files with 2720 additions and 2474 deletions
+3 -3
View File
@@ -46,7 +46,7 @@ import fs from 'fs'
import { v4 as uuidv4 } from 'uuid'
import logger from '../utils/logger'
import constants from '../constants.json'
import { paths } from './files'
import { Request } from '../types/basicTypes'
interface URLFormatOptions {
@@ -115,7 +115,7 @@ function ReadDir(path: string, listHidden?: boolean): Array<string> {
}
}
function ReadJSON(name: string): any {
function ReadJSON<T = any>(name: string): T {
try {
return JSON.parse(ReadFile(name))
} catch (err) {
@@ -329,7 +329,7 @@ function getGitRevision(dir: string): string {
}
function getScriptVersion(): string {
const scriptContent = ReadFile(constants.moodleTestUserscriptPath)
const scriptContent = ReadFile(paths.moodleTestUserscriptPath)
let temp: string | string[] = scriptContent.split('\n').find((x) => {
return x.includes('@version')