vona-core 5.0.90 → 5.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,7 +61,7 @@ export class AppLogger extends BeanSimple {
|
|
|
61
61
|
}, Winston);
|
|
62
62
|
}
|
|
63
63
|
createTransportFile(fileName, clientInfo, options) {
|
|
64
|
-
const dirname = this.app.config.
|
|
64
|
+
const dirname = this.app.config.logger.baseDir;
|
|
65
65
|
if (!fse.existsSync(dirname)) {
|
|
66
66
|
const [_, err] = catchErrorSync(() => {
|
|
67
67
|
fse.ensureDirSync(dirname);
|
package/dist/lib/utils/util.d.ts
CHANGED
|
@@ -32,11 +32,11 @@ export declare class AppUtil extends BeanSimple {
|
|
|
32
32
|
combineApiPathControllerAndActionRaw(moduleName: ModuleInfo.IModuleInfo | string, controllerPath: string | undefined, actionPath: RegExp | string | undefined, simplify?: boolean): string;
|
|
33
33
|
combineApiPathControllerAndAction(moduleName: ModuleInfo.IModuleInfo | string, controllerPath: string | undefined, actionPath: RegExp | string | undefined, prefix?: string | boolean, simplify?: boolean): string;
|
|
34
34
|
combineApiPath(path: string | undefined, moduleName?: ModuleInfo.IModuleInfo | string, prefix?: string | boolean, simplify?: boolean): string;
|
|
35
|
-
combineStaticPath(
|
|
35
|
+
combineStaticPath(staticPath: string | undefined, moduleName?: ModuleInfo.IModuleInfo | string): string;
|
|
36
36
|
combineResourceName(resourceName: string | undefined, moduleName: ModuleInfo.IModuleInfo | string, simplify?: boolean, simplifyProviderId?: boolean): string;
|
|
37
37
|
getPublicPathPhysical(subdir?: string, ensure?: boolean): Promise<string>;
|
|
38
38
|
get prodRootPath(): string;
|
|
39
|
-
getAssetPathPhysical(moduleName: ModuleInfo.IModuleInfo | string, scene: keyof IModuleAssetSceneRecord, assetPath?: string): string
|
|
39
|
+
getAssetPathPhysical(moduleName: ModuleInfo.IModuleInfo | string, scene: keyof IModuleAssetSceneRecord, assetPath?: string): string;
|
|
40
40
|
createError(data: any, returnObject?: boolean): any;
|
|
41
41
|
monkeyModule(ebAppMonkey: any, ebModulesMonkey: any, monkeyName: TypeMonkeyName, moduleTarget?: IModule, ...monkeyData: any[]): Promise<void>;
|
|
42
42
|
monkeyModuleSync(ebAppMonkey: any, ebModulesMonkey: any, monkeyName: TypeMonkeyName, moduleTarget?: IModule, ...monkeyData: any[]): void;
|
|
@@ -62,5 +62,5 @@ export declare function prepareEnv(env: Partial<NodeJS.ProcessEnv>): VonaConfigE
|
|
|
62
62
|
export declare function beanFullNameFromOnionName(onionName: string, sceneName: keyof IBeanSceneRecord): keyof IBeanRecord;
|
|
63
63
|
export declare function onionNameFromBeanFullName(beanFullName: string, sceneName: keyof IBeanSceneRecord): string;
|
|
64
64
|
export declare function filterHeaders(headers: object | undefined, whitelist: string[]): {} | undefined;
|
|
65
|
-
export declare function combineFilePathSafe(dir: string, file: string): string
|
|
65
|
+
export declare function combineFilePathSafe(dir: string, file: string): string;
|
|
66
66
|
export {};
|
package/dist/lib/utils/util.js
CHANGED
|
@@ -40,16 +40,20 @@ export class AppUtil extends BeanSimple {
|
|
|
40
40
|
combineApiPath(path, moduleName, prefix, simplify) {
|
|
41
41
|
return combineApiPath(path, moduleName, prefix, simplify, this.app.config.server.globalPrefix);
|
|
42
42
|
}
|
|
43
|
-
combineStaticPath(
|
|
43
|
+
combineStaticPath(staticPath, moduleName) {
|
|
44
44
|
const globalPrefix = '/api/static';
|
|
45
|
-
if (!
|
|
46
|
-
|
|
45
|
+
if (!staticPath)
|
|
46
|
+
staticPath = '';
|
|
47
|
+
// safe
|
|
48
|
+
staticPath = path.normalize(staticPath);
|
|
49
|
+
if (staticPath.includes('..'))
|
|
50
|
+
throw new Error(`unsafe path: ${staticPath}`);
|
|
47
51
|
// ignore globalPrefix
|
|
48
|
-
if (
|
|
49
|
-
return
|
|
52
|
+
if (staticPath.startsWith('//'))
|
|
53
|
+
return staticPath.substring(1);
|
|
50
54
|
// ignore module path
|
|
51
|
-
if (
|
|
52
|
-
return `${globalPrefix}${
|
|
55
|
+
if (staticPath.startsWith('/'))
|
|
56
|
+
return `${globalPrefix}${staticPath}`;
|
|
53
57
|
// globalPrefix + module path + arg
|
|
54
58
|
if (!moduleName)
|
|
55
59
|
throw new Error('should specify the moduleName');
|
|
@@ -57,7 +61,7 @@ export class AppUtil extends BeanSimple {
|
|
|
57
61
|
moduleName = moduleName.relativeName;
|
|
58
62
|
const parts = moduleName.split('-');
|
|
59
63
|
// path
|
|
60
|
-
return `${globalPrefix}/${parts[0]}/${parts[1]}/${
|
|
64
|
+
return `${globalPrefix}/${parts[0]}/${parts[1]}/${staticPath}`;
|
|
61
65
|
}
|
|
62
66
|
combineResourceName(resourceName, moduleName, simplify, simplifyProviderId) {
|
|
63
67
|
return combineResourceName(resourceName, moduleName, simplify, simplifyProviderId);
|
|
@@ -300,6 +304,6 @@ export function combineFilePathSafe(dir, file) {
|
|
|
300
304
|
const fullPath = path.normalize(path.join(dir, file));
|
|
301
305
|
// files that can be accessd should be under options.dir
|
|
302
306
|
if (fullPath.indexOf(dir) !== 0)
|
|
303
|
-
|
|
307
|
+
throw new Error(`unsafe dir: ${dir}`);
|
|
304
308
|
return fullPath;
|
|
305
309
|
}
|
|
@@ -6,13 +6,13 @@ export interface VonaConfigEnv {
|
|
|
6
6
|
SERVER_KEYS: string | undefined;
|
|
7
7
|
SERVER_GLOBALPREFIX: string | undefined;
|
|
8
8
|
SERVER_PUBLICDIR: string | undefined;
|
|
9
|
-
SERVER_LOGGERDIR: string | undefined;
|
|
10
9
|
SERVER_SUBDOMAINOFFSET: string | undefined;
|
|
11
10
|
SERVER_WORKERS: string | undefined;
|
|
12
11
|
SERVER_LISTEN_HOSTNAME: string | undefined;
|
|
13
12
|
SERVER_LISTEN_PORT: string | undefined;
|
|
14
13
|
SERVER_LISTEN_DISABLE: 'true' | 'false' | undefined;
|
|
15
14
|
TEST_WHYISNODERUNNING: string | undefined;
|
|
15
|
+
LOGGER_DIR: string | undefined;
|
|
16
16
|
LOGGER_DUMMY: 'true' | 'false' | undefined;
|
|
17
17
|
LOGGER_ROTATE_ENABLE: 'true' | 'false' | undefined;
|
|
18
18
|
LOGGER_ROTATE_FILENAME: string | undefined;
|