@certd/lib-server 1.39.13 → 1.39.16
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.
- package/dist/system/settings/service/models.d.ts +1 -0
- package/dist/system/settings/service/models.js +1 -0
- package/dist/system/settings/service/sys-settings-service.d.ts +1 -0
- package/dist/system/settings/service/sys-settings-service.js +15 -8
- package/dist/user/access/service/encrypt-service.d.ts +1 -1
- package/dist/user/access/service/encrypt-service.js +2 -8
- package/package.json +7 -7
|
@@ -50,6 +50,7 @@ export declare class SysPrivateSettings extends BaseSettings {
|
|
|
50
50
|
encryptSecret?: string;
|
|
51
51
|
httpsProxy?: string;
|
|
52
52
|
httpProxy?: string;
|
|
53
|
+
commonHeaders?: string;
|
|
53
54
|
reverseProxies?: Record<string, string>;
|
|
54
55
|
dnsResultOrder?: string;
|
|
55
56
|
commonCnameEnabled?: boolean;
|
|
@@ -21,6 +21,7 @@ export declare class SysSettingsService extends BaseService<SysSettingsEntity> {
|
|
|
21
21
|
reloadSettings(): Promise<void>;
|
|
22
22
|
reloadPublicSettings(): Promise<void>;
|
|
23
23
|
reloadPrivateSettings(): Promise<void>;
|
|
24
|
+
parseKeyValueText(text: string): {};
|
|
24
25
|
setEnvironmentVars(vars: string): void;
|
|
25
26
|
updateByKey(key: string, setting: any): Promise<void>;
|
|
26
27
|
backupSecret(): Promise<void>;
|
|
@@ -13,7 +13,7 @@ import { Repository } from 'typeorm';
|
|
|
13
13
|
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
|
14
14
|
import { SysInstallInfo, SysPrivateSettings, SysPublicSettings, SysSecret, SysSecretBackup } from './models.js';
|
|
15
15
|
import { getAllSslProviderDomains, setSslProviderReverseProxies, setWalkFromAuthoritative } from '@certd/acme-client';
|
|
16
|
-
import { cache, logger, mergeUtils, setGlobalProxy } from '@certd/basic';
|
|
16
|
+
import { cache, logger, mergeUtils, setGlobalHeaders, setGlobalProxy } from '@certd/basic';
|
|
17
17
|
import { isPlus } from '@certd/plus-core';
|
|
18
18
|
import * as dns from 'node:dns';
|
|
19
19
|
import { BaseService, setAdminMode } from '../../../basic/index.js';
|
|
@@ -154,6 +154,7 @@ let SysSettingsService = class SysSettingsService extends BaseService {
|
|
|
154
154
|
httpsProxy: privateSetting.httpsProxy,
|
|
155
155
|
};
|
|
156
156
|
setGlobalProxy(opts);
|
|
157
|
+
setGlobalHeaders(this.parseKeyValueText(privateSetting.commonHeaders));
|
|
157
158
|
if (privateSetting.dnsResultOrder) {
|
|
158
159
|
dns.setDefaultResultOrder(privateSetting.dnsResultOrder);
|
|
159
160
|
}
|
|
@@ -165,12 +166,12 @@ let SysSettingsService = class SysSettingsService extends BaseService {
|
|
|
165
166
|
this.setEnvironmentVars(privateSetting.environmentVars);
|
|
166
167
|
setWalkFromAuthoritative(privateSetting.acmeWalkFromAuthoritative);
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
if (typeof
|
|
171
|
-
|
|
169
|
+
parseKeyValueText(text) {
|
|
170
|
+
const values = {};
|
|
171
|
+
if (typeof text !== 'string') {
|
|
172
|
+
text = "";
|
|
172
173
|
}
|
|
173
|
-
|
|
174
|
+
text.split('\n').forEach(line => {
|
|
174
175
|
line = line.trim();
|
|
175
176
|
if (!line || line.startsWith('#')) {
|
|
176
177
|
return;
|
|
@@ -182,11 +183,17 @@ let SysSettingsService = class SysSettingsService extends BaseService {
|
|
|
182
183
|
if (!line.includes("=")) {
|
|
183
184
|
return;
|
|
184
185
|
}
|
|
185
|
-
const
|
|
186
|
+
const eqIndex = line.indexOf('=');
|
|
187
|
+
const key = line.substring(0, eqIndex).trim();
|
|
188
|
+
const value = line.substring(eqIndex + 1).trim();
|
|
186
189
|
if (key && value) {
|
|
187
|
-
|
|
190
|
+
values[key] = value;
|
|
188
191
|
}
|
|
189
192
|
});
|
|
193
|
+
return values;
|
|
194
|
+
}
|
|
195
|
+
setEnvironmentVars(vars) {
|
|
196
|
+
const envVars = this.parseKeyValueText(vars);
|
|
190
197
|
//先删除旧环境变量
|
|
191
198
|
if (lastSaveEnvVars) {
|
|
192
199
|
for (const key in lastSaveEnvVars) {
|
|
@@ -5,7 +5,7 @@ import { Encryptor, SysSettingsService } from '../../../system/index.js';
|
|
|
5
5
|
export declare class EncryptService {
|
|
6
6
|
encryptor: Encryptor;
|
|
7
7
|
sysSettingService: SysSettingsService;
|
|
8
|
-
|
|
8
|
+
doInit(): Promise<void>;
|
|
9
9
|
encrypt(text: string): string;
|
|
10
10
|
decrypt(encryptedText: string): string;
|
|
11
11
|
}
|
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
10
|
+
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
|
11
11
|
import { Encryptor, SysSettingsService } from '../../../system/index.js';
|
|
12
12
|
/**
|
|
13
13
|
* 授权
|
|
@@ -15,7 +15,7 @@ import { Encryptor, SysSettingsService } from '../../../system/index.js';
|
|
|
15
15
|
let EncryptService = class EncryptService {
|
|
16
16
|
encryptor;
|
|
17
17
|
sysSettingService;
|
|
18
|
-
async
|
|
18
|
+
async doInit() {
|
|
19
19
|
const secret = await this.sysSettingService.getSecret();
|
|
20
20
|
this.encryptor = new Encryptor(secret.encryptSecret);
|
|
21
21
|
}
|
|
@@ -32,12 +32,6 @@ __decorate([
|
|
|
32
32
|
Inject(),
|
|
33
33
|
__metadata("design:type", SysSettingsService)
|
|
34
34
|
], EncryptService.prototype, "sysSettingService", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
Init(),
|
|
37
|
-
__metadata("design:type", Function),
|
|
38
|
-
__metadata("design:paramtypes", []),
|
|
39
|
-
__metadata("design:returntype", Promise)
|
|
40
|
-
], EncryptService.prototype, "init", null);
|
|
41
35
|
EncryptService = __decorate([
|
|
42
36
|
Provide(),
|
|
43
37
|
Scope(ScopeEnum.Singleton)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certd/lib-server",
|
|
3
|
-
"version": "1.39.
|
|
3
|
+
"version": "1.39.16",
|
|
4
4
|
"description": "midway with flyway, sql upgrade way ",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "AGPL",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@certd/acme-client": "^1.39.
|
|
33
|
-
"@certd/basic": "^1.39.
|
|
34
|
-
"@certd/pipeline": "^1.39.
|
|
35
|
-
"@certd/plugin-lib": "^1.39.
|
|
36
|
-
"@certd/plus-core": "^1.39.
|
|
32
|
+
"@certd/acme-client": "^1.39.16",
|
|
33
|
+
"@certd/basic": "^1.39.16",
|
|
34
|
+
"@certd/pipeline": "^1.39.16",
|
|
35
|
+
"@certd/plugin-lib": "^1.39.16",
|
|
36
|
+
"@certd/plus-core": "^1.39.16",
|
|
37
37
|
"@midwayjs/cache": "3.14.0",
|
|
38
38
|
"@midwayjs/core": "3.20.11",
|
|
39
39
|
"@midwayjs/i18n": "3.20.13",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"typeorm": "^0.3.11",
|
|
70
70
|
"typescript": "^5.4.2"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "1c6dc169ac04fd09ef94404a912a15cbb17e1452"
|
|
73
73
|
}
|