asai-vue-host 0.2.59 → 0.2.61

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,103 @@
1
+ import { defineComponent as W, inject as k, computed as S, reactive as C, onMounted as U, onBeforeUnmount as v, resolveComponent as f, createElementBlock as L, createBlock as u, unref as d, openBlock as l, Fragment as O, resolveDynamicComponent as $ } from "vue";
2
+ const P = /* @__PURE__ */ W({
3
+ __name: "AsaiInitPage",
4
+ props: {
5
+ appmodules: {},
6
+ ujt: {}
7
+ },
8
+ setup(a) {
9
+ const i = a, g = k("$vueProxy"), { $global: r, $fn: s, $model: b, $ws: y } = i.ujt;
10
+ b.appmodules = i.appmodules;
11
+ function w() {
12
+ let e = s.As?.localGet("as-user-code");
13
+ e && (e = s.As.toObj(e), r.code.pri = e[0], r.code.pub = e[1]), r.code.pri && s.As.localGet("as-user-info") && (r.user.info = s.As.toObj(s.AsAES.dec(s.As.localGet("as-user-info")))), s.inittoken();
14
+ }
15
+ function m() {
16
+ r?.sys?.onwebws && s.ws.web.wsListen({ ty: "publish/web" }, (e) => {
17
+ const t = e?.db?.lang, n = !!r.user?.info?.us;
18
+ t === "nousername" && !n || (e?.db?.lang && (e.db.langpm ? e.db.con = s.lg("asai.hostmsg." + e.db.lang, e.db.langpm) || e.db.con : e.db.con = s.lg("asai.hostmsg." + e.db.lang) || e.db.con), e?.db === "pong" ? s.ws.web.wsApi("ping").then((c) => {
19
+ }) : e?.db?.bs ? p(e.db.bs) : e?.db?.con && r?.msg?.fn?.(e.db), e?.db?.exit && n && s.exit());
20
+ });
21
+ }
22
+ function j() {
23
+ const e = r.link?.ws?.web;
24
+ return !(!e || e.sec && !s.gettoken(0));
25
+ }
26
+ function p(e) {
27
+ if (Array.isArray(e) && e[0]?.[0])
28
+ try {
29
+ e.forEach((t) => {
30
+ s.As.setObjValByPath(y.wssys, t[0], t[1]);
31
+ });
32
+ } catch {
33
+ }
34
+ }
35
+ r.rlv = S(() => !r.location.hash || r.location.hash == "/" || r.sys?.router?.rights?.lv0?.find((e) => r.location.hash.includes(e)) ? 0 : r.sys?.router?.rights?.lv1?.find((e) => r.location.hash.includes(e)) ? 1 : r.sys?.router?.rights?.lv2?.find((e) => r.location.hash.includes(e)) ? 2 : r.sys?.router?.rights?.lv3?.find((e) => r.location.hash.includes(e)) ? 3 : r.sys?.router?.config?.lv || 0);
36
+ function h(e, t) {
37
+ try {
38
+ console.error(t + " Error:", e);
39
+ let n = "";
40
+ e?.error?.stack && typeof e?.error?.stack == "string" ? n = e.error.stack : e?.error?.message && typeof e?.error?.message == "string" ? n = e.error.message : e?.message && typeof e?.message == "string" ? n = e.message : e?.reason?.message && typeof e?.reason?.message == "string" ? n = e.reason.message : e?.reason && typeof e?.reason == "string" ? n = e.reason : e && typeof e == "string" && (n = e), n && (n = "Web " + t + ` Error:
41
+ ` + n, console.error(n), s.$log(n), r?.msg?.fn?.({
42
+ type: "err",
43
+ con: n
44
+ })), e.preventDefault();
45
+ } catch (n) {
46
+ console.error("Try Error:", n);
47
+ }
48
+ }
49
+ const o = C({
50
+ catchErrorUnhandledrejection: null,
51
+ catchErrorCatch: null
52
+ });
53
+ return U(() => {
54
+ s.initweb(g).then(() => {
55
+ let e = [];
56
+ if (s?.useApi?.(i.ujt, "web"), r?.sys?.tyrobot && (s.useApi?.(i.ujt, r.sys.tyrobot), s.useWs?.(i.ujt, r.sys.tyrobot)), w(), r?.sys?.onwebws && (s.useWs?.(i.ujt, "web"), m(), j() && e.push(s.ws.web?.init?.())), r?.sys?.local?.lang || e.push(
57
+ s.initmodel("/sys/setting/settinglang.json").then((t) => {
58
+ typeof t?.data == "string" ? r.config.langcur = JSON.parse(t?.data || "{}")?.lang : r.config.langcur = (t?.data || {})?.lang;
59
+ })
60
+ ), r?.sys?.aes?.lv && !r.sys.aesfns && s.AsaiVueAES?.useAES) {
61
+ const { toAES: t, fromAES: n } = s.AsaiVueAES.useAES(i.ujt);
62
+ r.sys.aesfns = { allaes: r.sys.aes.lv > 1, toAES: t, fromAES: n };
63
+ }
64
+ Promise.all(e).then(() => {
65
+ s.changelang(r.config.langcur).then((t) => {
66
+ !window?.$CFG?.title && r.lang.configweb?.webtit && (document.title = r.lang.configweb?.webtit), r.stat.webclient = 1, r.sys.catcherror && (o.catchErrorUnhandledrejection = (c) => {
67
+ h(c, "Unhandledrejection");
68
+ }, window?.addEventListener?.("unhandledrejection", o.catchErrorUnhandledrejection), o.catchErrorCatch = (c) => {
69
+ h(c, "Catch");
70
+ }, window?.addEventListener?.("error", o.catchErrorCatch));
71
+ });
72
+ });
73
+ });
74
+ }), v(() => {
75
+ s.offweb(), r.sys.catcherror && (o.catchErrorUnhandledrejection && (window.removeEventListener("unhandledrejection", o.catchErrorUnhandledrejection), o.catchErrorUnhandledrejection = null), o.catchErrorCatch && (window.removeEventListener("error", o.catchErrorCatch), o.catchErrorCatch = null)), r?.sys?.onwebws || s.ws.web.wsListenOff({
76
+ ty: "publish/web"
77
+ });
78
+ }), (e, t) => {
79
+ const n = f("AsaiWebServer"), c = f("AsaiWebServerNode"), A = f("AsaiWebServerUser"), E = f("AsaiWebServerUserOnline");
80
+ return d(r).stat.webclient ? (l(), L(O, { key: 0 }, [
81
+ d(r).rlv === 0 ? (l(), u(n, {
82
+ key: 0,
83
+ ujt: a.ujt
84
+ }, null, 8, ["ujt"])) : d(r).rlv === 1 ? (l(), u(c, {
85
+ key: 1,
86
+ ujt: a.ujt
87
+ }, null, 8, ["ujt"])) : d(r).rlv === 2 ? (l(), u(A, {
88
+ key: 2,
89
+ ujt: a.ujt
90
+ }, null, 8, ["ujt"])) : (l(), u(E, {
91
+ key: 3,
92
+ ujt: a.ujt
93
+ }, null, 8, ["ujt"]))
94
+ ], 64)) : (l(), u($("PageLoadClient"), {
95
+ key: 1,
96
+ ujt: a.ujt
97
+ }, null, 8, ["ujt"]));
98
+ };
99
+ }
100
+ });
101
+ export {
102
+ P as default
103
+ };