@pubinfo/module-crypto 2.1.12 → 2.2.0-beta.1

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.
@@ -0,0 +1,217 @@
1
+ import { cryptoContext as e, n as t, t as n } from "./index.js";
2
+ import { r, t as i } from "./drawerCryptoUrl-BtGF8N07.js";
3
+ import { PubinfoIcon as a, useAuth as o } from "pubinfo";
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 n().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: n, mode: r, whiteListUrls: i } = K, a = {
48
+ cryptoEnabled: n,
49
+ cryptoMode: r,
50
+ cryptoWhitePath: i
51
+ }, { success: o } = await t({ json: JSON.stringify(a) });
52
+ o && (O.success("配置更改成功"), e.callAsync({
53
+ ...e.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 };
@@ -0,0 +1 @@
1
+ .safe-rule-form .ant-input[data-v-89197708],.safe-rule-form .ant-select[data-v-89197708]{width:90%}.safe-rule-form[data-v-89197708] .ant-tag-checkable-checked{color:#1677ff;background:#fff;font-size:13px}.safe-rule-form[data-v-89197708] .ant-tag-checkable{font-size:13px}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo/module-crypto",
3
3
  "type": "module",
4
- "version": "2.1.12",
4
+ "version": "2.2.0-beta.1",
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": "2.1.12"
26
+ "pubinfo": "2.2.0-beta.1"
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": "2.1.12"
39
+ "pubinfo": "2.2.0-beta.1"
40
40
  },
41
41
  "scripts": {
42
42
  "dev": "pubinfo build -w --sourcemap",
package/src/index.ts CHANGED
@@ -54,8 +54,8 @@ export function crypto(options: CryptoOptions): ModuleOptions {
54
54
  };
55
55
  }
56
56
 
57
+ export { ctx as cryptoContext } from './context.ts';
57
58
  export { setupAes } from './cryptoAlg/aes.ts';
58
59
  export { setupSm4Cbc } from './cryptoAlg/sm4-cbc.ts';
59
60
  export { setupSm4Ecb } from './cryptoAlg/sm4-ecb.ts';
60
61
  export * from './interface';
61
- export { default as CryptoSettingPage } from './pages/setting.vue';
@@ -1,10 +0,0 @@
1
- declare function onOpen(edit: boolean, list: API.UrlEntry[], index?: number): Promise<void>;
2
- declare const __VLS_export: import("vue").DefineComponent<{}, {
3
- open: typeof onOpen;
4
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- submit: (...args: any[]) => void;
6
- }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
7
- onSubmit?: ((...args: any[]) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
9
- declare const _default: typeof __VLS_export;
10
- export default _default;
@@ -1,3 +0,0 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
- declare const _default: typeof __VLS_export;
3
- export default _default;