@nocobase/server 3.0.0-alpha.2 → 3.0.0-alpha.4

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.
@@ -89,6 +89,7 @@ export declare class Gateway extends EventEmitter {
89
89
  private resolveLegacyV2SettingsRedirect;
90
90
  private getPortalRootPublicPath;
91
91
  private getPortalAppPublicPath;
92
+ private resolvePortalRootEntryRedirect;
92
93
  private getPortalMatch;
93
94
  private isPortalIndexRequest;
94
95
  private getPortalDistRoot;
@@ -358,10 +358,6 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
358
358
  from: "/admin/settings/mail/oauth2",
359
359
  to: "/admin/settings/mail/oauth2"
360
360
  },
361
- {
362
- from: "/admin/ai/knowledge-base/detail",
363
- to: "/settings/ai/knowledge-base/detail"
364
- },
365
361
  {
366
362
  from: "/admin/workflow/executions",
367
363
  to: "/settings/workflow/executions"
@@ -394,6 +390,22 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
394
390
  }
395
391
  return `${this.getPortalRootPublicPath()}apps/${(0, import_utils3.normalizePortalAppName)(appName)}/`;
396
392
  }
393
+ resolvePortalRootEntryRedirect(pathname) {
394
+ const portalRootPublicPath = this.getPortalRootPublicPath();
395
+ const v2PublicPath = this.getV2PublicPath();
396
+ if (v2PublicPath === portalRootPublicPath) {
397
+ return null;
398
+ }
399
+ if (pathname === portalRootPublicPath || pathname === portalRootPublicPath.slice(0, -1)) {
400
+ return v2PublicPath;
401
+ }
402
+ const portalAppsPublicPath = `${portalRootPublicPath}apps/`;
403
+ if (!pathname.startsWith(portalAppsPublicPath)) {
404
+ return null;
405
+ }
406
+ const match = /^([A-Za-z0-9_-]+)\/?$/.exec(pathname.slice(portalAppsPublicPath.length));
407
+ return match ? `${v2PublicPath}apps/${match[1]}/` : null;
408
+ }
397
409
  getPortalMatch(pathname) {
398
410
  const portalRootPublicPath = this.getPortalRootPublicPath();
399
411
  if (!pathname.startsWith(portalRootPublicPath)) {
@@ -580,6 +592,13 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
580
592
  res.end();
581
593
  return;
582
594
  }
595
+ const portalRootEntryRedirect = this.resolvePortalRootEntryRedirect(pathname);
596
+ if (portalRootEntryRedirect) {
597
+ res.statusCode = 302;
598
+ res.setHeader("Location", `${portalRootEntryRedirect}${search || ""}`);
599
+ res.end();
600
+ return;
601
+ }
583
602
  const supervisor = import_app_supervisor.AppSupervisor.getInstance();
584
603
  let handleApp = "main";
585
604
  try {
@@ -680,12 +699,6 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
680
699
  return;
681
700
  }
682
701
  }
683
- if (!pathname.startsWith(portalMatch.publicPath)) {
684
- res.statusCode = 302;
685
- res.setHeader("Location", `${portalMatch.publicPath}${search || ""}`);
686
- res.end();
687
- return;
688
- }
689
702
  const portalDistRoot = this.getPortalDistRoot(portalMatch);
690
703
  const portalIndex = (0, import_path.resolve)(portalDistRoot, "index.html");
691
704
  if (!import_fs.default.existsSync(portalIndex)) {
@@ -693,6 +706,12 @@ const _Gateway = class _Gateway extends import_events.EventEmitter {
693
706
  res.end();
694
707
  return;
695
708
  }
709
+ if (!pathname.startsWith(portalMatch.publicPath)) {
710
+ res.statusCode = 302;
711
+ res.setHeader("Location", `${portalMatch.publicPath}${search || ""}`);
712
+ res.end();
713
+ return;
714
+ }
696
715
  if (this.isPortalIndexRequest(pathname, portalMatch.publicPath)) {
697
716
  res.setHeader("Content-Type", "text/html; charset=utf-8");
698
717
  res.end(import_fs.default.readFileSync(portalIndex, "utf-8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "3.0.0-alpha.2",
3
+ "version": "3.0.0-alpha.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -10,21 +10,21 @@
10
10
  "@koa/cors": "^5.0.0",
11
11
  "@koa/multer": "^3.1.0",
12
12
  "@koa/router": "^13.1.0",
13
- "@nocobase/acl": "3.0.0-alpha.2",
14
- "@nocobase/actions": "3.0.0-alpha.2",
15
- "@nocobase/ai": "3.0.0-alpha.2",
16
- "@nocobase/auth": "3.0.0-alpha.2",
17
- "@nocobase/cache": "3.0.0-alpha.2",
18
- "@nocobase/data-source-manager": "3.0.0-alpha.2",
19
- "@nocobase/database": "3.0.0-alpha.2",
20
- "@nocobase/evaluators": "3.0.0-alpha.2",
21
- "@nocobase/lock-manager": "3.0.0-alpha.2",
22
- "@nocobase/logger": "3.0.0-alpha.2",
23
- "@nocobase/resourcer": "3.0.0-alpha.2",
24
- "@nocobase/sdk": "3.0.0-alpha.2",
25
- "@nocobase/snowflake-id": "3.0.0-alpha.2",
26
- "@nocobase/telemetry": "3.0.0-alpha.2",
27
- "@nocobase/utils": "3.0.0-alpha.2",
13
+ "@nocobase/acl": "3.0.0-alpha.4",
14
+ "@nocobase/actions": "3.0.0-alpha.4",
15
+ "@nocobase/ai": "3.0.0-alpha.4",
16
+ "@nocobase/auth": "3.0.0-alpha.4",
17
+ "@nocobase/cache": "3.0.0-alpha.4",
18
+ "@nocobase/data-source-manager": "3.0.0-alpha.4",
19
+ "@nocobase/database": "3.0.0-alpha.4",
20
+ "@nocobase/evaluators": "3.0.0-alpha.4",
21
+ "@nocobase/lock-manager": "3.0.0-alpha.4",
22
+ "@nocobase/logger": "3.0.0-alpha.4",
23
+ "@nocobase/resourcer": "3.0.0-alpha.4",
24
+ "@nocobase/sdk": "3.0.0-alpha.4",
25
+ "@nocobase/snowflake-id": "3.0.0-alpha.4",
26
+ "@nocobase/telemetry": "3.0.0-alpha.4",
27
+ "@nocobase/utils": "3.0.0-alpha.4",
28
28
  "@types/decompress": "4.2.7",
29
29
  "@types/ini": "^1.3.31",
30
30
  "@types/koa-send": "^4.1.3",
@@ -61,5 +61,5 @@
61
61
  "@types/serve-handler": "^6.1.1",
62
62
  "@types/ws": "^8.5.5"
63
63
  },
64
- "gitHead": "a3faea21082b30989301de04591ee1b91fd4e6a5"
64
+ "gitHead": "6658768567378382de758c4e814ac510d688400c"
65
65
  }