chore: get random value

pull/21/merge
xiaojunnuo 2023-06-28 22:10:52 +08:00
parent 68eb4198f1
commit f5493c542b
6 changed files with 31 additions and 23 deletions

View File

@ -6,9 +6,10 @@ CertD 是一个帮助你全自动申请和部署SSL证书的工具。
## 特性
本项目不仅支持证书申请过程自动化,还可以自动化部署证书,让你的证书永不过期。
* 全自动申请证书
* 全自动申请证书(支持阿里云、腾讯云、华为云注册的域名)
* 全自动部署证书(目前支持服务器上传部署、阿里云、腾讯云等)
* 可与CI/DI工具结合使用
* 支持通配符域名
* 支持多个域名打到一个证书上
## 免费证书申请说明
* 本项目ssl证书提供商为letencrypt

View File

@ -3,7 +3,8 @@ import fs from 'fs'
//读取 packages/core/pipline/package.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的包
async function getPackages(directoryPath) {

View File

@ -11,12 +11,12 @@
"scripts": {
"start": "lerna bootstrap --hoist",
"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": "",
"proxy": "npm config set proxy=http://127.0.0.1:10809",
"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\"",
"deploy": "node deploy.js"
"deploy1": "node deploy.js"
},
"license": "MIT",
"dependencies": {

View File

@ -21,6 +21,7 @@
"node-forge": "^1.3.1",
"nodemailer": "^6.9.3",
"qs": "^6.11.2",
"react-native-get-random-values": "^1.9.0",
"uuid": "^8.3.2"
},
"devDependencies": {

View File

@ -6,6 +6,10 @@ import { IAccessService } from "../access";
import { IEmailService } from "../service";
import { IContext } from "../core";
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";
export enum ContextScope {
global,

View File

@ -21,7 +21,7 @@ interface PageState {
inited: boolean;
}
// 判定是否需要缓存
const isKeepAlive = (data) => get(data, "meta.cache", false);
const isKeepAlive = (data: any) => get(data, "meta.cache", false);
export const usePageStore = defineStore({
id: "app.page",
@ -48,6 +48,7 @@ export const usePageStore = defineStore({
inited: false
}),
getters: {
// @ts-ignore
getOpened() {
// @ts-ignore
return this.opened;
@ -91,7 +92,7 @@ export const usePageStore = defineStore({
const valid: Array<number> = [];
// 处理数据
this.opened = value
.map((opened) => {
.map((opened: any) => {
// 忽略首页
if (opened.fullPath === "/index") {
valid.push(1);
@ -105,7 +106,7 @@ export const usePageStore = defineStore({
// 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存
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
this.openedLoaded = true;
// 根据 opened 数据生成缓存设置
@ -132,7 +133,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @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];
page.params = params || page.params;
@ -148,7 +149,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload { oldIndex, newIndex }
*/
async openedSort({ oldIndex, newIndex }) {
async openedSort({ oldIndex, newIndex }: any) {
// 重排页面列表某一项
const page = this.opened[oldIndex];
this.opened.splice(oldIndex, 1);
@ -162,7 +163,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload new tag info
*/
async add({ tag, params, query, fullPath }) {
async add({ tag, params, query, fullPath }: any) {
// 设置新的 tag 在新打开一个以前没打开过的页面时使用
const newTag = tag;
newTag.params = params || newTag.params;
@ -183,7 +184,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @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;
// 判断此页面是否已经打开 并且记录位置
@ -227,7 +228,7 @@ export const usePageStore = defineStore({
* @param {Object} context
* @param {Object} payload { tagName: }
*/
async close({ tagName }) {
async close({ tagName }: any) {
// 预定下个新页面
let newPage = {};
const isCurrent = this.current === tagName;
@ -267,7 +268,7 @@ export const usePageStore = defineStore({
*/
async closeLeft(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return i >= currentIndex;
},
...opts
@ -280,7 +281,7 @@ export const usePageStore = defineStore({
*/
async closeRight(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return currentIndex >= i;
},
...opts
@ -321,7 +322,7 @@ export const usePageStore = defineStore({
*/
async closeOther(opts = {}) {
await this.closeByCondition({
condition({ i, currentIndex }) {
condition({ i, currentIndex }: any) {
return currentIndex === i;
},
...opts
@ -364,7 +365,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} name name
*/
keepAliveRemove(name) {
keepAliveRemove(name: any) {
const list = cloneDeep(this.keepAlive);
const index = list.findIndex((item) => item === name);
if (index !== -1) {
@ -377,7 +378,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} name name
*/
keepAlivePush(name) {
keepAlivePush(name: any) {
const keep = cloneDeep(this.keepAlive);
keep.push(name);
this.keepAlive = uniq(keep);
@ -395,7 +396,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {String} fullPath new fullPath
*/
currentSet(fullPath) {
currentSet(fullPath: any) {
this.current = fullPath;
},
/**
@ -404,7 +405,7 @@ export const usePageStore = defineStore({
* @param {Object} state state
* @param {Array} routes routes
*/
async init(routes) {
async init(routes: any) {
if (this.inited) {
return;
}
@ -414,9 +415,9 @@ export const usePageStore = defineStore({
routes = frameworkRoutes;
}
const pool = [];
const push = function (routes) {
routes.forEach((route) => {
const pool: any = [];
const push = function (routes: any) {
routes.forEach((route: any) => {
if (route.children && route.children.length > 0) {
push(route.children);
} else {