zcatalyst-cli 1.18.0-beta.13 → 1.18.0-beta.14

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.
@@ -97,7 +97,7 @@ function spinUpMaster(listenPort, { otherServerDetails, appSailDetails, slateDet
97
97
  }
98
98
  }
99
99
  const proxy = (0, utils_1.createProxyServer)(listenPort);
100
- const signRedirectUrl = slateDetails ? undefined : '/app/local-redirect';
100
+ const signRedirectUrl = slateDetails ? '/' : '/app/local-redirect';
101
101
  appSailDetails && ((_b = (_a = appSailDetails.target) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.catalyst_auth) === true
102
102
  ? proxy.on('proxyRes', (0, utils_1.proxyResponseHandler)({
103
103
  signInRedirect: appSailDetails.target.config.login_redirect || '/'
@@ -11,25 +11,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.addSlateRoutes = void 0;
13
13
  function addSlateRoutes(app, details, proxy, unknownProxy) {
14
- app.use('/__catalyst/sdk/init', (req, res) => __awaiter(this, void 0, void 0, function* () {
14
+ app.use(['/accounts', '/oauthorize', '/__catalyst'], (req, res) => {
15
15
  req.url = req.originalUrl;
16
16
  unknownProxy(req, res);
17
- }));
18
- app.use(['/accounts', '/oauthorize'], (req, res) => {
19
- req.url = req.originalUrl;
20
- unknownProxy(req, res);
21
- });
22
- app.use('/__catalyst', (req, res) => {
23
- req.url = req.originalUrl;
24
- if (req.url.includes('redirect_url')) {
25
- res.redirect(req.url.split('redirect_url=')[1]);
26
- }
27
- else if (req.url.includes('service_url')) {
28
- res.redirect(req.url.split('service_url=')[1]);
29
- }
30
- else {
31
- unknownProxy(req, res);
32
- }
33
17
  });
34
18
  app.use('/', (req, res) => __awaiter(this, void 0, void 0, function* () {
35
19
  if (req.header('catalyst-component') === 'true') {
@@ -89,9 +89,11 @@ const proxyResponseHandler = ({ systemRoutes, signInRedirect }) => (proxyRes, re
89
89
  return cookie;
90
90
  });
91
91
  if (req.url.startsWith('/baas') || req.url.startsWith('/__catalyst')) {
92
- if (req.url.includes('/signin-redirect') && signInRedirect) {
92
+ const urlParams = new URLSearchParams(req.url.split('?')[1] || '');
93
+ const redirectUrl = urlParams.get('redirect_url') || urlParams.get('service_url') || signInRedirect;
94
+ if (req.url.includes('/signin-redirect') && redirectUrl) {
93
95
  if (systemRoutes === undefined) {
94
- (0, exports.redirectByAuth)(req, res, signInRedirect);
96
+ (0, exports.redirectByAuth)(req, res, redirectUrl);
95
97
  return;
96
98
  }
97
99
  const sourceRedirectUrl = Object.keys(systemRoutes).find((sourceUrl) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcatalyst-cli",
3
- "version": "1.18.0-beta.13",
3
+ "version": "1.18.0-beta.14",
4
4
  "description": "Command Line Tool for CATALYST",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {