mirror of https://github.com/certd/certd
chore: get random value
parent
68eb4198f1
commit
f5493c542b
|
@ -6,9 +6,10 @@ CertD 是一个帮助你全自动申请和部署SSL证书的工具。
|
||||||
## 特性
|
## 特性
|
||||||
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
|
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
|
||||||
|
|
||||||
* 全自动申请证书
|
* 全自动申请证书(支持阿里云、腾讯云、华为云注册的域名)
|
||||||
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
|
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
|
||||||
* 可与CI/DI工具结合使用
|
* 支持通配符域名
|
||||||
|
* 支持多个域名打到一个证书上
|
||||||
|
|
||||||
## 免费证书申请说明
|
## 免费证书申请说明
|
||||||
* 本项目ssl证书提供商为letencrypt
|
* 本项目ssl证书提供商为letencrypt
|
||||||
|
|
|
@ -3,7 +3,8 @@ import fs from 'fs'
|
||||||
|
|
||||||
//读取 packages/core/pipline/package.json的版本号
|
//读取 packages/core/pipline/package.json的版本号
|
||||||
import { default as packageJson } from './packages/core/pipeline/package.json' assert { type: "json" };
|
import { default as packageJson } from './packages/core/pipeline/package.json' assert { type: "json" };
|
||||||
console.log("certdVersion", packageJson.version)
|
const certdVersion = packageJson.version
|
||||||
|
console.log("certdVersion",certdVersion)
|
||||||
|
|
||||||
// 同步npmmirror的包
|
// 同步npmmirror的包
|
||||||
async function getPackages(directoryPath) {
|
async function getPackages(directoryPath) {
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "lerna bootstrap --hoist",
|
"start": "lerna bootstrap --hoist",
|
||||||
"i-all": "lerna link && lerna exec npm install ",
|
"i-all": "lerna link && lerna exec npm install ",
|
||||||
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && npm run deploy",
|
"publish": "npm run proxy && npm run prepublishOnly1 && lerna publish --conventional-commits && npm run afterpublishOnly && node deploy.js",
|
||||||
"afterpublishOnly": "",
|
"afterpublishOnly": "",
|
||||||
"proxy": "npm config set proxy=http://127.0.0.1:10809",
|
"proxy": "npm config set proxy=http://127.0.0.1:10809",
|
||||||
"prepublishOnly1": "npm run before-build && lerna run build ",
|
"prepublishOnly1": "npm run before-build && lerna run build ",
|
||||||
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
|
"before-build": "cd ./packages/core/acme-client && time /t >build.md && git add ./build.md && git commit -m \"build: prepare to build\"",
|
||||||
"deploy": "node deploy.js"
|
"deploy1": "node deploy.js"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"nodemailer": "^6.9.3",
|
"nodemailer": "^6.9.3",
|
||||||
"qs": "^6.11.2",
|
"qs": "^6.11.2",
|
||||||
|
"react-native-get-random-values": "^1.9.0",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -6,6 +6,10 @@ import { IAccessService } from "../access";
|
||||||
import { IEmailService } from "../service";
|
import { IEmailService } from "../service";
|
||||||
import { IContext } from "../core";
|
import { IContext } from "../core";
|
||||||
import { AxiosInstance } from "axios";
|
import { AxiosInstance } from "axios";
|
||||||
|
|
||||||
|
//解决 uuid random-values not support 问题
|
||||||
|
// https://github.com/uuidjs/uuid#getrandomvalues-not-supported
|
||||||
|
import "react-native-get-random-values";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
export enum ContextScope {
|
export enum ContextScope {
|
||||||
global,
|
global,
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface PageState {
|
||||||
inited: boolean;
|
inited: boolean;
|
||||||
}
|
}
|
||||||
// 判定是否需要缓存
|
// 判定是否需要缓存
|
||||||
const isKeepAlive = (data) => get(data, "meta.cache", false);
|
const isKeepAlive = (data: any) => get(data, "meta.cache", false);
|
||||||
|
|
||||||
export const usePageStore = defineStore({
|
export const usePageStore = defineStore({
|
||||||
id: "app.page",
|
id: "app.page",
|
||||||
|
@ -48,6 +48,7 @@ export const usePageStore = defineStore({
|
||||||
inited: false
|
inited: false
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
|
// @ts-ignore
|
||||||
getOpened() {
|
getOpened() {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return this.opened;
|
return this.opened;
|
||||||
|
@ -91,7 +92,7 @@ export const usePageStore = defineStore({
|
||||||
const valid: Array<number> = [];
|
const valid: Array<number> = [];
|
||||||
// 处理数据
|
// 处理数据
|
||||||
this.opened = value
|
this.opened = value
|
||||||
.map((opened) => {
|
.map((opened: any) => {
|
||||||
// 忽略首页
|
// 忽略首页
|
||||||
if (opened.fullPath === "/index") {
|
if (opened.fullPath === "/index") {
|
||||||
valid.push(1);
|
valid.push(1);
|
||||||
|
@ -105,7 +106,7 @@ export const usePageStore = defineStore({
|
||||||
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
|
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
|
||||||
return Object.assign({}, opened, find);
|
return Object.assign({}, opened, find);
|
||||||
})
|
})
|
||||||
.filter((opened, index) => valid[index] === 1);
|
.filter((opened: any, index: any) => valid[index] === 1);
|
||||||
// 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
|
// 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
|
||||||
this.openedLoaded = true;
|
this.openedLoaded = true;
|
||||||
// 根据 opened 数据生成缓存设置
|
// 根据 opened 数据生成缓存设置
|
||||||
|
@ -132,7 +133,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} payload { index, params, query, fullPath } 路由信息
|
* @param {Object} payload { index, params, query, fullPath } 路由信息
|
||||||
*/
|
*/
|
||||||
async openedUpdate({ index, params, query, fullPath }) {
|
async openedUpdate({ index, params, query, fullPath }: any) {
|
||||||
// 更新页面列表某一项
|
// 更新页面列表某一项
|
||||||
const page = this.opened[index];
|
const page = this.opened[index];
|
||||||
page.params = params || page.params;
|
page.params = params || page.params;
|
||||||
|
@ -148,7 +149,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} payload { oldIndex, newIndex } 位置信息
|
* @param {Object} payload { oldIndex, newIndex } 位置信息
|
||||||
*/
|
*/
|
||||||
async openedSort({ oldIndex, newIndex }) {
|
async openedSort({ oldIndex, newIndex }: any) {
|
||||||
// 重排页面列表某一项
|
// 重排页面列表某一项
|
||||||
const page = this.opened[oldIndex];
|
const page = this.opened[oldIndex];
|
||||||
this.opened.splice(oldIndex, 1);
|
this.opened.splice(oldIndex, 1);
|
||||||
|
@ -162,7 +163,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} payload new tag info
|
* @param {Object} payload new tag info
|
||||||
*/
|
*/
|
||||||
async add({ tag, params, query, fullPath }) {
|
async add({ tag, params, query, fullPath }: any) {
|
||||||
// 设置新的 tag 在新打开一个以前没打开过的页面时使用
|
// 设置新的 tag 在新打开一个以前没打开过的页面时使用
|
||||||
const newTag = tag;
|
const newTag = tag;
|
||||||
newTag.params = params || newTag.params;
|
newTag.params = params || newTag.params;
|
||||||
|
@ -183,7 +184,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath, meta } 路由信息
|
* @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath, meta } 路由信息
|
||||||
*/
|
*/
|
||||||
async open({ name, params, query, fullPath, meta }) {
|
async open({ name, params, query, fullPath, meta }: any) {
|
||||||
// 已经打开的页面
|
// 已经打开的页面
|
||||||
const opened = this.opened;
|
const opened = this.opened;
|
||||||
// 判断此页面是否已经打开 并且记录位置
|
// 判断此页面是否已经打开 并且记录位置
|
||||||
|
@ -227,7 +228,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} payload { tagName: 要关闭的标签名字 }
|
* @param {Object} payload { tagName: 要关闭的标签名字 }
|
||||||
*/
|
*/
|
||||||
async close({ tagName }) {
|
async close({ tagName }: any) {
|
||||||
// 预定下个新页面
|
// 预定下个新页面
|
||||||
let newPage = {};
|
let newPage = {};
|
||||||
const isCurrent = this.current === tagName;
|
const isCurrent = this.current === tagName;
|
||||||
|
@ -267,7 +268,7 @@ export const usePageStore = defineStore({
|
||||||
*/
|
*/
|
||||||
async closeLeft(opts = {}) {
|
async closeLeft(opts = {}) {
|
||||||
await this.closeByCondition({
|
await this.closeByCondition({
|
||||||
condition({ i, currentIndex }) {
|
condition({ i, currentIndex }: any) {
|
||||||
return i >= currentIndex;
|
return i >= currentIndex;
|
||||||
},
|
},
|
||||||
...opts
|
...opts
|
||||||
|
@ -280,7 +281,7 @@ export const usePageStore = defineStore({
|
||||||
*/
|
*/
|
||||||
async closeRight(opts = {}) {
|
async closeRight(opts = {}) {
|
||||||
await this.closeByCondition({
|
await this.closeByCondition({
|
||||||
condition({ i, currentIndex }) {
|
condition({ i, currentIndex }: any) {
|
||||||
return currentIndex >= i;
|
return currentIndex >= i;
|
||||||
},
|
},
|
||||||
...opts
|
...opts
|
||||||
|
@ -321,7 +322,7 @@ export const usePageStore = defineStore({
|
||||||
*/
|
*/
|
||||||
async closeOther(opts = {}) {
|
async closeOther(opts = {}) {
|
||||||
await this.closeByCondition({
|
await this.closeByCondition({
|
||||||
condition({ i, currentIndex }) {
|
condition({ i, currentIndex }: any) {
|
||||||
return currentIndex === i;
|
return currentIndex === i;
|
||||||
},
|
},
|
||||||
...opts
|
...opts
|
||||||
|
@ -364,7 +365,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} state state
|
* @param {Object} state state
|
||||||
* @param {String} name name
|
* @param {String} name name
|
||||||
*/
|
*/
|
||||||
keepAliveRemove(name) {
|
keepAliveRemove(name: any) {
|
||||||
const list = cloneDeep(this.keepAlive);
|
const list = cloneDeep(this.keepAlive);
|
||||||
const index = list.findIndex((item) => item === name);
|
const index = list.findIndex((item) => item === name);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
@ -377,7 +378,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} state state
|
* @param {Object} state state
|
||||||
* @param {String} name name
|
* @param {String} name name
|
||||||
*/
|
*/
|
||||||
keepAlivePush(name) {
|
keepAlivePush(name: any) {
|
||||||
const keep = cloneDeep(this.keepAlive);
|
const keep = cloneDeep(this.keepAlive);
|
||||||
keep.push(name);
|
keep.push(name);
|
||||||
this.keepAlive = uniq(keep);
|
this.keepAlive = uniq(keep);
|
||||||
|
@ -395,7 +396,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} state state
|
* @param {Object} state state
|
||||||
* @param {String} fullPath new fullPath
|
* @param {String} fullPath new fullPath
|
||||||
*/
|
*/
|
||||||
currentSet(fullPath) {
|
currentSet(fullPath: any) {
|
||||||
this.current = fullPath;
|
this.current = fullPath;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -404,7 +405,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} state state
|
* @param {Object} state state
|
||||||
* @param {Array} routes routes
|
* @param {Array} routes routes
|
||||||
*/
|
*/
|
||||||
async init(routes) {
|
async init(routes: any) {
|
||||||
if (this.inited) {
|
if (this.inited) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -414,9 +415,9 @@ export const usePageStore = defineStore({
|
||||||
routes = frameworkRoutes;
|
routes = frameworkRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pool = [];
|
const pool: any = [];
|
||||||
const push = function (routes) {
|
const push = function (routes: any) {
|
||||||
routes.forEach((route) => {
|
routes.forEach((route: any) => {
|
||||||
if (route.children && route.children.length > 0) {
|
if (route.children && route.children.length > 0) {
|
||||||
push(route.children);
|
push(route.children);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue