@adonis-agora/media-dashboard 9.0.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 +37 -0
- package/README.md +9 -25
- package/dist/index.d.ts +4 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -13
- package/dist/index.js.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 +14 -25
- package/skills/media-dashboard-console/SKILL.md +33 -84
- package/dist/provider/media_dashboard_provider.d.ts +0 -42
- package/dist/provider/media_dashboard_provider.d.ts.map +0 -1
- package/dist/provider/media_dashboard_provider.js +0 -57
- package/dist/provider/media_dashboard_provider.js.map +0 -1
- package/dist/spa/assets/index-3HWw8Zsr.js +0 -12
- package/dist/spa/assets/index-3HWw8Zsr.js.map +0 -1
- package/dist/spa/assets/index-CrdjxPM5.css +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
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
|
+
|
|
21
|
+
## 10.0.0-rc.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- [#281](https://github.com/DavideCarvalho/adonis-agora-media/pull/281) [`94f8af1`](https://github.com/DavideCarvalho/adonis-agora-media/commit/94f8af12bb87bf614a8ff0262958dd6120708851) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Remove the standalone console provider. The console ships in `@adonis-agora/media`; register its provider instead.
|
|
26
|
+
|
|
27
|
+
- **Removed:** the `@adonis-agora/media-dashboard/media_dashboard_provider` subpath and the `MediaDashboardProvider` export from `@adonis-agora/media-dashboard`. Replace `() => import('@adonis-agora/media-dashboard/media_dashboard_provider')` with `() => import('@adonis-agora/media/dashboard_provider')` in `adonisrc.ts`. `config/media_dashboard.ts` is unchanged.
|
|
28
|
+
- The package now only exports the console's API types (`.` and `./types`).
|
|
29
|
+
- The console reads its runtime config only from the JSON data block the provider injects; a `window.__MEDIA_DASHBOARD__` global is no longer read.
|
|
30
|
+
- The `@adonis-agora/media` and `@adonisjs/core` peers are removed: the package no longer imports either, so installing it requires neither.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- [#281](https://github.com/DavideCarvalho/adonis-agora-media/pull/281) [`94f8af1`](https://github.com/DavideCarvalho/adonis-agora-media/commit/94f8af12bb87bf614a8ff0262958dd6120708851) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Console fixes:
|
|
35
|
+
|
|
36
|
+
- The console now sends shield's CSRF token (`x-xsrf-token`, from the `XSRF-TOKEN` cookie) on every POST, including uploads from the Upload tab, so actions work in apps that use `@adonisjs/shield`. A redirected or non-2xx response now shows as an error instead of a silent success.
|
|
37
|
+
- The Uploads tab shows `upload sessions table missing — run the media migration (node ace migration:run)` (HTTP 503) instead of a 500 when the `lucid` upload-session store's tables do not exist.
|
|
38
|
+
- `FolderBody` is exported from `@adonis-agora/media/dashboard` and `@adonis-agora/media-dashboard`.
|
|
39
|
+
|
|
3
40
|
## 9.0.0
|
|
4
41
|
|
|
5
42
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -10,8 +10,7 @@ is reimplemented; the upload UI reuses [`@adonis-agora/media-react`](../react).
|
|
|
10
10
|
|
|
11
11
|
## The console ships embedded in `@adonis-agora/media` — install that instead
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
SPA, and all of its server-side auth/service logic) is bundled straight into
|
|
13
|
+
The console (this React SPA, and all of its server-side auth/service logic) is bundled into
|
|
15
14
|
[`@adonis-agora/media`](../adonis) at build time; `node ace configure @adonis-agora/media` registers
|
|
16
15
|
its `dashboard_provider` for you, with no separate package to add:
|
|
17
16
|
|
|
@@ -34,29 +33,12 @@ import { defineConfig } from '@adonis-agora/media/dashboard'
|
|
|
34
33
|
```
|
|
35
34
|
|
|
36
35
|
See [`@adonis-agora/media`'s Dashboard section](../adonis#dashboard) for the full config reference —
|
|
37
|
-
`defineConfig`, `DashboardService`, the
|
|
36
|
+
`defineConfig`, `DashboardService`, the `authorize` contract and `ObjectInsightProvider` all live under
|
|
38
37
|
`@adonis-agora/media/dashboard` now.
|
|
39
38
|
|
|
40
|
-
##
|
|
39
|
+
## Configuration
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
works, for hosts that already register it directly, or that prefer keeping the dashboard as an
|
|
44
|
-
explicit, separately-versioned install. Its provider is a thin delegate to the embedded one above (no
|
|
45
|
-
logic of its own), so both entry points stay identical in behavior. **Register only one of the two.**
|
|
46
|
-
|
|
47
|
-
```sh
|
|
48
|
-
pnpm add @adonis-agora/media-dashboard
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
providers: [
|
|
53
|
-
() => import('@adonis-agora/media/media_provider'),
|
|
54
|
-
() => import('@adonis-agora/media-dashboard/media_dashboard_provider'),
|
|
55
|
-
]
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`config/media_dashboard.ts` is read from the SAME config key (`media_dashboard`) regardless of which
|
|
59
|
-
provider you register, authored against `@adonis-agora/media/dashboard`'s `defineConfig` either way:
|
|
41
|
+
`config/media_dashboard.ts`, authored against `@adonis-agora/media/dashboard`'s `defineConfig`:
|
|
60
42
|
|
|
61
43
|
```ts
|
|
62
44
|
import { defineConfig } from '@adonis-agora/media/dashboard'
|
|
@@ -66,16 +48,18 @@ export default defineConfig({
|
|
|
66
48
|
basePath: '/media/dashboard', // where the SPA mounts (default)
|
|
67
49
|
actions: true, // enable copy/move/delete (default: false, read-only)
|
|
68
50
|
disks: ['s3', 'backups'], // browsable disks (default: derived from media config)
|
|
69
|
-
|
|
51
|
+
authorize: (ctx) => ctx.auth.user?.isAdmin === true, // who may open it — SPA + API
|
|
52
|
+
middleware: middleware.auth(), // runs after authorize
|
|
70
53
|
})
|
|
71
54
|
```
|
|
72
55
|
|
|
73
56
|
Mount the SPA under any path without rebuilding — the provider rewrites Vite's asset base and injects
|
|
74
|
-
the runtime
|
|
57
|
+
the runtime config into `index.html` at serve time, as a JSON data block
|
|
58
|
+
(`<script type="application/json" id="media-dashboard-config">`) that a strict CSP does not block.
|
|
75
59
|
|
|
76
60
|
## Routes
|
|
77
61
|
|
|
78
|
-
Registered under `apiBasePath` (default `<basePath>/api`), behind your `middleware`:
|
|
62
|
+
Registered under `apiBasePath` (default `<basePath>/api`), behind `authorize` and your `middleware`:
|
|
79
63
|
|
|
80
64
|
| Method | Path | Backed by |
|
|
81
65
|
| --- | --- | --- |
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@adonis-agora/media-dashboard`'s public surface
|
|
3
|
-
* `DashboardService
|
|
4
|
-
*
|
|
5
|
-
* package's provider (still exported below) is a thin delegate to it. Author `config/media_dashboard.ts`
|
|
6
|
-
* against `@adonis-agora/media/dashboard`'s `defineConfig` regardless of which provider you register;
|
|
7
|
-
* both read the SAME `media_dashboard` config key.
|
|
8
|
-
*
|
|
9
|
-
* What's left here: the standalone provider entry point, and the wire-format API types (kept as this
|
|
10
|
-
* package's own copy — the SPA needs them and importing `@adonis-agora/media`'s copy would reintroduce
|
|
11
|
-
* the workspace cycle the provider's delegation deliberately avoids; see that file's doc comment).
|
|
2
|
+
* `@adonis-agora/media-dashboard`'s public surface: the console's wire-format API types. The console
|
|
3
|
+
* itself (provider, `defineConfig`, `DashboardService`, `authorize`) ships in `@adonis-agora/media`
|
|
4
|
+
* under `./dashboard_provider` and `./dashboard`; this package is the SPA's build-time source.
|
|
12
5
|
*/
|
|
13
|
-
export {
|
|
14
|
-
export type { CollectionFilter, CollectionListResponse, CollectionSummary, CollectionsSummaryResponse, ConsoleSessionUserInfo, CopyMoveBody, CursorPage, CursorPageInfo, CursorParams, DeleteBody, DiskCapabilities, DiskInfo, DiskListResponse, LoginBody, MediaDetailResponse, MediaEntry, MediaVariant, MeResponse, ObjectDetailResponse, ObjectEntry, ObjectFolder, ObjectInsight, ObjectInsightFact, ObjectInsightLink, ObjectInsightsResponse, ObjectListResponse, Topology, UploadDetailResponse, UploadInfo, UploadListResponse, UploadPart, } from './types.js';
|
|
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';
|
|
15
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
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* `@adonis-agora/media-dashboard`'s public surface, shrunk as of `7.0.0`: `defineConfig`,
|
|
3
|
-
* `DashboardService`/`DashboardError`, the session-auth helpers and `ObjectInsightProvider` all moved
|
|
4
|
-
* to `@adonis-agora/media`'s own `./dashboard` subpath — the console is now embedded there, and this
|
|
5
|
-
* package's provider (still exported below) is a thin delegate to it. Author `config/media_dashboard.ts`
|
|
6
|
-
* against `@adonis-agora/media/dashboard`'s `defineConfig` regardless of which provider you register;
|
|
7
|
-
* both read the SAME `media_dashboard` config key.
|
|
8
|
-
*
|
|
9
|
-
* What's left here: the standalone provider entry point, and the wire-format API types (kept as this
|
|
10
|
-
* package's own copy — the SPA needs them and importing `@adonis-agora/media`'s copy would reintroduce
|
|
11
|
-
* the workspace cycle the provider's delegation deliberately avoids; see that file's doc comment).
|
|
12
|
-
*/
|
|
13
|
-
export { default as MediaDashboardProvider } from './provider/media_dashboard_provider.js';
|
|
1
|
+
export {};
|
|
14
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|