@adonis-agora/media-dashboard 10.0.0-rc.0 → 10.0.0-rc.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/CHANGELOG.md +18 -0
- package/README.md +4 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/spa/assets/index-DOnygWEb.js +12 -0
- package/dist/spa/assets/index-DOnygWEb.js.map +1 -0
- package/dist/spa/assets/index-XkvYeRIj.css +2 -0
- package/dist/spa/index.html +2 -2
- package/dist/types.d.ts +0 -17
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/skills/media-dashboard-console/SKILL.md +31 -56
- package/dist/spa/assets/index-C-7cKQuV.js +0 -12
- package/dist/spa/assets/index-C-7cKQuV.js.map +0 -1
- package/dist/spa/assets/index-Db6cSeO5.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @adonis-agora/media-dashboard
|
|
2
2
|
|
|
3
|
+
## 10.0.0-rc.1
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#284](https://github.com/DavideCarvalho/adonis-agora-media/pull/284) [`ddf507b`](https://github.com/DavideCarvalho/adonis-agora-media/commit/ddf507bf477c00e89f8ca4ab033f56efd56519ad) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The media console is closed in production until you set `authorize`. Without `authorize` in `config/media_dashboard.ts`, the console is open outside production and in production answers `403` to every page and API request. Either way it logs once at boot: ``[@adonis-agora/media] console has no `authorize` configured: it is open outside production and denies every request in production. Set `authorize` in config/media_dashboard.ts.`` Before, it was open in every environment unless `middleware` or `auth` closed it. `authorize` runs before `middleware`, so a console guarded only by `middleware` needs `authorize` too, for example `authorize: () => true` to keep your middleware as the gate.
|
|
8
|
+
|
|
9
|
+
`authorize` now takes the access contract shared by every Agora console, in three forms: an inline function `(ctx) => result`, a `ConsoleAuthorizer` class (built through the container, so `@inject()` works), or a lazy import of one (`() => import('#policies/console_access')`, loaded once). A check may also answer `{ redirectTo: '/login' }`: page navigations are redirected there and API calls get `401`. Every result the hook accepted before keeps working, and a check that throws is still a `403`.
|
|
10
|
+
|
|
11
|
+
API refusals now answer `{ error: 'forbidden' }` (`403`) and `{ error: 'unauthenticated' }` (`401`, plus `redirectTo` when the check asked for a redirect), the same bodies as every other Agora console. Before they were `{ error: 'Forbidden' }` and `{ error: 'Unauthorized' }`.
|
|
12
|
+
|
|
13
|
+
New `authorizeByToken({ token })` for machine access: `authorize: authorizeByToken({ token: env.get('CONSOLE_TOKEN') })` allows requests with `Authorization: Bearer <token>` and answers `401` otherwise. An empty or missing token throws when the config loads.
|
|
14
|
+
|
|
15
|
+
The `DashboardAuthorize`, `AuthorizeResult` and `AuthorizeDecision` types are replaced by `ConsoleAuthorize`, `ConsoleAuthorizeResult` and `ConsoleAuthorizer`, exported from `@adonis-agora/media/dashboard` together with `resolveConsoleAuthorize` and `authorizeByToken`.
|
|
16
|
+
|
|
17
|
+
The console no longer has a login of its own: the `auth` option of `config/media_dashboard.ts` is removed, with no alias. Gone with it: the console's login screen and sign out button, the `GET /me`, `POST /login`, `POST /session` and `POST /logout` API routes, the `media_dashboard_session` cookie and its `secret`/`ttl`/`session`/`login`/`revalidate` hooks, and the exports `resolveConsoleAuth`, `signSessionCookie`, `verifySessionCookie` and the types `ConsoleAuthOptions`, `ResolvedConsoleAuth`, `ConsoleSession`, `ConsoleSessionUser`, `ConsoleSessionUserInfo`, `AuthMode`, `SessionHook`, `LoginHook`, `RevalidateHook`, `MeResponse` and `LoginBody` (from `@adonis-agora/media/dashboard` and `@adonis-agora/media-dashboard`). Sign-in is your app's own: gate the console in `authorize` and return `{ redirectTo: '/login' }` for a signed-out visitor. When one of the console's API calls answers `401`, the console follows that `redirectTo`, or reloads the page when there is none. `@adonis-agora/media-dashboard`'s client drops `me()`, `login()`, `logout()` and `ConsoleAuthState`, and takes an `onUnauthenticated` option (default `followUnauthenticated`).
|
|
18
|
+
|
|
19
|
+
`@adonis-agora/media-react` drops the console launcher, which only minted the removed console session: `OpenMediaDashboardButton`, `useOpenMediaDashboard`, `openMediaDashboardMutationOptions`, `openMediaDashboard`, `mintMediaDashboardSession`, `mediaDashboardSessionUrl`, `mediaDashboardUrl`, `ConsoleSessionError` and their types. Link to the console's `basePath` instead.
|
|
20
|
+
|
|
3
21
|
## 10.0.0-rc.0
|
|
4
22
|
|
|
5
23
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import { defineConfig } from '@adonis-agora/media/dashboard'
|
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
See [`@adonis-agora/media`'s Dashboard section](../adonis#dashboard) for the full config reference —
|
|
36
|
-
`defineConfig`, `DashboardService`, the
|
|
36
|
+
`defineConfig`, `DashboardService`, the `authorize` contract and `ObjectInsightProvider` all live under
|
|
37
37
|
`@adonis-agora/media/dashboard` now.
|
|
38
38
|
|
|
39
39
|
## Configuration
|
|
@@ -48,7 +48,8 @@ export default defineConfig({
|
|
|
48
48
|
basePath: '/media/dashboard', // where the SPA mounts (default)
|
|
49
49
|
actions: true, // enable copy/move/delete (default: false, read-only)
|
|
50
50
|
disks: ['s3', 'backups'], // browsable disks (default: derived from media config)
|
|
51
|
-
|
|
51
|
+
authorize: (ctx) => ctx.auth.user?.isAdmin === true, // who may open it — SPA + API
|
|
52
|
+
middleware: middleware.auth(), // runs after authorize
|
|
52
53
|
})
|
|
53
54
|
```
|
|
54
55
|
|
|
@@ -58,7 +59,7 @@ the runtime config into `index.html` at serve time, as a JSON data block
|
|
|
58
59
|
|
|
59
60
|
## Routes
|
|
60
61
|
|
|
61
|
-
Registered under `apiBasePath` (default `<basePath>/api`), behind your `middleware`:
|
|
62
|
+
Registered under `apiBasePath` (default `<basePath>/api`), behind `authorize` and your `middleware`:
|
|
62
63
|
|
|
63
64
|
| Method | Path | Backed by |
|
|
64
65
|
| --- | --- | --- |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `@adonis-agora/media-dashboard`'s public surface: the console's wire-format API types. The console
|
|
3
|
-
* itself (provider, `defineConfig`, `DashboardService`,
|
|
3
|
+
* itself (provider, `defineConfig`, `DashboardService`, `authorize`) ships in `@adonis-agora/media`
|
|
4
4
|
* under `./dashboard_provider` and `./dashboard`; this package is the SPA's build-time source.
|
|
5
5
|
*/
|
|
6
|
-
export type { CollectionFilter, CollectionListResponse, CollectionSummary, CollectionsSummaryResponse,
|
|
6
|
+
export type { CollectionFilter, CollectionListResponse, CollectionSummary, CollectionsSummaryResponse, CopyMoveBody, CursorPage, CursorPageInfo, CursorParams, DeleteBody, DiskCapabilities, DiskInfo, DiskListResponse, FolderBody, MediaDetailResponse, MediaEntry, MediaVariant, ObjectDetailResponse, ObjectEntry, ObjectFolder, ObjectInsight, ObjectInsightFact, ObjectInsightLink, ObjectInsightsResponse, ObjectListResponse, Topology, UploadDetailResponse, UploadInfo, UploadListResponse, UploadPart, } from './types.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,0BAA0B,EAC1B,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,UAAU,GACX,MAAM,YAAY,CAAC"}
|