@celilo/console-server 0.5.0 → 0.5.1
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/package.json +1 -1
- package/spa/assets/index-C31pEQ-J.js +26 -0
- package/spa/index.html +1 -1
- package/src/serve.ts +8 -3
- package/spa/assets/index-DJJXEYrW.js +0 -26
package/spa/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>celilo</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-C31pEQ-J.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-eLF_dgP-.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/src/serve.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import { join } from 'node:path';
|
|
19
|
+
import { API_BASE_PATH } from '@celilo/console-protocol';
|
|
19
20
|
import type { ServiceType } from '@celilo/console-protocol';
|
|
20
21
|
import { CALLBACK_PATH } from './oidc-login';
|
|
21
22
|
import { Upstream, type UpstreamOptions, UpstreamUnavailable } from './upstream';
|
|
@@ -267,7 +268,11 @@ export function createHandler(options: ServeOptions): (request: Request) => Prom
|
|
|
267
268
|
// bundle even with every API call refused.
|
|
268
269
|
const subject = await options.authenticate(request);
|
|
269
270
|
if (subject === null) {
|
|
270
|
-
if (
|
|
271
|
+
if (
|
|
272
|
+
options.login &&
|
|
273
|
+
!url.pathname.startsWith(`${API_BASE_PATH}/`) &&
|
|
274
|
+
url.pathname !== CALLBACK_PATH
|
|
275
|
+
) {
|
|
271
276
|
return options.login.redirectToLogin(request);
|
|
272
277
|
}
|
|
273
278
|
return new Response('Unauthorized', {
|
|
@@ -276,8 +281,8 @@ export function createHandler(options: ServeOptions): (request: Request) => Prom
|
|
|
276
281
|
});
|
|
277
282
|
}
|
|
278
283
|
|
|
279
|
-
if (url.pathname.startsWith(
|
|
280
|
-
const name = url.pathname.slice(
|
|
284
|
+
if (url.pathname.startsWith(`${API_BASE_PATH}/`)) {
|
|
285
|
+
const name = url.pathname.slice(API_BASE_PATH.length + 1) as ApiName;
|
|
281
286
|
if (!SERVED.includes(name)) {
|
|
282
287
|
return Response.json(
|
|
283
288
|
{ isSucc: false, err: { message: `Unknown verb: ${name}`, type: 'ApiError' } },
|