mirror of https://github.com/certd/certd
chore: lib-server
parent
a13203fb3f
commit
a4e2cc54e6
|
@ -30,14 +30,11 @@ services:
|
||||||
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码,可以设置为true,重启之后,管理员密码将改成123456,然后请及时修改回false
|
# ↑↑↑↑↑--------------------------- 如果忘记管理员密码,可以设置为true,重启之后,管理员密码将改成123456,然后请及时修改回false
|
||||||
- certd_cron_immediateTriggerOnce=false
|
- certd_cron_immediateTriggerOnce=false
|
||||||
# ↑↑↑↑↑--------------------------- 如果设置为true,启动后所有配置了cron的流水线任务都将被立即触发一次
|
# ↑↑↑↑↑--------------------------- 如果设置为true,启动后所有配置了cron的流水线任务都将被立即触发一次
|
||||||
- VITE_APP_ICP_NO=
|
- certd_site_icp_no=
|
||||||
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号
|
# ↑↑↑↑↑ ----------------------------------------- 这里可以设置备案号
|
||||||
#- certd_koa_key=./data/ssl/cert.key
|
#- certd_koa_key=./data/ssl/cert.key
|
||||||
#- certd_koa_cert=./data/ssl/cert.crt
|
#- certd_koa_cert=./data/ssl/cert.crt
|
||||||
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key,则表示https方式启动,使用https协议访问,https://your.domain:7001
|
# ↑↑↑↑↑ ----------------------------------------- 配置证书和key,则表示https方式启动,使用https协议访问,https://your.domain:7001
|
||||||
# 设置环境变量即可自定义certd配置
|
# 设置环境变量即可自定义certd配置
|
||||||
# 服务端配置项见: packages/ui/certd-server/src/config/config.default.ts
|
# 配置项见: packages/ui/certd-server/src/config/config.default.ts
|
||||||
# 服务端配置规则: certd_ + 配置项, 点号用_代替
|
# 配置规则: certd_ + 配置项, 点号用_代替
|
||||||
|
|
||||||
# 客户端配置项见: packages/ui/certd-client/.env
|
|
||||||
# 按实际名称配置环境变量即可,如: VITE_APP_API=http://localhost:7001
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"asn1js": "^3.0.5",
|
"asn1js": "^3.0.5",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"debug": "^4.3.5",
|
"debug": "^4.3.5",
|
||||||
"https-proxy-agent": "^7.0.4",
|
"https-proxy-agent": "^7.0.5",
|
||||||
"node-forge": "^1.3.1"
|
"node-forge": "^1.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@certd/basic": "^1.25.9",
|
"@certd/basic": "^1.25.9",
|
||||||
"@certd/plus-core": "^1.25.9",
|
"@certd/plus-core": "^1.25.9",
|
||||||
|
"nanoid": "^5.0.7",
|
||||||
"axios": "^1.7.2",
|
"axios": "^1.7.2",
|
||||||
"fix-path": "^4.0.0",
|
"fix-path": "^4.0.0",
|
||||||
"http-proxy-agent": "^7.0.2",
|
"http-proxy-agent": "^7.0.2",
|
||||||
|
|
|
@ -8,6 +8,7 @@ export * from "./util.promise.js";
|
||||||
export * from "./util.hash.js";
|
export * from "./util.hash.js";
|
||||||
export * from "./util.merge.js";
|
export * from "./util.merge.js";
|
||||||
export * from "./util.cache.js";
|
export * from "./util.cache.js";
|
||||||
|
import { nanoid } from "nanoid";
|
||||||
import { mergeUtils } from "./util.merge.js";
|
import { mergeUtils } from "./util.merge.js";
|
||||||
import { sp } from "./util.sp.js";
|
import { sp } from "./util.sp.js";
|
||||||
import { hashUtils } from "./util.hash.js";
|
import { hashUtils } from "./util.hash.js";
|
||||||
|
@ -25,4 +26,5 @@ export const utils = {
|
||||||
_,
|
_,
|
||||||
mergeUtils,
|
mergeUtils,
|
||||||
cache,
|
cache,
|
||||||
|
nanoid,
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
logs/
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
node_modules/
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
coverage/
|
||||||
|
!dist/
|
||||||
|
.idea/
|
||||||
|
run/
|
||||||
|
.DS_Store
|
||||||
|
*.sw*
|
||||||
|
*.un~
|
||||||
|
.tsbuildinfo
|
||||||
|
.tsbuildinfo.*
|
||||||
|
/data/db.sqlite
|
|
@ -0,0 +1,11 @@
|
||||||
|
# 🎨 editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "./node_modules/mwts/",
|
||||||
|
"ignorePatterns": ["node_modules", "dist", "test", "jest.config.js", "typings"],
|
||||||
|
"env": {
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
*.local
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.idea
|
||||||
|
.DS_Store
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
||||||
|
test/user.secret.ts
|
||||||
|
|
||||||
|
tsconfig.tsbuildinfo
|
|
@ -0,0 +1,2 @@
|
||||||
|
node_modules
|
||||||
|
src
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"printWidth": 160,
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "es5",
|
||||||
|
"arrowParens": "avoid"
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
# Change Log
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [1.25.9](https://github.com/certd/certd/compare/v1.25.8...v1.25.9) (2024-10-01)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.8](https://github.com/certd/certd/compare/v1.25.7...v1.25.8) (2024-09-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.7](https://github.com/certd/certd/compare/v1.25.6...v1.25.7) (2024-09-29)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.6](https://github.com/certd/certd/compare/v1.25.5...v1.25.6) (2024-09-29)
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* 部署支持1Panel ([d047234](https://github.com/certd/certd/commit/d047234d98d31504f2e5a472b66e1b75806af26e))
|
||||||
|
|
||||||
|
## [1.25.5](https://github.com/certd/certd/compare/v1.25.4...v1.25.5) (2024-09-26)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.4](https://github.com/certd/certd/compare/v1.25.3...v1.25.4) (2024-09-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.3](https://github.com/certd/certd/compare/v1.25.2...v1.25.3) (2024-09-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.2](https://github.com/certd/certd/compare/v1.25.1...v1.25.2) (2024-09-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.25.1](https://github.com/certd/certd/compare/v1.25.0...v1.25.1) (2024-09-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
# [1.25.0](https://github.com/certd/certd/compare/v1.24.4...v1.25.0) (2024-09-24)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.24.4](https://github.com/certd/certd/compare/v1.24.3...v1.24.4) (2024-09-09)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.22.6](https://github.com/certd/certd/compare/v1.22.5...v1.22.6) (2024-08-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.22.3](https://github.com/certd/certd/compare/v1.22.2...v1.22.3) (2024-07-25)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.22.2](https://github.com/certd/certd/compare/v1.22.1...v1.22.2) (2024-07-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
## [1.22.1](https://github.com/certd/certd/compare/v1.22.0...v1.22.1) (2024-07-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @certd/midway-flyway-js
|
||||||
|
|
||||||
|
# [1.22.0](https://github.com/certd/certd/compare/v1.21.2...v1.22.0) (2024-07-19)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* 升级midway,支持esm ([485e603](https://github.com/certd/certd/commit/485e603b5165c28bc08694997726eaf2a585ebe7))
|
||||||
|
* 支持postgresql ([3b19bfb](https://github.com/certd/certd/commit/3b19bfb4291e89064b3b407a80dae092d54747d5))
|
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Greper
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
|
@ -0,0 +1,16 @@
|
||||||
|
# Vue 3 + TypeScript + Vite
|
||||||
|
|
||||||
|
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||||
|
|
||||||
|
## Recommended IDE Setup
|
||||||
|
|
||||||
|
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
|
||||||
|
|
||||||
|
## Type Support For `.vue` Imports in TS
|
||||||
|
|
||||||
|
Since TypeScript cannot handle type information for `.vue` imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in `.vue` imports (for example to get props validation when using manual `h(...)` calls), you can enable Volar's Take Over mode by following these steps:
|
||||||
|
|
||||||
|
1. Run `Extensions: Show Built-in Extensions` from VS Code's command palette, look for `TypeScript and JavaScript Language Features`, then right click and select `Disable (Workspace)`. By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
|
||||||
|
2. Reload the VS Code window by running `Developer: Reload Window` from the command palette.
|
||||||
|
|
||||||
|
You can learn more about Take Over mode [here](https://github.com/johnsoncodehk/volar/discussions/471).
|
|
@ -0,0 +1,125 @@
|
||||||
|
# midway-flyway-js
|
||||||
|
|
||||||
|
[English](./README.md) | [简体中文](./README_zhCN.md)
|
||||||
|
|
||||||
|
|
||||||
|
`midway-flyway-js`是基于typeorm的flyway的js实现。
|
||||||
|
本项目被构建为midway组件,可与midway无缝集成。
|
||||||
|
|
||||||
|
# flyway
|
||||||
|
flyway是一款java版本的数据库升级迁移解决方案。
|
||||||
|
它能在server启动时自动检查脚本目录,执行sql升级脚本,记录执行历史。
|
||||||
|
|
||||||
|
本项目根据类似flyway的思路实现数据库升级迁移方案
|
||||||
|
|
||||||
|
# 快速开始
|
||||||
|
|
||||||
|
## 1. 准备
|
||||||
|
* nodejs环境
|
||||||
|
* midway项目
|
||||||
|
* [配置typeorm](https://www.yuque.com/midwayjs/midway_v2/orm)
|
||||||
|
|
||||||
|
## 2. 安装
|
||||||
|
```
|
||||||
|
npm install midway-flyway-js
|
||||||
|
# or
|
||||||
|
yarn add midway-flyway-js
|
||||||
|
```
|
||||||
|
## 3. 集成
|
||||||
|
```js
|
||||||
|
import * as orm from 'typeorm';
|
||||||
|
import * as flyway from 'midway-flyway-js';
|
||||||
|
@Configuration({
|
||||||
|
imports: [
|
||||||
|
orm, // 加载 orm 组件
|
||||||
|
flyway, //加载flyway组件
|
||||||
|
],
|
||||||
|
})
|
||||||
|
export class ContainerConfiguration {}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 4. 配置参数【可选】
|
||||||
|
`/src/config/config.default.js`文件
|
||||||
|
```js
|
||||||
|
export const flyway ={
|
||||||
|
// 脚本目录
|
||||||
|
// 默认值 "./db/migrition"
|
||||||
|
scriptDir:"./db/migrition",
|
||||||
|
// 基线,基线脚本及之前的脚本都跳过不执行
|
||||||
|
// 默认值:null
|
||||||
|
// 如果你原本就是空数据库,那么不需要配置此项
|
||||||
|
baseline: 'v1__init.sql',
|
||||||
|
// 执行记录表名
|
||||||
|
// 默认值 flyway_history
|
||||||
|
flywayTableName:'flyway_history',
|
||||||
|
// 是否允许hash值不同
|
||||||
|
// 默认值:false
|
||||||
|
// 相同名称sql文件被改动后,hash会变化
|
||||||
|
// 此时运行会报hash conflict错误
|
||||||
|
// 配置此参数为true,将忽略hash conflict错误
|
||||||
|
allowHashNotMatch:false
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
## 5. 编写升级sql
|
||||||
|
|
||||||
|
将你的sql升级脚本,放到 `/src/db/migrition`目录下
|
||||||
|
|
||||||
|
建议命名规则`v{version}__{name}.sql`,例如`v1__init.sql`
|
||||||
|
|
||||||
|
|
||||||
|
## 6. 启动你的midway服务
|
||||||
|
```
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7. 运行效果
|
||||||
|
以下效果为midway自动启动后,自动执行`v1__init.sql`脚本的记录
|
||||||
|
```
|
||||||
|
2021-06-26 15:45:39,630 INFO 12245 [ midfly ] start-------------
|
||||||
|
query: SELECT * FROM "sqlite_master" WHERE "type" = 'table' AND "name" = 'flyway_history'
|
||||||
|
query: CREATE TABLE "flyway_history" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "timestamp" bigint NOT NULL, "name" varchar NOT NULL, "hash" varchar, "success" boolean)
|
||||||
|
query: BEGIN TRANSACTION
|
||||||
|
query: SELECT "FlywayHistory"."id" AS "FlywayHistory_id", "FlywayHistory"."name" AS "FlywayHistory_name", "FlywayHistory"."hash" AS "FlywayHistory_hash", "FlywayHistory"."timestamp" AS "FlywayHistory_timestamp", "FlywayHistory"."success" AS "FlywayHistory_success" FROM "flyway_history" "FlywayHistory" WHERE "FlywayHistory"."name" = ? AND "FlywayHistory"."success" = ? LIMIT 1 -- PARAMETERS: ["v1__init.sql",1]
|
||||||
|
2021-06-26 15:45:39,664 INFO 12245 need exec script file:
|
||||||
|
2021-06-26 15:45:39,666 INFO 12245 [ midfly ] exec
|
||||||
|
query: -- 表:sys_permission
|
||||||
|
CREATE TABLE "sys_permission" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(100) NOT NULL, "permission" varchar(100), "parent_id" integer NOT NULL DEFAULT (-1), "sort" integer NOT NULL, "create_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP));
|
||||||
|
query: INSERT INTO sys_permission (id, title, permission, parent_id, sort, create_time, update_time) VALUES (1, '系统管理', 'sys', -1, 1, 1, 1624085863636);
|
||||||
|
query: -- 表:sys_role
|
||||||
|
CREATE TABLE "sys_role" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(100) NOT NULL, "create_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP));
|
||||||
|
query: INSERT INTO sys_role (id, name, create_time, update_time) VALUES (1, '管理员', 1, 1623749138537);
|
||||||
|
query: -- 表:sys_role_permission
|
||||||
|
CREATE TABLE "sys_role_permission" ("role_id" integer NOT NULL, "permission_id" integer NOT NULL, PRIMARY KEY ("role_id", "permission_id"));
|
||||||
|
query: INSERT INTO sys_role_permission (role_id, permission_id) VALUES (1, 1);
|
||||||
|
query: -- 表:sys_user
|
||||||
|
CREATE TABLE "sys_user" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "username" varchar(100) NOT NULL, "password" varchar(50) NOT NULL, "nick_name" varchar(50), "avatar" varchar(255), "phone_code" varchar(20), "mobile" varchar(20), "email" varchar(100),"remark" varchar(100), "status" integer NOT NULL DEFAULT (1), "create_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "update_time" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP));
|
||||||
|
query: INSERT INTO sys_user (id, username, password, nick_name, avatar, phone_code, mobile, email, status, create_time, update_time,remark) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 'admin', NULL, NULL, NULL, NULL, 1, 2011123132, 123132,NULL);
|
||||||
|
query: -- 表:sys_user_role
|
||||||
|
CREATE TABLE "sys_user_role" ("role_id" integer NOT NULL, "user_id" integer NOT NULL, PRIMARY KEY ("role_id", "user_id"));
|
||||||
|
query: INSERT INTO sys_user_role (role_id, user_id) VALUES (1, 1);
|
||||||
|
query: -- 索引:IDX_223de54d6badbe43a5490450c3
|
||||||
|
CREATE UNIQUE INDEX "IDX_223de54d6badbe43a5490450c3" ON "sys_role" ("name");
|
||||||
|
query: -- 索引:IDX_9e7164b2f1ea1348bc0eb0a7da
|
||||||
|
CREATE UNIQUE INDEX "IDX_9e7164b2f1ea1348bc0eb0a7da" ON "sys_user" ("username");
|
||||||
|
query: DELETE FROM "flyway_history" WHERE "name" = ? -- PARAMETERS: ["v1__init.sql"]
|
||||||
|
query: INSERT INTO "flyway_history"("id", "name", "hash", "timestamp", "success") VALUES (NULL, ?, ?, ?, ?) -- PARAMETERS: ["v1__init.sql","0c661bd7afebac224bbaa60bc5bb56e9",1624693539781,1]
|
||||||
|
query: SELECT "FlywayHistory"."id" AS "FlywayHistory_id", "FlywayHistory"."success" AS "FlywayHistory_success" FROM "flyway_history" "FlywayHistory" WHERE "FlywayHistory"."id" = ? -- PARAMETERS: [1]
|
||||||
|
query: COMMIT
|
||||||
|
2021-06-26 15:45:39,800 INFO 12245 [ midfly ] end-------------
|
||||||
|
```
|
||||||
|
|
||||||
|
# 注意事项
|
||||||
|
1. 升级sql文件最后一行请不要有注释,应该以一条sql语句的分号结尾。
|
||||||
|
|
||||||
|
# 他们在用
|
||||||
|
* [fs-server-js](https://github.com/fast-crud/fs-server-js)
|
||||||
|
|
||||||
|
# 参考项目
|
||||||
|
* [flyway](https://github.com/flyway/flyway) : java版flyway
|
||||||
|
* [flyway-js](https://github.com/wanglihui/flyway-js) : Sequelize版flyway
|
||||||
|
|
||||||
|
感谢以上项目
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
module.exports = {
|
||||||
|
preset: 'ts-jest',
|
||||||
|
testEnvironment: 'node',
|
||||||
|
testPathIgnorePatterns: ['<rootDir>/test/fixtures'],
|
||||||
|
coveragePathIgnorePatterns: ['<rootDir>/test/'],
|
||||||
|
};
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"type": "sqlite",
|
||||||
|
"database": "./data/db.sqlite",
|
||||||
|
"synchronize": false,
|
||||||
|
"logging": true,
|
||||||
|
"entities": [ "src/**/entity.ts"]
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"name": "@certd/lib-server",
|
||||||
|
"version": "1.25.9",
|
||||||
|
"description": "midway with flyway, sql upgrade way ",
|
||||||
|
"private": false,
|
||||||
|
"type": "module",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts",
|
||||||
|
"scripts": {
|
||||||
|
"before-build": "rimraf dist && rimraf tsconfig.tsbuildinfo && rimraf .rollup.cache",
|
||||||
|
"build": "npm run before-build && tsc --skipLibCheck",
|
||||||
|
"test": "midway-bin test --ts -V",
|
||||||
|
"test1": "midway-bin test --ts -V -f test/blank.test.ts -t 'hash-check'",
|
||||||
|
"cov": "midway-bin cov --ts",
|
||||||
|
"lint": "mwts check",
|
||||||
|
"lint:fix": "mwts fix",
|
||||||
|
"prepublish": "npm run build",
|
||||||
|
"pub": "npm publish"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "greper",
|
||||||
|
"files": [
|
||||||
|
"dist/**/*.js",
|
||||||
|
"dist/**/*.d.ts"
|
||||||
|
],
|
||||||
|
"license": "AGPL",
|
||||||
|
"dependencies": {
|
||||||
|
"@certd/pipeline": "^1.25.9",
|
||||||
|
"@midwayjs/core": "^3",
|
||||||
|
"@midwayjs/i18n": "^3",
|
||||||
|
"@midwayjs/info": "^3",
|
||||||
|
"@midwayjs/koa": "^3",
|
||||||
|
"@midwayjs/logger": "^3",
|
||||||
|
"@midwayjs/typeorm": "^3",
|
||||||
|
"@midwayjs/cache": "^3",
|
||||||
|
"better-sqlite3": "^11.1.2",
|
||||||
|
"typeorm": "^0.3.20",
|
||||||
|
"lodash-es": "^4.17.21"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"mwts": "^1.3.0",
|
||||||
|
"mwtsc": "^1.4.0",
|
||||||
|
"@rollup/plugin-commonjs": "^23.0.4",
|
||||||
|
"@rollup/plugin-json": "^6.0.0",
|
||||||
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.3",
|
||||||
|
"@rollup/plugin-typescript": "^11.0.0",
|
||||||
|
"@types/chai": "^4.3.3",
|
||||||
|
"@types/node": "^18",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.38.1",
|
||||||
|
"@typescript-eslint/parser": "^5.38.1",
|
||||||
|
"cross-env": "^6.0.0",
|
||||||
|
"eslint": "^8.24.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-plugin-import": "^2.26.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"prettier": "^2.8.8",
|
||||||
|
"rimraf": "^5.0.5",
|
||||||
|
"rollup": "^3.7.4",
|
||||||
|
"rollup-plugin-visualizer": "^5.8.2",
|
||||||
|
"ts-node": "^10.9.1",
|
||||||
|
"tslib": "^2.5.2",
|
||||||
|
"typeorm": "^0.3.11",
|
||||||
|
"typescript": "^5.4.2"
|
||||||
|
},
|
||||||
|
"gitHead": "afa8155fda10f9a32427b351454b460897295a2c"
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
import { Inject } from '@midwayjs/core';
|
import { Inject } from '@midwayjs/core';
|
||||||
import { Context } from '@midwayjs/koa';
|
import * as koa from '@midwayjs/koa';
|
||||||
import { Constants } from './constants.js';
|
import { Constants } from './constants.js';
|
||||||
|
|
||||||
export abstract class BaseController {
|
export abstract class BaseController {
|
||||||
@Inject()
|
@Inject()
|
||||||
ctx: Context;
|
ctx: koa.Context;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成功返回
|
* 成功返回
|
|
@ -1,6 +1,6 @@
|
||||||
import { ValidateException } from './exception/validation-exception.js';
|
import { ValidateException } from './exception/index.js';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
import { PermissionException } from './exception/permission-exception.js';
|
import { PermissionException } from './exception/index.js';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { Inject } from '@midwayjs/core';
|
import { Inject } from '@midwayjs/core';
|
||||||
import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
|
import { TypeORMDataSourceManager } from '@midwayjs/typeorm';
|
|
@ -0,0 +1,7 @@
|
||||||
|
export * from './auth-exception.js'
|
||||||
|
export * from './base-exception.js'
|
||||||
|
export * from './permission-exception.js'
|
||||||
|
export * from './preview-exception.js'
|
||||||
|
export * from './validation-exception.js'
|
||||||
|
export * from './vip-exception.js'
|
||||||
|
export * from './common-exception.js'
|
|
@ -0,0 +1,7 @@
|
||||||
|
export * from './base-controller.js';
|
||||||
|
export * from './constants.js';
|
||||||
|
export * from './crud-controller.js';
|
||||||
|
export * from './enum-item.js';
|
||||||
|
export * from './exception/index.js';
|
||||||
|
export * from './result.js';
|
||||||
|
export * from './base-service.js';
|
|
@ -0,0 +1,11 @@
|
||||||
|
import type { IMidwayContainer } from '@midwayjs/core';
|
||||||
|
import { Configuration } from '@midwayjs/core';
|
||||||
|
import { logger } from '@certd/pipeline';
|
||||||
|
@Configuration({
|
||||||
|
namespace: 'lib-server',
|
||||||
|
})
|
||||||
|
export class LibServerConfiguration {
|
||||||
|
async onReady(container: IMidwayContainer) {
|
||||||
|
logger.info('lib start');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { SysSettingsEntity } from './system/index.js';
|
||||||
|
|
||||||
|
export * from './basic/index.js';
|
||||||
|
export * from './system/index.js';
|
||||||
|
export { LibServerConfiguration as Configuration } from './configuration.js';
|
||||||
|
|
||||||
|
export const libServerEntities = [SysSettingsEntity];
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './settings/index.js';
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
@Entity('sys_settings')
|
||||||
|
export class SysSettingsEntity {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
@Column({ comment: 'key', length: 100 })
|
||||||
|
key: string;
|
||||||
|
@Column({ comment: '名称', length: 100 })
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
@Column({ name: 'setting', comment: '设置', length: 1024, nullable: true })
|
||||||
|
setting: string;
|
||||||
|
|
||||||
|
// public 公开读,私有写, private 私有读,私有写
|
||||||
|
@Column({ name: 'access', comment: '访问权限' })
|
||||||
|
access: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
name: 'create_time',
|
||||||
|
comment: '创建时间',
|
||||||
|
default: () => 'CURRENT_TIMESTAMP',
|
||||||
|
})
|
||||||
|
createTime: Date;
|
||||||
|
@Column({
|
||||||
|
name: 'update_time',
|
||||||
|
comment: '修改时间',
|
||||||
|
default: () => 'CURRENT_TIMESTAMP',
|
||||||
|
})
|
||||||
|
updateTime: Date;
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
export * from './service/sys-settings-service.js';
|
||||||
|
export * from './service/models.js';
|
||||||
|
export * from './entity/sys-settings.js';
|
|
@ -7,6 +7,7 @@ export class BaseSettings {
|
||||||
return 'settings.' + this.__key__;
|
return 'settings.' + this.__key__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SysPublicSettings extends BaseSettings {
|
export class SysPublicSettings extends BaseSettings {
|
||||||
static __key__ = 'sys.public';
|
static __key__ = 'sys.public';
|
||||||
static __title__ = '系统公共设置';
|
static __title__ = '系统公共设置';
|
|
@ -1,13 +1,11 @@
|
||||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
|
||||||
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
||||||
import { CacheManager } from '@midwayjs/cache';
|
import { CacheManager } from '@midwayjs/cache';
|
||||||
import { BaseSettings, SysPublicSettings } from './models.js';
|
import { BaseSettings, SysPrivateSettings, SysPublicSettings } from './models.js';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
|
import { BaseService } from '../../../basic/index.js';
|
||||||
export type SysPrivateSettings = NonNullable<unknown>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置
|
* 设置
|
|
@ -0,0 +1,4 @@
|
||||||
|
end -----
|
||||||
|
```
|
||||||
|
# test
|
||||||
|
The last line of the SQL file should be uncommented and should end with a semicolon of the SQL statement.
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"compileOnSave": true,
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"inlineSourceMap":true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"stripInternal": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"pretty": true,
|
||||||
|
"declaration": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"typeRoots": [ "./typings", "./node_modules/@types"],
|
||||||
|
"outDir": "dist",
|
||||||
|
"rootDir": "src",
|
||||||
|
"composite": true,
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"strict": false,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts",
|
||||||
|
"src/**/*.d.ts",
|
||||||
|
"src/**/*.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"*.js",
|
||||||
|
"*.ts",
|
||||||
|
"dist",
|
||||||
|
"node_modules",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
}
|
|
@ -55,7 +55,7 @@ export function errorLog(error: any) {
|
||||||
if (error.response?.data?.message) {
|
if (error.response?.data?.message) {
|
||||||
message = error.response.data.message;
|
message = error.response.data.message;
|
||||||
}
|
}
|
||||||
if (message.indexOf("ssl3_get_record:wrong version number" > -1)) {
|
if (message.indexOf("ssl3_get_record:wrong version number") >= 0) {
|
||||||
message = "http协议错误,服务端要求http协议,请检查是否使用了https请求";
|
message = "http协议错误,服务端要求http协议,请检查是否使用了https请求";
|
||||||
}
|
}
|
||||||
// 显示提示
|
// 显示提示
|
||||||
|
|
|
@ -150,35 +150,69 @@ function openUpgrade() {
|
||||||
content: () => {
|
content: () => {
|
||||||
const vipLabel = userStore.vipLabel;
|
const vipLabel = userStore.vipLabel;
|
||||||
return (
|
return (
|
||||||
<div class="mt-10 mb-10">
|
<div class="mt-10 mb-10 vip-active-modal">
|
||||||
<div>
|
<div class="vip-type-vs">
|
||||||
<a-row gutter={20}>
|
<a-row gutter={20}>
|
||||||
<a-col span={8}>
|
<a-col span={8}>
|
||||||
<h3 class="block-header">免费版</h3>
|
<h3 class="block-header">免费版</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>证书申请功能无限制</li>
|
<li>
|
||||||
<li>证书流水线数量限制10条</li>
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>证书申请功能无限制
|
||||||
<li>部分部署插件不可用</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
证书流水线数量10条
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
常用的部署插件
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col span={8}>
|
<a-col span={8}>
|
||||||
<h3 class="block-header">专业版</h3>
|
<h3 class="block-header">专业版</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>可加VIP群,需求优先实现</li>
|
<li>
|
||||||
<li>证书流水线数量无限制</li>
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
<li>免配置发邮件功能</li>
|
可加VIP群,需求优先实现
|
||||||
<li>宝塔、易盾、群晖、cdnfly、1Panel等部署插件</li>
|
</li>
|
||||||
<li>多用户有限制</li>
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
证书流水线数量无限制
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
免配置发邮件功能
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
支持宝塔、易盾、群晖、cdnfly、1Panel等部署插件
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col span={8}>
|
<a-col span={8}>
|
||||||
<h3 class="block-header">商业版</h3>
|
<h3 class="block-header">商业版</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>拥有专业版所有特权</li>
|
<li>
|
||||||
<li>修改logo、标题</li>
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
<li>多用户无限制</li>
|
拥有专业版所有特权
|
||||||
<li>支持用户支付</li>
|
</li>
|
||||||
<li>允许商用</li>
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
修改logo、标题
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
多用户无限制
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
支持用户支付
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<fs-icon class="color-green" icon="ion:checkmark-sharp"></fs-icon>
|
||||||
|
允许商用
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
@ -224,4 +258,18 @@ function openUpgrade() {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vip-active-modal {
|
||||||
|
ul {
|
||||||
|
list-style-type: unset;
|
||||||
|
margin-left: 0px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.vip-type-vs {
|
||||||
|
.fs-icon {
|
||||||
|
margin-right: 5px;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -86,6 +86,7 @@ import { env } from "../utils/util.env";
|
||||||
import FsThemeModeSet from "./components/theme/mode-set.vue";
|
import FsThemeModeSet from "./components/theme/mode-set.vue";
|
||||||
import VipButton from "/@/components/vip-button/index.vue";
|
import VipButton from "/@/components/vip-button/index.vue";
|
||||||
import TutorialButton from "/@/components/tutorial/index.vue";
|
import TutorialButton from "/@/components/tutorial/index.vue";
|
||||||
|
import { useUserStore } from "/@/store/modules/user";
|
||||||
export default {
|
export default {
|
||||||
name: "LayoutFramework",
|
name: "LayoutFramework",
|
||||||
// eslint-disable-next-line vue/no-unused-components
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
|
@ -130,7 +131,10 @@ export default {
|
||||||
const version = ref(import.meta.env.VITE_APP_VERSION);
|
const version = ref(import.meta.env.VITE_APP_VERSION);
|
||||||
|
|
||||||
const envRef = ref(env);
|
const envRef = ref(env);
|
||||||
|
|
||||||
|
const userStore = useUserStore();
|
||||||
return {
|
return {
|
||||||
|
userStore,
|
||||||
version,
|
version,
|
||||||
frameworkMenus,
|
frameworkMenus,
|
||||||
headerMenus,
|
headerMenus,
|
||||||
|
|
|
@ -75,6 +75,33 @@ export const sysResources = [
|
||||||
},
|
},
|
||||||
path: "/sys/account",
|
path: "/sys/account",
|
||||||
component: "/sys/account/index.vue"
|
component: "/sys/account/index.vue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "站点个性化",
|
||||||
|
name: "site",
|
||||||
|
meta: {
|
||||||
|
icon: "ion:document-text-outline",
|
||||||
|
permission: "sys:settings:view"
|
||||||
|
},
|
||||||
|
component: "/sys/site/index.vue"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "商业版设置",
|
||||||
|
name: "/sys/commercial",
|
||||||
|
meta: {
|
||||||
|
icon: "ion:document-text-outline",
|
||||||
|
permission: "sys:settings:view"
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: "套餐设置",
|
||||||
|
name: "suite",
|
||||||
|
meta: {
|
||||||
|
icon: "ion:document-text-outline",
|
||||||
|
permission: "sys:settings:view"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
// @ts-ignore
|
||||||
|
import { request } from "/src/api/service";
|
||||||
|
const apiPrefix = "/sys/settings";
|
||||||
|
|
||||||
|
export const SettingKeys = {
|
||||||
|
SysPublic: "sys.public",
|
||||||
|
SysPrivate: "sys.private"
|
||||||
|
};
|
||||||
|
export async function SettingsGet(key: string) {
|
||||||
|
return await request({
|
||||||
|
url: apiPrefix + "/get",
|
||||||
|
method: "post",
|
||||||
|
params: {
|
||||||
|
key
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function SettingsSave(key: string, setting: any) {
|
||||||
|
await request({
|
||||||
|
url: apiPrefix + "/save",
|
||||||
|
method: "post",
|
||||||
|
data: {
|
||||||
|
key,
|
||||||
|
setting: JSON.stringify(setting)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function PublicSettingsSave(setting: any) {
|
||||||
|
await request({
|
||||||
|
url: apiPrefix + "/savePublicSettings",
|
||||||
|
method: "post",
|
||||||
|
data: setting
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function stopOtherUserTimer() {
|
||||||
|
await request({
|
||||||
|
url: apiPrefix + "/stopOtherUserTimer",
|
||||||
|
method: "post"
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,92 @@
|
||||||
|
<template>
|
||||||
|
<fs-page class="page-sys-settings">
|
||||||
|
<template #header>
|
||||||
|
<div class="title">站点个性化设置</div>
|
||||||
|
</template>
|
||||||
|
<div class="sys-settings-form">
|
||||||
|
<a-form
|
||||||
|
:model="formState"
|
||||||
|
name="basic"
|
||||||
|
:label-col="{ span: 8 }"
|
||||||
|
:wrapper-col="{ span: 16 }"
|
||||||
|
autocomplete="off"
|
||||||
|
@finish="onFinish"
|
||||||
|
@finish-failed="onFinishFailed"
|
||||||
|
>
|
||||||
|
<a-form-item label="开启自助注册" name="registerEnabled">
|
||||||
|
<a-switch v-model:checked="formState.registerEnabled" />
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item label="管理其他用户流水线" name="managerOtherUserPipeline">
|
||||||
|
<a-switch v-model:checked="formState.managerOtherUserPipeline" />
|
||||||
|
</a-form-item>
|
||||||
|
<!-- <a-form-item label="启动后触发流水线" name="triggerOnStartup">-->
|
||||||
|
<!-- <a-switch v-model:checked="formState.triggerOnStartup" />-->
|
||||||
|
<!-- <div class="helper">启动后自动触发一次所有已启用的流水线</div>-->
|
||||||
|
<!-- </a-form-item>-->
|
||||||
|
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
<a-button type="primary" html-type="submit">保存</a-button>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
|
<!-- <a-descriptions label="系统维护操作">-->
|
||||||
|
<!-- <a-descriptions-item label="自动化任务">-->
|
||||||
|
<!-- <a-button @click="stopOtherUserTimer">停止所有其他用户的定时任务</a-button>-->
|
||||||
|
<!-- </a-descriptions-item>-->
|
||||||
|
<!-- </a-descriptions>-->
|
||||||
|
</div>
|
||||||
|
</fs-page>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { reactive } from "vue";
|
||||||
|
import * as api from "./api";
|
||||||
|
import { PublicSettingsSave, SettingKeys } from "./api";
|
||||||
|
import { notification } from "ant-design-vue";
|
||||||
|
import { useSettingStore } from "/src/store/modules/settings";
|
||||||
|
|
||||||
|
interface FormState {
|
||||||
|
title: string;
|
||||||
|
logo: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formState = reactive<Partial<FormState>>({
|
||||||
|
registerEnabled: false,
|
||||||
|
managerOtherUserPipeline: false
|
||||||
|
});
|
||||||
|
|
||||||
|
async function loadSysPublicSettings() {
|
||||||
|
const data: any = await api.SettingsGet(SettingKeys.SysPublic);
|
||||||
|
const setting = JSON.parse(data.setting);
|
||||||
|
Object.assign(formState, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
loadSysPublicSettings();
|
||||||
|
const settingsStore = useSettingStore();
|
||||||
|
const onFinish = async (form: any) => {
|
||||||
|
await api.PublicSettingsSave(form);
|
||||||
|
await settingsStore.loadSysSettings();
|
||||||
|
notification.success({
|
||||||
|
message: "保存成功"
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
|
// console.log("Failed:", errorInfo);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function stopOtherUserTimer() {
|
||||||
|
await api.stopOtherUserTimer();
|
||||||
|
notification.success({
|
||||||
|
message: "停止成功"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.page-sys-settings {
|
||||||
|
.sys-settings-form {
|
||||||
|
width: 500px;
|
||||||
|
margin: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -17,21 +17,23 @@
|
||||||
# password: root
|
# password: root
|
||||||
# database: postgres
|
# database: postgres
|
||||||
|
|
||||||
typeorm:
|
#typeorm:
|
||||||
dataSource:
|
# dataSource:
|
||||||
default:
|
# default:
|
||||||
database: './data/db-comm.sqlite'
|
# database: './data/db-comm.sqlite'
|
||||||
#plus:
|
|
||||||
# server:
|
|
||||||
# baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
|
||||||
plus:
|
plus:
|
||||||
server:
|
server:
|
||||||
baseUrls: ['http://127.0.0.1:11007']
|
baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
||||||
|
|
||||||
account:
|
account:
|
||||||
server:
|
server:
|
||||||
baseUrl: 'http://127.0.0.1:1017/subject'
|
baseUrl: 'https://ai.handsfree.work/subject'
|
||||||
|
|
||||||
|
|
||||||
|
#plus:
|
||||||
|
# server:
|
||||||
|
# baseUrls: ['http://127.0.0.1:11007']
|
||||||
|
#
|
||||||
#account:
|
#account:
|
||||||
# server:
|
# server:
|
||||||
# baseUrl: 'https://ai.handsfree.work/subject'
|
# baseUrl: 'http://127.0.0.1:1017/subject'
|
||||||
|
|
|
@ -5,7 +5,7 @@ const { Bootstrap } = require('@midwayjs/bootstrap');
|
||||||
const DirectoryFileDetector = require('@midwayjs/core').DirectoryFileDetector;
|
const DirectoryFileDetector = require('@midwayjs/core').DirectoryFileDetector;
|
||||||
|
|
||||||
const baseDir = process.cwd();
|
const baseDir = process.cwd();
|
||||||
const pipelineDir = baseDir + './node_modules/@certd/pipeline';
|
const pipelineDir = baseDir + './node_modules/@certd/pipeline/dist';
|
||||||
const customFileDetector = new DirectoryFileDetector({
|
const customFileDetector = new DirectoryFileDetector({
|
||||||
loadDir: [baseDir, pipelineDir],
|
loadDir: [baseDir, pipelineDir],
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
"@alicloud/pop-core": "^1.7.10",
|
"@alicloud/pop-core": "^1.7.10",
|
||||||
"@certd/acme-client": "^1.25.9",
|
"@certd/acme-client": "^1.25.9",
|
||||||
"@certd/lib-huawei": "^1.25.9",
|
"@certd/lib-huawei": "^1.25.9",
|
||||||
|
"@certd/lib-server": "^1.25.9",
|
||||||
"@certd/commercial-core": "^1.25.9",
|
"@certd/commercial-core": "^1.25.9",
|
||||||
"@certd/lib-jdcloud": "^1.25.9",
|
"@certd/lib-jdcloud": "^1.25.9",
|
||||||
"@certd/lib-k8s": "^1.25.9",
|
"@certd/lib-k8s": "^1.25.9",
|
||||||
|
@ -64,7 +65,7 @@
|
||||||
"lru-cache": "^10.2.0",
|
"lru-cache": "^10.2.0",
|
||||||
"md5": "^2.3.0",
|
"md5": "^2.3.0",
|
||||||
"mwtsc": "^1.4.0",
|
"mwtsc": "^1.4.0",
|
||||||
"nanoid": "^4.0.0",
|
"nanoid": "^5.0.7",
|
||||||
"nodemailer": "^6.9.3",
|
"nodemailer": "^6.9.3",
|
||||||
"pg": "^8.12.0",
|
"pg": "^8.12.0",
|
||||||
"qiniu": "^7.12.0",
|
"qiniu": "^7.12.0",
|
||||||
|
|
|
@ -12,6 +12,8 @@ import { PipelineEntity } from '../modules/pipeline/entity/pipeline.js';
|
||||||
//import { logger } from '../utils/logger';
|
//import { logger } from '../utils/logger';
|
||||||
// load .env file in process.cwd
|
// load .env file in process.cwd
|
||||||
import { mergeConfig } from './loader.js';
|
import { mergeConfig } from './loader.js';
|
||||||
|
import { libServerEntities } from '@certd/lib-server';
|
||||||
|
import { commercialEntities } from '@certd/commercial-core';
|
||||||
|
|
||||||
const env = process.env.NODE_ENV || 'development';
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
|
@ -63,7 +65,7 @@ const development = {
|
||||||
logging: false,
|
logging: false,
|
||||||
|
|
||||||
// 配置实体模型 或者 entities: '/entity',
|
// 配置实体模型 或者 entities: '/entity',
|
||||||
entities: ['**/modules/*/entity/*.ts', '**/entity/*.js', '**/entity/*.d.ts', PipelineEntity, FlywayHistory, UserEntity],
|
entities: ['**/modules/*/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,7 +2,7 @@ import path from 'path';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { logger } from '../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
|
|
||||||
function parseEnv(defaultConfig: any) {
|
function parseEnv(defaultConfig: any) {
|
||||||
const config = {};
|
const config = {};
|
||||||
|
|
|
@ -11,10 +11,11 @@ import cors from '@koa/cors';
|
||||||
import { GlobalExceptionMiddleware } from './middleware/global-exception.js';
|
import { GlobalExceptionMiddleware } from './middleware/global-exception.js';
|
||||||
import { PreviewMiddleware } from './middleware/preview.js';
|
import { PreviewMiddleware } from './middleware/preview.js';
|
||||||
import { AuthorityMiddleware } from './middleware/authority.js';
|
import { AuthorityMiddleware } from './middleware/authority.js';
|
||||||
import { logger } from './utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { ResetPasswdMiddleware } from './middleware/reset-passwd/middleware.js';
|
import { ResetPasswdMiddleware } from './middleware/reset-passwd/middleware.js';
|
||||||
import DefaultConfig from './config/config.default.js';
|
import DefaultConfig from './config/config.default.js';
|
||||||
|
import * as libServer from '@certd/lib-server';
|
||||||
|
import * as commercial from '@certd/commercial-core';
|
||||||
process.on('uncaughtException', error => {
|
process.on('uncaughtException', error => {
|
||||||
console.error('未捕获的异常:', error);
|
console.error('未捕获的异常:', error);
|
||||||
// 在这里可以添加日志记录、发送错误通知等操作
|
// 在这里可以添加日志记录、发送错误通知等操作
|
||||||
|
@ -33,6 +34,8 @@ process.on('uncaughtException', error => {
|
||||||
component: info,
|
component: info,
|
||||||
enabledEnvironment: ['local'],
|
enabledEnvironment: ['local'],
|
||||||
},
|
},
|
||||||
|
libServer,
|
||||||
|
commercial,
|
||||||
],
|
],
|
||||||
importConfigs: [
|
importConfigs: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Init, Inject, MidwayWebRouterService, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Init, Inject, MidwayWebRouterService, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import { Constants } from '../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { logger } from '../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { AuthService } from '../modules/authority/service/auth-service.js';
|
import { AuthService } from '../modules/authority/service/auth-service.js';
|
||||||
import { SysSettingsService } from '../modules/system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysPrivateSettings } from '../modules/system/service/models.js';
|
import { SysPrivateSettings } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限校验
|
* 权限校验
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide } from '@midwayjs/core';
|
import { Provide } from '@midwayjs/core';
|
||||||
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
|
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
|
||||||
import { logger } from '../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { Result } from '../basic/result.js';
|
import { Result } from '@certd/lib-server';
|
||||||
|
|
||||||
@Provide()
|
@Provide()
|
||||||
export class GlobalExceptionMiddleware implements IWebMiddleware {
|
export class GlobalExceptionMiddleware implements IWebMiddleware {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Config, Provide } from '@midwayjs/core';
|
import { Config, Provide } from '@midwayjs/core';
|
||||||
import { IMidwayKoaContext, NextFunction, IWebMiddleware } from '@midwayjs/koa';
|
import { IMidwayKoaContext, NextFunction, IWebMiddleware } from '@midwayjs/koa';
|
||||||
import { PreviewException } from '../basic/exception/preview-exception.js';
|
import { PreviewException } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预览模式
|
* 预览模式
|
||||||
|
@ -30,15 +30,10 @@ export class PreviewMiddleware implements IWebMiddleware {
|
||||||
if (url.indexOf('?') !== -1) {
|
if (url.indexOf('?') !== -1) {
|
||||||
url = url.substring(0, url.indexOf('?'));
|
url = url.substring(0, url.indexOf('?'));
|
||||||
}
|
}
|
||||||
const isModify =
|
const isModify = url.endsWith('update') || url.endsWith('delete') || url.endsWith('authz');
|
||||||
url.endsWith('update') ||
|
|
||||||
url.endsWith('delete') ||
|
|
||||||
url.endsWith('authz');
|
|
||||||
const isPreviewId = id < 1000;
|
const isPreviewId = id < 1000;
|
||||||
if (this.preview && isModify && isPreviewId) {
|
if (this.preview && isModify && isPreviewId) {
|
||||||
throw new PreviewException(
|
throw new PreviewException('对不起,预览环境不允许修改此数据,如需体验请添加新数据');
|
||||||
'对不起,预览环境不允许修改此数据,如需体验请添加新数据'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
await next();
|
await next();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
import {
|
import { Autoload, Config, Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
Autoload,
|
|
||||||
Config,
|
|
||||||
Init,
|
|
||||||
Inject,
|
|
||||||
Provide,
|
|
||||||
Scope,
|
|
||||||
ScopeEnum,
|
|
||||||
} from '@midwayjs/core';
|
|
||||||
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
|
||||||
import { CommonException } from '../../basic/exception/common-exception.js';
|
import { CommonException } from '@certd/lib-server';
|
||||||
import { UserService } from '../../modules/authority/service/user-service.js';
|
import { UserService } from '../../modules/authority/service/user-service.js';
|
||||||
import { logger } from '../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码模式
|
* 重置密码模式
|
||||||
|
@ -26,9 +18,7 @@ export class ResetPasswdMiddleware implements IWebMiddleware {
|
||||||
resolve() {
|
resolve() {
|
||||||
return async (ctx: IMidwayKoaContext, next: NextFunction) => {
|
return async (ctx: IMidwayKoaContext, next: NextFunction) => {
|
||||||
if (this.resetAdminPasswd === true) {
|
if (this.resetAdminPasswd === true) {
|
||||||
throw new CommonException(
|
throw new CommonException('1号管理员密码已修改为123456,当前为重置密码模式,无法响应请求,请关闭重置密码模式恢复正常服务');
|
||||||
'1号管理员密码已修改为123456,当前为重置密码模式,无法响应请求,请关闭重置密码模式恢复正常服务'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
await next();
|
await next();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { PlusService } from '../basic/service/plus-service.js';
|
import { PlusService } from '../basic/service/plus-service.js';
|
||||||
import { AppKey } from '@certd/pipeline';
|
import { AppKey } from '@certd/pipeline';
|
||||||
import { SysSettingsService } from '../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysInstallInfo } from '../system/service/models.js';
|
import { SysInstallInfo } from '@certd/lib-server';
|
||||||
|
|
||||||
export type PreBindUserReq = {
|
export type PreBindUserReq = {
|
||||||
userId: number;
|
userId: number;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { PermissionService } from '../service/permission-service.js';
|
import { PermissionService } from '../service/permission-service.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { RoleService } from '../service/role-service.js';
|
import { RoleService } from '../service/role-service.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Provide, Controller, Post, Inject, Body, Query, ALL } from '@midwayjs/core';
|
import { Provide, Controller, Post, Inject, Body, Query, ALL } from '@midwayjs/core';
|
||||||
import { UserService } from '../service/user-service.js';
|
import { UserService } from '../service/user-service.js';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { RoleService } from '../service/role-service.js';
|
import { RoleService } from '../service/role-service.js';
|
||||||
import { PermissionService } from '../service/permission-service.js';
|
import { PermissionService } from '../service/permission-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户
|
* 系统用户
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { EnumItem } from '../../../basic/enum-item.js';
|
import { EnumItem } from '@certd/lib-server';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
class ResourceTypes {
|
class ResourceTypes {
|
||||||
MENU = new EnumItem('menu', '菜单', 'blue');
|
MENU = new EnumItem('menu', '菜单', 'blue');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { RoleService } from './role-service.js';
|
import { RoleService } from './role-service.js';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限校验
|
* 权限校验
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { PermissionEntity } from '../entity/permission.js';
|
import { PermissionEntity } from '../entity/permission.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { RolePermissionEntity } from '../entity/role-permission.js';
|
import { RolePermissionEntity } from '../entity/role-permission.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { In, Repository } from 'typeorm';
|
import { In, Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { RoleEntity } from '../entity/role.js';
|
import { RoleEntity } from '../entity/role.js';
|
||||||
import { UserRoleService } from './user-role-service.js';
|
import { UserRoleService } from './user-role-service.js';
|
||||||
import { RolePermissionEntity } from '../entity/role-permission.js';
|
import { RolePermissionEntity } from '../entity/role-permission.js';
|
||||||
|
@ -50,12 +50,7 @@ export class RoleService extends BaseService<RoleEntity> {
|
||||||
async getPermissionByRoleIds(roleIds: any) {
|
async getPermissionByRoleIds(roleIds: any) {
|
||||||
return await this.permissionService.repository
|
return await this.permissionService.repository
|
||||||
.createQueryBuilder('permission')
|
.createQueryBuilder('permission')
|
||||||
.innerJoinAndSelect(
|
.innerJoinAndSelect(RolePermissionEntity, 'rp', 'rp.permissionId = permission.id and rp.roleId in (:...roleIds)', { roleIds })
|
||||||
RolePermissionEntity,
|
|
||||||
'rp',
|
|
||||||
'rp.permissionId = permission.id and rp.roleId in (:...roleIds)',
|
|
||||||
{ roleIds }
|
|
||||||
)
|
|
||||||
.getMany();
|
.getMany();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +114,7 @@ export class RoleService extends BaseService<RoleEntity> {
|
||||||
return permissionSet;
|
return permissionSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCachedPermissionSetByRoleIds(
|
async getCachedPermissionSetByRoleIds(roleIds: number[]): Promise<Set<string>> {
|
||||||
roleIds: number[]
|
|
||||||
): Promise<Set<string>> {
|
|
||||||
const roleIdsKey = roleIds.join(',');
|
const roleIdsKey = roleIds.join(',');
|
||||||
let permissionSet = this.permissionCache.get(roleIdsKey);
|
let permissionSet = this.permissionCache.get(roleIdsKey);
|
||||||
if (permissionSet) {
|
if (permissionSet) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { UserRoleEntity } from '../entity/user-role.js';
|
import { UserRoleEntity } from '../entity/user-role.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,4 @@ export class UserRoleService extends BaseService<UserRoleEntity> {
|
||||||
getRepository() {
|
getRepository() {
|
||||||
return this.repository;
|
return this.repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,16 @@ import { Repository } from 'typeorm';
|
||||||
import { UserEntity } from '../entity/user.js';
|
import { UserEntity } from '../entity/user.js';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
import md5 from 'md5';
|
import md5 from 'md5';
|
||||||
import { CommonException } from '../../../basic/exception/common-exception.js';
|
import { CommonException } from '@certd/lib-server';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { RoleService } from './role-service.js';
|
import { RoleService } from './role-service.js';
|
||||||
import { PermissionService } from './permission-service.js';
|
import { PermissionService } from './permission-service.js';
|
||||||
import { UserRoleService } from './user-role-service.js';
|
import { UserRoleService } from './user-role-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { UserRoleEntity } from '../entity/user-role.js';
|
import { UserRoleEntity } from '../entity/user-role.js';
|
||||||
import bcrypt from 'bcryptjs';
|
import bcrypt from 'bcryptjs';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysInstallInfo } from '../../system/service/models.js';
|
import { SysInstallInfo } from '@certd/lib-server';
|
||||||
import { RandomUtil } from '../../../utils/random.js';
|
import { RandomUtil } from '../../../utils/random.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { logger } from '../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { UserService } from '../authority/service/user-service.js';
|
import { UserService } from '../authority/service/user-service.js';
|
||||||
import { SysSettingsService } from '../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { SysInstallInfo, SysPrivateSettings } from '../system/service/models.js';
|
import { SysInstallInfo, SysPrivateSettings } from '@certd/lib-server';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { PlusService } from '../basic/service/plus-service.js';
|
import { PlusService } from '../basic/service/plus-service.js';
|
||||||
import { isComm } from '@certd/plus-core';
|
|
||||||
|
|
||||||
export type InstallInfo = {
|
export type InstallInfo = {
|
||||||
installTime: number;
|
installTime: number;
|
||||||
|
@ -58,15 +57,6 @@ export class AutoInitSite {
|
||||||
// 授权许可
|
// 授权许可
|
||||||
await this.plusService.verify();
|
await this.plusService.verify();
|
||||||
|
|
||||||
if (isComm()) {
|
|
||||||
//加载商业版代码
|
|
||||||
try {
|
|
||||||
await import('@certd/commercial-core');
|
|
||||||
} catch (e) {
|
|
||||||
logger.error('加载商业版代码失败,请尝试升级版本', e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info('初始化站点完成');
|
logger.info('初始化站点完成');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { PipelineService } from '../pipeline/service/pipeline-service.js';
|
import { PipelineService } from '../pipeline/service/pipeline-service.js';
|
||||||
import { logger } from '../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { SysSettingsService } from '../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
|
|
||||||
@Autoload()
|
@Autoload()
|
||||||
@Scope(ScopeEnum.Singleton)
|
@Scope(ScopeEnum.Singleton)
|
||||||
|
|
|
@ -2,10 +2,10 @@ import { Rule, RuleType } from '@midwayjs/validate';
|
||||||
import { ALL, Inject } from '@midwayjs/core';
|
import { ALL, Inject } from '@midwayjs/core';
|
||||||
import { Body } from '@midwayjs/core';
|
import { Body } from '@midwayjs/core';
|
||||||
import { Controller, Post, Provide } from '@midwayjs/core';
|
import { Controller, Post, Provide } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { CodeService } from '../service/code-service.js';
|
import { CodeService } from '../service/code-service.js';
|
||||||
import { EmailService } from '../service/email-service.js';
|
import { EmailService } from '../service/email-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
export class SmsCodeReq {
|
export class SmsCodeReq {
|
||||||
@Rule(RuleType.number().required())
|
@Rule(RuleType.number().required())
|
||||||
phoneCode: number;
|
phoneCode: number;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { EmailService } from '../service/email-service.js';
|
import { EmailService } from '../service/email-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { MidwayEnvironmentService } from '@midwayjs/core';
|
import { MidwayEnvironmentService } from '@midwayjs/core';
|
||||||
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
@Provide()
|
@Provide()
|
||||||
@Controller('/home')
|
@Controller('/home')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
|
import { Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '../../system/service/models.js';
|
import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '@certd/lib-server';
|
||||||
import { AppKey } from '@certd/pipeline';
|
import { AppKey } from '@certd/pipeline';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { EmailSend } from '@certd/pipeline';
|
||||||
import { IEmailService, isPlus } from '@certd/pipeline';
|
import { IEmailService, isPlus } from '@certd/pipeline';
|
||||||
import nodemailer from 'nodemailer';
|
import nodemailer from 'nodemailer';
|
||||||
import type SMTPConnection from 'nodemailer/lib/smtp-connection';
|
import type SMTPConnection from 'nodemailer/lib/smtp-connection';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { UserSettingsService } from '../../mine/service/user-settings-service.js';
|
import { UserSettingsService } from '../../mine/service/user-settings-service.js';
|
||||||
import { PlusService } from './plus-service.js';
|
import { PlusService } from './plus-service.js';
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { Config, Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Config, Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysInstallInfo, SysLicenseInfo } from '../../system/service/models.js';
|
import { SysInstallInfo, SysLicenseInfo } from '@certd/lib-server';
|
||||||
import { AppKey, http, PlusRequestService, verify } from '@certd/pipeline';
|
import { AppKey, http, PlusRequestService, verify } from '@certd/pipeline';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
|
|
||||||
@Provide()
|
@Provide()
|
||||||
@Scope(ScopeEnum.Singleton)
|
@Scope(ScopeEnum.Singleton)
|
||||||
|
|
|
@ -1,14 +1,7 @@
|
||||||
import {
|
import { Body, Controller, Inject, Post, Provide, ALL } from '@midwayjs/core';
|
||||||
Body,
|
|
||||||
Controller,
|
|
||||||
Inject,
|
|
||||||
Post,
|
|
||||||
Provide,
|
|
||||||
ALL,
|
|
||||||
} from '@midwayjs/core';
|
|
||||||
import { LoginService } from '../service/login-service.js';
|
import { LoginService } from '../service/login-service.js';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +13,7 @@ export class LoginController extends BaseController {
|
||||||
@Post('/login', { summary: Constants.per.guest })
|
@Post('/login', { summary: Constants.per.guest })
|
||||||
public async login(
|
public async login(
|
||||||
@Body(ALL)
|
@Body(ALL)
|
||||||
user
|
user: any
|
||||||
) {
|
) {
|
||||||
const token = await this.loginService.login(user);
|
const token = await this.loginService.login(user);
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
import {
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
ALL,
|
import { BaseController } from '@certd/lib-server';
|
||||||
Body,
|
import { Constants } from '@certd/lib-server';
|
||||||
Controller,
|
|
||||||
Inject,
|
|
||||||
Post,
|
|
||||||
Provide,
|
|
||||||
} from '@midwayjs/core';
|
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
|
||||||
import { Constants } from '../../../basic/constants.js';
|
|
||||||
import { UserService } from '../../authority/service/user-service.js';
|
import { UserService } from '../../authority/service/user-service.js';
|
||||||
import { UserEntity } from '../../authority/entity/user.js';
|
import { UserEntity } from '../../authority/entity/user.js';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Config, Inject, Provide } from '@midwayjs/core';
|
import { Config, Inject, Provide } from '@midwayjs/core';
|
||||||
import { UserService } from '../../authority/service/user-service.js';
|
import { UserService } from '../../authority/service/user-service.js';
|
||||||
import jwt from 'jsonwebtoken';
|
import jwt from 'jsonwebtoken';
|
||||||
import { CommonException } from '../../../basic/exception/common-exception.js';
|
import { CommonException } from '@certd/lib-server';
|
||||||
import { RoleService } from '../../authority/service/role-service.js';
|
import { RoleService } from '../../authority/service/role-service.js';
|
||||||
import { UserEntity } from '../../authority/entity/user.js';
|
import { UserEntity } from '../../authority/entity/user.js';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysPrivateSettings } from '../../system/service/models.js';
|
import { SysPrivateSettings } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户
|
* 系统用户
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { UserService } from '../../authority/service/user-service.js';
|
import { UserService } from '../../authority/service/user-service.js';
|
||||||
import { getPlusInfo } from '@certd/pipeline';
|
import { getPlusInfo } from '@certd/pipeline';
|
||||||
import { RoleService } from '../../authority/service/role-service.js';
|
import { RoleService } from '../../authority/service/role-service.js';
|
||||||
|
|
|
@ -7,8 +7,8 @@ import {
|
||||||
Provide,
|
Provide,
|
||||||
Query,
|
Query,
|
||||||
} from '@midwayjs/core';
|
} from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { UserSettingsService } from '../service/user-settings-service.js';
|
import { UserSettingsService } from '../service/user-settings-service.js';
|
||||||
import { UserSettingsEntity } from '../entity/user-settings.js';
|
import { UserSettingsEntity } from '../entity/user-settings.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { UserSettingsEntity } from '../entity/user-settings.js';
|
import { UserSettingsEntity } from '../entity/user-settings.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { AccessService } from '../service/access-service.js';
|
import { AccessService } from '../service/access-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
|
@ -12,7 +12,7 @@ export class AccessController extends CrudController<AccessService> {
|
||||||
@Inject()
|
@Inject()
|
||||||
service: AccessService;
|
service: AccessService;
|
||||||
|
|
||||||
getService() {
|
getService(): AccessService {
|
||||||
return this.service;
|
return this.service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ALL, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { DnsProviderService } from '../service/dns-provider-service.js';
|
import { DnsProviderService } from '../service/dns-provider-service.js';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插件
|
* 插件
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import {
|
import {
|
||||||
AccessRequestHandleReq,
|
AccessRequestHandleReq,
|
||||||
http,
|
http,
|
||||||
|
@ -12,7 +12,7 @@ import {
|
||||||
TaskInstanceContext,
|
TaskInstanceContext,
|
||||||
utils,
|
utils,
|
||||||
} from '@certd/pipeline';
|
} from '@certd/pipeline';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { AccessService } from '../service/access-service.js';
|
import { AccessService } from '../service/access-service.js';
|
||||||
import { EmailService } from '../../basic/service/email-service.js';
|
import { EmailService } from '../../basic/service/email-service.js';
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
import { ALL, Body, Controller, Get, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Get, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CommonException, Constants, CrudController, PermissionException } from '@certd/lib-server';
|
||||||
import { PipelineEntity } from '../entity/pipeline.js';
|
import { PipelineEntity } from '../entity/pipeline.js';
|
||||||
import { HistoryService } from '../service/history-service.js';
|
import { HistoryService } from '../service/history-service.js';
|
||||||
import { HistoryLogService } from '../service/history-log-service.js';
|
import { HistoryLogService } from '../service/history-log-service.js';
|
||||||
import { HistoryEntity } from '../entity/history.js';
|
import { HistoryEntity } from '../entity/history.js';
|
||||||
import { HistoryLogEntity } from '../entity/history-log.js';
|
import { HistoryLogEntity } from '../entity/history-log.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
|
||||||
import { PipelineService } from '../service/pipeline-service.js';
|
import { PipelineService } from '../service/pipeline-service.js';
|
||||||
import { CommonException } from '../../../basic/exception/common-exception.js';
|
|
||||||
import { PermissionException } from '../../../basic/exception/permission-exception.js';
|
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { AuthService } from '../../authority/service/auth-service.js';
|
import { AuthService } from '../../authority/service/auth-service.js';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 证书
|
* 证书
|
||||||
|
@ -33,7 +30,7 @@ export class HistoryController extends CrudController<HistoryService> {
|
||||||
@Inject()
|
@Inject()
|
||||||
sysSettingsService: SysSettingsService;
|
sysSettingsService: SysSettingsService;
|
||||||
|
|
||||||
getService() {
|
getService(): HistoryService {
|
||||||
return this.service;
|
return this.service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { PipelineService } from '../service/pipeline-service.js';
|
import { PipelineService } from '../service/pipeline-service.js';
|
||||||
import { PipelineEntity } from '../entity/pipeline.js';
|
import { PipelineEntity } from '../entity/pipeline.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import { HistoryService } from '../service/history-service.js';
|
import { HistoryService } from '../service/history-service.js';
|
||||||
import { AuthService } from '../../authority/service/auth-service.js';
|
import { AuthService } from '../../authority/service/auth-service.js';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 证书
|
* 证书
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { ALL, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { PluginService } from '../service/plugin-service.js';
|
import { PluginService } from '../service/plugin-service.js';
|
||||||
import { Constants } from '../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插件
|
* 插件
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { AccessEntity } from '../entity/access.js';
|
import { AccessEntity } from '../entity/access.js';
|
||||||
import { AccessDefine, accessRegistry, IAccessService, newAccess } from '@certd/pipeline';
|
import { AccessDefine, accessRegistry, IAccessService, newAccess } from '@certd/pipeline';
|
||||||
import { EncryptService } from './encrypt-service.js';
|
import { EncryptService } from './encrypt-service.js';
|
||||||
import { ValidateException } from '../../../basic/exception/validation-exception.js';
|
import { ValidateException } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Init, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysPrivateSettings } from '../../system/service/models.js';
|
import { SysPrivateSettings } from '@certd/lib-server';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权
|
* 授权
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { In, Repository } from 'typeorm';
|
import { In, Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { HistoryLogEntity } from '../entity/history-log.js';
|
import { HistoryLogEntity } from '../entity/history-log.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { In, Repository } from 'typeorm';
|
import { In, Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { HistoryEntity } from '../entity/history.js';
|
import { HistoryEntity } from '../entity/history.js';
|
||||||
import { PipelineEntity } from '../entity/pipeline.js';
|
import { PipelineEntity } from '../entity/pipeline.js';
|
||||||
import { HistoryDetail } from '../entity/vo/history-detail.js';
|
import { HistoryDetail } from '../entity/vo/history-detail.js';
|
||||||
import { HistoryLogService } from './history-log-service.js';
|
import { HistoryLogService } from './history-log-service.js';
|
||||||
import { FileItem, Pipeline, RunnableCollection } from '@certd/pipeline';
|
import { FileItem, Pipeline, RunnableCollection } from '@certd/pipeline';
|
||||||
import { FileStore } from '@certd/pipeline';
|
import { FileStore } from '@certd/pipeline';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 证书申请
|
* 证书申请
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Config, Inject, Provide, Scope, ScopeEnum, sleep } from '@midwayjs/core';
|
import { Config, Inject, Provide, Scope, ScopeEnum, sleep } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { In, Repository } from 'typeorm';
|
import { In, Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { PipelineEntity } from '../entity/pipeline.js';
|
import { PipelineEntity } from '../entity/pipeline.js';
|
||||||
import { PipelineDetail } from '../entity/vo/pipeline-detail.js';
|
import { PipelineDetail } from '../entity/vo/pipeline-detail.js';
|
||||||
import { Executor, isPlus, Pipeline, ResultType, RunHistory, UserInfo } from '@certd/pipeline';
|
import { Executor, isPlus, Pipeline, ResultType, RunHistory, UserInfo } from '@certd/pipeline';
|
||||||
|
@ -13,9 +13,9 @@ import { HistoryService } from './history-service.js';
|
||||||
import { HistoryEntity } from '../entity/history.js';
|
import { HistoryEntity } from '../entity/history.js';
|
||||||
import { HistoryLogEntity } from '../entity/history-log.js';
|
import { HistoryLogEntity } from '../entity/history-log.js';
|
||||||
import { HistoryLogService } from './history-log-service.js';
|
import { HistoryLogService } from './history-log-service.js';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { EmailService } from '../../basic/service/email-service.js';
|
import { EmailService } from '../../basic/service/email-service.js';
|
||||||
import { NeedVIPException } from '../../../basic/exception/vip-exception.js';
|
import { NeedVIPException } from '@certd/lib-server';
|
||||||
import { UserService } from '../../authority/service/user-service.js';
|
import { UserService } from '../../authority/service/user-service.js';
|
||||||
|
|
||||||
const runningTasks: Map<string | number, Executor> = new Map();
|
const runningTasks: Map<string | number, Executor> = new Map();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||||
import { InjectEntityModel } from '@midwayjs/typeorm';
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
||||||
import { In, Repository } from 'typeorm';
|
import { In, Repository } from 'typeorm';
|
||||||
import { BaseService } from '../../../basic/base-service.js';
|
import { BaseService } from '@certd/lib-server';
|
||||||
import { StorageEntity } from '../entity/storage.js';
|
import { StorageEntity } from '../entity/storage.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { SysSettingsService } from '../service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { BaseController } from '../../../basic/base-controller.js';
|
import { BaseController } from '@certd/lib-server';
|
||||||
import { AppKey } from '@certd/pipeline';
|
import { AppKey } from '@certd/pipeline';
|
||||||
import { SysInstallInfo } from '../service/models.js';
|
import { SysInstallInfo } from '@certd/lib-server';
|
||||||
import { logger } from '../../../utils/logger.js';
|
import { logger } from '@certd/pipeline';
|
||||||
import { PlusService } from '../../basic/service/plus-service.js';
|
import { PlusService } from '../../basic/service/plus-service.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
|
import { BaseController } from '@certd/lib-server';
|
||||||
|
import { AppKey } from '@certd/pipeline';
|
||||||
|
import { SysInstallInfo } from '@certd/lib-server';
|
||||||
|
import { logger } from '@certd/pipeline';
|
||||||
|
import { PlusService } from '../../basic/service/plus-service.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
@Provide()
|
||||||
|
@Controller('/api/sys/site')
|
||||||
|
export class SysPlusController extends BaseController {
|
||||||
|
@Inject()
|
||||||
|
sysSettingsService: SysSettingsService;
|
||||||
|
|
||||||
|
@Inject()
|
||||||
|
plusService: PlusService;
|
||||||
|
|
||||||
|
@Post('/active', { summary: 'sys:settings:edit' })
|
||||||
|
async active(@Body(ALL) body) {
|
||||||
|
const { code } = body;
|
||||||
|
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||||
|
const siteId = installInfo.siteId;
|
||||||
|
const formData = {
|
||||||
|
appKey: AppKey,
|
||||||
|
code,
|
||||||
|
subjectId: siteId,
|
||||||
|
};
|
||||||
|
|
||||||
|
const res: any = await this.plusService.active(formData);
|
||||||
|
|
||||||
|
if (res.code > 0) {
|
||||||
|
logger.error('激活失败', res.message);
|
||||||
|
return this.fail(res.message, 1);
|
||||||
|
}
|
||||||
|
const license = res.data.license;
|
||||||
|
|
||||||
|
await this.plusService.updateLicense(license);
|
||||||
|
|
||||||
|
return this.ok(true);
|
||||||
|
}
|
||||||
|
@Post('/bindUrl', { summary: 'sys:settings:edit' })
|
||||||
|
async bindUrl(@Body(ALL) body: { url: string }) {
|
||||||
|
const { url } = body;
|
||||||
|
|
||||||
|
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||||
|
await this.plusService.bindUrl(installInfo.siteId, url);
|
||||||
|
|
||||||
|
installInfo.bindUrl = url;
|
||||||
|
await this.sysSettingsService.saveSetting(installInfo);
|
||||||
|
|
||||||
|
return this.ok(true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
||||||
import { CrudController } from '../../../basic/crud-controller.js';
|
import { CrudController } from '@certd/lib-server';
|
||||||
import { SysSettingsService } from '../service/sys-settings-service.js';
|
import { SysSettingsService } from '@certd/lib-server';
|
||||||
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
import { SysSettingsEntity } from '../entity/sys-settings.js';
|
||||||
import { SysPublicSettings } from '../service/models.js';
|
import { SysPublicSettings } from '@certd/lib-server';
|
||||||
import * as _ from 'lodash-es';
|
import * as _ from 'lodash-es';
|
||||||
import { PipelineService } from '../../pipeline/service/pipeline-service.js';
|
import { PipelineService } from '../../pipeline/service/pipeline-service.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
|
import { AbstractTaskPlugin, IsTaskPlugin, pluginGroups, RunStrategy, TaskInput, TaskOutput } from '@certd/pipeline';
|
||||||
import { CertInfo, CertReader } from '@certd/plugin-cert';
|
import { CertInfo, CertReader } from '@certd/plugin-cert';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { Constants } from '../../../../basic/constants.js';
|
import { Constants } from '@certd/lib-server';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
@IsTaskPlugin({
|
@IsTaskPlugin({
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class CustomScriptPlugin extends AbstractTaskPlugin {
|
||||||
name: 'pi-output-selector',
|
name: 'pi-output-selector',
|
||||||
from: ['CertApply', 'CertApplyLego'],
|
from: ['CertApply', 'CertApplyLego'],
|
||||||
},
|
},
|
||||||
required: true,
|
required: false,
|
||||||
})
|
})
|
||||||
cert!: CertInfo;
|
cert!: CertInfo;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import log4js from 'log4js';
|
|
||||||
import path from 'path';
|
|
||||||
const level = process.env.NODE_ENV === 'development' ? 'debug' : 'info';
|
|
||||||
const filename = path.join('/logs/server.log');
|
|
||||||
log4js.configure({
|
|
||||||
appenders: {
|
|
||||||
std: { type: 'stdout', level: 'debug' },
|
|
||||||
file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename },
|
|
||||||
},
|
|
||||||
categories: { default: { appenders: ['std'], level } },
|
|
||||||
});
|
|
||||||
export const logger = log4js.getLogger('server');
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue