@schema-platform/platform-shared 1.7.19 → 1.7.20

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.
@@ -21,27 +21,24 @@ function p(o) {
21
21
  const e = f(window.location.pathname);
22
22
  return e ? `${n}${a}/${e}/login?redirect=${encodeURIComponent(t)}` : `${n}/login?redirect=${encodeURIComponent(t)}`;
23
23
  }
24
- function g(o) {
24
+ function P(o) {
25
25
  s() || (window.location.href = p(o));
26
26
  }
27
27
  const h = /^\/schema-platform\/(editor|flow|ai|ua|docs)$/, $ = /^\/schema-platform\/(editor|flow|ai|ua|docs)(\/|$)/;
28
- function A(o, n) {
28
+ function g(o, n) {
29
29
  const t = (o || "/").trim() || "/", e = n.endsWith("/") ? n : `${n}/`, r = e.replace(/\/$/, "") || "/";
30
- if ($.test(t)) {
31
- if (t === r || t === e || t.startsWith(e) || r !== "/" && t.startsWith(`${r}/`)) {
32
- if (t === r || t === e)
33
- return { mode: "router", path: "/" };
34
- let i = t.slice(r.length);
35
- return i.startsWith("/") || (i = `/${i}`), { mode: "router", path: i || "/" };
36
- }
37
- return { mode: "location", href: h.test(t) ? `${t}/` : t };
30
+ if (t === r || t === e || t.startsWith(e) || r !== "/" && t.startsWith(`${r}/`)) {
31
+ if (t === r || t === e)
32
+ return { mode: "router", path: "/" };
33
+ let i = t.slice(r.length);
34
+ return i.startsWith("/") || (i = `/${i}`), { mode: "router", path: i || "/" };
38
35
  }
39
- return { mode: "router", path: t.startsWith("/") ? t : `/${t}` };
36
+ return $.test(t) ? { mode: "location", href: h.test(t) ? `${t}/` : t } : { mode: "router", path: t.startsWith("/") ? t : `/${t}` };
40
37
  }
41
38
  export {
42
39
  s as isAuthLoginPath,
43
40
  u as isShellEmbedded,
44
- g as redirectToLogin,
41
+ P as redirectToLogin,
45
42
  p as resolveLoginUrl,
46
- A as resolvePostLoginNavigation
43
+ g as resolvePostLoginNavigation
47
44
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schema-platform/platform-shared",
3
- "version": "1.7.19",
3
+ "version": "1.7.20",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -79,22 +79,26 @@ export function resolvePostLoginNavigation(
79
79
  const base = routeBase.endsWith('/') ? routeBase : `${routeBase}/`
80
80
  const baseNoSlash = base.replace(/\/$/, '') || '/'
81
81
 
82
- if (PLATFORM_APP_PATH_RE.test(raw)) {
83
- const underCurrent =
84
- raw === baseNoSlash ||
85
- raw === base ||
86
- raw.startsWith(base) ||
87
- (baseNoSlash !== '/' && raw.startsWith(`${baseNoSlash}/`))
88
-
89
- if (underCurrent) {
90
- if (raw === baseNoSlash || raw === base) {
91
- return { mode: 'router', path: '/' }
92
- }
93
- let path = raw.slice(baseNoSlash.length)
94
- if (!path.startsWith('/')) path = `/${path}`
95
- return { mode: 'router', path: path || '/' }
82
+ // 同应用:落在当前 base 内 → 去掉 base 前缀后走 router。
83
+ // 不区分平台/非平台:redirect 存的是含 base 的完整 pathname(如 vigil 的 /vigil/llm),
84
+ // router.push 的 path 必须去掉 base,否则会拼成 /vigil/vigil/llm(地址栏倍增)。
85
+ const underCurrent =
86
+ raw === baseNoSlash ||
87
+ raw === base ||
88
+ raw.startsWith(base) ||
89
+ (baseNoSlash !== '/' && raw.startsWith(`${baseNoSlash}/`))
90
+
91
+ if (underCurrent) {
92
+ if (raw === baseNoSlash || raw === base) {
93
+ return { mode: 'router', path: '/' }
96
94
  }
95
+ let path = raw.slice(baseNoSlash.length)
96
+ if (!path.startsWith('/')) path = `/${path}`
97
+ return { mode: 'router', path: path || '/' }
98
+ }
97
99
 
100
+ // 跨平台应用:硬跳转,「仅应用根路径」补尾斜杠,避免 nginx 无斜杠落到兜底 AI
101
+ if (PLATFORM_APP_PATH_RE.test(raw)) {
98
102
  const href = PLATFORM_APP_ROOT_RE.test(raw) ? `${raw}/` : raw
99
103
  return { mode: 'location', href }
100
104
  }