[PR #37] [MERGED] Feature/js extensions #4406

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

📋 Pull Request Information

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

Base: main ← Head: feature/js-extensions


📝 Commits (2)

  • e0a5ad7 feat: add JavaScript support to extension system
  • 97d423a feat: add JavaScript support to extension system

📊 Changes

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

View changed files

📝 packages/client/src/components/layout/CustomThemeInjector.tsx (+128 -1)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+16 -3)
📝 packages/client/src/stores/ui.store.ts (+2 -0)

📄 Description

Add JavaScript support to extension system" --body "## Summary
Adds JavaScript execution support to the existing extension system, alongside the current CSS injection.

Changes

  • ui.store.ts — Added optional js field to InstalledExtension interface
  • SettingsPanel.tsx — Extension importer now accepts .js files and reads the js field from JSON extensions
  • CustomThemeInjector.tsx — Added a new useEffect that executes JS from enabled extensions with a sandboxed marinara API object

Extension API

JS extensions receive a marinara object with:

  • apiFetch(path, options) — fetch from /api/*
  • addStyle(css) — inject CSS with auto-cleanup
  • addElement(parent, tag, attrs) — create DOM elements with auto-cleanup
  • on(target, event, handler) — addEventListener with auto-cleanup
  • setInterval(fn, ms) / setTimeout(fn, ms) — timers with auto-cleanup
  • observe(target, callback, options) — MutationObserver with auto-cleanup
  • onCleanup(fn) — register custom cleanup

All resources are automatically cleaned up when an extension is disabled or removed.

Backwards Compatible

Existing CSS-only extensions continue to work with zero changes."


🔄 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/37 **Author:** [@LukaTheHero](https://github.com/LukaTheHero) **Created:** 4/1/2026 **Status:** ✅ Merged **Merged:** 4/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `main` ← **Head:** `feature/js-extensions` --- ### 📝 Commits (2) - [`e0a5ad7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e0a5ad7eddc59896ff5fc1863320eb0665f26bfc) feat: add JavaScript support to extension system - [`97d423a`](https://github.com/Pasta-Devs/Marinara-Engine/commit/97d423a3abef209681bed7fa890a288081720259) feat: add JavaScript support to extension system ### 📊 Changes **3 files changed** (+146 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/layout/CustomThemeInjector.tsx` (+128 -1) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+16 -3) 📝 `packages/client/src/stores/ui.store.ts` (+2 -0) </details> ### 📄 Description Add JavaScript support to extension system" --body "## Summary Adds JavaScript execution support to the existing extension system, alongside the current CSS injection. ## Changes - **ui.store.ts** — Added optional js field to InstalledExtension interface - **SettingsPanel.tsx** — Extension importer now accepts .js files and reads the js field from JSON extensions - **CustomThemeInjector.tsx** — Added a new useEffect that executes JS from enabled extensions with a sandboxed marinara API object ## Extension API JS extensions receive a marinara object with: - apiFetch(path, options) — fetch from /api/* - addStyle(css) — inject CSS with auto-cleanup - addElement(parent, tag, attrs) — create DOM elements with auto-cleanup - on(target, event, handler) — addEventListener with auto-cleanup - setInterval(fn, ms) / setTimeout(fn, ms) — timers with auto-cleanup - observe(target, callback, options) — MutationObserver with auto-cleanup - onCleanup(fn) — register custom cleanup All resources are automatically cleaned up when an extension is disabled or removed. ## Backwards Compatible Existing CSS-only extensions continue to work with zero changes." --- <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:20 +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#4406
No description provided.