[PR #66] [MERGED] feat: extension hooks for bot browser providers and generic proxy route #4435

Closed
opened 2026-10-22 04:07:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/66
Author: @LukaTheHero
Created: 4/5/2026
Status: ✅ Merged
Merged: 4/5/2026
Merged by: @LukaTheHero

Base: main ← Head: feature/extension-bot-browser-hooks


📝 Commits (1)

  • 459210a feat: extension hooks for bot browser providers and generic proxy route

📊 Changes

4 files changed (+244 additions, -3 deletions)

View changed files

📝 packages/client/src/components/bot-browser/BotBrowserView.tsx (+39 -3)
📝 packages/client/src/components/layout/CustomThemeInjector.tsx (+13 -0)
➕ packages/server/src/routes/ext-proxy.routes.ts (+188 -0)
📝 packages/server/src/routes/index.ts (+4 -0)

📄 Description

What's new

1. Generic Extension Proxy Route (POST /api/ext/proxy)

  • Allows client-side extensions to make server-side HTTP requests
  • Accepts { url, method, headers, body, timeout, responseType }
  • Supports JSON, text, and binary response types
  • Also includes POST /api/ext/proxy/binary for image/avatar proxying
  • Security: blocks requests to localhost/private IP ranges

2. Bot Browser Provider Registry

  • Extensions can now register custom bot browser providers via marinara.registerBotBrowserProvider(config)
  • The bot browser dynamically reads from both built-in and extension-registered providers
  • Providers registered by extensions appear in the source dropdown alongside built-in ones
  • When an extension is disabled/removed, its provider is automatically unregistered (cleanup)

3. Extension API Addition

  • Added registerBotBrowserProvider(config) to the marinara API object passed to JS extensions
  • Returns an unregister function; cleanup is automatic when the extension is toggled off

Use case

Third-party extensions can now add new character sources to the bot browser (e.g. additional websites) without modifying Marinara Engine's core code. The proxy route handles CORS, and the provider registry handles UI integration.

Files changed

  • packages/server/src/routes/ext-proxy.routes.ts — NEW: generic proxy route
  • packages/server/src/routes/index.ts — registered proxy route
  • packages/client/src/components/bot-browser/BotBrowserView.tsx — dynamic provider registry
  • packages/client/src/components/layout/CustomThemeInjector.tsx — new extension API method

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/66 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/5/2026 **Status:** ✅ Merged **Merged:** 4/5/2026 **Merged by:** [@LukaTheHero](https://github.com/LukaTheHero) **Base:** `main` ← **Head:** `feature/extension-bot-browser-hooks` --- ### 📝 Commits (1) - [`459210a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/459210a998b5fa14f710a902c2558268cba3d828) feat: extension hooks for bot browser providers and generic proxy route ### 📊 Changes **4 files changed** (+244 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/bot-browser/BotBrowserView.tsx` (+39 -3) 📝 `packages/client/src/components/layout/CustomThemeInjector.tsx` (+13 -0) ➕ `packages/server/src/routes/ext-proxy.routes.ts` (+188 -0) 📝 `packages/server/src/routes/index.ts` (+4 -0) </details> ### 📄 Description ## What's new ### 1. Generic Extension Proxy Route (`POST /api/ext/proxy`) - Allows client-side extensions to make server-side HTTP requests - Accepts `{ url, method, headers, body, timeout, responseType }` - Supports JSON, text, and binary response types - Also includes `POST /api/ext/proxy/binary` for image/avatar proxying - Security: blocks requests to localhost/private IP ranges ### 2. Bot Browser Provider Registry - Extensions can now register custom bot browser providers via `marinara.registerBotBrowserProvider(config)` - The bot browser dynamically reads from both built-in and extension-registered providers - Providers registered by extensions appear in the source dropdown alongside built-in ones - When an extension is disabled/removed, its provider is automatically unregistered (cleanup) ### 3. Extension API Addition - Added `registerBotBrowserProvider(config)` to the `marinara` API object passed to JS extensions - Returns an unregister function; cleanup is automatic when the extension is toggled off ## Use case Third-party extensions can now add new character sources to the bot browser (e.g. additional websites) without modifying Marinara Engine's core code. The proxy route handles CORS, and the provider registry handles UI integration. ## Files changed - `packages/server/src/routes/ext-proxy.routes.ts` — NEW: generic proxy route - `packages/server/src/routes/index.ts` — registered proxy route - `packages/client/src/components/bot-browser/BotBrowserView.tsx` — dynamic provider registry - `packages/client/src/components/layout/CustomThemeInjector.tsx` — new extension API method --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:07:34 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4435
No description provided.