@fecommunity/reactpress-server 4.0.0-beta.9 → 4.0.1
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/README.md +327 -45
- package/bin/reactpress-server.js +6 -14
- package/dist/app.module.js +27 -15
- package/dist/app.module.js.map +1 -1
- package/dist/filters/http-exception.filter.js +1 -1
- package/dist/filters/http-exception.filter.js.map +1 -1
- package/dist/generate-swagger.d.ts +1 -1
- package/dist/generate-swagger.js +11 -12
- package/dist/generate-swagger.js.map +1 -1
- package/dist/interceptors/transform.interceptor.d.ts +6 -2
- package/dist/interceptors/transform.interceptor.js +5 -10
- package/dist/interceptors/transform.interceptor.js.map +1 -1
- package/dist/logger/index.js +4 -5
- package/dist/logger/index.js.map +1 -1
- package/dist/main.d.ts +1 -1
- package/dist/main.js +23 -45
- package/dist/main.js.map +1 -1
- package/dist/modules/article/article.controller.d.ts +2 -7
- package/dist/modules/article/article.controller.js +48 -103
- package/dist/modules/article/article.controller.js.map +1 -1
- package/dist/modules/article/article.entity.d.ts +0 -4
- package/dist/modules/article/article.entity.js +41 -61
- package/dist/modules/article/article.entity.js.map +1 -1
- package/dist/modules/article/article.module.js +3 -18
- package/dist/modules/article/article.module.js.map +1 -1
- package/dist/modules/article/article.service.d.ts +2 -16
- package/dist/modules/article/article.service.js +29 -151
- package/dist/modules/article/article.service.js.map +1 -1
- package/dist/modules/auth/auth.controller.js +11 -11
- package/dist/modules/auth/auth.controller.js.map +1 -1
- package/dist/modules/auth/auth.module.js +4 -4
- package/dist/modules/auth/auth.module.js.map +1 -1
- package/dist/modules/auth/auth.service.js +7 -8
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/jwt-auth.guard.js +3 -4
- package/dist/modules/auth/jwt-auth.guard.js.map +1 -1
- package/dist/modules/auth/jwt.strategy.js +3 -4
- package/dist/modules/auth/jwt.strategy.js.map +1 -1
- package/dist/modules/auth/roles.guard.js +2 -2
- package/dist/modules/auth/roles.guard.js.map +1 -1
- package/dist/modules/category/category.controller.js +20 -21
- package/dist/modules/category/category.controller.js.map +1 -1
- package/dist/modules/category/category.entity.js +13 -13
- package/dist/modules/category/category.entity.js.map +1 -1
- package/dist/modules/category/category.module.js +1 -1
- package/dist/modules/category/category.module.js.map +1 -1
- package/dist/modules/category/category.service.js +4 -5
- package/dist/modules/category/category.service.js.map +1 -1
- package/dist/modules/comment/comment.controller.js +20 -24
- package/dist/modules/comment/comment.controller.js.map +1 -1
- package/dist/modules/comment/comment.entity.js +31 -31
- package/dist/modules/comment/comment.entity.js.map +1 -1
- package/dist/modules/comment/comment.module.js +2 -11
- package/dist/modules/comment/comment.module.js.map +1 -1
- package/dist/modules/comment/comment.service.d.ts +1 -5
- package/dist/modules/comment/comment.service.js +16 -43
- package/dist/modules/comment/comment.service.js.map +1 -1
- package/dist/modules/comment/html.d.ts +1 -1
- package/dist/modules/comment/html.js +3 -3
- package/dist/modules/comment/html.js.map +1 -1
- package/dist/modules/file/file.controller.d.ts +1 -1
- package/dist/modules/file/file.controller.js +20 -22
- package/dist/modules/file/file.controller.js.map +1 -1
- package/dist/modules/file/file.entity.d.ts +0 -7
- package/dist/modules/file/file.entity.js +15 -20
- package/dist/modules/file/file.entity.js.map +1 -1
- package/dist/modules/file/file.module.js +4 -16
- package/dist/modules/file/file.module.js.map +1 -1
- package/dist/modules/file/file.service.d.ts +1 -5
- package/dist/modules/file/file.service.js +24 -70
- package/dist/modules/file/file.service.js.map +1 -1
- package/dist/modules/install/install.controller.js +5 -5
- package/dist/modules/install/install.controller.js.map +1 -1
- package/dist/modules/install/install.module.js +1 -1
- package/dist/modules/install/install.module.js.map +1 -1
- package/dist/modules/install/install.service.js +2 -2
- package/dist/modules/install/install.service.js.map +1 -1
- package/dist/modules/knowledge/knowledge.controller.js +33 -35
- package/dist/modules/knowledge/knowledge.controller.js.map +1 -1
- package/dist/modules/knowledge/knowledge.entity.js +33 -33
- package/dist/modules/knowledge/knowledge.entity.js.map +1 -1
- package/dist/modules/knowledge/knowledge.module.js +1 -1
- package/dist/modules/knowledge/knowledge.module.js.map +1 -1
- package/dist/modules/knowledge/knowledge.service.js +11 -12
- package/dist/modules/knowledge/knowledge.service.js.map +1 -1
- package/dist/modules/page/page.controller.js +23 -24
- package/dist/modules/page/page.controller.js.map +1 -1
- package/dist/modules/page/page.entity.js +27 -27
- package/dist/modules/page/page.entity.js.map +1 -1
- package/dist/modules/page/page.module.js +1 -1
- package/dist/modules/page/page.module.js.map +1 -1
- package/dist/modules/page/page.service.js +12 -12
- package/dist/modules/page/page.service.js.map +1 -1
- package/dist/modules/search/search.controller.js +12 -12
- package/dist/modules/search/search.controller.js.map +1 -1
- package/dist/modules/search/search.entity.js +13 -13
- package/dist/modules/search/search.entity.js.map +1 -1
- package/dist/modules/search/search.module.js +1 -1
- package/dist/modules/search/search.module.js.map +1 -1
- package/dist/modules/search/search.service.js +2 -2
- package/dist/modules/search/search.service.js.map +1 -1
- package/dist/modules/setting/setting.constant.d.ts +4 -5
- package/dist/modules/setting/setting.constant.js +20 -5
- package/dist/modules/setting/setting.constant.js.map +1 -1
- package/dist/modules/setting/setting.controller.js +11 -11
- package/dist/modules/setting/setting.controller.js.map +1 -1
- package/dist/modules/setting/setting.entity.d.ts +0 -3
- package/dist/modules/setting/setting.entity.js +49 -64
- package/dist/modules/setting/setting.entity.js.map +1 -1
- package/dist/modules/setting/setting.module.js +2 -2
- package/dist/modules/setting/setting.module.js.map +1 -1
- package/dist/modules/setting/setting.service.d.ts +2 -13
- package/dist/modules/setting/setting.service.js +24 -169
- package/dist/modules/setting/setting.service.js.map +1 -1
- package/dist/modules/smtp/mail.util.d.ts +6 -7
- package/dist/modules/smtp/mail.util.js +9 -5
- package/dist/modules/smtp/mail.util.js.map +1 -1
- package/dist/modules/smtp/smtp.controller.d.ts +0 -3
- package/dist/modules/smtp/smtp.controller.js +14 -27
- package/dist/modules/smtp/smtp.controller.js.map +1 -1
- package/dist/modules/smtp/smtp.entity.js +15 -15
- package/dist/modules/smtp/smtp.entity.js.map +1 -1
- package/dist/modules/smtp/smtp.module.js +2 -2
- package/dist/modules/smtp/smtp.module.js.map +1 -1
- package/dist/modules/smtp/smtp.service.d.ts +0 -14
- package/dist/modules/smtp/smtp.service.js +12 -40
- package/dist/modules/smtp/smtp.service.js.map +1 -1
- package/dist/modules/tag/tag.controller.js +22 -24
- package/dist/modules/tag/tag.controller.js.map +1 -1
- package/dist/modules/tag/tag.entity.js +12 -12
- package/dist/modules/tag/tag.entity.js.map +1 -1
- package/dist/modules/tag/tag.module.js +1 -1
- package/dist/modules/tag/tag.module.js.map +1 -1
- package/dist/modules/tag/tag.service.js +4 -5
- package/dist/modules/tag/tag.service.js.map +1 -1
- package/dist/modules/user/user.controller.js +28 -39
- package/dist/modules/user/user.controller.js.map +1 -1
- package/dist/modules/user/user.entity.js +22 -22
- package/dist/modules/user/user.entity.js.map +1 -1
- package/dist/modules/user/user.module.js +2 -2
- package/dist/modules/user/user.module.js.map +1 -1
- package/dist/modules/user/user.service.js +12 -16
- package/dist/modules/user/user.service.js.map +1 -1
- package/dist/modules/view/view.controller.js +19 -20
- package/dist/modules/view/view.controller.js.map +1 -1
- package/dist/modules/view/view.entity.js +24 -24
- package/dist/modules/view/view.entity.js.map +1 -1
- package/dist/modules/view/view.module.js +1 -1
- package/dist/modules/view/view.module.js.map +1 -1
- package/dist/modules/view/view.service.js +4 -4
- package/dist/modules/view/view.service.js.map +1 -1
- package/dist/public/favicon.png +0 -0
- package/dist/starter.d.ts +1 -3
- package/dist/starter.js +14 -202
- package/dist/starter.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +15957 -1
- package/dist/utils/date.util.js +1 -1
- package/dist/utils/date.util.js.map +1 -1
- package/dist/utils/markdown.util.js +1 -1
- package/dist/utils/markdown.util.js.map +1 -1
- package/dist/utils/oss/aliyun-oss-client.d.ts +1 -3
- package/dist/utils/oss/aliyun-oss-client.js +0 -5
- package/dist/utils/oss/aliyun-oss-client.js.map +1 -1
- package/dist/utils/oss/oss-client.d.ts +1 -3
- package/dist/utils/oss/oss-client.js.map +1 -1
- package/dist/utils/oss.util.d.ts +1 -3
- package/dist/utils/oss.util.js +1 -6
- package/dist/utils/oss.util.js.map +1 -1
- package/dist/utils/uniqueid.util.js +1 -1
- package/dist/utils/uniqueid.util.js.map +1 -1
- package/dist/utils/upload.util.d.ts +2 -6
- package/dist/utils/upload.util.js +8 -23
- package/dist/utils/upload.util.js.map +1 -1
- package/dist/utils/user.util.d.ts +0 -1
- package/dist/utils/user.util.js +2 -6
- package/dist/utils/user.util.js.map +1 -1
- package/package.json +28 -21
- package/public/favicon.png +0 -0
- package/dist/common/api-messages.d.ts +0 -41
- package/dist/common/api-messages.js +0 -45
- package/dist/common/api-messages.js.map +0 -1
- package/dist/database/typeorm-options.d.ts +0 -3
- package/dist/database/typeorm-options.js +0 -60
- package/dist/database/typeorm-options.js.map +0 -1
- package/dist/modules/api-key/api-key.controller.d.ts +0 -14
- package/dist/modules/api-key/api-key.controller.js +0 -63
- package/dist/modules/api-key/api-key.controller.js.map +0 -1
- package/dist/modules/api-key/api-key.entity.d.ts +0 -11
- package/dist/modules/api-key/api-key.entity.js +0 -63
- package/dist/modules/api-key/api-key.entity.js.map +0 -1
- package/dist/modules/api-key/api-key.guard.d.ts +0 -7
- package/dist/modules/api-key/api-key.guard.js +0 -39
- package/dist/modules/api-key/api-key.guard.js.map +0 -1
- package/dist/modules/api-key/api-key.module.d.ts +0 -2
- package/dist/modules/api-key/api-key.module.js +0 -28
- package/dist/modules/api-key/api-key.module.js.map +0 -1
- package/dist/modules/api-key/api-key.service.d.ts +0 -15
- package/dist/modules/api-key/api-key.service.js +0 -81
- package/dist/modules/api-key/api-key.service.js.map +0 -1
- package/dist/modules/article/article-revision.entity.d.ts +0 -11
- package/dist/modules/article/article-revision.entity.js +0 -53
- package/dist/modules/article/article-revision.entity.js.map +0 -1
- package/dist/modules/article/article-slug.util.d.ts +0 -2
- package/dist/modules/article/article-slug.util.js +0 -19
- package/dist/modules/article/article-slug.util.js.map +0 -1
- package/dist/modules/article/scheduled-publish.service.d.ts +0 -13
- package/dist/modules/article/scheduled-publish.service.js +0 -65
- package/dist/modules/article/scheduled-publish.service.js.map +0 -1
- package/dist/modules/bootstrap/bootstrap.constants.d.ts +0 -20
- package/dist/modules/bootstrap/bootstrap.constants.js +0 -171
- package/dist/modules/bootstrap/bootstrap.constants.js.map +0 -1
- package/dist/modules/bootstrap/bootstrap.service.d.ts +0 -22
- package/dist/modules/bootstrap/bootstrap.service.js +0 -183
- package/dist/modules/bootstrap/bootstrap.service.js.map +0 -1
- package/dist/modules/bootstrap/install-locale.d.ts +0 -2
- package/dist/modules/bootstrap/install-locale.js +0 -11
- package/dist/modules/bootstrap/install-locale.js.map +0 -1
- package/dist/modules/extension/extension.module.d.ts +0 -9
- package/dist/modules/extension/extension.module.js +0 -50
- package/dist/modules/extension/extension.module.js.map +0 -1
- package/dist/modules/extension/plugin-loader.service.d.ts +0 -12
- package/dist/modules/extension/plugin-loader.service.js +0 -96
- package/dist/modules/extension/plugin-loader.service.js.map +0 -1
- package/dist/modules/extension/plugin-registry.bridge.d.ts +0 -3
- package/dist/modules/extension/plugin-registry.bridge.js +0 -44
- package/dist/modules/extension/plugin-registry.bridge.js.map +0 -1
- package/dist/modules/extension/plugin.controller.d.ts +0 -22
- package/dist/modules/extension/plugin.controller.js +0 -155
- package/dist/modules/extension/plugin.controller.js.map +0 -1
- package/dist/modules/extension/plugin.service.d.ts +0 -52
- package/dist/modules/extension/plugin.service.js +0 -391
- package/dist/modules/extension/plugin.service.js.map +0 -1
- package/dist/modules/extension/preview-draft.store.d.ts +0 -13
- package/dist/modules/extension/preview-draft.store.js +0 -41
- package/dist/modules/extension/preview-draft.store.js.map +0 -1
- package/dist/modules/extension/theme-registry.bridge.d.ts +0 -56
- package/dist/modules/extension/theme-registry.bridge.js +0 -46
- package/dist/modules/extension/theme-registry.bridge.js.map +0 -1
- package/dist/modules/extension/theme.controller.d.ts +0 -66
- package/dist/modules/extension/theme.controller.js +0 -301
- package/dist/modules/extension/theme.controller.js.map +0 -1
- package/dist/modules/extension/theme.service.d.ts +0 -140
- package/dist/modules/extension/theme.service.js +0 -1039
- package/dist/modules/extension/theme.service.js.map +0 -1
- package/dist/modules/file/file-optimization.controller.d.ts +0 -12
- package/dist/modules/file/file-optimization.controller.js +0 -79
- package/dist/modules/file/file-optimization.controller.js.map +0 -1
- package/dist/modules/file/file-optimization.service.d.ts +0 -36
- package/dist/modules/file/file-optimization.service.js +0 -385
- package/dist/modules/file/file-optimization.service.js.map +0 -1
- package/dist/modules/file/file-optimization.types.d.ts +0 -66
- package/dist/modules/file/file-optimization.types.js +0 -5
- package/dist/modules/file/file-optimization.types.js.map +0 -1
- package/dist/modules/file/image-optimizer-plugin.guard.d.ts +0 -7
- package/dist/modules/file/image-optimizer-plugin.guard.js +0 -33
- package/dist/modules/file/image-optimizer-plugin.guard.js.map +0 -1
- package/dist/modules/health/health.controller.d.ts +0 -11
- package/dist/modules/health/health.controller.js +0 -55
- package/dist/modules/health/health.controller.js.map +0 -1
- package/dist/modules/health/health.module.d.ts +0 -2
- package/dist/modules/health/health.module.js +0 -20
- package/dist/modules/health/health.module.js.map +0 -1
- package/dist/modules/hook/hook.module.d.ts +0 -2
- package/dist/modules/hook/hook.module.js +0 -22
- package/dist/modules/hook/hook.module.js.map +0 -1
- package/dist/modules/hook/hook.service.d.ts +0 -26
- package/dist/modules/hook/hook.service.js +0 -105
- package/dist/modules/hook/hook.service.js.map +0 -1
- package/dist/modules/webhook/webhook.controller.d.ts +0 -12
- package/dist/modules/webhook/webhook.controller.js +0 -63
- package/dist/modules/webhook/webhook.controller.js.map +0 -1
- package/dist/modules/webhook/webhook.entity.d.ts +0 -9
- package/dist/modules/webhook/webhook.entity.js +0 -54
- package/dist/modules/webhook/webhook.entity.js.map +0 -1
- package/dist/modules/webhook/webhook.module.d.ts +0 -2
- package/dist/modules/webhook/webhook.module.js +0 -27
- package/dist/modules/webhook/webhook.module.js.map +0 -1
- package/dist/modules/webhook/webhook.service.d.ts +0 -16
- package/dist/modules/webhook/webhook.service.js +0 -100
- package/dist/modules/webhook/webhook.service.js.map +0 -1
- package/dist/node-polyfills.d.ts +0 -18
- package/dist/node-polyfills.js +0 -24
- package/dist/node-polyfills.js.map +0 -1
- package/dist/public/apple-touch-icon.png +0 -0
- package/dist/public/favicon-16.png +0 -0
- package/dist/public/favicon-32.png +0 -0
- package/dist/public/favicon-48.png +0 -0
- package/dist/public/favicon.ico +0 -0
- package/dist/public/icon-192.png +0 -0
- package/dist/public/icon-512.png +0 -0
- package/dist/public/logo-200.png +0 -0
- package/dist/public/logo-400.png +0 -0
- package/dist/public/logo.png +0 -0
- package/dist/public/logo.svg +0 -7
- package/dist/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/dist/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/dist/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/html-sanitize.util.d.ts +0 -1
- package/dist/utils/html-sanitize.util.js +0 -33
- package/dist/utils/html-sanitize.util.js.map +0 -1
- package/dist/utils/image-processor.util.d.ts +0 -23
- package/dist/utils/image-processor.util.js +0 -88
- package/dist/utils/image-processor.util.js.map +0 -1
- package/dist/utils/local-api-quiet.util.d.ts +0 -1
- package/dist/utils/local-api-quiet.util.js +0 -8
- package/dist/utils/local-api-quiet.util.js.map +0 -1
- package/dist/utils/project-root.util.d.ts +0 -2
- package/dist/utils/project-root.util.js +0 -42
- package/dist/utils/project-root.util.js.map +0 -1
- package/dist/utils/query-whitelist.util.d.ts +0 -1
- package/dist/utils/query-whitelist.util.js +0 -100
- package/dist/utils/query-whitelist.util.js.map +0 -1
- package/dist/utils/theme-placeholder-cover.d.ts +0 -8
- package/dist/utils/theme-placeholder-cover.js +0 -94
- package/dist/utils/theme-placeholder-cover.js.map +0 -1
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon-48.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/icon-192.png +0 -0
- package/public/icon-512.png +0 -0
- package/public/logo-200.png +0 -0
- package/public/logo-400.png +0 -0
- package/public/logo.png +0 -0
- package/public/logo.svg +0 -7
- package/public/uploads/2026-05-30/QR3X4UZQ93ZTUPGXCFA9II..png +0 -0
- package/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8.webp +0 -0
- package/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_medium.webp +0 -0
- package/public/uploads/2026-05-31/BXQV3NX9ZVWHGNOSX9AXD8_thumb.webp +0 -0
- package/public/uploads/2026-05-31/I2SZC0ONA7CF31UM46MN56..jpg +0 -0
|
@@ -10,9 +10,6 @@ export declare class Setting {
|
|
|
10
10
|
systemFavicon: string;
|
|
11
11
|
systemNoticeInfo: string;
|
|
12
12
|
systemFooterInfo: string;
|
|
13
|
-
aboutUsGithubUrl: string;
|
|
14
|
-
aboutUsCommentQr: string;
|
|
15
|
-
aboutUsWechatQr: string;
|
|
16
13
|
adminSystemUrl: string;
|
|
17
14
|
baiduAnalyticsId: string;
|
|
18
15
|
googleAnalyticsId: string;
|
|
@@ -15,133 +15,118 @@ const typeorm_1 = require("typeorm");
|
|
|
15
15
|
let Setting = class Setting {
|
|
16
16
|
};
|
|
17
17
|
__decorate([
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
swagger_1.ApiProperty(),
|
|
19
|
+
typeorm_1.PrimaryGeneratedColumn('uuid'),
|
|
20
20
|
__metadata("design:type", String)
|
|
21
21
|
], Setting.prototype, "id", void 0);
|
|
22
22
|
__decorate([
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
swagger_1.ApiProperty(),
|
|
24
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
25
25
|
__metadata("design:type", String)
|
|
26
26
|
], Setting.prototype, "i18n", void 0);
|
|
27
27
|
__decorate([
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
swagger_1.ApiProperty(),
|
|
29
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
30
30
|
__metadata("design:type", String)
|
|
31
31
|
], Setting.prototype, "globalSetting", void 0);
|
|
32
32
|
__decorate([
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
swagger_1.ApiProperty(),
|
|
34
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
35
35
|
__metadata("design:type", String)
|
|
36
36
|
], Setting.prototype, "systemUrl", void 0);
|
|
37
37
|
__decorate([
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
swagger_1.ApiProperty(),
|
|
39
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
40
40
|
__metadata("design:type", String)
|
|
41
41
|
], Setting.prototype, "systemTitle", void 0);
|
|
42
42
|
__decorate([
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
swagger_1.ApiProperty(),
|
|
44
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
45
45
|
__metadata("design:type", String)
|
|
46
46
|
], Setting.prototype, "systemSubTitle", void 0);
|
|
47
47
|
__decorate([
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
swagger_1.ApiProperty(),
|
|
49
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
50
50
|
__metadata("design:type", String)
|
|
51
51
|
], Setting.prototype, "systemLogo", void 0);
|
|
52
52
|
__decorate([
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
swagger_1.ApiProperty(),
|
|
54
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
55
55
|
__metadata("design:type", String)
|
|
56
56
|
], Setting.prototype, "systemBg", void 0);
|
|
57
57
|
__decorate([
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
swagger_1.ApiProperty(),
|
|
59
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
60
60
|
__metadata("design:type", String)
|
|
61
61
|
], Setting.prototype, "systemFavicon", void 0);
|
|
62
62
|
__decorate([
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
swagger_1.ApiProperty(),
|
|
64
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
65
65
|
__metadata("design:type", String)
|
|
66
66
|
], Setting.prototype, "systemNoticeInfo", void 0);
|
|
67
67
|
__decorate([
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
swagger_1.ApiProperty(),
|
|
69
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
70
70
|
__metadata("design:type", String)
|
|
71
71
|
], Setting.prototype, "systemFooterInfo", void 0);
|
|
72
72
|
__decorate([
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
__metadata("design:type", String)
|
|
76
|
-
], Setting.prototype, "aboutUsGithubUrl", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, swagger_1.ApiProperty)(),
|
|
79
|
-
(0, typeorm_1.Column)({ type: 'text', default: null }),
|
|
80
|
-
__metadata("design:type", String)
|
|
81
|
-
], Setting.prototype, "aboutUsCommentQr", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
(0, swagger_1.ApiProperty)(),
|
|
84
|
-
(0, typeorm_1.Column)({ type: 'text', default: null }),
|
|
85
|
-
__metadata("design:type", String)
|
|
86
|
-
], Setting.prototype, "aboutUsWechatQr", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
(0, swagger_1.ApiProperty)(),
|
|
89
|
-
(0, typeorm_1.Column)({ type: 'text', default: null }),
|
|
73
|
+
swagger_1.ApiProperty(),
|
|
74
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
90
75
|
__metadata("design:type", String)
|
|
91
76
|
], Setting.prototype, "adminSystemUrl", void 0);
|
|
92
77
|
__decorate([
|
|
93
|
-
|
|
94
|
-
|
|
78
|
+
swagger_1.ApiProperty(),
|
|
79
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
95
80
|
__metadata("design:type", String)
|
|
96
81
|
], Setting.prototype, "baiduAnalyticsId", void 0);
|
|
97
82
|
__decorate([
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
swagger_1.ApiProperty(),
|
|
84
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
100
85
|
__metadata("design:type", String)
|
|
101
86
|
], Setting.prototype, "googleAnalyticsId", void 0);
|
|
102
87
|
__decorate([
|
|
103
|
-
|
|
104
|
-
|
|
88
|
+
swagger_1.ApiProperty(),
|
|
89
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
105
90
|
__metadata("design:type", String)
|
|
106
91
|
], Setting.prototype, "seoKeyword", void 0);
|
|
107
92
|
__decorate([
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
swagger_1.ApiProperty(),
|
|
94
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
110
95
|
__metadata("design:type", String)
|
|
111
96
|
], Setting.prototype, "seoDesc", void 0);
|
|
112
97
|
__decorate([
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
swagger_1.ApiProperty(),
|
|
99
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
115
100
|
__metadata("design:type", String)
|
|
116
101
|
], Setting.prototype, "oss", void 0);
|
|
117
102
|
__decorate([
|
|
118
|
-
|
|
119
|
-
|
|
103
|
+
swagger_1.ApiProperty(),
|
|
104
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
120
105
|
__metadata("design:type", String)
|
|
121
106
|
], Setting.prototype, "smtpHost", void 0);
|
|
122
107
|
__decorate([
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
swagger_1.ApiProperty(),
|
|
109
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
125
110
|
__metadata("design:type", String)
|
|
126
111
|
], Setting.prototype, "smtpPort", void 0);
|
|
127
112
|
__decorate([
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
swagger_1.ApiProperty(),
|
|
114
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
130
115
|
__metadata("design:type", String)
|
|
131
116
|
], Setting.prototype, "smtpUser", void 0);
|
|
132
117
|
__decorate([
|
|
133
|
-
|
|
134
|
-
|
|
118
|
+
swagger_1.ApiProperty(),
|
|
119
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
135
120
|
__metadata("design:type", String)
|
|
136
121
|
], Setting.prototype, "smtpPass", void 0);
|
|
137
122
|
__decorate([
|
|
138
|
-
|
|
139
|
-
|
|
123
|
+
swagger_1.ApiProperty(),
|
|
124
|
+
typeorm_1.Column({ type: 'text', default: null }),
|
|
140
125
|
__metadata("design:type", String)
|
|
141
126
|
], Setting.prototype, "smtpFromUser", void 0);
|
|
142
127
|
__decorate([
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
swagger_1.ApiProperty(),
|
|
129
|
+
typeorm_1.CreateDateColumn({
|
|
145
130
|
type: 'datetime',
|
|
146
131
|
comment: '创建时间',
|
|
147
132
|
name: 'create_at',
|
|
@@ -149,8 +134,8 @@ __decorate([
|
|
|
149
134
|
__metadata("design:type", Date)
|
|
150
135
|
], Setting.prototype, "createAt", void 0);
|
|
151
136
|
__decorate([
|
|
152
|
-
|
|
153
|
-
|
|
137
|
+
swagger_1.ApiProperty(),
|
|
138
|
+
typeorm_1.UpdateDateColumn({
|
|
154
139
|
type: 'datetime',
|
|
155
140
|
comment: '更新时间',
|
|
156
141
|
name: 'update_at',
|
|
@@ -158,7 +143,7 @@ __decorate([
|
|
|
158
143
|
__metadata("design:type", Date)
|
|
159
144
|
], Setting.prototype, "updateAt", void 0);
|
|
160
145
|
Setting = __decorate([
|
|
161
|
-
|
|
146
|
+
typeorm_1.Entity()
|
|
162
147
|
], Setting);
|
|
163
148
|
exports.Setting = Setting;
|
|
164
149
|
//# sourceMappingURL=setting.entity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setting.entity.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qCAAqG;
|
|
1
|
+
{"version":3,"file":"setting.entity.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA8C;AAC9C,qCAAqG;AAGrG,IAAa,OAAO,GAApB,MAAa,OAAO;CAwGnB,CAAA;AArGC;IAFC,qBAAW,EAAE;IACb,gCAAsB,CAAC,MAAM,CAAC;;mCACpB;AAIX;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;qCAC3B;AAIb;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CAClB;AAItB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;0CACtB;AAIlB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;4CACpB;AAIpB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;+CACjB;AAIvB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;2CACrB;AAInB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCACvB;AAIjB;IAFC,qBAAW,EAAE;IACb,gBAAM,CA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AM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCACvB;AAIjB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;yCACvB;AAIjB;IAFC,qBAAW,EAAE;IACb,gBAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;6CACnB;AAQrB;IANC,qBAAW,EAAE;IACb,0BAAgB,CAAC;QAChB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,WAAW;KAClB,CAAC;8BACQ,IAAI;yCAAC;AAQf;IANC,qBAAW,EAAE;IACb,0BAAgB,CAAC;QAChB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,MAAM;QACf,IAAI,EAAE,WAAW;KAClB,CAAC;8BACQ,IAAI;yCAAC;AAvGJ,OAAO;IADnB,gBAAM,EAAE;GACI,OAAO,CAwGnB;AAxGY,0BAAO"}
|
|
@@ -17,8 +17,8 @@ const setting_service_1 = require("./setting.service");
|
|
|
17
17
|
let SettingModule = class SettingModule {
|
|
18
18
|
};
|
|
19
19
|
SettingModule = __decorate([
|
|
20
|
-
|
|
21
|
-
imports: [typeorm_1.TypeOrmModule.forFeature([setting_entity_1.Setting]),
|
|
20
|
+
common_1.Module({
|
|
21
|
+
imports: [typeorm_1.TypeOrmModule.forFeature([setting_entity_1.Setting]), common_1.forwardRef(() => user_module_1.UserModule), common_1.forwardRef(() => auth_module_1.AuthModule)],
|
|
22
22
|
exports: [setting_service_1.SettingService],
|
|
23
23
|
providers: [setting_service_1.SettingService],
|
|
24
24
|
controllers: [setting_controller_1.SettingController],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setting.module.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,6CAAgD;AAEhD,qDAAiD;AACjD,qDAAiD;AACjD,6DAAyD;AACzD,qDAA2C;AAC3C,uDAAmD;
|
|
1
|
+
{"version":3,"file":"setting.module.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAoD;AACpD,6CAAgD;AAEhD,qDAAiD;AACjD,qDAAiD;AACjD,6DAAyD;AACzD,qDAA2C;AAC3C,uDAAmD;AAQnD,IAAa,aAAa,GAA1B,MAAa,aAAa;CAAG,CAAA;AAAhB,aAAa;IANzB,eAAM,CAAC;QACN,OAAO,EAAE,CAAC,uBAAa,CAAC,UAAU,CAAC,CAAC,wBAAO,CAAC,CAAC,EAAE,mBAAU,CAAC,GAAG,EAAE,CAAC,wBAAU,CAAC,EAAE,mBAAU,CAAC,GAAG,EAAE,CAAC,wBAAU,CAAC,CAAC;QAC1G,OAAO,EAAE,CAAC,gCAAc,CAAC;QACzB,SAAS,EAAE,CAAC,gCAAc,CAAC;QAC3B,WAAW,EAAE,CAAC,sCAAiB,CAAC;KACjC,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa"}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
-
import { ConfigService } from '@nestjs/config';
|
|
3
1
|
import { Repository } from 'typeorm';
|
|
4
2
|
import { Setting } from './setting.entity';
|
|
5
|
-
export declare class SettingService
|
|
3
|
+
export declare class SettingService {
|
|
6
4
|
private readonly settingRepository;
|
|
7
|
-
|
|
8
|
-
constructor(settingRepository: Repository<Setting>, configService: ConfigService);
|
|
9
|
-
onModuleInit(): void;
|
|
10
|
-
private runInitializers;
|
|
11
|
-
getSettingRow(): Promise<Setting>;
|
|
12
|
-
private settingRowScore;
|
|
13
|
-
private ensureSettingRow;
|
|
5
|
+
constructor(settingRepository: Repository<Setting>);
|
|
14
6
|
initI18n(): Promise<void>;
|
|
15
7
|
initGlobalConfig(): Promise<void>;
|
|
16
|
-
initSystemSettings(): Promise<void>;
|
|
17
|
-
migrateLegacyAppearance(): Promise<void>;
|
|
18
|
-
initThemeConfigurations(): Promise<void>;
|
|
19
8
|
findAll(innerInvoke?: boolean, isAdmin?: boolean): Promise<Setting>;
|
|
20
9
|
update(setting: Partial<Setting>): Promise<Setting>;
|
|
21
10
|
}
|
|
@@ -13,76 +13,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SettingService = void 0;
|
|
16
|
-
const theme_1 = require("../../../../toolkit/dist/theme");
|
|
17
16
|
const common_1 = require("@nestjs/common");
|
|
18
|
-
const config_1 = require("@nestjs/config");
|
|
19
17
|
const typeorm_1 = require("@nestjs/typeorm");
|
|
20
18
|
const merge = require("deepmerge");
|
|
21
19
|
const typeorm_2 = require("typeorm");
|
|
22
20
|
const setting_constant_1 = require("./setting.constant");
|
|
23
21
|
const setting_entity_1 = require("./setting.entity");
|
|
24
|
-
const bootstrap_constants_1 = require("../bootstrap/bootstrap.constants");
|
|
25
|
-
const install_locale_1 = require("../bootstrap/install-locale");
|
|
26
|
-
const THEMES_WITH_CONFIGURATION = ['reactpress-theme-starter'];
|
|
27
|
-
function trimUrl(url) {
|
|
28
|
-
return url.replace(/\/+$/, '');
|
|
29
|
-
}
|
|
30
22
|
let SettingService = class SettingService {
|
|
31
|
-
constructor(settingRepository
|
|
23
|
+
constructor(settingRepository) {
|
|
32
24
|
this.settingRepository = settingRepository;
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
onModuleInit() {
|
|
36
|
-
void this.runInitializers();
|
|
37
|
-
}
|
|
38
|
-
async runInitializers() {
|
|
39
|
-
try {
|
|
40
|
-
await this.initI18n();
|
|
41
|
-
await this.initGlobalConfig();
|
|
42
|
-
await this.initSystemSettings();
|
|
43
|
-
await this.migrateLegacyAppearance();
|
|
44
|
-
await this.initThemeConfigurations();
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.error('[SettingService] initialization failed:', error);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async getSettingRow() {
|
|
51
|
-
return this.ensureSettingRow();
|
|
52
|
-
}
|
|
53
|
-
settingRowScore(row) {
|
|
54
|
-
var _a, _b, _c;
|
|
55
|
-
return ((((_a = row.globalSetting) === null || _a === void 0 ? void 0 : _a.trim()) ? 4 : 0) +
|
|
56
|
-
(((_b = row.i18n) === null || _b === void 0 ? void 0 : _b.trim()) ? 2 : 0) +
|
|
57
|
-
(((_c = row.systemTitle) === null || _c === void 0 ? void 0 : _c.trim()) ? 1 : 0));
|
|
58
|
-
}
|
|
59
|
-
async ensureSettingRow() {
|
|
60
|
-
const items = await this.settingRepository.find({ order: { createAt: 'ASC' } });
|
|
61
|
-
if (items.length === 0) {
|
|
62
|
-
return this.settingRepository.save(this.settingRepository.create({}));
|
|
63
|
-
}
|
|
64
|
-
if (items.length === 1)
|
|
65
|
-
return items[0];
|
|
66
|
-
const sorted = [...items].sort((a, b) => this.settingRowScore(b) - this.settingRowScore(a));
|
|
67
|
-
const primary = Object.assign({}, sorted[0]);
|
|
68
|
-
for (const row of sorted.slice(1)) {
|
|
69
|
-
for (const key of Object.keys(row)) {
|
|
70
|
-
if (key === 'id' || key === 'createAt' || key === 'updateAt')
|
|
71
|
-
continue;
|
|
72
|
-
const val = row[key];
|
|
73
|
-
const current = primary[key];
|
|
74
|
-
if (val != null && String(val).trim() !== '' && (current == null || String(current).trim() === '')) {
|
|
75
|
-
primary[key] = val;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const saved = await this.settingRepository.save(primary);
|
|
80
|
-
await this.settingRepository.remove(sorted.slice(1));
|
|
81
|
-
return saved;
|
|
25
|
+
this.initI18n();
|
|
26
|
+
this.initGlobalConfig();
|
|
82
27
|
}
|
|
83
28
|
async initI18n() {
|
|
84
29
|
try {
|
|
85
|
-
const
|
|
30
|
+
const items = await this.settingRepository.find();
|
|
31
|
+
const target = (items && items[0]) || {};
|
|
86
32
|
let data = {};
|
|
87
33
|
try {
|
|
88
34
|
if (target.i18n) {
|
|
@@ -110,142 +56,51 @@ let SettingService = class SettingService {
|
|
|
110
56
|
}
|
|
111
57
|
}
|
|
112
58
|
async initGlobalConfig() {
|
|
113
|
-
|
|
114
|
-
const target =
|
|
59
|
+
const items = await this.settingRepository.find();
|
|
60
|
+
const target = (items && items[0]) || {};
|
|
115
61
|
let data = {};
|
|
116
62
|
try {
|
|
117
63
|
if (target.globalSetting) {
|
|
118
64
|
data = JSON.parse(target.globalSetting);
|
|
119
65
|
}
|
|
120
66
|
}
|
|
121
|
-
catch (
|
|
67
|
+
catch (e) {
|
|
122
68
|
data = {};
|
|
123
69
|
}
|
|
124
|
-
const
|
|
125
|
-
const defaultTheme = (0, theme_1.getThemeStateFromGlobalSetting)(setting_constant_1.settings);
|
|
126
|
-
const mergedTheme = Object.assign(Object.assign(Object.assign({}, defaultTheme), themeState), { mods: Object.assign(Object.assign({}, defaultTheme.mods), themeState.mods), installedThemes: ((_a = themeState.installedThemes) === null || _a === void 0 ? void 0 : _a.length) > 0 ? themeState.installedThemes : defaultTheme.installedThemes });
|
|
127
|
-
const mergedSettings = Object.assign(Object.assign({}, data), { theme: mergedTheme });
|
|
70
|
+
const mergedSettings = merge({}, setting_constant_1.settings, data);
|
|
128
71
|
const mergedSettingsString = JSON.stringify(mergedSettings);
|
|
129
72
|
if (!target.globalSetting || target.globalSetting !== mergedSettingsString) {
|
|
130
73
|
target.globalSetting = mergedSettingsString;
|
|
131
74
|
await this.settingRepository.save(target);
|
|
132
75
|
}
|
|
133
76
|
}
|
|
134
|
-
async initSystemSettings() {
|
|
135
|
-
const locale = (0, install_locale_1.resolveInstallLocale)(this.configService.get('REACTPRESS_LANG') || this.configService.get('LANG'));
|
|
136
|
-
const clientSiteUrl = this.configService.get('CLIENT_SITE_URL', 'http://localhost:3001');
|
|
137
|
-
const urlDefaults = {
|
|
138
|
-
systemUrl: clientSiteUrl,
|
|
139
|
-
adminSystemUrl: `${trimUrl(clientSiteUrl)}/admin/`,
|
|
140
|
-
};
|
|
141
|
-
const target = await this.ensureSettingRow();
|
|
142
|
-
let changed = false;
|
|
143
|
-
const merged = Object.assign(Object.assign({}, (0, bootstrap_constants_1.getSystemSettingSeedDefaults)(locale)), urlDefaults);
|
|
144
|
-
for (const [key, defaultValue] of Object.entries(merged)) {
|
|
145
|
-
const current = target[key];
|
|
146
|
-
if (current != null && String(current).trim() !== '')
|
|
147
|
-
continue;
|
|
148
|
-
target[key] = defaultValue;
|
|
149
|
-
changed = true;
|
|
150
|
-
}
|
|
151
|
-
if (!changed)
|
|
152
|
-
return;
|
|
153
|
-
await this.settingRepository.save(target);
|
|
154
|
-
console.log(`[SettingService] system settings seeded with built-in defaults (${locale})`);
|
|
155
|
-
}
|
|
156
|
-
async migrateLegacyAppearance() {
|
|
157
|
-
const target = await this.ensureSettingRow();
|
|
158
|
-
if (!target.id && !target.globalSetting)
|
|
159
|
-
return;
|
|
160
|
-
let gs = {};
|
|
161
|
-
try {
|
|
162
|
-
if (target.globalSetting) {
|
|
163
|
-
gs = JSON.parse(target.globalSetting);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
catch (_a) {
|
|
167
|
-
gs = {};
|
|
168
|
-
}
|
|
169
|
-
const { global, changed } = (0, theme_1.migrateLegacyAppearanceToThemeMods)(gs, target);
|
|
170
|
-
if (changed) {
|
|
171
|
-
target.globalSetting = JSON.stringify(global);
|
|
172
|
-
await this.settingRepository.save(target);
|
|
173
|
-
console.log('[SettingService] legacy appearance migrated to theme mods');
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
async initThemeConfigurations() {
|
|
177
|
-
const target = await this.ensureSettingRow();
|
|
178
|
-
let gs = {};
|
|
179
|
-
try {
|
|
180
|
-
if (target.globalSetting) {
|
|
181
|
-
gs = JSON.parse(target.globalSetting);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (_a) {
|
|
185
|
-
gs = {};
|
|
186
|
-
}
|
|
187
|
-
const themeState = (0, theme_1.getThemeStateFromGlobalSetting)(gs);
|
|
188
|
-
const activeTheme = themeState.activeTheme || 'hello-world';
|
|
189
|
-
const config = gs.config && typeof gs.config === 'object'
|
|
190
|
-
? Object.assign({}, gs.config)
|
|
191
|
-
: {};
|
|
192
|
-
let changed = false;
|
|
193
|
-
for (const themeId of THEMES_WITH_CONFIGURATION) {
|
|
194
|
-
const seed = (0, theme_1.getThemeConfigurationSeed)(themeId, 'zh');
|
|
195
|
-
if (!seed)
|
|
196
|
-
continue;
|
|
197
|
-
const current = config[themeId];
|
|
198
|
-
const merged = merge({}, seed, current && typeof current === 'object' ? current : {});
|
|
199
|
-
const mergedStr = JSON.stringify(merged);
|
|
200
|
-
const prevStr = JSON.stringify(current !== null && current !== void 0 ? current : {});
|
|
201
|
-
if (mergedStr !== prevStr) {
|
|
202
|
-
config[themeId] = merged;
|
|
203
|
-
changed = true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (!gs.config && Object.keys(config).length) {
|
|
207
|
-
changed = true;
|
|
208
|
-
}
|
|
209
|
-
if (changed) {
|
|
210
|
-
gs.config = config;
|
|
211
|
-
target.globalSetting = JSON.stringify(gs);
|
|
212
|
-
await this.settingRepository.save(target);
|
|
213
|
-
console.log(`[SettingService] theme config seeded (active: ${activeTheme})`);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
77
|
async findAll(innerInvoke = false, isAdmin = false) {
|
|
217
|
-
const
|
|
78
|
+
const data = await this.settingRepository.find();
|
|
79
|
+
const res = data[0];
|
|
218
80
|
if (!res) {
|
|
219
81
|
return {};
|
|
220
82
|
}
|
|
221
|
-
if (
|
|
83
|
+
if (innerInvoke || isAdmin) {
|
|
222
84
|
return res;
|
|
223
85
|
}
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
return
|
|
86
|
+
const filterRes = setting_constant_1.UNPROTECTED_KEYS.reduce((a, c) => {
|
|
87
|
+
a[c] = res[c];
|
|
88
|
+
return a;
|
|
89
|
+
}, {});
|
|
90
|
+
return filterRes;
|
|
229
91
|
}
|
|
230
92
|
async update(setting) {
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
delete sanitized.smtpPass;
|
|
236
|
-
}
|
|
237
|
-
if (Object.keys(sanitized).length === 0) {
|
|
238
|
-
return old !== null && old !== void 0 ? old : {};
|
|
239
|
-
}
|
|
240
|
-
const updatedTag = await this.settingRepository.merge(old, sanitized);
|
|
93
|
+
const old = await this.settingRepository.find();
|
|
94
|
+
const updatedTag = old && old[0]
|
|
95
|
+
? await this.settingRepository.merge(old[0], setting)
|
|
96
|
+
: await this.settingRepository.create(setting);
|
|
241
97
|
return this.settingRepository.save(updatedTag);
|
|
242
98
|
}
|
|
243
99
|
};
|
|
244
100
|
SettingService = __decorate([
|
|
245
|
-
|
|
246
|
-
__param(0,
|
|
247
|
-
__metadata("design:paramtypes", [typeorm_2.Repository
|
|
248
|
-
config_1.ConfigService])
|
|
101
|
+
common_1.Injectable(),
|
|
102
|
+
__param(0, typeorm_1.InjectRepository(setting_entity_1.Setting)),
|
|
103
|
+
__metadata("design:paramtypes", [typeorm_2.Repository])
|
|
249
104
|
], SettingService);
|
|
250
105
|
exports.SettingService = SettingService;
|
|
251
106
|
//# sourceMappingURL=setting.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setting.service.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"setting.service.js","sourceRoot":"","sources":["../../../src/modules/setting/setting.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6CAAmD;AACnD,mCAAmC;AACnC,qCAAqC;AAErC,yDAAsE;AACtE,qDAA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EAAE,EAAE;YACjD,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACd,OAAO,CAAC,CAAC;QACX,CAAC,EAAE,EAAE,CAAY,CAAC;QAElB,OAAO,SAAS,CAAC;IACnB,CAAC;IAOD,KAAK,CAAC,MAAM,CAAC,OAAyB;QACpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAEhD,MAAM,UAAU,GACd,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;YACX,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;YACrD,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AA3GY,cAAc;IAD1B,mBAAU,EAAE;IAGR,WAAA,0BAAgB,CAAC,wBAAO,CAAC,CAAA;qCACU,oBAAU;GAHrC,cAAc,CA2G1B;AA3GY,wCAAc"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
host:
|
|
3
|
-
port:
|
|
4
|
-
user:
|
|
5
|
-
pass:
|
|
6
|
-
}
|
|
7
|
-
export declare const sendEmail: (message: Record<string, unknown>, { host, port, user, pass }: SmtpTransportConfig) => Promise<unknown>;
|
|
1
|
+
export declare const sendEmail: (message: any, { host, port, user, pass }: {
|
|
2
|
+
host: any;
|
|
3
|
+
port: any;
|
|
4
|
+
user: any;
|
|
5
|
+
pass: any;
|
|
6
|
+
}) => Promise<unknown>;
|
|
@@ -5,14 +5,18 @@ const nodemailer = require('nodemailer');
|
|
|
5
5
|
const sendEmail = (message, { host, port, user, pass }) => {
|
|
6
6
|
if (!host || !port || !user || !pass) {
|
|
7
7
|
console.log('邮箱配置不正确,无法发送邮件');
|
|
8
|
-
return
|
|
8
|
+
return null;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const transport = nodemailer.createTransport({
|
|
11
|
+
host,
|
|
12
|
+
port,
|
|
13
|
+
secureConnection: true,
|
|
14
|
+
secure: true,
|
|
15
|
+
auth: {
|
|
13
16
|
user,
|
|
14
17
|
pass,
|
|
15
|
-
}
|
|
18
|
+
},
|
|
19
|
+
});
|
|
16
20
|
return new Promise((resolve, reject) => {
|
|
17
21
|
transport.sendMail(message, function (err, info) {
|
|
18
22
|
if (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mail.util.js","sourceRoot":"","sources":["../../../src/modules/smtp/mail.util.ts"],"names":[],"mappings":";;;AACA,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"mail.util.js","sourceRoot":"","sources":["../../../src/modules/smtp/mail.util.ts"],"names":[],"mappings":";;;AACA,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAElC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;IAC/D,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;QACpC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,UAAU,CAAC,eAAe,CAAC;QAC3C,IAAI;QACJ,IAAI;QACJ,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE;YACJ,IAAI;YACJ,IAAI;SACL;KACF,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAS,GAAG,EAAE,IAAI;YAC5C,IAAI,GAAG,EAAE;gBACP,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;gBAC3B,MAAM,CAAC,GAAG,CAAC,CAAC;aACb;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC,CAAC;aACf;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB"}
|
|
@@ -4,9 +4,6 @@ export declare class SMTPController {
|
|
|
4
4
|
private readonly smtpService;
|
|
5
5
|
constructor(smtpService: SMTPService);
|
|
6
6
|
create(data: any): Promise<SMTP>;
|
|
7
|
-
testSend(data: any): Promise<{
|
|
8
|
-
ok: true;
|
|
9
|
-
}>;
|
|
10
7
|
findAll(queryParam: any): Promise<[SMTP[], number]>;
|
|
11
8
|
deleteById(id: any): Promise<SMTP>;
|
|
12
9
|
}
|