Merge remote-tracking branch 'origin/v2-dev' into v2-dev

This commit is contained in:
xiaojunnuo
2024-12-09 09:34:12 +08:00
54 changed files with 254 additions and 97 deletions

View File

@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.28.1](https://github.com/certd/certd/compare/v1.28.0...v1.28.1) (2024-12-08)
### Performance Improvements
* 通知选择器优化 ([2c0cbdd](https://github.com/certd/certd/commit/2c0cbdd29ecb74cc939b2ae7ee86b8d40f70ba31))
* 新增七牛云插件分组 ([49e7dc5](https://github.com/certd/certd/commit/49e7dc56e1a95fbdea3e30cdeb945b48415b69e3))
* 新增server酱3通知 ([6aa4872](https://github.com/certd/certd/commit/6aa487269c9f6862e188b37a0d6c73f79c937d94))
* 支持易发云短信 ([94fa77f](https://github.com/certd/certd/commit/94fa77fcd2b9bea294fb05736c0d8cdc81f56103))
* cname value优化 ([e8c9c2a](https://github.com/certd/certd/commit/e8c9c2a47d47048ae743b16f7bc932dbe18a89e9))
* favicon支持自定义 ([8b9c47d](https://github.com/certd/certd/commit/8b9c47daf194515006689a212ae9cf586bdf5993))
# [1.28.0](https://github.com/certd/certd/compare/v1.27.9...v1.28.0) (2024-11-30)
### Bug Fixes

View File

@@ -0,0 +1 @@
CREATE INDEX "index_user_id" ON "pi_pipeline" ("user_id");

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/ui-server",
"version": "1.28.0",
"version": "1.28.1",
"description": "fast-server base midway",
"private": true,
"type": "module",
@@ -29,18 +29,18 @@
},
"dependencies": {
"@alicloud/pop-core": "^1.7.10",
"@certd/acme-client": "^1.28.0",
"@certd/basic": "^1.28.0",
"@certd/commercial-core": "^1.28.0",
"@certd/lib-huawei": "^1.28.0",
"@certd/lib-k8s": "^1.28.0",
"@certd/lib-server": "^1.28.0",
"@certd/midway-flyway-js": "^1.28.0",
"@certd/pipeline": "^1.28.0",
"@certd/plugin-cert": "^1.28.0",
"@certd/plugin-lib": "^1.28.0",
"@certd/plugin-plus": "^1.28.0",
"@certd/plus-core": "^1.28.0",
"@certd/acme-client": "^1.28.1",
"@certd/basic": "^1.28.1",
"@certd/commercial-core": "^1.28.1",
"@certd/lib-huawei": "^1.28.1",
"@certd/lib-k8s": "^1.28.1",
"@certd/lib-server": "^1.28.1",
"@certd/midway-flyway-js": "^1.28.1",
"@certd/pipeline": "^1.28.1",
"@certd/plugin-cert": "^1.28.1",
"@certd/plugin-lib": "^1.28.1",
"@certd/plugin-plus": "^1.28.1",
"@certd/plus-core": "^1.28.1",
"@huaweicloud/huaweicloud-sdk-cdn": "^3.1.120",
"@huaweicloud/huaweicloud-sdk-core": "^3.1.120",
"@koa/cors": "^5.0.0",

View File

@@ -71,7 +71,7 @@ const development = {
type: 'better-sqlite3',
database: './data/db.sqlite',
synchronize: false, // 如果第一次使用,不存在表,有同步的需求可以写 true
logging: false,
logging: true,
// 配置实体模型 或者 entities: '/entity',
entities: ['**/modules/**/entity/*.js', ...libServerEntities, ...commercialEntities, PipelineEntity, FlywayHistory, UserEntity],

View File

@@ -1,11 +1,18 @@
import { Controller, Get, Provide } from '@midwayjs/core';
import { BaseController, Constants } from '@certd/lib-server';
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
import { BaseController, Constants, FileService, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
import { http, logger } from '@certd/basic';
import { isComm } from '@certd/plus-core';
/**
*/
@Provide()
@Controller('/api/app/')
export class AppController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
@Inject()
fileService: FileService;
@Get('/latest', { summary: Constants.per.authOnly })
async latest(): Promise<any> {
const res = await http.request({
@@ -20,4 +27,21 @@ export class AppController extends BaseController {
return this.ok('');
}
}
@Get('/favicon', { summary: Constants.per.guest })
public async getFavicon() {
if (isComm()) {
const siteInfo = await this.sysSettingsService.getSetting<SysSiteInfo>(SysSiteInfo);
const favicon = siteInfo.logo;
if (favicon) {
const redirect = '/api/basic/file/download?key=' + favicon;
this.ctx.response.redirect(redirect);
this.ctx.response.set('Cache-Control', 'public,max-age=25920');
return;
}
}
const redirect = '/static/images/logo/logo.svg';
this.ctx.response.redirect(redirect);
this.ctx.response.set('Cache-Control', 'public,max-age=25920');
}
}

View File

@@ -20,7 +20,8 @@ export class CnameProviderController extends BaseController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const res = await this.providerService.list({});
return this.ok(res);
}

View File

@@ -39,7 +39,8 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
const list = await this.getService().list(body);
return this.ok(list);
}

View File

@@ -25,7 +25,8 @@ export class UserSettingsController extends CrudController<UserSettingsService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -37,7 +37,8 @@ export class AccessController extends CrudController<AccessService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -78,9 +78,10 @@ export class HistoryController extends CrudController<HistoryService> {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.query = body.query ?? {};
const isAdmin = await this.authService.isAdmin(this.ctx);
if (!isAdmin) {
body.userId = this.getUserId();
body.query.userId = this.getUserId();
}
if (body.pipelineId == null) {
return this.ok([]);

View File

@@ -38,7 +38,8 @@ export class NotificationController extends CrudController<NotificationService>
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.list(body);
}

View File

@@ -36,7 +36,8 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return await super.list(body);
}
@@ -67,7 +68,9 @@ export class PipelineGroupController extends CrudController<PipelineGroupService
@Post('/all', { summary: Constants.per.authOnly })
async all() {
const list: any = await this.service.find({
userId: this.getUserId(),
where: {
userId: this.getUserId(),
},
});
return this.ok(list);
}

View File

@@ -14,9 +14,9 @@ export class SysPlusController extends BaseController {
@Post('/active', { summary: 'sys:settings:edit' })
async active(@Body(ALL) body) {
const { code } = body;
const { code, inviteCode } = body;
await this.plusService.active(code);
await this.plusService.active(code, inviteCode);
return this.ok(true);
}

View File

@@ -29,20 +29,16 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
@Post('/page', { summary: 'sys:settings:view' })
async page(@Body(ALL) body) {
body.query = body.query ?? {};
body.query.userId = this.getUserId();
return super.page(body);
}
@Post('/list', { summary: 'sys:settings:view' })
async list(@Body(ALL) body) {
body.userId = this.getUserId();
return super.list(body);
}
@Post('/add', { summary: 'sys:settings:edit' })
async add(@Body(ALL) bean) {
bean.userId = this.getUserId();
return super.add(bean);
}

View File

@@ -93,7 +93,7 @@ export class CnameRecordService extends BaseService<CnameRecordEntity> {
const cnameKey = utils.id.simpleNanoId();
const safeDomain = param.domain.replaceAll('.', '-');
param.recordValue = `${safeDomain}-${cnameKey}.${cnameProvider.domain}`;
param.recordValue = `${safeDomain}.${cnameKey}.${cnameProvider.domain}`;
}
async update(param: any) {