Compare commits

...

37 Commits

Author SHA1 Message Date
xiaojunnuo
ef1896fdcf v0.3.1 2022-12-28 12:58:13 +08:00
xiaojunnuo
7438cea8d1 refactor: 0.3.1 2022-12-28 12:56:16 +08:00
xiaojunnuo
6950d779e0 perf: ui 升级到antdv3.x 2022-10-18 09:40:00 +08:00
xiaojunnuo
4c31db427a perf: ui 升级到antdv3.x 2022-10-17 22:04:12 +08:00
xiaojunnuo
540981e071 refactor: 1 2022-10-17 20:06:41 +08:00
xiaojunnuo
ed8b9cd5e9 refactor: 1 2022-10-17 17:06:10 +08:00
xiaojunnuo
3dea83ce31 refactor: 1 2022-10-17 17:01:37 +08:00
xiaojunnuo
cfb46a7c2b v0.3.0 2022-10-17 17:00:47 +08:00
xiaojunnuo
dd2f44bfe9 refactor: 1 2022-10-17 17:00:33 +08:00
xiaojunnuo
09d0e79bcd feat: 升级client0.3.0 2022-10-17 16:59:07 +08:00
xiaojunnuo
a9c1ca5c97 refactor: 1 2022-10-17 16:57:54 +08:00
xiaojunnuo
1af6fb3a58 refactor: 1 2022-10-17 16:54:01 +08:00
xiaojunnuo
a38004c1ed upgrade client 2022-09-28 17:11:32 +08:00
xiaojunnuo
5a355b276e upgrade client 2022-09-28 17:11:25 +08:00
xiaojunnuo
a52721bd7e upgrade client 2022-09-28 16:52:26 +08:00
xiaojunnuo
6df399fe02 upgrade client 2022-09-28 16:50:38 +08:00
xiaojunnuo
6d8ede9575 client submodules 2022-09-28 15:43:54 +08:00
xiaojunnuo
7145aa60ca v0.2.2 2021-12-04 18:43:58 +08:00
xiaojunnuo
b1181c0f9a refactor: 1 2021-12-04 18:39:05 +08:00
xiaojunnuo
bace2a7c25 refactor: 1 2021-12-04 18:34:52 +08:00
xiaojunnuo
a70b4373de v0.2.1 2021-12-04 17:11:07 +08:00
xiaojunnuo
b7c12e6d91 perf: 支持阿里云 ack ingress 2021-12-04 16:57:12 +08:00
xiaojunnuo
6a88dd476e refactor: 0.2.0 2021-12-02 17:07:10 +08:00
xiaojunnuo
5fbd774266 v0.2.0 2021-12-02 17:01:24 +08:00
xiaojunnuo
bdec010d2e refactor: 1 2021-12-02 17:00:24 +08:00
xiaojunnuo
05a00b7b78 feat: 私钥升级为PKCS8 2021-12-02 16:47:46 +08:00
xiaojunnuo
eaf23c3034 v0.1.21 2021-11-04 18:02:14 +08:00
xiaojunnuo
276a8b35e5 feat: 支持腾讯云nginx-ingress 2021-11-04 18:00:30 +08:00
xiaojunnuo
466d659f6e fix: 修改ssh privateKey参数名 2021-06-09 17:50:18 +08:00
xiaojunnuo
84e26381b5 v0.1.20 2021-06-02 09:15:30 +08:00
xiaojunnuo
469b5a5f69 fix: fix 任务成功后不需要重新运行 2021-06-02 09:14:10 +08:00
xiaojunnuo
ad77ebd2f9 refactor: 1 2021-03-17 18:06:06 +08:00
xiaojunnuo
b75543c3bc v0.1.19 2021-03-16 19:14:31 +08:00
xiaojunnuo
0677275742 refactor: 1 2021-03-16 18:40:16 +08:00
xiaojunnuo
0c3724e0ad refactor: 1 2021-03-16 18:27:24 +08:00
xiaojunnuo
803083d23c refactor: 1 2021-03-16 18:25:11 +08:00
xiaojunnuo
f4f8067a12 refactor: new client 2021-03-15 19:04:46 +08:00
93 changed files with 1634 additions and 88212 deletions

14
.gitignore vendored
View File

@@ -1,9 +1,16 @@
# IntelliJ project files
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/
**/dist
.idea
*.iml
out
gen
node_modules/
/test/*.private.*
/*.log
@@ -15,3 +22,8 @@ node_modules/
/packages/*/node_modules
/packages/ui/certd-server/tmp/
/packages/ui/certd-ui/dist/
/other
/dev-sidecar-test
/packages/core/certd/yarn.lock
/packages/test
/test/own

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "packages/base/node-acme-client"]
path = packages/base/node-acme-client
url = https://github.com/certd/node-acme-client.git

View File

@@ -1,6 +1,8 @@
{
"packages": [
"packages/*/*"
"packages/base/*",
"packages/core/*",
"packages/plugins/*"
],
"version": "0.1.18"
"version": "0.3.1"
}

22168
package-lock.json generated

File diff suppressed because it is too large Load Diff

7
packages/core/api/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/api",
"version": "0.1.17",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"type": "module",
@@ -22,5 +22,5 @@
"eslint-plugin-promise": "^4.2.1",
"mocha": "^8.2.1"
},
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

7
packages/core/certd/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/certd",
"version": "0.1.18",
"version": "0.3.1",
"description": "a ssl cert keeper",
"main": "src/index.js",
"scripts": {
@@ -10,8 +10,8 @@
"author": "Greper",
"license": "MIT",
"dependencies": {
"@certd/acme-client": "^0.1.6",
"@certd/api": "^0.1.17",
"@certd/acme-client": "^0.3.1",
"@certd/api": "^0.3.1",
"dayjs": "^1.9.7",
"lodash-es": "^4.17.20",
"node-forge": "^0.10.0"
@@ -25,5 +25,5 @@
"eslint-plugin-promise": "^4.2.1",
"mocha": "^8.2.1"
},
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -5,6 +5,9 @@ const logger = util.logger
export class AcmeService {
constructor (store) {
this.store = store
acme.setLogger((text) => {
logger.info(text)
})
}
async getAccountConfig (email) {

7
packages/core/executor/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/executor",
"version": "0.1.18",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"scripts": {
@@ -10,15 +10,15 @@
},
"type": "module",
"dependencies": {
"@certd/api": "^0.1.17",
"@certd/certd": "^0.1.18",
"@certd/api": "^0.3.1",
"@certd/certd": "^0.3.1",
"dayjs": "^1.9.7",
"lodash-es": "^4.17.20"
},
"devDependencies": {
"@certd/plugin-aliyun": "^0.1.18",
"@certd/plugin-host": "^0.1.18",
"@certd/plugin-tencent": "^0.1.18",
"@certd/plugin-aliyun": "^0.3.1",
"@certd/plugin-host": "^0.3.1",
"@certd/plugin-tencent": "^0.3.1",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.1",
@@ -35,5 +35,5 @@
"author": "Greper",
"license": "MIT",
"sideEffects": false,
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -58,14 +58,14 @@ export class Executor {
logger.info('----------------------')
if (!cert.isNew) {
// 如果没有更新
if (!options.args.forceDeploy && !options.args.forceRedeploy) {
// 且不需要强制运行deploy
if (options.args.forceRedeploy) {
// 强制重新部署,清空保存的状态
await certd.certStore.setCurrentFile('context.json', '{}')
} else if (!options.args.forceDeploy) {
// 且不需要强制deploy
logger.info('证书无更新,无需重新部署')
logger.info('任务完成')
return { cert }
} else {
// 强制重新运行,清空保存的状态
await certd.certStore.setCurrentFile('context.json', '{}')
}
}
// 读取上次执行进度
@@ -88,15 +88,16 @@ export class Executor {
logger.info('任务完成')
trace.print()
const result = resultTrace.get({ })
const returnData = {
if (result) {
if (result.status === 'error' && options.args.doNotThrowError === false) {
throw new Error(result.remark)
}
}
return {
cert,
context,
result
}
if (result.status === 'error' && options.args.doNotThrowError === false) {
throw new Error(result.remark)
}
return returnData
}
async runCertd (certd) {

View File

@@ -76,7 +76,9 @@ export class Trace {
}
}
const result = this.get({ type: 'result' })
this.printTraceLine(result, 'result', '')
if (result) {
this.printTraceLine(result, 'result', '')
}
const mainContext = {}
_.merge(mainContext, context)
delete mainContext.__trace__

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,20 @@
{
"name": "@certd/plugin-aliyun",
"version": "0.1.18",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"type": "module",
"dependencies": {
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/openapi-client": "^0.4.0",
"@alicloud/pop-core": "^1.7.10",
"@certd/api": "^0.1.17",
"@certd/api": "^0.3.1",
"dayjs": "^1.9.7",
"lodash-es": "^4.17.20"
},
"devDependencies": {
"@certd/certd": "^0.1.18",
"@certd/certd": "^0.3.1",
"@certd/plugin-common": "^0.3.1",
"chai": "^4.2.0",
"eslint": "^7.15.0",
"eslint-config-standard": "^16.0.2",
@@ -22,5 +25,5 @@
},
"author": "Greper",
"license": "MIT",
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -1,16 +1,17 @@
import _ from 'lodash-es'
import { AliyunDnsProvider } from './dns-providers/aliyun.js'
import { AliyunAccessProvider } from './access-providers/aliyun.js'
import { UploadCertToAliyun } from './plugins/upload-to-aliyun/index.js'
import { DeployCertToAliyunCDN } from './plugins/deploy-to-cdn/index.js'
import { DeployCertToAliyunAckIngress } from './plugins/deploy-to-ack-ingress/index.js'
import { pluginRegistry, accessProviderRegistry, dnsProviderRegistry } from '@certd/api'
export const Plugins = {
UploadCertToAliyun,
DeployCertToAliyunCDN
DeployCertToAliyunCDN,
DeployCertToAliyunAckIngress
}
export default {
install () {

View File

@@ -0,0 +1,200 @@
import { AbstractAliyunPlugin } from '../abstract-aliyun.js'
import Core from '@alicloud/pop-core'
import { K8sClient } from '@certd/plugin-common'
const ROAClient = Core.ROAClient
const define = {
name: 'deployCertToAliyunAckIngress',
label: '部署到阿里云AckIngress',
input: {
clusterId: {
label: '集群id',
component: {
placeholder: '集群id'
},
required: true
},
secretName: {
label: '保密字典Id',
component: {
placeholder: '保密字典Id'
},
required: true
},
regionId: {
label: '大区',
value: 'cn-shanghai',
component: {
placeholder: '集群所属大区'
},
required: true
},
namespace: {
label: '命名空间',
value: 'default',
component: {
placeholder: '命名空间'
},
required: true
},
ingressName: {
label: 'ingress名称',
value: '',
component: {
placeholder: 'ingress名称'
},
required: true,
helper: '可以传入一个数组'
},
ingressClass: {
label: 'ingress类型',
value: 'nginx',
component: {
placeholder: '暂时只支持nginx类型'
},
required: true
},
isPrivateIpAddress: {
label: '是否私网ip',
value: false,
component: {
placeholder: '集群连接端点是否是私网ip'
},
helper: '如果您当前certd运行在同一个私网下可以选择是。',
required: true
},
accessProvider: {
label: 'Access提供者',
type: [String, Object],
desc: 'access授权',
component: {
name: 'access-provider-selector',
filter: 'aliyun'
},
required: true
}
},
output: {
}
}
export class DeployCertToAliyunAckIngress extends AbstractAliyunPlugin {
static define () {
return define
}
async execute ({ cert, props, context }) {
const accessProvider = this.getAccessProvider(props.accessProvider)
const client = this.getClient(accessProvider, props.regionId)
const kubeConfigStr = await this.getKubeConfig(client, props.clusterId, props.isPrivateIpAddress)
this.logger.info('kubeconfig已成功获取')
const k8sClient = new K8sClient(kubeConfigStr)
const ingressType = props.ingressClass || 'qcloud'
if (ingressType === 'qcloud') {
throw new Error('暂未实现')
// await this.patchQcloudCertSecret({ k8sClient, props, context })
} else {
await this.patchNginxCertSecret({ cert, k8sClient, props, context })
}
await this.sleep(3000) // 停留2秒等待secret部署完成
// await this.restartIngress({ k8sClient, props })
return true
}
async restartIngress ({ k8sClient, props }) {
const { namespace } = props
const body = {
metadata: {
labels: {
certd: this.appendTimeSuffix('certd')
}
}
}
const ingressList = await k8sClient.getIngressList({ namespace })
console.log('ingressList:', ingressList)
if (!ingressList || !ingressList.body || !ingressList.body.items) {
return
}
const ingressNames = ingressList.body.items.filter(item => {
if (!item.spec.tls) {
return false
}
for (const tls of item.spec.tls) {
if (tls.secretName === props.secretName) {
return true
}
}
return false
}).map(item => {
return item.metadata.name
})
for (const ingress of ingressNames) {
await k8sClient.patchIngress({ namespace, ingressName: ingress, body })
this.logger.info(`ingress已重启:${ingress}`)
}
}
async patchNginxCertSecret ({ cert, k8sClient, props, context }) {
const crt = cert.crt
const key = cert.key
const crtBase64 = Buffer.from(crt).toString('base64')
const keyBase64 = Buffer.from(key).toString('base64')
const { namespace, secretName } = props
const body = {
data: {
'tls.crt': crtBase64,
'tls.key': keyBase64
},
metadata: {
labels: {
certd: this.appendTimeSuffix('certd')
}
}
}
let secretNames = secretName
if (typeof secretName === 'string') {
secretNames = [secretName]
}
for (const secret of secretNames) {
await k8sClient.patchSecret({ namespace, secretName: secret, body })
this.logger.info(`CertSecret已更新:${secret}`)
}
}
getClient (aliyunProvider, regionId) {
return new ROAClient({
accessKeyId: aliyunProvider.accessKeyId,
accessKeySecret: aliyunProvider.accessKeySecret,
endpoint: `https://cs.${regionId}.aliyuncs.com`,
apiVersion: '2015-12-15'
})
}
async getKubeConfig (client, clusterId, isPrivateIpAddress = false) {
const httpMethod = 'GET'
const uriPath = `/k8s/${clusterId}/user_config`
const queries = {
PrivateIpAddress: isPrivateIpAddress
}
const body = '{}'
const headers = {
'Content-Type': 'application/json'
}
const requestOption = {}
try {
const res = await client.request(httpMethod, uriPath, queries, body, headers, requestOption)
return res.config
} catch (e) {
console.error('请求出错:', e)
throw e
}
}
}

View File

@@ -0,0 +1,67 @@
import pkg from 'chai'
import { DeployCertToAliyunAckIngress } from '../../src/plugins/deploy-to-ack-ingress/index.js'
import { Certd } from '@certd/certd'
import { createOptions } from '../../../../../test/options.js'
import { K8sClient } from '@certd/plugin-common'
const { expect } = pkg
async function getOptions () {
const options = createOptions()
options.args.test = false
options.cert.email = 'xiaojunnuo@qq.com'
options.cert.domains = ['*.docmirror.cn']
const certd = new Certd(options)
const cert = await certd.readCurrentCert()
const context = {}
const deployOpts = {
accessProviders: options.accessProviders,
cert,
props: {
accessProvider: 'aliyun-yonsz-prod',
regionId: 'cn-shanghai',
clusterId: 'c9e107ca518314f70973636965037fc00',
secretName: 'default-ingress-secret1638601684896',
namespace: 'default',
ingressClass: 'nginx'
},
context
}
return { options, deployOpts }
}
describe('DeployCertToAliyunAckIngressNginx', function () {
it('#getAliyunSecrets', async function () {
this.timeout(50000)
const { options, deployOpts } = await getOptions()
const plugin = new DeployCertToAliyunAckIngress(options)
const ackClient = plugin.getClient(options.accessProviders[deployOpts.props.accessProvider], deployOpts.props.regionId)
const kubeConfig = await plugin.getKubeConfig(ackClient, deployOpts.props.clusterId, false)
const k8sClient = new K8sClient(kubeConfig)
const secrets = await k8sClient.getSecret({ namespace: 'default' })
console.log('secrets:', secrets)
})
it('#getAliyunIngreses', async function () {
this.timeout(50000)
const { options, deployOpts } = await getOptions()
const plugin = new DeployCertToAliyunAckIngress(options)
const ackClient = plugin.getClient(options.accessProviders[deployOpts.props.accessProvider], deployOpts.props.regionId)
const kubeConfig = await plugin.getKubeConfig(ackClient, deployOpts.props.clusterId, false)
const k8sClient = new K8sClient(kubeConfig)
const list = await k8sClient.getIngressList({ namespace: 'default' })
console.log('list:', list)
})
it('#execute', async function () {
this.timeout(5000)
const { options, deployOpts } = await getOptions()
const plugin = new DeployCertToAliyunAckIngress(options)
const ret = await plugin.doExecute(deployOpts)
console.log('success', ret)
})
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
{
"extends": "standard",
"env": {
"mocha": true
},
"overrides": [
{
"files": ["*.test.js", "*.spec.js"],
"rules": {
"no-unused-expressions": "off"
}
}
]
}

View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

View File

@@ -0,0 +1,23 @@
{
"name": "@certd/plugin-common",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"type": "module",
"dependencies": {
"kubernetes-client": "^9.0.0"
},
"devDependencies": {
"@certd/certd": "^0.3.1",
"chai": "^4.2.0",
"eslint": "^7.15.0",
"eslint-config-standard": "^16.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"mocha": "^8.2.1"
},
"author": "Greper",
"license": "MIT",
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -0,0 +1 @@
export { K8sClient } from './lib/k8s.client.js'

View File

@@ -87,6 +87,11 @@ export class K8sClient {
})
}
async getIngressList (opts) {
const namespace = opts.namespace || 'default'
return await this.client.apis.extensions.v1beta1.namespaces(namespace).ingresses.get()
}
async getIngress (opts) {
const namespace = opts.namespace || 'default'
const ingressName = opts.ingressName

View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,17 +1,17 @@
{
"name": "@certd/plugin-host",
"version": "0.1.18",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"type": "module",
"dependencies": {
"@certd/api": "^0.1.17",
"@certd/api": "^0.3.1",
"dayjs": "^1.9.7",
"lodash-es": "^4.17.20",
"ssh2": "^0.8.9"
},
"devDependencies": {
"@certd/certd": "^0.1.18",
"@certd/certd": "^0.3.1",
"chai": "^4.2.0",
"eslint": "^7.15.0",
"eslint-config-standard": "^16.0.2",
@@ -22,5 +22,5 @@
},
"author": "Greper",
"license": "MIT",
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -17,7 +17,7 @@ export class SSHAccessProvider {
required: true
},
password: { desc: '登录密码' },
publicKey: {
privateKey: {
desc: '密钥,密码或此项必填一项'
}
}

View File

@@ -36,4 +36,17 @@ describe('HostShellExecute', function () {
expect(ret).ok
console.log('-----' + JSON.stringify(ret))
})
it('#execute-publicKey-login', async function () {
this.timeout(10000)
const options = createOptions()
const plugin = new HostShellExecute(options)
const shellOpts = {
props: { script: ['ls'], accessProvider: 'tencent-ssh-base01' },
context: {}
}
const ret = await plugin.doExecute(shellOpts)
expect(ret).ok
console.log('-----' + JSON.stringify(ret))
})
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,19 @@
{
"name": "@certd/plugin-tencent",
"version": "0.1.18",
"version": "0.3.1",
"description": "",
"main": "src/index.js",
"type": "module",
"dependencies": {
"@certd/api": "^0.1.17",
"@certd/api": "^0.3.1",
"@certd/plugin-common": "^0.3.1",
"dayjs": "^1.9.7",
"kubernetes-client": "^9.0.0",
"lodash-es": "^4.17.20",
"tencentcloud-sdk-nodejs": "^4.0.44"
},
"devDependencies": {
"@certd/certd": "^0.1.18",
"@certd/certd": "^0.3.1",
"chai": "^4.2.0",
"eslint": "^7.15.0",
"eslint-config-standard": "^16.0.2",
@@ -23,5 +24,5 @@
},
"author": "Greper",
"license": "MIT",
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -29,7 +29,7 @@ export class DnspodDnsProvider extends AbstractDnsProvider {
this.loginToken = accessProvider.id + ',' + accessProvider.token
}
async doRequest (options) {
async doRequest (options, successCodes = []) {
const config = {
method: 'post',
formData: {
@@ -43,8 +43,11 @@ export class DnspodDnsProvider extends AbstractDnsProvider {
_.merge(config, options)
const ret = await request(config)
if (!ret || !ret.status || ret.status.code !== '1') {
throw new Error('请求失败:' + ret.status.message + ',api=' + config.url)
if (!ret || !ret.status) {
const code = ret.status.code
if (code !== '1' || !successCodes.includes(code)) {
throw new Error('请求失败:' + ret.status.message + ',api=' + config.url)
}
}
return ret
}
@@ -73,7 +76,7 @@ export class DnspodDnsProvider extends AbstractDnsProvider {
value: value,
mx: 1
}
})
}, ['104'])// 104错误码为记录已存在无需再次添加
this.logger.info('添加域名解析成功:', fullRecord, value, JSON.stringify(ret.record))
return ret.record
}

View File

@@ -1,6 +1,6 @@
import { AbstractTencentPlugin } from '../abstract-tencent.js'
import tencentcloud from 'tencentcloud-sdk-nodejs'
import { K8sClient } from '../../utils/util.k8s.client.js'
import { K8sClient } from '@certd/plugin-common'
export class DeployCertToTencentTKEIngress extends AbstractTencentPlugin {
/**
* 插件定义
@@ -41,6 +41,11 @@ export class DeployCertToTencentTKEIngress extends AbstractTencentPlugin {
label: 'ingress名称',
desc: '支持多个(传入数组)'
},
ingressClass: {
type: String,
label: 'ingress类型',
desc: '可选 qcloud / nginx'
},
clusterIp: {
type: String,
label: '集群内网ip',
@@ -86,7 +91,13 @@ export class DeployCertToTencentTKEIngress extends AbstractTencentPlugin {
// 修改内网解析ip地址
k8sClient.setLookup({ [clusterDomain]: { ip: props.clusterIp } })
}
await this.patchCertSecret({ k8sClient, props, context })
const ingressType = props.ingressClass || 'qcloud'
if (ingressType === 'qcloud') {
await this.patchQcloudCertSecret({ k8sClient, props, context })
} else {
await this.patchNginxCertSecret({ cert, k8sClient, props, context })
}
await this.sleep(2000) // 停留2秒等待secret部署完成
await this.restartIngress({ k8sClient, props })
return true
@@ -121,7 +132,7 @@ export class DeployCertToTencentTKEIngress extends AbstractTencentPlugin {
return ret.Kubeconfig
}
async patchCertSecret ({ k8sClient, props, context }) {
async patchQcloudCertSecret ({ k8sClient, props, context }) {
const { tencentCertId } = context
if (tencentCertId == null) {
throw new Error('请先将【上传证书到腾讯云】作为前置任务')
@@ -151,6 +162,35 @@ export class DeployCertToTencentTKEIngress extends AbstractTencentPlugin {
}
}
async patchNginxCertSecret ({ cert, k8sClient, props, context }) {
const crt = cert.crt
const key = cert.key
const crtBase64 = Buffer.from(crt).toString('base64')
const keyBase64 = Buffer.from(key).toString('base64')
const { namespace, secretName } = props
const body = {
data: {
'tls.crt': crtBase64,
'tls.key': keyBase64
},
metadata: {
labels: {
certd: this.appendTimeSuffix('certd')
}
}
}
let secretNames = secretName
if (typeof secretName === 'string') {
secretNames = [secretName]
}
for (const secret of secretNames) {
await k8sClient.patchSecret({ namespace, secretName: secret, body })
this.logger.info(`CertSecret已更新:${secret}`)
}
}
async restartIngress ({ k8sClient, props }) {
const { namespace, ingressName } = props

View File

@@ -0,0 +1,59 @@
import pkg from 'chai'
import { DeployCertToTencentTKEIngress } from '../../src/plugins/deploy-to-tke-ingress/index.js'
import { Certd } from '@certd/certd'
import { createOptions } from '../../../../../test/options.js'
import { K8sClient } from '../../src/utils/util.k8s.client.js'
const { expect } = pkg
async function getOptions () {
const options = createOptions()
options.args.test = false
options.cert.email = 'xiaojunnuo@qq.com'
options.cert.domains = ['*.docmirror.cn']
const certd = new Certd(options)
const cert = await certd.readCurrentCert()
const context = {}
const deployOpts = {
accessProviders: options.accessProviders,
cert,
props: {
accessProvider: 'tencent-yonsz',
region: 'ap-guangzhou',
clusterId: 'cls-6lbj1vee'
},
context
}
return { options, deployOpts }
}
describe('DeployCertToTencentTKEIngressNginx', function () {
it('#getTKESecrets', async function () {
this.timeout(50000)
const { options, deployOpts } = await getOptions()
const plugin = new DeployCertToTencentTKEIngress(options)
const tkeClient = plugin.getTkeClient(options.accessProviders[deployOpts.props.accessProvider], deployOpts.props.region)
const kubeConfig = await plugin.getTkeKubeConfig(tkeClient, deployOpts.props.clusterId)
const k8sClient = new K8sClient(kubeConfig)
k8sClient.setLookup({
'cls-6lbj1vee.ccs.tencent-cloud.com': { ip: '13.123.123.123' }
})
const secrets = await k8sClient.getSecret({ namespace: 'stress' })
console.log('secrets:', secrets)
})
it('#execute', async function () {
this.timeout(5000)
const { options, deployOpts } = await getOptions()
deployOpts.props.ingressName = 'stress-ingress-nginx'
deployOpts.props.ingressClass = 'nginx'
deployOpts.props.secretName = 'stress-all'
deployOpts.props.namespace = 'stress'
const plugin = new DeployCertToTencentTKEIngress(options)
const ret = await plugin.doExecute(deployOpts)
console.log('sucess', ret)
})
})

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

7
packages/ui/certd-server/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
yarn-error.log
yarn.lock
package-lock.json
/.idea/

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@certd/server",
"version": "0.1.18",
"version": "0.2.2",
"private": false,
"type": "module",
"scripts": {
@@ -10,11 +10,11 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@certd/api": "^0.1.17",
"@certd/executor": "^0.1.18",
"@certd/plugin-aliyun": "^0.1.18",
"@certd/plugin-host": "^0.1.18",
"@certd/plugin-tencent": "^0.1.18",
"@certd/api": "^0.3.1",
"@certd/executor": "^0.3.1",
"@certd/plugin-aliyun": "^0.3.1",
"@certd/plugin-host": "^0.3.1",
"@certd/plugin-tencent": "^0.3.1",
"compressing": "^1.5.1",
"debug": "^4.1.1",
"fs-extra": "^9.1.0",
@@ -39,5 +39,5 @@
"eslint-plugin-promise": "^4.2.1",
"nodemon": "^1.19.1"
},
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "5fbd7742665c0a949333d805153e9b6af91c0a71"
}

View File

@@ -3,16 +3,16 @@ import PluginAliyun from '@certd/plugin-aliyun'
import PluginTencent from '@certd/plugin-tencent'
import PluginHost from '@certd/plugin-host'
// import options
import { createRequire } from 'module'
// 安装默认插件和授权提供者
PluginAliyun.install()
PluginTencent.install()
PluginHost.install()
// import options
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const options =require('./options.json')
const options = require('./options.json')
//开始执行
// 开始执行
const executor = new Executor()
await executor.run(options)

View File

@@ -14,9 +14,9 @@
"author": "greper",
"license": "MIT",
"dependencies": {
"@certd/executor": "^0.1.15",
"@certd/plugin-aliyun": "^0.1.15",
"@certd/plugin-host": "^0.1.15",
"@certd/plugin-tencent": "^0.1.15"
"@certd/executor": "^0.3.1",
"@certd/plugin-aliyun": "^0.3.1",
"@certd/plugin-host": "^0.3.1",
"@certd/plugin-tencent": "^0.3.1"
}
}

View File

@@ -1 +1 @@
VUE_APP_API=/api
VITE_APP_API=/api

View File

@@ -0,0 +1,2 @@
node_modules
.idea

View File

@@ -1,28 +1,76 @@
module.exports = {
root: true,
env: {
node: true
browser: true,
node: true,
es6: true
},
parser: "vue-eslint-parser",
parserOptions: {
parser: "@typescript-eslint/parser",
ecmaVersion: 2020,
sourceType: "module",
jsxPragma: "React",
ecmaFeatures: {
jsx: true,
tsx: true
}
},
extends: [
'plugin:vue/vue3-essential',
'@vue/standard'
"plugin:vue/vue3-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier"
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
},
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
],
env: {
mocha: true
}
}
]
}
//"max-len": [0, 200, 2, { ignoreUrls: true }],
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
// "@typescript-eslint/no-unused-vars": [
// "error",
// {
// argsIgnorePattern: "^h$",
// varsIgnorePattern: "^h$",
// },
// ],
// "no-unused-vars": [
// "error",
// {
// argsIgnorePattern: "^h$",
// varsIgnorePattern: "^h$",
// },
// ],
// "vue/custom-event-name-casing": "off",
// "no-use-before-define": "off",
// "space-before-function-paren": "off",
// "vue/attributes-order": "off",
// "vue/one-component-per-file": "off",
// "vue/html-closing-bracket-newline": "off",
// "vue/max-attributes-per-line": "off",
// "vue/multiline-html-element-content-newline": "off",
// "vue/singleline-html-element-content-newline": "off",
// "vue/attribute-hyphenation": "off",
// "vue/require-default-prop": "off",
// "vue/html-self-closing": [
// "error",
// {
// html: {
// void: "always",
// normal: "never",
// component: "always",
// },
// svg: "always",
// math: "always",
// },
// ],
}
};

11
packages/ui/certd-ui/.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
/stats.html
yarn.lock
.idea
/.idea/
yarn-error.log
vite-profile.cpuprofile

View File

@@ -0,0 +1,2 @@
node_modules
/stats.html

View File

@@ -0,0 +1,5 @@
{
"trailingComma": "none",
"printWidth": 120
}

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>certd</title>
<link rel="stylesheet" type="text/css" href="/index.css" />
</head>
<body>
<div id="app">
<div class="fs-bootstrap">
<div class="fs-bootstrap__main">
<div class="fs-bootstrap__loading"></div>
</div>
</div>
</div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -1,62 +1,88 @@
{
"name": "@certd/certd-ui",
"version": "0.1.18",
"private": false,
"version": "0.2.1",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint"
"dev": "vite",
"dev:pm": "vite --mode pm",
"dev:force": "vite --force",
"debug": "vite --mode debug",
"debug:pm": "vite --mode debugpm",
"debug:force": "vite --force --mode debug",
"build": "vite build ",
"serve": "vite preview",
"preview": "vite preview",
"pretty-quick": "pretty-quick",
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/",
"upgrade": "yarn upgrade-interactive --latest"
},
"author": "Greper",
"license": "MIT",
"dependencies": {
"@ant-design/colors": "^6.0.0",
"@ant-design/icons-vue": "^6.0.1",
"ant-design-vue": "^2.0.0",
"axios": "^0.21.1",
"core-js": "^3.8.1",
"lodash-es": "^4.17.20",
"vue": "^3.0.4",
"vue-i18n": "^9.0.0-rc.2",
"vue-router": "^4.0.1"
"ant-design-vue": "^3.2.12",
"axios": "^0.27.2",
"core-js": "^3.25.4",
"dayjs": "^1.11.5",
"lodash-es": "^4.17.15",
"mitt": "^3.0.0",
"vue": "^3.2.40",
"vue-i18n": "^9.2.2",
"vue-router": "^4.1.5"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/eslint-parser": "^7.12.1",
"@vue/cli-plugin-babel": "~5.0.0-alpha.3",
"@vue/cli-plugin-eslint": "~5.0.0-alpha.3",
"@vue/cli-plugin-router": "~5.0.0-alpha.3",
"@vue/cli-plugin-unit-mocha": "~5.0.0-alpha.3",
"@vue/cli-plugin-webpack-4": "^5.0.0-alpha.3",
"@vue/cli-service": "~5.0.0-alpha.3",
"@vue/compiler-sfc": "^3.0.4",
"@vue/eslint-config-standard": "^6.0.0",
"@vue/test-utils": "^2.0.0-0",
"babel-eslint": "^10.1.0",
"babel-plugin-import": "^1.13.3",
"chai": "^4.2.0",
"compression-webpack-plugin": "^5.0.1",
"eslint": "^7.15.0",
"eslint-plugin-import": "^2.20.2",
"@rollup/plugin-commonjs": "^22.0.2",
"@rollup/plugin-node-resolve": "^14.1.0",
"@types/chai": "^4.3.3",
"@types/mocha": "^10.0.0",
"@types/node": "^18.8.0",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"@vitejs/plugin-legacy": "^2.2.0",
"@vitejs/plugin-vue": "^3.1.2",
"@vitejs/plugin-vue-jsx": "^2.0.1",
"@vue/compiler-sfc": "^3.2.40",
"@vue/eslint-config-typescript": "^11.0.2",
"@vue/test-utils": "^2.1.0",
"autoprefixer": "^10.4.12",
"caller-path": "^4.0.0",
"chai": "^4.1.2",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.2.0",
"less": "^3.0.4",
"less-loader": "^5.0.0",
"lint-staged": "^9.5.0",
"postcss": "^8.2.4",
"webpack": "^4.0.0"
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-vue": "^9.5.1",
"less": "^4.1.3",
"less-loader": "^11.0.0",
"lint-staged": "^13.0.3",
"postcss": "^8.4.17",
"prettier": "2.7.1",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup-plugin-visualizer": "^5.8.2",
"stylelint": "^14.13.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-order": "^5.0.0",
"vite": "^3.1.4",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-optimize-persist": "^0.1.2",
"vite-plugin-package-config": "^0.1.1",
"vue-eslint-parser": "^9.1.0"
},
"resolutions": {
"@vue/cli-*/webpack": "^4.0.0"
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
},
"gitHead": "4a421d5b142d453203c68ce6d1036e168ea2455b"
"gitHead": "9c2162697f3affea22c9a8cbc0ca74f4034ab27e",
"vite": {
"optimizeDeps": {
"include": [
"@iconify/iconify"
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,7 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="500" height="500" viewBox="0 0 500.000000 500.000000"
>
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
transform="translate(70, 76) scale(6,6)"
></path>
</svg>

After

Width:  |  Height:  |  Size: 402 B

View File

@@ -0,0 +1,44 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="800" height="300" viewBox="0 0 800.000000 300.000000"
>
<g fill="#333">
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
transform="translate(40, 40) scale(4,4)"
></path>
<g transform="translate(280, 260) scale(2,2)">
<path d="M28.95-58.70L49.98-58.70L49.98-48.22L33.70-48.22Q27.37-48.22 24.46-47.34Q21.56-46.46 19.62-43.91L19.62-43.91Q18.30-42.15 17.82-40.39Q17.34-38.63 16.98-34.41L16.98-34.41L49.98-34.41L49.98-23.94L16.98-23.94Q17.69-16.37 21.47-13.42Q25.26-10.47 34.32-10.47L34.32-10.47L49.98-10.47L49.98 0L33.70 0Q27.10 0 22.09-0.79L22.09-0.79Q14.17-2.11 9.50-7.74L9.50-7.74Q2.82-15.84 2.82-29.66L2.82-29.66Q2.82-44.97 12.23-53.50L12.23-53.50Q15.49-56.41 19.14-57.55Q22.79-58.70 28.95-58.70L28.95-58.70Z"
transform="translate(0 0) "
></path>
<path d="M28.51-22.26L18.48-22.26L18.48 0L5.98 0L5.98-58.70L34.67-58.70Q46.99-58.70 51.83-55.53L51.83-55.53Q55.18-53.42 56.98-49.94Q58.78-46.46 58.78-42.33L58.78-42.33Q58.78-33.97 54.56-29.39L54.56-29.39Q51.92-26.66 47.61-25.26L47.61-25.26Q51.04-24.02 52.80-22.66Q54.56-21.30 55.97-18.66L55.97-18.66Q57.02-16.54 57.51-14.61Q57.99-12.67 58.26-8.89L58.26-8.89Q58.78-2.55 59.66 0L59.66 0L45.67 0Q45.06-2.02 44.35-8.36L44.35-8.36Q43.91-13.46 42.55-16.19Q41.18-18.92 38.46-20.50L38.46-20.50Q35.02-22.35 28.51-22.26L28.51-22.26ZM18.48-48.22L18.48-32.74L35.99-32.74Q40.39-32.74 42.24-34.06L42.24-34.06Q45.06-35.99 45.06-40.83L45.06-40.83Q45.06-46.20 40.83-47.70L40.83-47.70Q39.34-48.22 35.99-48.22L35.99-48.22L18.48-48.22Z"
transform="translate(58.855999999999995 0) "
></path>
<path d="M19.01 0L19.01-48.22L0.35-48.22L0.35-58.70L50.95-58.70L50.95-48.22L31.50-48.22L31.50 0L19.01 0Z"
transform="translate(126.68799999999999 0) "
></path>
<path d="M5.98 0L5.98-58.70L30.89-58.70Q40.22-58.70 45.32-56.85L45.32-56.85Q54.74-53.42 57.90-44.26L57.90-44.26Q60.28-37.22 60.28-29.22L60.28-29.22Q60.28-21.30 57.99-14.26L57.99-14.26Q55.70-7.04 50.42-3.61L50.42-3.61Q47.08-1.50 43.08-0.75Q39.07 0 30.89 0L30.89 0L5.98 0ZM30.89-48.22L18.48-48.22L18.48-10.47L30.89-10.47Q39.07-10.47 42.24-14.08L42.24-14.08Q44.18-16.37 45.36-20.50Q46.55-24.64 46.55-29.30L46.55-29.30Q46.55-34.50 45.14-38.81Q43.74-43.12 41.45-45.23L41.45-45.23Q38.10-48.22 30.89-48.22L30.89-48.22Z"
transform="translate(183.07999999999998 0) "
></path>
</g>
<!-- <path d="M13.00-21.91L21.24-21.91L21.24-17.23L14.04-17.23Q10.39-17.23-->
<!-- 9-15.62L9-15.62Q7.65-14.08-->
<!-- 7.65-10.93L7.65-10.93Q7.65-7.42 9.86-5.80L9.86-5.80Q10.75-5.17-->
<!-- 11.81-4.93Q12.87-4.68-->
<!-- 14.76-4.68L14.76-4.68L21.24-4.68L21.24-->
<!-- 0L13.00 0Q9.67 0 7.74-0.67Q5.80-1.35-->
<!-- 4.32-3.01L4.32-3.01Q1.48-6.17-->
<!-- 1.48-11.03L1.48-11.03Q1.48-16.88-->
<!-- 4.86-19.75L4.86-19.75Q6.21-20.93-->
<!-- 8.10-21.42Q9.99-21.91-->
<!-- 13.00-21.91L13.00-21.91ZM31.05-13.32L43.74-13.32L43.74-8.64L31.05-8.64Q31.23-6.48-->
<!-- 32.44-5.58Q33.66-4.68 36.41-4.68L36.41-4.68L43.74-4.68L43.74 0L35.73 0Q33.12 0 31.48-0.47Q29.83-0.94 28.39-2.02L28.39-2.02Q24.39-5.13 24.39-11.25L24.39-11.25Q24.39-15.21 26.50-18.18L26.50-18.18Q27.94-20.20 29.97-21.06Q31.99-21.91 35.28-21.91L35.28-21.91L43.74-21.91L43.74-17.23L35.73-17.23Q33.25-17.23 32.27-16.40Q31.27-15.57 31.05-13.32L31.05-13.32ZM48.64 0L48.64-21.91L57.55-21.91Q60.30-21.91 61.81-21.53Q63.31-21.15 64.31-20.25L64.31-20.25Q65.30-19.35 65.70-18Q66.10-16.65 66.10-14.13L66.10-14.13L66.10-12.01L60.30-12.01L60.30-13.18Q60.30-15.52 59.49-16.38Q58.68-17.23 56.38-17.23L56.38-17.23L54.67-17.23L54.67 0L48.64 0ZM67.50-21.91L71.33-21.91L71.33-30.02L77.36-30.02L77.36-21.91L82.94-21.91L82.94-17.23L77.36-17.23L77.36-9.27Q77.36-6.48 77.85-5.76L77.85-5.76Q78.61-4.68 80.55-4.68L80.55-4.68L82.94-4.68L82.94 0L78.57 0Q74.66 0 72.99-1.89Q71.33-3.78 71.33-8.23L71.33-8.23L71.33-17.23L67.50-17.23L67.50-21.91ZM96.08-21.91L101.75-21.91L101.75-30.02L107.73-30.02L107.73 0L97.38 0Q94.23 0 92.61-0.49L92.61-0.49Q88.78-1.71 86.90-5.26L86.90-5.26Q85.59-7.65 85.59-11.12L85.59-11.12Q85.59-16.74 89.37-19.84L89.37-19.84Q91.84-21.91 96.08-21.91L96.08-21.91ZM97.38-4.68L101.75-4.68L101.75-17.23L97.38-17.23Q94.50-17.23 93.02-15.30L93.02-15.30Q91.71-13.68 91.71-11.12L91.71-11.12Q91.71-7.38 93.87-5.76L93.87-5.76Q95.36-4.68 97.38-4.68L97.38-4.68Z"-->
<!-- fill="#2c3e50"-->
<!-- transform="translate(300, 270) scale(4,4)"-->
<!-- ></path>-->
<text x="300" y="100" font-size="50" font-weight="bold">让你的证书永不过期</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,44 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="800" height="300" viewBox="0 0 800.000000 300.000000"
>
<g fill="#fff">
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
transform="translate(40, 40) scale(4,4)"
></path>
<g transform="translate(280, 260) scale(2,2)">
<path d="M28.95-58.70L49.98-58.70L49.98-48.22L33.70-48.22Q27.37-48.22 24.46-47.34Q21.56-46.46 19.62-43.91L19.62-43.91Q18.30-42.15 17.82-40.39Q17.34-38.63 16.98-34.41L16.98-34.41L49.98-34.41L49.98-23.94L16.98-23.94Q17.69-16.37 21.47-13.42Q25.26-10.47 34.32-10.47L34.32-10.47L49.98-10.47L49.98 0L33.70 0Q27.10 0 22.09-0.79L22.09-0.79Q14.17-2.11 9.50-7.74L9.50-7.74Q2.82-15.84 2.82-29.66L2.82-29.66Q2.82-44.97 12.23-53.50L12.23-53.50Q15.49-56.41 19.14-57.55Q22.79-58.70 28.95-58.70L28.95-58.70Z"
transform="translate(0 0) "
></path>
<path d="M28.51-22.26L18.48-22.26L18.48 0L5.98 0L5.98-58.70L34.67-58.70Q46.99-58.70 51.83-55.53L51.83-55.53Q55.18-53.42 56.98-49.94Q58.78-46.46 58.78-42.33L58.78-42.33Q58.78-33.97 54.56-29.39L54.56-29.39Q51.92-26.66 47.61-25.26L47.61-25.26Q51.04-24.02 52.80-22.66Q54.56-21.30 55.97-18.66L55.97-18.66Q57.02-16.54 57.51-14.61Q57.99-12.67 58.26-8.89L58.26-8.89Q58.78-2.55 59.66 0L59.66 0L45.67 0Q45.06-2.02 44.35-8.36L44.35-8.36Q43.91-13.46 42.55-16.19Q41.18-18.92 38.46-20.50L38.46-20.50Q35.02-22.35 28.51-22.26L28.51-22.26ZM18.48-48.22L18.48-32.74L35.99-32.74Q40.39-32.74 42.24-34.06L42.24-34.06Q45.06-35.99 45.06-40.83L45.06-40.83Q45.06-46.20 40.83-47.70L40.83-47.70Q39.34-48.22 35.99-48.22L35.99-48.22L18.48-48.22Z"
transform="translate(58.855999999999995 0) "
></path>
<path d="M19.01 0L19.01-48.22L0.35-48.22L0.35-58.70L50.95-58.70L50.95-48.22L31.50-48.22L31.50 0L19.01 0Z"
transform="translate(126.68799999999999 0) "
></path>
<path d="M5.98 0L5.98-58.70L30.89-58.70Q40.22-58.70 45.32-56.85L45.32-56.85Q54.74-53.42 57.90-44.26L57.90-44.26Q60.28-37.22 60.28-29.22L60.28-29.22Q60.28-21.30 57.99-14.26L57.99-14.26Q55.70-7.04 50.42-3.61L50.42-3.61Q47.08-1.50 43.08-0.75Q39.07 0 30.89 0L30.89 0L5.98 0ZM30.89-48.22L18.48-48.22L18.48-10.47L30.89-10.47Q39.07-10.47 42.24-14.08L42.24-14.08Q44.18-16.37 45.36-20.50Q46.55-24.64 46.55-29.30L46.55-29.30Q46.55-34.50 45.14-38.81Q43.74-43.12 41.45-45.23L41.45-45.23Q38.10-48.22 30.89-48.22L30.89-48.22Z"
transform="translate(183.07999999999998 0) "
></path>
</g>
<!-- <path d="M13.00-21.91L21.24-21.91L21.24-17.23L14.04-17.23Q10.39-17.23-->
<!-- 9-15.62L9-15.62Q7.65-14.08-->
<!-- 7.65-10.93L7.65-10.93Q7.65-7.42 9.86-5.80L9.86-5.80Q10.75-5.17-->
<!-- 11.81-4.93Q12.87-4.68-->
<!-- 14.76-4.68L14.76-4.68L21.24-4.68L21.24-->
<!-- 0L13.00 0Q9.67 0 7.74-0.67Q5.80-1.35-->
<!-- 4.32-3.01L4.32-3.01Q1.48-6.17-->
<!-- 1.48-11.03L1.48-11.03Q1.48-16.88-->
<!-- 4.86-19.75L4.86-19.75Q6.21-20.93-->
<!-- 8.10-21.42Q9.99-21.91-->
<!-- 13.00-21.91L13.00-21.91ZM31.05-13.32L43.74-13.32L43.74-8.64L31.05-8.64Q31.23-6.48-->
<!-- 32.44-5.58Q33.66-4.68 36.41-4.68L36.41-4.68L43.74-4.68L43.74 0L35.73 0Q33.12 0 31.48-0.47Q29.83-0.94 28.39-2.02L28.39-2.02Q24.39-5.13 24.39-11.25L24.39-11.25Q24.39-15.21 26.50-18.18L26.50-18.18Q27.94-20.20 29.97-21.06Q31.99-21.91 35.28-21.91L35.28-21.91L43.74-21.91L43.74-17.23L35.73-17.23Q33.25-17.23 32.27-16.40Q31.27-15.57 31.05-13.32L31.05-13.32ZM48.64 0L48.64-21.91L57.55-21.91Q60.30-21.91 61.81-21.53Q63.31-21.15 64.31-20.25L64.31-20.25Q65.30-19.35 65.70-18Q66.10-16.65 66.10-14.13L66.10-14.13L66.10-12.01L60.30-12.01L60.30-13.18Q60.30-15.52 59.49-16.38Q58.68-17.23 56.38-17.23L56.38-17.23L54.67-17.23L54.67 0L48.64 0ZM67.50-21.91L71.33-21.91L71.33-30.02L77.36-30.02L77.36-21.91L82.94-21.91L82.94-17.23L77.36-17.23L77.36-9.27Q77.36-6.48 77.85-5.76L77.85-5.76Q78.61-4.68 80.55-4.68L80.55-4.68L82.94-4.68L82.94 0L78.57 0Q74.66 0 72.99-1.89Q71.33-3.78 71.33-8.23L71.33-8.23L71.33-17.23L67.50-17.23L67.50-21.91ZM96.08-21.91L101.75-21.91L101.75-30.02L107.73-30.02L107.73 0L97.38 0Q94.23 0 92.61-0.49L92.61-0.49Q88.78-1.71 86.90-5.26L86.90-5.26Q85.59-7.65 85.59-11.12L85.59-11.12Q85.59-16.74 89.37-19.84L89.37-19.84Q91.84-21.91 96.08-21.91L96.08-21.91ZM97.38-4.68L101.75-4.68L101.75-17.23L97.38-17.23Q94.50-17.23 93.02-15.30L93.02-15.30Q91.71-13.68 91.71-11.12L91.71-11.12Q91.71-7.38 93.87-5.76L93.87-5.76Q95.36-4.68 97.38-4.68L97.38-4.68Z"-->
<!-- fill="#2c3e50"-->
<!-- transform="translate(300, 270) scale(4,4)"-->
<!-- ></path>-->
<text x="300" y="100" font-size="50" font-weight="bold">让你的证书永不过期</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,17 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="500" height="500" viewBox="0 0 500.000000 500.000000"
>
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
fill="#2c3e50"
transform="translate(124, 60) scale(4,4)"
></path>
<path d="M13.00-21.91L21.24-21.91L21.24-17.23L14.04-17.23Q10.39-17.23 9-15.62L9-15.62Q7.65-14.08 7.65-10.93L7.65-10.93Q7.65-7.42 9.86-5.80L9.86-5.80Q10.75-5.17 11.81-4.93Q12.87-4.68 14.76-4.68L14.76-4.68L21.24-4.68L21.24 0L13.00 0Q9.67 0 7.74-0.67Q5.80-1.35 4.32-3.01L4.32-3.01Q1.48-6.17 1.48-11.03L1.48-11.03Q1.48-16.88 4.86-19.75L4.86-19.75Q6.21-20.93 8.10-21.42Q9.99-21.91 13.00-21.91L13.00-21.91ZM31.05-13.32L43.74-13.32L43.74-8.64L31.05-8.64Q31.23-6.48 32.44-5.58Q33.66-4.68 36.41-4.68L36.41-4.68L43.74-4.68L43.74 0L35.73 0Q33.12 0 31.48-0.47Q29.83-0.94 28.39-2.02L28.39-2.02Q24.39-5.13 24.39-11.25L24.39-11.25Q24.39-15.21 26.50-18.18L26.50-18.18Q27.94-20.20 29.97-21.06Q31.99-21.91 35.28-21.91L35.28-21.91L43.74-21.91L43.74-17.23L35.73-17.23Q33.25-17.23 32.27-16.40Q31.27-15.57 31.05-13.32L31.05-13.32ZM48.64 0L48.64-21.91L57.55-21.91Q60.30-21.91 61.81-21.53Q63.31-21.15 64.31-20.25L64.31-20.25Q65.30-19.35 65.70-18Q66.10-16.65 66.10-14.13L66.10-14.13L66.10-12.01L60.30-12.01L60.30-13.18Q60.30-15.52 59.49-16.38Q58.68-17.23 56.38-17.23L56.38-17.23L54.67-17.23L54.67 0L48.64 0ZM67.50-21.91L71.33-21.91L71.33-30.02L77.36-30.02L77.36-21.91L82.94-21.91L82.94-17.23L77.36-17.23L77.36-9.27Q77.36-6.48 77.85-5.76L77.85-5.76Q78.61-4.68 80.55-4.68L80.55-4.68L82.94-4.68L82.94 0L78.57 0Q74.66 0 72.99-1.89Q71.33-3.78 71.33-8.23L71.33-8.23L71.33-17.23L67.50-17.23L67.50-21.91ZM96.08-21.91L101.75-21.91L101.75-30.02L107.73-30.02L107.73 0L97.38 0Q94.23 0 92.61-0.49L92.61-0.49Q88.78-1.71 86.90-5.26L86.90-5.26Q85.59-7.65 85.59-11.12L85.59-11.12Q85.59-16.74 89.37-19.84L89.37-19.84Q91.84-21.91 96.08-21.91L96.08-21.91ZM97.38-4.68L101.75-4.68L101.75-17.23L97.38-17.23Q94.50-17.23 93.02-15.30L93.02-15.30Q91.71-13.68 91.71-11.12L91.71-11.12Q91.71-7.38 93.87-5.76L93.87-5.76Q95.36-4.68 97.38-4.68L97.38-4.68Z"
fill="#2c3e50"
transform="translate(28, 430) scale(4,4)"
></path>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,7 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="500" height="500" viewBox="0 0 500.000000 500.000000"
>
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
transform="translate(70, 76) scale(6,6)"
></path>
</svg>

After

Width:  |  Height:  |  Size: 402 B

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
width="210mm"
height="210mm"
viewBox="0 0 210 210"
version="1.1"
id="svg8">
<defs
id="defs2" />
<g
id="layer1"
style="display:inline">
<path
style="fill:#002255;stroke:none;stroke-width:0.625348"
d="M 35.587501,69.766667 V 59.766664 h 70.000109 69.99991 v 10.000003 9.999997 H 105.58761 35.587501 Z"
id="path12" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2"
width="32.244232"
height="20"
x="71.506088"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8"
width="32.244232"
height="20"
x="107.42467"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8"
width="32.244232"
height="20"
x="143.34325"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4"
width="32.244232"
height="20"
x="71.506088"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-3"
width="32.244232"
height="20"
x="107.42467"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-2"
width="32.244232"
height="20"
x="143.34325"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7"
width="32.244232"
height="20"
x="35.587502"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4-0"
width="32.244232"
height="20"
x="35.587502"
y="129.82079" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-9"
width="32.244232"
height="20"
x="71.506088"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-37"
width="32.244232"
height="20"
x="107.42467"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-4"
width="32.244232"
height="20"
x="143.34325"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7-1"
width="32.244232"
height="20"
x="35.587502"
y="82.941666" />
</g>
<polygon
points="75.3,174.4 103.1,103.6 79.8,103.6 112.6,41.3 156.4,41.3 129.9,90.5 148.1,90.5 "
fill="#f6cc00"
id="polygon276"
transform="matrix(1.0930933,0,0,0.99853202,-17.517362,-0.52287941)" />
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,44 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="800" height="300" viewBox="0 0 800.000000 300.000000"
>
<g fill="#fff">
<path d="M28.34 56.68h28.34V36.12H28.34a7.79 7.79 0 1 1 0-15.58h19.84v9.05h8.5V12H28.34a16.29 16.29 0 0 0 0 32.58h19.84v3.56H28.34a19.84 19.84 0 0 1 0-39.68h28.34V0H28.34a28.34 28.34 0 0 0 0 56.68z"
transform="translate(40, 40) scale(4,4)"
></path>
<g transform="translate(280, 260) scale(2,2)">
<path d="M28.95-58.70L49.98-58.70L49.98-48.22L33.70-48.22Q27.37-48.22 24.46-47.34Q21.56-46.46 19.62-43.91L19.62-43.91Q18.30-42.15 17.82-40.39Q17.34-38.63 16.98-34.41L16.98-34.41L49.98-34.41L49.98-23.94L16.98-23.94Q17.69-16.37 21.47-13.42Q25.26-10.47 34.32-10.47L34.32-10.47L49.98-10.47L49.98 0L33.70 0Q27.10 0 22.09-0.79L22.09-0.79Q14.17-2.11 9.50-7.74L9.50-7.74Q2.82-15.84 2.82-29.66L2.82-29.66Q2.82-44.97 12.23-53.50L12.23-53.50Q15.49-56.41 19.14-57.55Q22.79-58.70 28.95-58.70L28.95-58.70Z"
transform="translate(0 0) "
></path>
<path d="M28.51-22.26L18.48-22.26L18.48 0L5.98 0L5.98-58.70L34.67-58.70Q46.99-58.70 51.83-55.53L51.83-55.53Q55.18-53.42 56.98-49.94Q58.78-46.46 58.78-42.33L58.78-42.33Q58.78-33.97 54.56-29.39L54.56-29.39Q51.92-26.66 47.61-25.26L47.61-25.26Q51.04-24.02 52.80-22.66Q54.56-21.30 55.97-18.66L55.97-18.66Q57.02-16.54 57.51-14.61Q57.99-12.67 58.26-8.89L58.26-8.89Q58.78-2.55 59.66 0L59.66 0L45.67 0Q45.06-2.02 44.35-8.36L44.35-8.36Q43.91-13.46 42.55-16.19Q41.18-18.92 38.46-20.50L38.46-20.50Q35.02-22.35 28.51-22.26L28.51-22.26ZM18.48-48.22L18.48-32.74L35.99-32.74Q40.39-32.74 42.24-34.06L42.24-34.06Q45.06-35.99 45.06-40.83L45.06-40.83Q45.06-46.20 40.83-47.70L40.83-47.70Q39.34-48.22 35.99-48.22L35.99-48.22L18.48-48.22Z"
transform="translate(58.855999999999995 0) "
></path>
<path d="M19.01 0L19.01-48.22L0.35-48.22L0.35-58.70L50.95-58.70L50.95-48.22L31.50-48.22L31.50 0L19.01 0Z"
transform="translate(126.68799999999999 0) "
></path>
<path d="M5.98 0L5.98-58.70L30.89-58.70Q40.22-58.70 45.32-56.85L45.32-56.85Q54.74-53.42 57.90-44.26L57.90-44.26Q60.28-37.22 60.28-29.22L60.28-29.22Q60.28-21.30 57.99-14.26L57.99-14.26Q55.70-7.04 50.42-3.61L50.42-3.61Q47.08-1.50 43.08-0.75Q39.07 0 30.89 0L30.89 0L5.98 0ZM30.89-48.22L18.48-48.22L18.48-10.47L30.89-10.47Q39.07-10.47 42.24-14.08L42.24-14.08Q44.18-16.37 45.36-20.50Q46.55-24.64 46.55-29.30L46.55-29.30Q46.55-34.50 45.14-38.81Q43.74-43.12 41.45-45.23L41.45-45.23Q38.10-48.22 30.89-48.22L30.89-48.22Z"
transform="translate(183.07999999999998 0) "
></path>
</g>
<!-- <path d="M13.00-21.91L21.24-21.91L21.24-17.23L14.04-17.23Q10.39-17.23-->
<!-- 9-15.62L9-15.62Q7.65-14.08-->
<!-- 7.65-10.93L7.65-10.93Q7.65-7.42 9.86-5.80L9.86-5.80Q10.75-5.17-->
<!-- 11.81-4.93Q12.87-4.68-->
<!-- 14.76-4.68L14.76-4.68L21.24-4.68L21.24-->
<!-- 0L13.00 0Q9.67 0 7.74-0.67Q5.80-1.35-->
<!-- 4.32-3.01L4.32-3.01Q1.48-6.17-->
<!-- 1.48-11.03L1.48-11.03Q1.48-16.88-->
<!-- 4.86-19.75L4.86-19.75Q6.21-20.93-->
<!-- 8.10-21.42Q9.99-21.91-->
<!-- 13.00-21.91L13.00-21.91ZM31.05-13.32L43.74-13.32L43.74-8.64L31.05-8.64Q31.23-6.48-->
<!-- 32.44-5.58Q33.66-4.68 36.41-4.68L36.41-4.68L43.74-4.68L43.74 0L35.73 0Q33.12 0 31.48-0.47Q29.83-0.94 28.39-2.02L28.39-2.02Q24.39-5.13 24.39-11.25L24.39-11.25Q24.39-15.21 26.50-18.18L26.50-18.18Q27.94-20.20 29.97-21.06Q31.99-21.91 35.28-21.91L35.28-21.91L43.74-21.91L43.74-17.23L35.73-17.23Q33.25-17.23 32.27-16.40Q31.27-15.57 31.05-13.32L31.05-13.32ZM48.64 0L48.64-21.91L57.55-21.91Q60.30-21.91 61.81-21.53Q63.31-21.15 64.31-20.25L64.31-20.25Q65.30-19.35 65.70-18Q66.10-16.65 66.10-14.13L66.10-14.13L66.10-12.01L60.30-12.01L60.30-13.18Q60.30-15.52 59.49-16.38Q58.68-17.23 56.38-17.23L56.38-17.23L54.67-17.23L54.67 0L48.64 0ZM67.50-21.91L71.33-21.91L71.33-30.02L77.36-30.02L77.36-21.91L82.94-21.91L82.94-17.23L77.36-17.23L77.36-9.27Q77.36-6.48 77.85-5.76L77.85-5.76Q78.61-4.68 80.55-4.68L80.55-4.68L82.94-4.68L82.94 0L78.57 0Q74.66 0 72.99-1.89Q71.33-3.78 71.33-8.23L71.33-8.23L71.33-17.23L67.50-17.23L67.50-21.91ZM96.08-21.91L101.75-21.91L101.75-30.02L107.73-30.02L107.73 0L97.38 0Q94.23 0 92.61-0.49L92.61-0.49Q88.78-1.71 86.90-5.26L86.90-5.26Q85.59-7.65 85.59-11.12L85.59-11.12Q85.59-16.74 89.37-19.84L89.37-19.84Q91.84-21.91 96.08-21.91L96.08-21.91ZM97.38-4.68L101.75-4.68L101.75-17.23L97.38-17.23Q94.50-17.23 93.02-15.30L93.02-15.30Q91.71-13.68 91.71-11.12L91.71-11.12Q91.71-7.38 93.87-5.76L93.87-5.76Q95.36-4.68 97.38-4.68L97.38-4.68Z"-->
<!-- fill="#2c3e50"-->
<!-- transform="translate(300, 270) scale(4,4)"-->
<!-- ></path>-->
<text x="300" y="100" font-size="50" font-weight="bold">让你的证书永不过期</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
width="210mm"
height="210mm"
viewBox="0 0 210 210"
version="1.1"
id="svg8"
>
<g id="layer1" style="display:inline">
<path
style="fill:#002255;stroke:none;stroke-width:0.625348"
d="M 35.587501,69.766667 V 59.766664 h 70.000109 69.99991 v 10.000003 9.999997 H 105.58761 35.587501 Z"
id="path12" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2"
width="32.244232"
height="20"
x="71.506088"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8"
width="32.244232"
height="20"
x="107.42467"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8"
width="32.244232"
height="20"
x="143.34325"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4"
width="32.244232"
height="20"
x="71.506088"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-3"
width="32.244232"
height="20"
x="107.42467"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-2"
width="32.244232"
height="20"
x="143.34325"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7"
width="32.244232"
height="20"
x="35.587502"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4-0"
width="32.244232"
height="20"
x="35.587502"
y="129.82079" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-9"
width="32.244232"
height="20"
x="71.506088"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-37"
width="32.244232"
height="20"
x="107.42467"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-4"
width="32.244232"
height="20"
x="143.34325"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7-1"
width="32.244232"
height="20"
x="35.587502"
y="82.941666" />
</g>
<polygon
points="75.3,174.4 103.1,103.6 79.8,103.6 112.6,41.3 156.4,41.3 129.9,90.5 148.1,90.5 "
fill="#f6cc00"
id="polygon276"
transform="matrix(1.0930933,0,0,0.99853202,-17.517362,-0.52287941)" />
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,12 @@
html, body, #app { height: 100%; margin: 0; padding: 0; width: 100%;}
.fs-bootstrap { background-color: #474949; height: 100%; display: flex; flex-direction: column;position: fixed;width: 100% }
.fs-bootstrap__main {flex:1; user-select: none; width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.fs-bootstrap__footer { width: 100%; flex-grow: 0; text-align: center; padding: 10px 0; }
.fs-bootstrap__footer > a { font-size: 12px; color: #ABABAB; text-decoration: none; }
.fs-bootstrap__loading {box-sizing: border-box; height: 50px; width: 50px; margin-bottom: 5px;border:5px solid #333333;border-bottom:#aaa 5px solid;
border-radius:1000px; animation:load 1.1s infinite linear;-webkit-animation:load 1.1s infinite linear;-moz-animation:load 1.1s infinite linear; -o-animation:load 1.1s infinite linear;
}
@keyframes load {from {transform:rotate(0deg);-ms-transform:rotate(0deg);}to { transform:rotate(360deg);-ms-transform:rotate(360deg); }
}@-webkit-keyframes load {from {-webkit-transform:rotate(0deg); }to { -webkit-transform:rotate(360deg);}
}@-moz-keyframes load { from { -moz-transform:rotate(0deg); } to { -moz-transform:rotate(360deg);}
}@-o-keyframes load { from { -o-transform:rotate(0deg);} to { -o-transform:rotate(360deg);}}

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
width="210mm"
height="210mm"
viewBox="0 0 210 210"
version="1.1"
id="svg8"
>
<g id="layer1" style="display:inline">
<path
style="fill:#002255;stroke:none;stroke-width:0.625348"
d="M 35.587501,69.766667 V 59.766664 h 70.000109 69.99991 v 10.000003 9.999997 H 105.58761 35.587501 Z"
id="path12" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2"
width="32.244232"
height="20"
x="71.506088"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8"
width="32.244232"
height="20"
x="107.42467"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8"
width="32.244232"
height="20"
x="143.34325"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4"
width="32.244232"
height="20"
x="71.506088"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-3"
width="32.244232"
height="20"
x="107.42467"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-2"
width="32.244232"
height="20"
x="143.34325"
y="129.82079" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7"
width="32.244232"
height="20"
x="35.587502"
y="106.64581" />
<rect
style="fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-4-0"
width="32.244232"
height="20"
x="35.587502"
y="129.82079" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-9"
width="32.244232"
height="20"
x="71.506088"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-8-37"
width="32.244232"
height="20"
x="107.42467"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-8-5-8-4"
width="32.244232"
height="20"
x="143.34325"
y="82.941666" />
<rect
style="display:inline;fill:#2a7fff;fill-rule:evenodd;stroke-width:0.214311"
id="rect22-2-7-1"
width="32.244232"
height="20"
x="35.587502"
y="82.941666" />
</g>
<polygon
points="75.3,174.4 103.1,103.6 79.8,103.6 112.6,41.3 156.4,41.3 129.9,90.5 148.1,90.5 "
fill="#f6cc00"
id="polygon276"
transform="matrix(1.0930933,0,0,0.99853202,-17.517362,-0.52287941)" />
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -16,7 +16,6 @@
</template>
<script>
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import { useI18n } from 'vue-i18n'
export default {
data () {
@@ -25,8 +24,6 @@ export default {
}
},
setup () {
const { t } = useI18n() // call `useI18n`, and spread `t` from `useI18n` returning
return { t } // return render context that included `t`
}
}
</script>

View File

@@ -1,14 +1,14 @@
import { request } from './service'
import inputHandler from './util.input.handler'
import { request } from "./service";
import inputHandler from "./util.input.handler";
export default {
async list () {
async list() {
const ret = await request({
url: '/access-providers/list'
})
url: "/access-providers/list"
});
inputHandler.handle(ret)
inputHandler.handle(ret);
return ret
return ret;
}
}
};

View File

@@ -1,14 +1,14 @@
import { request } from './service'
import inputHandler from './util.input.handler'
import { request } from "./service";
import inputHandler from "./util.input.handler";
export default {
async list () {
async list() {
const ret = await request({
url: '/dns-providers/list'
})
url: "/dns-providers/list"
});
inputHandler.handle(ret)
inputHandler.handle(ret);
return ret
return ret;
}
}
};

View File

@@ -1,40 +1,40 @@
import { request } from './service'
import _ from 'lodash-es'
function arrayToMap (arr) {
import { request } from "./service";
import _ from "lodash-es";
function arrayToMap(arr) {
if (arr && arr instanceof Array) {
const map = {}
_.forEach(arr, item => {
map[item.key] = item
})
return map
const map = {};
_.forEach(arr, (item) => {
map[item.key] = item;
});
return map;
}
return arr
return arr;
}
function transfer (options) {
options.accessProviders = arrayToMap(options.accessProviders)
function transfer(options) {
options.accessProviders = arrayToMap(options.accessProviders);
}
export default {
exportsToZip (options) {
transfer(options)
exportsToZip(options) {
transfer(options);
return request({
url: '/exports/toZip',
url: "/exports/toZip",
data: { options },
method: 'post',
responseType: 'blob' // 重点在于配置responseType: 'blob'
}).then(res => {
console.log('res', res)
const filename = decodeURI(res.headers['content-disposition'].replace('attachment;filename=', '')) // 由后端设置下载文件名
const blob = new Blob([res.data], { type: 'application/zip' })
const a = document.createElement('a')
const url = window.URL.createObjectURL(blob)
a.href = url
a.download = filename
const body = document.getElementsByTagName('body')[0]
body.appendChild(a)
a.click()
body.removeChild(a)
window.URL.revokeObjectURL(url)
})
method: "post",
responseType: "blob" // 重点在于配置responseType: 'blob'
}).then((res) => {
console.log("res", res);
const filename = decodeURI(res.headers["content-disposition"].replace("attachment;filename=", "")); // 由后端设置下载文件名
const blob = new Blob([res.data], { type: "application/zip" });
const a = document.createElement("a");
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = filename;
const body = document.getElementsByTagName("body")[0];
body.appendChild(a);
a.click();
body.removeChild(a);
window.URL.revokeObjectURL(url);
});
}
}
};

View File

@@ -1,14 +1,14 @@
import { request } from './service'
import inputHandler from './util.input.handler'
import { request } from "./service";
import inputHandler from "./util.input.handler";
export default {
async list () {
async list() {
const ret = await request({
url: '/plugins/list'
})
url: "/plugins/list"
});
inputHandler.handle(ret)
inputHandler.handle(ret);
console.log('plugins', ret)
return ret
console.log("plugins", ret);
return ret;
}
}
};

View File

@@ -1,10 +1,15 @@
import { assign, map } from 'lodash'
import { service, request } from './service'
import { assign, map } from "lodash";
import { service, request } from "./service";
const files = require.context('./modules', false, /\.js$/)
const generators = files.keys().map(key => files(key).default)
const files = require.context("./modules", false, /\.js$/);
const generators = files.keys().map((key) => files(key).default);
export default assign({}, ...map(generators, generator => generator({
service,
request
})))
export default assign(
{},
...map(generators, (generator) =>
generator({
service,
request
})
)
);

View File

@@ -1,94 +1,117 @@
import axios from 'axios'
import { get } from 'lodash-es'
import { errorLog, errorCreate } from './tools'
import axios from "axios";
import { get } from "lodash-es";
import { errorLog, errorCreate } from "./tools";
import { env } from "/src/utils/util.env";
/**
* @description 创建请求实例
*/
function createService () {
function createService() {
// 创建一个 axios 实例
const service = axios.create()
const service = axios.create();
// 请求拦截
service.interceptors.request.use(
config => config,
error => {
(config) => config,
(error) => {
// 发送失败
console.log(error)
return Promise.reject(error)
console.log(error);
return Promise.reject(error);
}
)
);
// 响应拦截
service.interceptors.response.use(
response => {
console.log('response.config', response.config)
if (response.config.responseType === 'blob') {
return response
(response) => {
console.log("response.config", response.config);
if (response.config.responseType === "blob") {
return response;
}
// dataAxios 是 axios 返回数据中的 data
const dataAxios = response.data
const dataAxios = response.data;
// 这个状态码是和后端约定的
const { code } = dataAxios
const { code } = dataAxios;
// 根据 code 进行判断
if (code === undefined) {
// 如果没有 code 代表这不是项目后端开发的接口 比如可能是 D2Admin 请求最新版本
if (response.config.unpack) {
return dataAxios
return dataAxios;
}
return dataAxios.data
return dataAxios.data;
} else {
// 有 code 代表这是一个后端接口 可以进行进一步的判断
switch (code) {
case 0:
// [ 示例 ] code === 0 代表没有错误
return dataAxios.data
return dataAxios.data;
default:
// 不是正确的 code
errorCreate(`${dataAxios.msg}: ${response.config.url}`)
return dataAxios
errorCreate(`${dataAxios.msg}: ${response.config.url}`);
return dataAxios;
}
}
},
error => {
const status = get(error, 'response.status')
(error) => {
const status = get(error, "response.status");
switch (status) {
case 400: error.message = '请求错误'; break
case 401: error.message = '未授权,请登录'; break
case 403: error.message = '拒绝访问'; break
case 404: error.message = `请求地址出错: ${error.response.config.url}`; break
case 408: error.message = '请求超时'; break
case 500: error.message = '服务器内部错误'; break
case 501: error.message = '服务未实现'; break
case 502: error.message = '网关错误'; break
case 503: error.message = '服务不可用'; break
case 504: error.message = '网关超时'; break
case 505: error.message = 'HTTP版本不受支持'; break
default: break
case 400:
error.message = "请求错误";
break;
case 401:
error.message = "未授权,请登录";
break;
case 403:
error.message = "拒绝访问";
break;
case 404:
error.message = `请求地址出错: ${error.response.config.url}`;
break;
case 408:
error.message = "请求超时";
break;
case 500:
error.message = "服务器内部错误";
break;
case 501:
error.message = "服务未实现";
break;
case 502:
error.message = "网关错误";
break;
case 503:
error.message = "服务不可用";
break;
case 504:
error.message = "网关超时";
break;
case 505:
error.message = "HTTP版本不受支持";
break;
default:
break;
}
errorLog(error)
return Promise.reject(error)
errorLog(error);
return Promise.reject(error);
}
)
return service
);
return service;
}
/**
* @description 创建请求方法
* @param {Object} service axios 实例
*/
function createRequestFunction (service) {
function createRequestFunction(service) {
return function (config) {
const configDefault = {
headers: {
'Content-Type': get(config, 'headers.Content-Type', 'application/json')
"Content-Type": get(config, "headers.Content-Type", "application/json")
},
timeout: 5000,
baseURL: process.env.VUE_APP_API,
baseURL: env.API,
data: {}
}
return service(Object.assign(configDefault, config))
}
};
return service(Object.assign(configDefault, config));
};
}
// 用于真实网络请求的实例和请求方法
export const service = createService()
export const request = createRequestFunction(service)
export const service = createService();
export const request = createRequestFunction(service);

View File

@@ -1,18 +1,18 @@
import { notification } from 'ant-design-vue'
import { notification } from "ant-design-vue";
/**
* @description 安全地解析 json 字符串
* @param {String} jsonString 需要解析的 json 字符串
* @param {String} defaultValue 默认值
*/
export function parse (jsonString = '{}', defaultValue = {}) {
let result = defaultValue
export function parse(jsonString = "{}", defaultValue = {}) {
let result = defaultValue;
try {
result = JSON.parse(jsonString)
result = JSON.parse(jsonString);
} catch (error) {
console.log(error)
console.log(error);
}
return result
return result;
}
/**
@@ -21,11 +21,8 @@ export function parse (jsonString = '{}', defaultValue = {}) {
* @param {String} msg 状态信息
* @param {Number} code 状态码
*/
export function response (data = {}, msg = '', code = 0) {
return [
200,
{ code, msg, data }
]
export function response(data = {}, msg = "", code = 0) {
return [200, { code, msg, data }];
}
/**
@@ -33,8 +30,8 @@ export function response (data = {}, msg = '', code = 0) {
* @param {Any} data 返回值
* @param {String} msg 状态信息
*/
export function responseSuccess (data = {}, msg = '成功') {
return response(data, msg)
export function responseSuccess(data = {}, msg = "成功") {
return response(data, msg);
}
/**
@@ -43,29 +40,29 @@ export function responseSuccess (data = {}, msg = '成功') {
* @param {String} msg 状态信息
* @param {Number} code 状态码
*/
export function responseError (data = {}, msg = '请求失败', code = 500) {
return response(data, msg, code)
export function responseError(data = {}, msg = "请求失败", code = 500) {
return response(data, msg, code);
}
/**
* @description 记录和显示错误
* @param {Error} error 错误对象
*/
export function errorLog (error) {
export function errorLog(error) {
// 打印到控制台
console.log(error)
console.log(error);
// 显示提示
notification.error({
message: error.message
})
});
}
/**
* @description 创建一个错误
* @param {String} msg 错误信息
*/
export function errorCreate (msg) {
const error = new Error(msg)
errorLog(error)
throw error
export function errorCreate(msg) {
const error = new Error(msg);
errorLog(error);
throw error;
}

View File

@@ -1,37 +1,35 @@
import _ from 'lodash-es'
import _ from "lodash-es";
function handleInputs (inputs) {
function handleInputs(inputs) {
if (inputs == null) {
return
return;
}
_.forEach(inputs, (item, key) => {
if (item.required === true) {
if (item.component == null) {
item.component = {}
item.component = {};
}
let rules = item.component.rules
let rules = item.component.rules;
if (rules == null) {
item.component.rules = rules = []
item.component.rules = rules = [];
}
if (rules.length > 0) {
const hasRequired = rules.filter(rule => {
return rule.required === true
})
const hasRequired = rules.filter((rule) => {
return rule.required === true;
});
if (hasRequired.length > 0) {
return
return;
}
}
rules.push({ required: true, message: '该项必填' })
delete item.required
rules.push({ required: true, message: "该项必填" });
delete item.required;
}
})
});
}
export default {
handle (list) {
_.forEach(list, item => {
handleInputs(item.input)
})
handle(list) {
_.forEach(list, (item) => {
handleInputs(item.input);
});
}
}
};

View File

@@ -5,7 +5,8 @@
:closable="true"
width="500px"
v-model:visible="visible"
:after-visible-change="onAfterVisibleChange"
:destroyOnClose="true"
@after-visible-change="onAfterVisibleChange"
>
<div class="d-container access-provider-manager">
<a-button @click="add">
@@ -73,8 +74,6 @@
<script>
import { ref, reactive, nextTick, watch, inject } from 'vue'
// eslint-disable-next-line no-unused-vars
import { useForm } from '@ant-design-vue/use'
import _ from 'lodash-es'
import providerApi from '../../api/api.access-providers'
function useEdit (props, context, onEditSave) {

View File

@@ -1,4 +1,5 @@
<template>
<div>
<div class="access-provider-selector">
<a-select
:value="value"
@@ -18,11 +19,11 @@
:filter="filter"
@update:value="valueUpdate"
></access-provider-manager>
</div>
</template>
<script>
import { ref, inject } from 'vue'
import AccessProviderManager from './access-provider-manager'
import AccessProviderManager from './access-provider-manager.vue'
export default {
name: 'access-provider-selector',

View File

@@ -1,6 +1,6 @@
import DContainer from './d-container'
import ComponentRender from './component-render'
import AccessProviderSelector from './access-provider-selector/access-provider-selector'
import DContainer from './d-container.vue'
import ComponentRender from './component-render.vue'
import AccessProviderSelector from './access-provider-selector/access-provider-selector.vue'
const list = [
DContainer,

View File

@@ -4,12 +4,9 @@ import App from './App.vue'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'
import './style/common.less'
import { i18n } from './i18n'
import icons from './icons'
import components from './components'
const app = createApp(App)
app.config.productionTip = false
app.use(i18n)
icons(app)
app.use(Antd)
app.use(components)

View File

@@ -0,0 +1,40 @@
import _ from "lodash-es";
export function getEnvValue(key) {
// @ts-ignore
return import.meta.env["VITE_APP_" + key];
}
export class EnvConfig {
API;
MODE;
STORAGE;
TITLE;
PM_ENABLED;
constructor() {
this.init();
}
init() {
// @ts-ignore
_.forEach(import.meta.env, (value, key) => {
if (key.startsWith("VITE_APP")) {
key = key.replace("VITE_APP_", "");
this[key] = value;
}
});
// @ts-ignore
this.MODE = import.meta.env.MODE;
}
get(key, defaultValue) {
return this[key] ?? defaultValue;
}
isDev() {
return this.MODE === "development" || this.MODE === "debug";
}
isProd() {
return this.MODE === "production";
}
}
export const env = new EnvConfig();

View File

@@ -1,16 +1,16 @@
<template>
<div class="page-index flex-center">
<H2 class="title">CERT-D</H2>
<h2 class="title">CERT-D</h2>
<div class="page-body">
<a-tabs @change="callback">
<a-tabs >
<a-tab-pane key="1" tab="创建新证书">
<div class="create-from-domains">
<div class="input-row flex-row">
<a-select
size="large"
mode="tags"
:placeholder="$t('please.input.domain')"
placeholder="请输入域名"
v-model:value="formData.cert.domains"
:open="false"
></a-select>
@@ -51,11 +51,13 @@ export default {
})
const router = useRouter()
const createFromDomain = () => {
console.log("formData:",formData)
goToDetail(JSON.stringify(formData))
}
const goToDetail = (options) => {
router.push({ name: 'detail', params: { options } })
console.log("options:",options)
router.push({ name: 'detail', state: { options } })
}
const autoSize = reactive({ minRows: 8, maxRows: 10 })

View File

@@ -5,17 +5,17 @@
:closable="true"
width="600px"
v-model:visible="visible"
:after-visible-change="afterVisibleChange"
@after-visible-change="afterVisibleChange"
>
<d-container>
<a-form class="domain-form" :model="formData" :scrollToFirstError="true" :label-col="labelCol" :wrapper-col="wrapperCol">
<h3>域名信息</h3>
<a-form-item :label="$t('domain')" v-bind="validateInfos.domains">
<a-form-item label="域名" v-bind="validateInfos.domains">
<a-select
mode="tags"
:placeholder="$t('please.input.domain')"
placeholder="请输入域名"
v-model:value="formData.domains"
:open="false"
></a-select>
@@ -24,7 +24,7 @@
</template>
</a-form-item>
<a-form-item :label="$t('email')" v-bind="validateInfos.email">
<a-form-item label="邮箱" v-bind="validateInfos.email">
<a-input v-model:value="formData.email"/>
</a-form-item>
@@ -86,7 +86,8 @@
</template>
<script>
import { reactive, ref, watch } from 'vue'
import { useForm } from '@ant-design-vue/use'
import { Form } from 'ant-design-vue';
const useForm = Form.useForm;
import dnsProviderApi from '../../../api/api.dns-providers'
import _ from 'lodash-es'

View File

@@ -4,7 +4,7 @@
:closable="true"
width="600px"
v-model:visible="taskDrawerVisible"
:after-visible-change="taskDrawerOnAfterVisibleChange"
@after-visible-change="taskDrawerOnAfterVisibleChange"
>
<template #title>

View File

@@ -184,13 +184,13 @@ import { message } from 'ant-design-vue'
// eslint-disable-next-line no-unused-vars
import { reactive, ref, toRef, toRefs, provide, readonly } from 'vue'
// eslint-disable-next-line no-unused-vars
import { useRoute } from 'vue-router'
import CertForm from './components/cert-form'
import TaskForm from './components/task-form'
import { useRoute,useRouter } from 'vue-router'
import CertForm from './components/cert-form.vue'
import TaskForm from './components/task-form.vue'
import exportsApi from '../../api/api.exports'
import _ from 'lodash-es'
import DContainer from '../../components/d-container'
import commonUtil from '@/utils/util.common'
import DContainer from '../../components/d-container.vue'
import commonUtil from '/src/utils/util.common'
function useDeploy (options) {
const deployAdd = () => {
options.deploy.push({
@@ -245,9 +245,8 @@ function useExports (options) {
export default {
components: { DContainer, CertForm, TaskForm },
setup () {
const route = useRoute()
console.log('route', route)
const optionParams = route.params.options ? JSON.parse(route.params.options) : {}
const state = history.state
const optionParams = state.options ? JSON.parse(state.options ) : {}
if (optionParams.accessProviders) {
optionParams.accessProviders = commonUtil.mapToArray(optionParams.accessProviders)
}
@@ -286,6 +285,10 @@ export default {
taskFormRef.value.taskEdit(deploy, task, index)
}
function taskUpdated(task){
console.log('task updated',task)
}
useProvideAccessProviders(options)
return {
@@ -297,6 +300,7 @@ export default {
taskFormRef,
taskAdd,
taskEdit,
taskUpdated,
...useExports(options)
}
}

View File

@@ -0,0 +1,45 @@
{
"compilerOptions": {
// 这样就可以对 `this` 上的数据属性进行更严格的推断`
"noImplicitAny": false,
"target": "esnext",
"module": "esnext",
"strict": true,
"jsx": "preserve",
"importHelpers": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": ".",
"outDir": "./dist/ts",
"types": [
"mocha",
"chai",
"node"
],
"paths": {
"/@/*": ["src/*"],
"/src/*": ["src/*"],
"/#/*": ["types/*"]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

View File

@@ -0,0 +1,66 @@
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import visualizer from "rollup-plugin-visualizer";
import viteCompression from "vite-plugin-compression";
import * as path from "path";
// import { generateModifyVars } from "./build/modify-vars";
// import { configThemePlugin } from "./build/theme-plugin";
// import OptimizationPersist from "vite-plugin-optimize-persist";
// import PkgConfig from "vite-plugin-package-config";
// https://vitejs.dev/config/
// 增加环境变量 _
process.env.VITE_APP_VERSION = require("./package.json").version;
process.env.VITE_APP_BUILD_TIME = require("dayjs")().format("YYYY-M-D HH:mm:ss");
export default ({ command, mode }) => {
console.log("args", command, mode);
const devServerFs: any = {};
const devAlias: any[] = [];
return {
base: "/",
plugins: [
vueJsx(),
vue(),
// 压缩build后的代码
viteCompression()
],
esbuild: {
// pure: ["console.log", "debugger"],
jsxFactory: "h",
jsxFragment: "Fragment"
},
resolve: {
alias: [
...devAlias,
{ find: "/@", replacement: path.resolve("./src") },
{ find: "/#", replacement: path.resolve("./types") }
],
dedupe: ["vue"]
},
build: {
rollupOptions: {
plugins: [visualizer()]
}
},
css: {
preprocessorOptions: {
less: {
// 修改默认主题颜色配置less变量
// modifyVars: generateModifyVars(),
javascriptEnabled: true
}
}
},
server: {
fs: devServerFs,
proxy: {
// with options
"/api": {
//配套后端 https://github.com/fast-crud/fs-server-js
target: "http://127.0.0.1:3000"
}
}
}
};
};

View File

@@ -1,47 +0,0 @@
const CompressionWebpackPlugin = require('compression-webpack-plugin')
// 设置不参与构建的库
const externals = {}
// cdnDependencies.forEach(pkg => { externals[pkg.name] = pkg.library })
module.exports = {
lintOnSave: true,
pages: {
index: {
entry: 'src/main.js',
// template 中的 title 标签需要是 <title><%= htmlWebpackPlugin.options.title %></title>
title: 'Cert-D'
}
},
devServer: {
proxy: {
'/': {
target: 'http://localhost:3000/'
}
}
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true
}
}
},
configureWebpack: config => {
const configNew = {}
if (process.env.NODE_ENV === 'production') {
configNew.externals = externals
configNew.plugins = [
// gzip
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
threshold: 5120,
minRatio: 0.8,
deleteOriginalAssets: false
})
]
}
return configNew
}
}

5138
yarn.lock

File diff suppressed because it is too large Load Diff