@adonis-agora/media 1.0.0-rc.0 → 1.0.0-rc.2
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 +26 -0
- package/README.md +3 -2
- package/dist/assets/spa/assets/index-DOnygWEb.js +12 -0
- package/dist/assets/spa/assets/index-DOnygWEb.js.map +1 -0
- package/dist/assets/spa/assets/index-XkvYeRIj.css +2 -0
- package/dist/assets/spa/index.html +2 -2
- package/dist/providers/dashboard_provider.d.ts.map +1 -1
- package/dist/providers/dashboard_provider.js +97 -230
- package/dist/providers/dashboard_provider.js.map +1 -1
- package/dist/src/dashboard/access_denied_page.d.ts +5 -7
- package/dist/src/dashboard/access_denied_page.d.ts.map +1 -1
- package/dist/src/dashboard/access_denied_page.js +2 -6
- package/dist/src/dashboard/access_denied_page.js.map +1 -1
- package/dist/src/dashboard/console_authorize.d.ts +90 -0
- package/dist/src/dashboard/console_authorize.d.ts.map +1 -0
- package/dist/src/dashboard/console_authorize.js +136 -0
- package/dist/src/dashboard/console_authorize.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +19 -51
- package/dist/src/dashboard/define_config.d.ts.map +1 -1
- package/dist/src/dashboard/define_config.js.map +1 -1
- package/dist/src/dashboard/dev_tools.d.ts +95 -0
- package/dist/src/dashboard/dev_tools.d.ts.map +1 -0
- package/dist/src/dashboard/dev_tools.js +288 -0
- package/dist/src/dashboard/dev_tools.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +6 -4
- package/dist/src/dashboard/index.d.ts.map +1 -1
- package/dist/src/dashboard/index.js +3 -2
- package/dist/src/dashboard/index.js.map +1 -1
- package/dist/src/dashboard/service.d.ts +5 -1
- package/dist/src/dashboard/service.d.ts.map +1 -1
- package/dist/src/dashboard/service.js +13 -2
- package/dist/src/dashboard/service.js.map +1 -1
- package/dist/src/dashboard/types.d.ts +0 -17
- package/dist/src/dashboard/types.d.ts.map +1 -1
- package/dist/stubs/config/media_dashboard.stub +8 -20
- package/package.json +3 -3
- package/dist/assets/spa/assets/index-C-7cKQuV.js +0 -12
- package/dist/assets/spa/assets/index-C-7cKQuV.js.map +0 -1
- package/dist/assets/spa/assets/index-Db6cSeO5.css +0 -2
- package/dist/src/dashboard/auth.d.ts +0 -76
- package/dist/src/dashboard/auth.d.ts.map +0 -1
- package/dist/src/dashboard/auth.js +0 -134
- package/dist/src/dashboard/auth.js.map +0 -1
- package/dist/src/dashboard/cookie.d.ts +0 -20
- package/dist/src/dashboard/cookie.d.ts.map +0 -1
- package/dist/src/dashboard/cookie.js +0 -44
- package/dist/src/dashboard/cookie.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @adonis-agora/media
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#286](https://github.com/DavideCarvalho/adonis-agora-media/pull/286) [`847e057`](https://github.com/DavideCarvalho/adonis-agora-media/commit/847e0578c41b3823526de1c117c50fb32f891850) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - The media console now serves its data to coding agents on the app's dev MCP endpoint (`/mcp/agora`) when the app registers `@adonis-agora/agent/mcp_provider`. Ten `media_*` tools, gated by the console's own `authorize`: reads (`media_list_disks`, `media_list_objects`, `media_get_object`, `media_list_uploads`, `media_get_upload`, `media_list_collections`, `media_get_collections_summary`, `media_get_media`) are listed by default and never return a URL; the actions (`media_abort_upload`, `media_delete_objects`) only when the app opts in on the dev endpoint and the console has `actions: true`. No configuration in this package.
|
|
8
|
+
|
|
9
|
+
New `anyAuthorize(...authorizers)` in `@adonis-agora/media/dashboard`: allows a request when any of the given `authorize` forms does, e.g. a console token for MCP clients or a signed-in admin.
|
|
10
|
+
|
|
11
|
+
## 1.0.0-rc.1
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#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.
|
|
16
|
+
|
|
17
|
+
`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`.
|
|
18
|
+
|
|
19
|
+
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' }`.
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
The `DashboardAuthorize`, `AuthorizeResult` and `AuthorizeDecision` types are replaced by `ConsoleAuthorize`, `ConsoleAuthorizeResult` and `ConsoleAuthorizer`, exported from `@adonis-agora/media/dashboard` together with `resolveConsoleAuthorize` and `authorizeByToken`.
|
|
24
|
+
|
|
25
|
+
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`).
|
|
26
|
+
|
|
27
|
+
`@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.
|
|
28
|
+
|
|
3
29
|
## 1.0.0-rc.0
|
|
4
30
|
|
|
5
31
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ The package uses **subpath exports** (the Agora idiom), so heavy backends stay o
|
|
|
31
31
|
| `@adonis-agora/media/services/main` | the app-bound `MediaManager` singleton — `import media from '@adonis-agora/media/services/main'`, importable at any time (it resolves lazily on first use) |
|
|
32
32
|
| `@adonis-agora/media/media_provider` | the service provider (binds `MediaManager`, mounts optional upload/TUS routes) |
|
|
33
33
|
| `@adonis-agora/media/dashboard_provider` | the embedded management-console provider (React SPA + JSON API) |
|
|
34
|
-
| `@adonis-agora/media/dashboard` | `defineConfig` + types for `config/media_dashboard.ts`, `DashboardService`, the
|
|
34
|
+
| `@adonis-agora/media/dashboard` | `defineConfig` + types for `config/media_dashboard.ts`, `DashboardService`, the `authorize` contract (`authorizeByToken`), `ObjectInsightProvider` |
|
|
35
35
|
| `@adonis-agora/media/configure` | `node ace configure` hook |
|
|
36
36
|
| `@adonis-agora/media/single-file` | `storeSingleFile` / `removeSingleFile` / `storeSingleFileWith` / `removeSingleFileWith` / `isSingleFileStoreAvailable` — lets other packages delegate single-file uploads (e.g. avatars) to media without a hard dependency |
|
|
37
37
|
| `@adonis-agora/media/stores/lucid` | the Lucid `MediaStore` (`@adonisjs/lucid` peer) |
|
|
@@ -319,7 +319,8 @@ export default defineConfig({
|
|
|
319
319
|
basePath: '/media/dashboard', // where the SPA mounts (default)
|
|
320
320
|
actions: true, // enable copy/move/delete (default: false — read-only)
|
|
321
321
|
disks: ['s3', 'backups'], // browsable disks (default: derived from media config)
|
|
322
|
-
|
|
322
|
+
authorize: (ctx) => ctx.auth.user?.isAdmin === true, // who may open it — SPA + API
|
|
323
|
+
middleware: middleware.auth(), // runs after authorize
|
|
323
324
|
})
|
|
324
325
|
```
|
|
325
326
|
|