feat(plugin): admin-configurable marketplace URL as the install default
The Settings install command had a <your-scribe-repo> placeholder — not copyable. Add an instance-global 'plugin_marketplace_url' setting (admin sets it to the app's own repo) that every user's MCP Access reads, so the /plugin marketplace add command is copyable out of the box. Keeps it universal (each deployment configures its own repo) rather than hardcoding one. - services/settings.get_admin_setting(key): admin-scoped global read. - routes/plugin: GET /api/plugin/marketplace-url (any user) + PUT (admin). - SettingsView: Admin → 'Plugin marketplace' field to set it; MCP Access marketplace field falls back to the configured value. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,28 @@ from sqlalchemy import delete as sa_delete, select
|
||||
|
||||
from scribe.models import async_session
|
||||
from scribe.models.setting import Setting
|
||||
from scribe.models.user import User
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def get_admin_setting(key: str, default: str = "") -> str:
|
||||
"""Read an instance-global setting (one stored on an admin account).
|
||||
|
||||
Used for settings that aren't per-user — e.g. the plugin marketplace URL
|
||||
shown to everyone in Settings. Mirrors the admin-scoped lookup used for
|
||||
the application base URL.
|
||||
"""
|
||||
async with async_session() as session:
|
||||
result = await session.execute(
|
||||
select(Setting)
|
||||
.join(User, Setting.user_id == User.id)
|
||||
.where(User.role == "admin", Setting.key == key)
|
||||
)
|
||||
setting = result.scalars().first()
|
||||
return setting.value if setting and setting.value else default
|
||||
|
||||
|
||||
async def get_setting(user_id: int, key: str, default: str = "") -> str:
|
||||
async with async_session() as session:
|
||||
result = await session.execute(
|
||||
|
||||
Reference in New Issue
Block a user