labull-framework 0.1.29 → 0.1.30
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/README.md +9 -3
- package/dist/auth.js +6 -5
- package/dist/{chunk-index-DGTXheeR.js → chunk-index-3dQJWK2S.js} +194 -193
- package/dist/{chunk-index-BWpDbB19.js → chunk-index-BVIJeFeJ.js} +34 -29
- package/dist/index.js +27 -26
- package/dist/magic-block.js +492 -490
- package/dist/style.css +1 -1
- package/dist/types/auth-real.d.ts +8 -1
- package/dist/types/magic-block-real.d.ts +1 -1
- package/dist/types/ui-real.d.ts +10 -0
- package/dist/ui.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
|
|
1
|
+
import { ref as l, computed as T } from "vue";
|
|
2
|
+
let i = "";
|
|
3
|
+
function U(t) {
|
|
4
|
+
i = String(t ?? "").trim().replace(/\/+$/, "");
|
|
5
|
+
}
|
|
6
|
+
const h = 8e3, $ = 1500, y = "labull.csrf", C = "x-labull-csrf", P = ["GET", "HEAD", "OPTIONS"], u = l(null);
|
|
3
7
|
function v(t) {
|
|
4
8
|
for (const e of (typeof document > "u" ? "" : document.cookie).split(";")) {
|
|
5
9
|
const [n, ...s] = e.trim().split("=");
|
|
@@ -9,17 +13,17 @@ function v(t) {
|
|
|
9
13
|
}
|
|
10
14
|
function m(t = "GET", e = !1) {
|
|
11
15
|
const n = e ? { "Content-Type": "application/json" } : {}, s = v(y);
|
|
12
|
-
return s &&
|
|
16
|
+
return s && !P.includes(t.toUpperCase()) && (n[C] = s), n;
|
|
13
17
|
}
|
|
14
18
|
async function E(t, e = {}) {
|
|
15
|
-
const n = String(e.method ?? "GET").toUpperCase(), s = await fetch(`${
|
|
19
|
+
const n = String(e.method ?? "GET").toUpperCase(), s = await fetch(`${i}${t}`, {
|
|
16
20
|
...e,
|
|
17
21
|
method: n,
|
|
18
22
|
credentials: "include",
|
|
19
23
|
headers: { ...m(n, e.body !== void 0), ...e.headers ?? {} }
|
|
20
24
|
});
|
|
21
25
|
if (!s.ok) {
|
|
22
|
-
const
|
|
26
|
+
const r = await s.json().catch(() => null), a = typeof r?.message == "string" ? r.message : "";
|
|
23
27
|
throw Object.assign(new Error(a || `请求失败:${s.status} ${t}`), { status: s.status });
|
|
24
28
|
}
|
|
25
29
|
return s.status === 204 ? void 0 : await s.json();
|
|
@@ -31,13 +35,13 @@ function f() {
|
|
|
31
35
|
}
|
|
32
36
|
function O(t = f()) {
|
|
33
37
|
const e = t.startsWith("/") && !t.startsWith("//") ? t : "/";
|
|
34
|
-
return `${
|
|
38
|
+
return `${i}/auth/login?redirect=${encodeURIComponent(e)}`;
|
|
35
39
|
}
|
|
36
40
|
function w(t = f()) {
|
|
37
41
|
window.location.assign(O(t));
|
|
38
42
|
}
|
|
39
43
|
function _() {
|
|
40
|
-
u.value = null, window.location.assign(`${
|
|
44
|
+
u.value = null, window.location.assign(`${i}/auth/logout`);
|
|
41
45
|
}
|
|
42
46
|
async function b() {
|
|
43
47
|
try {
|
|
@@ -46,9 +50,9 @@ async function b() {
|
|
|
46
50
|
} catch (t) {
|
|
47
51
|
const e = t?.status;
|
|
48
52
|
return (e === 401 || e === 403) && await Promise.race([
|
|
49
|
-
fetch(`${
|
|
53
|
+
fetch(`${i}/auth/logout`, { method: "POST", credentials: "include", headers: m("POST", !0) }).catch(() => {
|
|
50
54
|
}),
|
|
51
|
-
new Promise((n) => setTimeout(n,
|
|
55
|
+
new Promise((n) => setTimeout(n, $))
|
|
52
56
|
]), u.value = null, null;
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -63,37 +67,37 @@ async function p(t = h) {
|
|
|
63
67
|
e !== void 0 && clearTimeout(e);
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
async function
|
|
70
|
+
async function D(t = f(), e = h) {
|
|
67
71
|
const n = await p(e);
|
|
68
72
|
return n !== "timeout" && n ? n : (n !== "timeout" && w(t), null);
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
const e = t.deadlineMs ?? h, n =
|
|
74
|
+
function R(t = {}) {
|
|
75
|
+
const e = t.deadlineMs ?? h, n = l(!1), s = l(!1), r = l(!1);
|
|
72
76
|
let a = null, d = !1;
|
|
73
|
-
async function S(
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
d = !0, s.value = !1,
|
|
77
|
+
async function S(o) {
|
|
78
|
+
const c = await p(e);
|
|
79
|
+
if (c !== "timeout" && c) {
|
|
80
|
+
d = !0, s.value = !1, r.value = !1, n.value = !0;
|
|
77
81
|
return;
|
|
78
82
|
}
|
|
79
|
-
if (n.value = !1, s.value = !0,
|
|
83
|
+
if (n.value = !1, s.value = !0, r.value = c === "timeout", c !== "timeout")
|
|
80
84
|
try {
|
|
81
|
-
w(
|
|
85
|
+
w(o);
|
|
82
86
|
} catch {
|
|
83
87
|
console.warn("[labull] 整页跳登录没成功;界面上的手动登录链接还在。");
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
|
-
function g(
|
|
87
|
-
return d ? Promise.resolve() : a || (a = S(
|
|
90
|
+
function g(o) {
|
|
91
|
+
return d ? Promise.resolve() : a || (a = S(o).finally(() => {
|
|
88
92
|
a = null;
|
|
89
93
|
}), a);
|
|
90
94
|
}
|
|
91
|
-
function A(
|
|
92
|
-
d = !1, n.value = !1, g(
|
|
95
|
+
function A(o) {
|
|
96
|
+
d = !1, n.value = !1, g(o);
|
|
93
97
|
}
|
|
94
|
-
return { open: n, denied: s, unreachable:
|
|
98
|
+
return { open: n, denied: s, unreachable: r, pass: g, recheck: A };
|
|
95
99
|
}
|
|
96
|
-
function
|
|
100
|
+
function j() {
|
|
97
101
|
async function t() {
|
|
98
102
|
const e = await p();
|
|
99
103
|
return e === "timeout" ? null : e;
|
|
@@ -112,18 +116,19 @@ function R() {
|
|
|
112
116
|
};
|
|
113
117
|
}
|
|
114
118
|
export {
|
|
115
|
-
|
|
116
|
-
C,
|
|
119
|
+
i as A,
|
|
120
|
+
$ as C,
|
|
117
121
|
h as a,
|
|
118
122
|
E as b,
|
|
119
123
|
m as c,
|
|
120
|
-
|
|
124
|
+
R as d,
|
|
121
125
|
f as e,
|
|
122
126
|
b as f,
|
|
123
127
|
p as g,
|
|
124
|
-
|
|
128
|
+
D as h,
|
|
125
129
|
w as i,
|
|
126
130
|
_ as j,
|
|
127
131
|
O as l,
|
|
128
|
-
|
|
132
|
+
U as s,
|
|
133
|
+
j as u
|
|
129
134
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { A as e, a as t, C as r, b as o, c as
|
|
2
|
-
import { A as
|
|
3
|
-
import { T as
|
|
1
|
+
import { A as e, a as t, C as r, b as o, c as i, d as l, e as u, f as c, g as n, h as T, l as A, i as b, j as p, s as d, u as h } from "./chunk-index-BVIJeFeJ.js";
|
|
2
|
+
import { A as E, P as _, a as P, b as U, _ as f, U as g, i as I, l as x } from "./chunk-index-3dQJWK2S.js";
|
|
3
|
+
import { T as N, a as m, c as D, f as L, i as v, b as B, o as M, p as H, s as O, u as R, d as j } from "./chunk-ProductShell.vue_vue_type_style_index_0_scoped_06035587_lang-Fky1ghd2.js";
|
|
4
4
|
export {
|
|
5
5
|
e as API_BASE,
|
|
6
6
|
t as AUTH_DEADLINE_MS,
|
|
7
|
-
|
|
7
|
+
E as AppSearch,
|
|
8
8
|
r as CLEAR_SESSION_DEADLINE_MS,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
_ as ProductShell,
|
|
10
|
+
P as ProductSide,
|
|
11
|
+
U as ProductTabs,
|
|
12
|
+
N as TAB_CONTEXT,
|
|
13
|
+
f as TabPage,
|
|
14
|
+
g as UserMenu,
|
|
15
|
+
m as activateTab,
|
|
16
16
|
o as apiFetch,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
i as authHeaders,
|
|
18
|
+
D as closeTab,
|
|
19
|
+
l as createAuthGate,
|
|
20
20
|
u as currentPath,
|
|
21
21
|
c as currentUser,
|
|
22
22
|
n as currentUserInTime,
|
|
23
23
|
T as ensureAuthenticated,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
L as followUrl,
|
|
25
|
+
I as installApp,
|
|
26
|
+
v as installTabNavigator,
|
|
27
|
+
B as isInstanceLocation,
|
|
28
|
+
x as labull,
|
|
29
|
+
A as loginUrl,
|
|
30
|
+
b as loginWithRedirect,
|
|
31
31
|
p as logout,
|
|
32
32
|
M as openTab,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
R as
|
|
33
|
+
H as provideTabContext,
|
|
34
|
+
d as setApiBase,
|
|
35
|
+
O as setTabTitle,
|
|
36
|
+
h as useAuth,
|
|
37
|
+
R as useTabContext,
|
|
38
|
+
j as useTabs
|
|
38
39
|
};
|