@pubinfo-pr/module-crypto 0.203.3 → 0.203.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/drawerCryptoUrl-D1mGfabN.js +110 -0
- package/dist/index.js +2236 -2210
- package/dist/setting-CwkOYk62.js +217 -0
- package/package.json +3 -3
- package/dist/drawerCryptoUrl-I-5m5_57.js +0 -107
- package/dist/setting-Df7ot4w8.js +0 -216
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./index.js";
|
|
2
|
+
import { r, t as i } from "./drawerCryptoUrl-D1mGfabN.js";
|
|
3
|
+
import { PubinfoIcon as a, useAuth as o } from "pubinfo-pr";
|
|
4
|
+
import { Button as s, CheckableTag as ee, Form as c, FormItem as l, Space as te, Switch as u } from "ant-design-vue/es";
|
|
5
|
+
import { createBlock as d, createCommentVNode as ne, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, normalizeClass as _, onMounted as v, openBlock as y, reactive as b, ref as x, resolveDirective as re, toDisplayString as S, unref as C, withCtx as w, withDirectives as T } from "vue";
|
|
6
|
+
import { PlusCircleOutlined as E, QuestionCircleOutlined as ie } from "@ant-design/icons-vue";
|
|
7
|
+
import { ProTable as ae } from "@pubinfo/pro-components";
|
|
8
|
+
import { Modal as D, message as O } from "ant-design-vue";
|
|
9
|
+
import './setting.css';//#region src/pages/enum.ts
|
|
10
|
+
var k = /* @__PURE__ */ function(e) {
|
|
11
|
+
return e.ADD = "新增", e.EDIT = "编辑", e.REMOVE = "删除", e.ENABLE = "启用", e.DISABLE = "停用", e;
|
|
12
|
+
}({}), oe = {
|
|
13
|
+
"w-full": "",
|
|
14
|
+
"h-full": "",
|
|
15
|
+
"pt-10px": "",
|
|
16
|
+
"px-10px": "",
|
|
17
|
+
"overflow-auto": ""
|
|
18
|
+
}, A = {
|
|
19
|
+
"h-full": "",
|
|
20
|
+
"min-w-1130px": ""
|
|
21
|
+
}, j = { class: "pt-20px pl-20px h-161px flex flex-col bg-[#ffffff] box-border bg-[url('@/assets/images/crypto-setting-bg.png')] bg-cover text-[#4e5969] dark:text-[#C9CDD4]" }, M = { class: "flex items-center" }, N = { class: "p-5px bg-[#f2f3f5] rounded-5px flex items-center" }, P = { class: "flex items-center ml-15px text-[#a3a4a8]" }, F = { class: "h-[calc(100%-165px)]" }, I = ["onClick"], L = { class: "ml-4px" }, R = ["onClick"], z = { class: "ml-4px" }, B = /* @__PURE__ */ ((e, t) => {
|
|
22
|
+
let n = e.__vccOpts || e;
|
|
23
|
+
for (let [e, r] of t) n[e] = r;
|
|
24
|
+
return n;
|
|
25
|
+
})(/* @__PURE__ */ g({
|
|
26
|
+
__name: "setting",
|
|
27
|
+
setup(g) {
|
|
28
|
+
let B = x(), V = x(), H = x(), U = { style: { width: "auto" } }, W = { span: 24 }, { auth: G } = o(), K = b({
|
|
29
|
+
isCrypto: !0,
|
|
30
|
+
mode: !0,
|
|
31
|
+
whiteListUrls: []
|
|
32
|
+
}), [q, J] = r(!1);
|
|
33
|
+
v(Y);
|
|
34
|
+
async function Y() {
|
|
35
|
+
await e().then((e) => {
|
|
36
|
+
J(!1), e && e.data && e.success && (K.isCrypto = e.data.cryptoEnabled || !1, K.whiteListUrls = e.data.cryptoWhitePath, K.mode = e.data.cryptoMode === void 0 ? !0 : e.data.cryptoMode);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function X(e, t) {
|
|
40
|
+
t && (K.mode = e, Z());
|
|
41
|
+
}
|
|
42
|
+
async function Z() {
|
|
43
|
+
if (!q.value) {
|
|
44
|
+
J(!0);
|
|
45
|
+
try {
|
|
46
|
+
await V.value?.validate();
|
|
47
|
+
let { isCrypto: e, mode: r, whiteListUrls: i } = K, a = {
|
|
48
|
+
cryptoEnabled: e,
|
|
49
|
+
cryptoMode: r,
|
|
50
|
+
cryptoWhitePath: i
|
|
51
|
+
}, { success: o } = await t({ json: JSON.stringify(a) });
|
|
52
|
+
o && (O.success("配置更改成功"), n.callAsync({
|
|
53
|
+
...n.use(),
|
|
54
|
+
isCrypto: K.isCrypto,
|
|
55
|
+
cryptoMode: K.mode,
|
|
56
|
+
whiteListUrls: K.whiteListUrls
|
|
57
|
+
}, () => {
|
|
58
|
+
Y();
|
|
59
|
+
}));
|
|
60
|
+
} catch {
|
|
61
|
+
J(!1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
let se = [
|
|
66
|
+
{
|
|
67
|
+
minWidth: 60,
|
|
68
|
+
hideInTable: !1,
|
|
69
|
+
title: "url地址",
|
|
70
|
+
dataIndex: "url"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
hideInSearch: !0,
|
|
74
|
+
minWidth: 200,
|
|
75
|
+
title: "描述",
|
|
76
|
+
dataIndex: "description",
|
|
77
|
+
ellipsis: !0
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
hideInSearch: !0,
|
|
81
|
+
title: "操作",
|
|
82
|
+
dataIndex: "action",
|
|
83
|
+
width: 200,
|
|
84
|
+
fixed: "right",
|
|
85
|
+
hideInTable() {
|
|
86
|
+
return !G([
|
|
87
|
+
"crypto_url_add",
|
|
88
|
+
"crypto_url_edit",
|
|
89
|
+
"crypto_url_delete"
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
function Q(e, t) {
|
|
95
|
+
if (!q.value) switch (e) {
|
|
96
|
+
case k.ADD:
|
|
97
|
+
H.value.open(!1, K.whiteListUrls);
|
|
98
|
+
break;
|
|
99
|
+
case k.EDIT:
|
|
100
|
+
H.value.open(!0, K.whiteListUrls, t);
|
|
101
|
+
break;
|
|
102
|
+
case k.REMOVE:
|
|
103
|
+
ce(K.whiteListUrls || [], t || 0);
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function ce(e, t) {
|
|
108
|
+
D.confirm({
|
|
109
|
+
title: "删除",
|
|
110
|
+
content: "确定要删除该条数据吗?",
|
|
111
|
+
async onOk() {
|
|
112
|
+
e.splice(t, 1), $(e);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function $(e) {
|
|
117
|
+
K.whiteListUrls = e, Z();
|
|
118
|
+
}
|
|
119
|
+
return (e, t) => {
|
|
120
|
+
let n = u, r = l, o = ee, g = c, v = E, b = s, x = a, D = te, O = re("auth");
|
|
121
|
+
return y(), f("div", oe, [p("div", A, [p("div", j, [h(g, {
|
|
122
|
+
ref_key: "formRef",
|
|
123
|
+
ref: V,
|
|
124
|
+
model: K,
|
|
125
|
+
"label-col": U,
|
|
126
|
+
"wrapper-col": W,
|
|
127
|
+
class: "safe-rule-form"
|
|
128
|
+
}, {
|
|
129
|
+
default: w(() => [h(r, {
|
|
130
|
+
label: "开启加密",
|
|
131
|
+
name: "isCrypto"
|
|
132
|
+
}, {
|
|
133
|
+
default: w(() => [h(n, {
|
|
134
|
+
checked: K.isCrypto,
|
|
135
|
+
"onUpdate:checked": t[0] ||= (e) => K.isCrypto = e,
|
|
136
|
+
disabled: C(q),
|
|
137
|
+
onChange: Z
|
|
138
|
+
}, null, 8, ["checked", "disabled"])]),
|
|
139
|
+
_: 1
|
|
140
|
+
}), h(r, {
|
|
141
|
+
label: "模式",
|
|
142
|
+
name: "isCrypto"
|
|
143
|
+
}, {
|
|
144
|
+
default: w(() => [p("div", M, [p("div", N, [h(o, {
|
|
145
|
+
checked: K.mode,
|
|
146
|
+
disabled: C(q),
|
|
147
|
+
class: _(C(q) ? "cursor-not-allowed!" : ""),
|
|
148
|
+
onChange: t[1] ||= (e) => !C(q) && X(!0, e)
|
|
149
|
+
}, {
|
|
150
|
+
default: w(() => [...t[4] ||= [m(" 白名单 ", -1)]]),
|
|
151
|
+
_: 1
|
|
152
|
+
}, 8, [
|
|
153
|
+
"checked",
|
|
154
|
+
"disabled",
|
|
155
|
+
"class"
|
|
156
|
+
]), h(o, {
|
|
157
|
+
checked: !K.mode,
|
|
158
|
+
class: _(["mr-0px!", C(q) ? "cursor-not-allowed!" : ""]),
|
|
159
|
+
onChange: t[2] ||= (e) => !C(q) && X(!1, e)
|
|
160
|
+
}, {
|
|
161
|
+
default: w(() => [...t[5] ||= [m(" 黑名单 ", -1)]]),
|
|
162
|
+
_: 1
|
|
163
|
+
}, 8, ["checked", "class"])]), p("div", P, [h(C(ie), { class: "mr-5px" }), t[6] ||= m("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ", -1)])])]),
|
|
164
|
+
_: 1
|
|
165
|
+
})]),
|
|
166
|
+
_: 1
|
|
167
|
+
}, 8, ["model"])]), p("div", F, [h(C(ae), {
|
|
168
|
+
ref_key: "tableRef",
|
|
169
|
+
ref: B,
|
|
170
|
+
"row-key": "id",
|
|
171
|
+
"data-source": K.whiteListUrls,
|
|
172
|
+
columns: se,
|
|
173
|
+
"auto-height": "",
|
|
174
|
+
search: !1,
|
|
175
|
+
pagination: !1,
|
|
176
|
+
scroll: { x: 1e3 }
|
|
177
|
+
}, {
|
|
178
|
+
toolbar: w(() => [T((y(), d(b, {
|
|
179
|
+
type: "primary",
|
|
180
|
+
disabled: C(q),
|
|
181
|
+
onClick: t[3] ||= (e) => Q(C(k).ADD)
|
|
182
|
+
}, {
|
|
183
|
+
default: w(() => [h(v), m(" " + S(C(k).ADD), 1)]),
|
|
184
|
+
_: 1
|
|
185
|
+
}, 8, ["disabled"])), [[O, "crypto_url_add"]])]),
|
|
186
|
+
bodyCell: w(({ column: e, index: t }) => [e.dataIndex === "action" ? (y(), d(D, { key: 0 }, {
|
|
187
|
+
default: w(() => [T((y(), f("a", {
|
|
188
|
+
class: "flex items-center hover:opacity-80",
|
|
189
|
+
onClick: (e) => Q(C(k).EDIT, t)
|
|
190
|
+
}, [h(x, {
|
|
191
|
+
name: "edit",
|
|
192
|
+
class: "text-base"
|
|
193
|
+
}), p("span", L, S(C(k).EDIT), 1)], 8, I)), [[O, "crypto_url_edit"]]), T((y(), f("span", {
|
|
194
|
+
flex: "",
|
|
195
|
+
"items-center": "",
|
|
196
|
+
"text-red-500": "",
|
|
197
|
+
"hover:cursor-pointer": "",
|
|
198
|
+
"hover:text-red-500": "",
|
|
199
|
+
"hover:opacity-80": "",
|
|
200
|
+
onClick: (e) => Q(C(k).REMOVE, t)
|
|
201
|
+
}, [h(x, {
|
|
202
|
+
name: "remove",
|
|
203
|
+
class: "text-base"
|
|
204
|
+
}), p("span", z, S(C(k).REMOVE), 1)], 8, R)), [[O, "crypto_url_delete"]])]),
|
|
205
|
+
_: 2
|
|
206
|
+
}, 1024)) : ne("", !0)]),
|
|
207
|
+
_: 1
|
|
208
|
+
}, 8, ["data-source"])])]), h(i, {
|
|
209
|
+
ref_key: "drawerRef",
|
|
210
|
+
ref: H,
|
|
211
|
+
onSubmit: $
|
|
212
|
+
}, null, 512)]);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}), [["__scopeId", "data-v-89197708"]]);
|
|
216
|
+
//#endregion
|
|
217
|
+
export { B as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo-pr/module-crypto",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.203.
|
|
4
|
+
"version": "0.203.5",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@ant-design/icons-vue": "^7.0.1",
|
|
24
24
|
"@pubinfo/pro-components": "^1.8.2",
|
|
25
25
|
"ant-design-vue": "^4.2.6",
|
|
26
|
-
"pubinfo-pr": "0.203.
|
|
26
|
+
"pubinfo-pr": "0.203.5"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@vueuse/core": "^14.2.1",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@pubinfo/pro-components": "^1.8.2",
|
|
37
37
|
"@types/crypto-js": "^4.2.2",
|
|
38
38
|
"ant-design-vue": "^4.2.6",
|
|
39
|
-
"pubinfo-pr": "0.203.
|
|
39
|
+
"pubinfo-pr": "0.203.5"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"dev": "pubinfo build -w --sourcemap",
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { i as __exportAll } from "./index.js";
|
|
2
|
-
import { Button, Drawer, Form, FormItem, Input, Space, Textarea } from "ant-design-vue/es";
|
|
3
|
-
import { createBlock, createTextVNode, createVNode, defineComponent, isRef, onMounted, openBlock, reactive, ref, shallowRef, toValue, unref, withCtx } from "vue";
|
|
4
|
-
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
5
|
-
function useToggle(e = !1, t = {}) {
|
|
6
|
-
let { truthyValue: n = !0, falsyValue: r = !1 } = t, i = isRef(e), a = shallowRef(e);
|
|
7
|
-
function o(e) {
|
|
8
|
-
if (arguments.length) return a.value = e, a.value;
|
|
9
|
-
{
|
|
10
|
-
let e = toValue(n);
|
|
11
|
-
return a.value = a.value === e ? toValue(r) : e, a.value;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return i ? o : [a, o];
|
|
15
|
-
}
|
|
16
|
-
var drawerCryptoUrl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
17
|
-
name: "DrawerCryptoUrl",
|
|
18
|
-
__name: "drawerCryptoUrl",
|
|
19
|
-
emits: ["submit"],
|
|
20
|
-
setup(e, { expose: s, emit: c }) {
|
|
21
|
-
let l = c, d = { url: [{
|
|
22
|
-
required: !0,
|
|
23
|
-
validator: b,
|
|
24
|
-
trigger: ["blur", "change"]
|
|
25
|
-
}] }, [f, m] = useToggle(!1), h = ref(), g = ref({}), _ = ref(!1), v = ref([]), y = ref(0);
|
|
26
|
-
function b(e, t, n) {
|
|
27
|
-
t ? /^\/(?!.*\*{3})(?:[\w-]+|:\w+|\*{1,2})(?:\/(?:[\w-]+|:\w+|\*{1,2}))*$/.test(t) ? n() : n(/* @__PURE__ */ Error("url格式不正确")) : n(/* @__PURE__ */ Error("请输入url"));
|
|
28
|
-
}
|
|
29
|
-
async function x(e, t, n) {
|
|
30
|
-
m(!0), v.value = t || [], y.value = n || 0, e ? (_.value = !0, g.value = { ...t?.[n || 0] }) : (_.value = !1, g.value = {});
|
|
31
|
-
}
|
|
32
|
-
let [S, C] = useToggle(!1);
|
|
33
|
-
function w() {
|
|
34
|
-
h.value?.validate().then(() => {
|
|
35
|
-
C(!0);
|
|
36
|
-
let e = { ...g.value };
|
|
37
|
-
_.value ? v.value[y.value] = e : v.value.push(e), C(!1), T(), l("submit", v.value);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function T() {
|
|
41
|
-
m(!1);
|
|
42
|
-
}
|
|
43
|
-
return s({ open: x }), (e, s) => {
|
|
44
|
-
let c = Input, l = FormItem, u = Textarea, p = Form, m = Button, _ = Space, v = Drawer;
|
|
45
|
-
return openBlock(), createBlock(v, {
|
|
46
|
-
open: unref(f),
|
|
47
|
-
"onUpdate:open": s[3] ||= (e) => isRef(f) ? f.value = e : null,
|
|
48
|
-
title: "url信息",
|
|
49
|
-
placement: "right",
|
|
50
|
-
width: 600,
|
|
51
|
-
"destroy-on-close": "",
|
|
52
|
-
"footer-style": { textAlign: "right" },
|
|
53
|
-
onClose: T
|
|
54
|
-
}, {
|
|
55
|
-
footer: withCtx(() => [createVNode(_, null, {
|
|
56
|
-
default: withCtx(() => [createVNode(m, { onClick: T }, {
|
|
57
|
-
default: withCtx(() => [...s[4] ||= [createTextVNode(" 取消 ", -1)]]),
|
|
58
|
-
_: 1
|
|
59
|
-
}), createVNode(m, {
|
|
60
|
-
type: "primary",
|
|
61
|
-
loading: unref(S),
|
|
62
|
-
onClick: s[2] ||= (e) => w()
|
|
63
|
-
}, {
|
|
64
|
-
default: withCtx(() => [...s[5] ||= [createTextVNode(" 提交 ", -1)]]),
|
|
65
|
-
_: 1
|
|
66
|
-
}, 8, ["loading"])]),
|
|
67
|
-
_: 1
|
|
68
|
-
})]),
|
|
69
|
-
default: withCtx(() => [createVNode(p, {
|
|
70
|
-
ref_key: "formRef",
|
|
71
|
-
ref: h,
|
|
72
|
-
model: unref(g),
|
|
73
|
-
rules: d,
|
|
74
|
-
"label-col": { style: { width: "90px" } }
|
|
75
|
-
}, {
|
|
76
|
-
default: withCtx(() => [createVNode(l, {
|
|
77
|
-
label: "url地址",
|
|
78
|
-
name: "url",
|
|
79
|
-
tooltip: "支持url通配符,示例:/api/v1/user/*,/api/login/**"
|
|
80
|
-
}, {
|
|
81
|
-
default: withCtx(() => [createVNode(c, {
|
|
82
|
-
value: unref(g).url,
|
|
83
|
-
"onUpdate:value": s[0] ||= (e) => unref(g).url = e,
|
|
84
|
-
maxlength: 200
|
|
85
|
-
}, null, 8, ["value"])]),
|
|
86
|
-
_: 1
|
|
87
|
-
}), createVNode(l, {
|
|
88
|
-
label: "描述",
|
|
89
|
-
name: "description"
|
|
90
|
-
}, {
|
|
91
|
-
default: withCtx(() => [createVNode(u, {
|
|
92
|
-
value: unref(g).description,
|
|
93
|
-
"onUpdate:value": s[1] ||= (e) => unref(g).description = e,
|
|
94
|
-
rows: 3,
|
|
95
|
-
"show-count": "",
|
|
96
|
-
maxlength: 200
|
|
97
|
-
}, null, 8, ["value"])]),
|
|
98
|
-
_: 1
|
|
99
|
-
})]),
|
|
100
|
-
_: 1
|
|
101
|
-
}, 8, ["model"])]),
|
|
102
|
-
_: 1
|
|
103
|
-
}, 8, ["open"]);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}), drawerCryptoUrl_exports = /* @__PURE__ */ __exportAll({ default: () => drawerCryptoUrl_default }), drawerCryptoUrl_default = drawerCryptoUrl_vue_vue_type_script_setup_true_lang_default;
|
|
107
|
-
export { drawerCryptoUrl_exports as n, useToggle as r, drawerCryptoUrl_default as t };
|
package/dist/setting-Df7ot4w8.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { n as getCryptoGetCryptoConfig, r as postCryptoEditCryptoConfig, t as ctx } from "./index.js";
|
|
2
|
-
import { r as useToggle, t as drawerCryptoUrl_default } from "./drawerCryptoUrl-I-5m5_57.js";
|
|
3
|
-
import { PubinfoIcon, useAuth } from "pubinfo-pr";
|
|
4
|
-
import { Button, CheckableTag, Form, FormItem, Space, Switch } from "ant-design-vue/es";
|
|
5
|
-
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, onMounted, openBlock, reactive, ref, resolveDirective, toDisplayString, unref, withCtx, withDirectives } from "vue";
|
|
6
|
-
import { PlusCircleOutlined, QuestionCircleOutlined } from "@ant-design/icons-vue";
|
|
7
|
-
import { ProTable } from "@pubinfo/pro-components";
|
|
8
|
-
import { Modal, message } from "ant-design-vue";
|
|
9
|
-
import './setting.css';let ACTION = /* @__PURE__ */ function(e) {
|
|
10
|
-
return e.ADD = "新增", e.EDIT = "编辑", e.REMOVE = "删除", e.ENABLE = "启用", e.DISABLE = "停用", e;
|
|
11
|
-
}({});
|
|
12
|
-
var _hoisted_1 = {
|
|
13
|
-
"w-full": "",
|
|
14
|
-
"h-full": "",
|
|
15
|
-
"pt-10px": "",
|
|
16
|
-
"px-10px": "",
|
|
17
|
-
"overflow-auto": ""
|
|
18
|
-
}, _hoisted_2 = {
|
|
19
|
-
"h-full": "",
|
|
20
|
-
"min-w-1130px": ""
|
|
21
|
-
}, _hoisted_3 = { class: "pt-20px pl-20px h-161px flex flex-col bg-[#ffffff] box-border bg-[url('@/assets/images/crypto-setting-bg.png')] bg-cover text-[#4e5969] dark:text-[#C9CDD4]" }, _hoisted_4 = { class: "flex items-center" }, _hoisted_5 = { class: "p-5px bg-[#f2f3f5] rounded-5px flex items-center" }, _hoisted_6 = { class: "flex items-center ml-15px text-[#a3a4a8]" }, _hoisted_7 = { class: "h-[calc(100%-165px)]" }, _hoisted_8 = ["onClick"], _hoisted_9 = { class: "ml-4px" }, _hoisted_10 = ["onClick"], _hoisted_11 = { class: "ml-4px" }, setting_default = /* @__PURE__ */ ((e, t) => {
|
|
22
|
-
let n = e.__vccOpts || e;
|
|
23
|
-
for (let [e, r] of t) n[e] = r;
|
|
24
|
-
return n;
|
|
25
|
-
})(/* @__PURE__ */ defineComponent({
|
|
26
|
-
__name: "setting",
|
|
27
|
-
setup(s) {
|
|
28
|
-
let p = ref(), m = ref(), h = ref(), g = { style: { width: "auto" } }, _ = { span: 24 }, { auth: v } = useAuth(), y = reactive({
|
|
29
|
-
isCrypto: !0,
|
|
30
|
-
mode: !0,
|
|
31
|
-
whiteListUrls: []
|
|
32
|
-
}), [b, x] = useToggle(!1);
|
|
33
|
-
onMounted(S);
|
|
34
|
-
async function S() {
|
|
35
|
-
await getCryptoGetCryptoConfig().then((e) => {
|
|
36
|
-
x(!1), e && e.data && e.success && (y.isCrypto = e.data.cryptoEnabled || !1, y.whiteListUrls = e.data.cryptoWhitePath, y.mode = e.data.cryptoMode === void 0 ? !0 : e.data.cryptoMode);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function C(e, t) {
|
|
40
|
-
t && (y.mode = e, w());
|
|
41
|
-
}
|
|
42
|
-
async function w() {
|
|
43
|
-
if (!b.value) {
|
|
44
|
-
x(!0);
|
|
45
|
-
try {
|
|
46
|
-
await m.value?.validate();
|
|
47
|
-
let { isCrypto: e, mode: r, whiteListUrls: i } = y, a = {
|
|
48
|
-
cryptoEnabled: e,
|
|
49
|
-
cryptoMode: r,
|
|
50
|
-
cryptoWhitePath: i
|
|
51
|
-
}, { success: o } = await postCryptoEditCryptoConfig({ json: JSON.stringify(a) });
|
|
52
|
-
o && (message.success("配置更改成功"), ctx.callAsync({
|
|
53
|
-
...ctx.use(),
|
|
54
|
-
isCrypto: y.isCrypto,
|
|
55
|
-
cryptoMode: y.mode,
|
|
56
|
-
whiteListUrls: y.whiteListUrls
|
|
57
|
-
}, () => {
|
|
58
|
-
S();
|
|
59
|
-
}));
|
|
60
|
-
} catch {
|
|
61
|
-
x(!1);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
let T = [
|
|
66
|
-
{
|
|
67
|
-
minWidth: 60,
|
|
68
|
-
hideInTable: !1,
|
|
69
|
-
title: "url地址",
|
|
70
|
-
dataIndex: "url"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
hideInSearch: !0,
|
|
74
|
-
minWidth: 200,
|
|
75
|
-
title: "描述",
|
|
76
|
-
dataIndex: "description",
|
|
77
|
-
ellipsis: !0
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
hideInSearch: !0,
|
|
81
|
-
title: "操作",
|
|
82
|
-
dataIndex: "action",
|
|
83
|
-
width: 200,
|
|
84
|
-
fixed: "right",
|
|
85
|
-
hideInTable() {
|
|
86
|
-
return !v([
|
|
87
|
-
"crypto_url_add",
|
|
88
|
-
"crypto_url_edit",
|
|
89
|
-
"crypto_url_delete"
|
|
90
|
-
]);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
];
|
|
94
|
-
function E(e, t) {
|
|
95
|
-
if (!b.value) switch (e) {
|
|
96
|
-
case ACTION.ADD:
|
|
97
|
-
h.value.open(!1, y.whiteListUrls);
|
|
98
|
-
break;
|
|
99
|
-
case ACTION.EDIT:
|
|
100
|
-
h.value.open(!0, y.whiteListUrls, t);
|
|
101
|
-
break;
|
|
102
|
-
case ACTION.REMOVE:
|
|
103
|
-
D(y.whiteListUrls || [], t || 0);
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function D(e, t) {
|
|
108
|
-
Modal.confirm({
|
|
109
|
-
title: "删除",
|
|
110
|
-
content: "确定要删除该条数据吗?",
|
|
111
|
-
async onOk() {
|
|
112
|
-
e.splice(t, 1), O(e);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function O(e) {
|
|
117
|
-
y.whiteListUrls = e, w();
|
|
118
|
-
}
|
|
119
|
-
return (e, t) => {
|
|
120
|
-
let n = Switch, r = FormItem, o = CheckableTag, s = Form, c = PlusCircleOutlined, l = Button, u = PubinfoIcon, d = Space, f = resolveDirective("auth");
|
|
121
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createVNode(s, {
|
|
122
|
-
ref_key: "formRef",
|
|
123
|
-
ref: m,
|
|
124
|
-
model: y,
|
|
125
|
-
"label-col": g,
|
|
126
|
-
"wrapper-col": _,
|
|
127
|
-
class: "safe-rule-form"
|
|
128
|
-
}, {
|
|
129
|
-
default: withCtx(() => [createVNode(r, {
|
|
130
|
-
label: "开启加密",
|
|
131
|
-
name: "isCrypto"
|
|
132
|
-
}, {
|
|
133
|
-
default: withCtx(() => [createVNode(n, {
|
|
134
|
-
checked: y.isCrypto,
|
|
135
|
-
"onUpdate:checked": t[0] ||= (e) => y.isCrypto = e,
|
|
136
|
-
disabled: unref(b),
|
|
137
|
-
onChange: w
|
|
138
|
-
}, null, 8, ["checked", "disabled"])]),
|
|
139
|
-
_: 1
|
|
140
|
-
}), createVNode(r, {
|
|
141
|
-
label: "模式",
|
|
142
|
-
name: "isCrypto"
|
|
143
|
-
}, {
|
|
144
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createVNode(o, {
|
|
145
|
-
checked: y.mode,
|
|
146
|
-
disabled: unref(b),
|
|
147
|
-
class: normalizeClass(unref(b) ? "cursor-not-allowed!" : ""),
|
|
148
|
-
onChange: t[1] ||= (e) => !unref(b) && C(!0, e)
|
|
149
|
-
}, {
|
|
150
|
-
default: withCtx(() => [...t[4] ||= [createTextVNode(" 白名单 ", -1)]]),
|
|
151
|
-
_: 1
|
|
152
|
-
}, 8, [
|
|
153
|
-
"checked",
|
|
154
|
-
"disabled",
|
|
155
|
-
"class"
|
|
156
|
-
]), createVNode(o, {
|
|
157
|
-
checked: !y.mode,
|
|
158
|
-
class: normalizeClass(["mr-0px!", unref(b) ? "cursor-not-allowed!" : ""]),
|
|
159
|
-
onChange: t[2] ||= (e) => !unref(b) && C(!1, e)
|
|
160
|
-
}, {
|
|
161
|
-
default: withCtx(() => [...t[5] ||= [createTextVNode(" 黑名单 ", -1)]]),
|
|
162
|
-
_: 1
|
|
163
|
-
}, 8, ["checked", "class"])]), createElementVNode("div", _hoisted_6, [createVNode(unref(QuestionCircleOutlined), { class: "mr-5px" }), t[6] ||= createTextVNode("白名单模式下,仅不加密过滤列表中的接口;黑名单模式下,仅加密过滤列表中的接口。 ", -1)])])]),
|
|
164
|
-
_: 1
|
|
165
|
-
})]),
|
|
166
|
-
_: 1
|
|
167
|
-
}, 8, ["model"])]), createElementVNode("div", _hoisted_7, [createVNode(unref(ProTable), {
|
|
168
|
-
ref_key: "tableRef",
|
|
169
|
-
ref: p,
|
|
170
|
-
"row-key": "id",
|
|
171
|
-
"data-source": y.whiteListUrls,
|
|
172
|
-
columns: T,
|
|
173
|
-
"auto-height": "",
|
|
174
|
-
search: !1,
|
|
175
|
-
pagination: !1,
|
|
176
|
-
scroll: { x: 1e3 }
|
|
177
|
-
}, {
|
|
178
|
-
toolbar: withCtx(() => [withDirectives((openBlock(), createBlock(l, {
|
|
179
|
-
type: "primary",
|
|
180
|
-
disabled: unref(b),
|
|
181
|
-
onClick: t[3] ||= (e) => E(unref(ACTION).ADD)
|
|
182
|
-
}, {
|
|
183
|
-
default: withCtx(() => [createVNode(c), createTextVNode(" " + toDisplayString(unref(ACTION).ADD), 1)]),
|
|
184
|
-
_: 1
|
|
185
|
-
}, 8, ["disabled"])), [[f, "crypto_url_add"]])]),
|
|
186
|
-
bodyCell: withCtx(({ column: e, index: t }) => [e.dataIndex === "action" ? (openBlock(), createBlock(d, { key: 0 }, {
|
|
187
|
-
default: withCtx(() => [withDirectives((openBlock(), createElementBlock("a", {
|
|
188
|
-
class: "flex items-center hover:opacity-80",
|
|
189
|
-
onClick: (e) => E(unref(ACTION).EDIT, t)
|
|
190
|
-
}, [createVNode(u, {
|
|
191
|
-
name: "edit",
|
|
192
|
-
class: "text-base"
|
|
193
|
-
}), createElementVNode("span", _hoisted_9, toDisplayString(unref(ACTION).EDIT), 1)], 8, _hoisted_8)), [[f, "crypto_url_edit"]]), withDirectives((openBlock(), createElementBlock("span", {
|
|
194
|
-
flex: "",
|
|
195
|
-
"items-center": "",
|
|
196
|
-
"text-red-500": "",
|
|
197
|
-
"hover:cursor-pointer": "",
|
|
198
|
-
"hover:text-red-500": "",
|
|
199
|
-
"hover:opacity-80": "",
|
|
200
|
-
onClick: (e) => E(unref(ACTION).REMOVE, t)
|
|
201
|
-
}, [createVNode(u, {
|
|
202
|
-
name: "remove",
|
|
203
|
-
class: "text-base"
|
|
204
|
-
}), createElementVNode("span", _hoisted_11, toDisplayString(unref(ACTION).REMOVE), 1)], 8, _hoisted_10)), [[f, "crypto_url_delete"]])]),
|
|
205
|
-
_: 2
|
|
206
|
-
}, 1024)) : createCommentVNode("", !0)]),
|
|
207
|
-
_: 1
|
|
208
|
-
}, 8, ["data-source"])])]), createVNode(drawerCryptoUrl_default, {
|
|
209
|
-
ref_key: "drawerRef",
|
|
210
|
-
ref: h,
|
|
211
|
-
onSubmit: O
|
|
212
|
-
}, null, 512)]);
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
}), [["__scopeId", "data-v-89197708"]]);
|
|
216
|
-
export { setting_default as default };
|