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:
@@ -144,8 +144,16 @@ const claudeCodeCommand = computed(() => {
|
||||
const _MKT_KEY = 'plugin_marketplace_url';
|
||||
const pluginMarketplaceUrl = ref<string>(localStorage.getItem(_MKT_KEY) || '');
|
||||
watch(pluginMarketplaceUrl, (v) => localStorage.setItem(_MKT_KEY, (v || '').trim()));
|
||||
// Instance default, set by an admin (Admin tab) and loaded on mount. Used when
|
||||
// the per-browser field is blank so the install command is copyable out of the box.
|
||||
const serverMarketplaceUrl = ref('');
|
||||
const adminMarketplaceUrl = ref('');
|
||||
const savingMarketplaceUrl = ref(false);
|
||||
const marketplaceUrlSaved = ref(false);
|
||||
const pluginInstallCommands = computed(() => {
|
||||
const mkt = (pluginMarketplaceUrl.value || '').trim() || '<your-scribe-repo>.git';
|
||||
const mkt = (pluginMarketplaceUrl.value || '').trim()
|
||||
|| serverMarketplaceUrl.value
|
||||
|| '<your-scribe-repo>.git';
|
||||
return `/plugin marketplace add ${mkt}\n/plugin install scribe@scribe-plugin`;
|
||||
});
|
||||
|
||||
@@ -429,6 +437,17 @@ onMounted(async () => {
|
||||
searxngConfigured.value = false;
|
||||
}
|
||||
|
||||
// Plugin marketplace URL (instance default; readable by all users so the
|
||||
// install command in MCP Access is copyable).
|
||||
try {
|
||||
const mk = await apiGet<{ marketplace_url: string }>("/api/plugin/marketplace-url");
|
||||
serverMarketplaceUrl.value = mk.marketplace_url || "";
|
||||
adminMarketplaceUrl.value = mk.marketplace_url || "";
|
||||
if (!pluginMarketplaceUrl.value) pluginMarketplaceUrl.value = mk.marketplace_url || "";
|
||||
} catch {
|
||||
// not configured yet
|
||||
}
|
||||
|
||||
// Load admin settings
|
||||
if (authStore.isAdmin) {
|
||||
try {
|
||||
@@ -658,6 +677,26 @@ async function saveBaseUrl() {
|
||||
}
|
||||
}
|
||||
|
||||
async function saveMarketplaceUrl() {
|
||||
savingMarketplaceUrl.value = true;
|
||||
marketplaceUrlSaved.value = false;
|
||||
try {
|
||||
const url = adminMarketplaceUrl.value.trim();
|
||||
await apiPut("/api/plugin/marketplace-url", { marketplace_url: url });
|
||||
serverMarketplaceUrl.value = url;
|
||||
// Reflect the new instance default in the copyable field unless the user
|
||||
// set their own per-browser override.
|
||||
if (!localStorage.getItem(_MKT_KEY)) pluginMarketplaceUrl.value = url;
|
||||
marketplaceUrlSaved.value = true;
|
||||
setTimeout(() => (marketplaceUrlSaved.value = false), 2000);
|
||||
} catch (e) {
|
||||
const body = (e as { body?: { error?: string } }).body;
|
||||
toastStore.show(body?.error || "Failed to save marketplace URL", "error");
|
||||
} finally {
|
||||
savingMarketplaceUrl.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRestoreFile(event: Event) {
|
||||
const file = (event.target as HTMLInputElement).files?.[0];
|
||||
if (!file) return;
|
||||
@@ -1663,6 +1702,31 @@ function formatUserDate(iso: string): string {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>Plugin marketplace</h2>
|
||||
<p class="section-desc">
|
||||
Git URL of the repo that ships this Scribe plugin (usually this app's own repo).
|
||||
Shown to every user in <strong>MCP Access</strong> so the install command is
|
||||
copyable. Example: https://git.example.com/you/Scribe.git
|
||||
</p>
|
||||
<div class="field url-field">
|
||||
<label for="marketplace-url">Marketplace git URL</label>
|
||||
<input
|
||||
id="marketplace-url"
|
||||
v-model="adminMarketplaceUrl"
|
||||
type="url"
|
||||
placeholder="https://git.example.com/you/Scribe.git"
|
||||
class="input"
|
||||
/>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button class="btn-save" @click="saveMarketplaceUrl" :disabled="savingMarketplaceUrl">
|
||||
{{ savingMarketplaceUrl ? "Saving..." : "Save" }}
|
||||
</button>
|
||||
<span v-if="marketplaceUrlSaved" class="saved-msg">Saved!</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="settings-section full-width">
|
||||
<h2>Email / SMTP</h2>
|
||||
<p class="section-desc">Configure SMTP to enable email notifications for all users.</p>
|
||||
|
||||
Reference in New Issue
Block a user