Add publisher release versions to plugins

This commit is contained in:
2026-09-18 01:16:45 -04:00
parent 166f039ae6
commit a718efc9e7
15 changed files with 167 additions and 29 deletions
+13 -5
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from 'svelte';
import { artifactVersionLabel } from '$lib/artifact-version.js';
import Card from '$ui/components/primitives/Card.svelte';
import Badge from '$ui/components/primitives/Badge.svelte';
import Button from '$ui/components/primitives/Button.svelte';
@@ -20,6 +21,7 @@
kind: ArtifactKind;
latestVersion: {
id: number; version: number; sha256: string; size: number;
release_version: string | null;
state: 'untested' | 'tested' | 'test-failed'; uploaded_at: string;
} | null;
versionCount: number;
@@ -33,9 +35,10 @@
let flash = $state<string | null>(null);
let uploading = $state(false);
let scopeOptions = $state<ScopeOptions>({ games: [], mapsByGame: {} });
let successBanner = $state<{ name: string; artifactId: number; version: number } | null>(null);
let successBanner = $state<{ name: string; artifactId: number; version: number; release_version: string | null } | null>(null);
let newName = $state('');
let newReleaseVersion = $state('');
let newScopeType = $state<'none' | 'game' | 'map'>('none');
let newScopeGame = $state('');
let newScopeMap = $state('');
@@ -85,6 +88,7 @@
const form = new FormData();
form.append('name', newName.trim());
form.append('kind', 'plugin');
form.append('releaseVersion', newReleaseVersion.trim());
form.append('scopeType', newScopeType);
if (scopeValue) form.append('scopeValue', scopeValue);
if (newNotes.trim()) form.append('notes', newNotes.trim());
@@ -94,9 +98,10 @@
const body = (await res.json()) as { ok: boolean; error?: string; script?: { id: number; name: string } };
if (!res.ok || !body.ok) { flash = body.error ?? `HTTP ${res.status}`; return; }
successBanner = body.script
? { name: body.script.name, artifactId: body.script.id, version: 1 }
? { name: body.script.name, artifactId: body.script.id, version: 1, release_version: newReleaseVersion.trim() || null }
: null;
newName = ''; newScopeType = 'none'; newScopeGame = ''; newScopeMap = ''; newNotes = ''; newFile = null;
newReleaseVersion = '';
await load();
} finally {
uploading = false;
@@ -121,7 +126,7 @@
if (!a.latestVersion) return '';
if (a.current_version_id === null) return 'untested';
if (a.latestVersion.id !== a.current_version_id) {
return `v${a.latestVersion.version} ${a.latestVersion.state.replace('-', ' ')}`;
return `${artifactVersionLabel(a.latestVersion)} ${a.latestVersion.state.replace('-', ' ')}`;
}
return '';
}
@@ -148,7 +153,7 @@
<h2 class="panel-title">Upload a plugin</h2>
{#if successBanner}
<div class="banner">
<strong>v{successBanner.version} of "{successBanner.name}" uploaded — untested.</strong>
<strong>{artifactVersionLabel(successBanner)} of "{successBanner.name}" uploaded — untested.</strong>
<span>Open a beta on <a href="/betas">the betas page</a> to test it before promotion.</span>
</div>
{/if}
@@ -156,6 +161,9 @@
<Field label="Name">
<Input bind:value={newName} placeholder="my plugin" disabled={uploading} />
</Field>
<Field label="Release version" hint="Optional. Use the publisher’s version or release tag, such as v3.1.0.">
<Input bind:value={newReleaseVersion} placeholder="v3.1.0" disabled={uploading} />
</Field>
<Field label="Notes" hint="Optional. What changed in this version.">
<Input bind:value={newNotes} placeholder="what changed" disabled={uploading} />
</Field>
@@ -218,7 +226,7 @@
</div>
<div class="row-meta">
<span class="path">{a.target_rel_path}</span>
<span>v{a.latestVersion?.version ?? '—'} · {a.versionCount} version{a.versionCount === 1 ? '' : 's'}</span>
<span>{artifactVersionLabel(a.latestVersion)} · {a.versionCount} version{a.versionCount === 1 ? '' : 's'}</span>
{#if a.servers.length}
<span>{a.servers.length} matching server{a.servers.length === 1 ? '' : 's'}</span>
{/if}