feat(web): surface discover.listenBrainzUrl; swap maxSeeds->chunkSize in Discovery tab
This commit is contained in:
@@ -13,17 +13,17 @@ describe("discover config API", () => {
|
||||
const body = await (await GET()).json();
|
||||
expect(body).toMatchObject({
|
||||
"discover.enabled": "false", "discover.intervalHours": "168",
|
||||
"discover.maxSeeds": "50", "discover.similarPerSeed": "20",
|
||||
"discover.albumsPerArtist": "1", "discover.minScore": "0",
|
||||
"discover.similarPerSeed": "20", "discover.albumsPerArtist": "1",
|
||||
"discover.minScore": "0", "discover.chunkSize": "5", "discover.listenBrainzUrl": "",
|
||||
});
|
||||
});
|
||||
|
||||
it("PATCH upserts known keys and ignores unknown ones", async () => {
|
||||
const res = await patch({ "discover.enabled": "true", "discover.maxSeeds": 25, "nope": "x" });
|
||||
const res = await patch({ "discover.enabled": "true", "discover.chunkSize": 25, "nope": "x" });
|
||||
expect((await res.json()).updated).toBe(2);
|
||||
const body = await (await GET()).json();
|
||||
expect(body["discover.enabled"]).toBe("true");
|
||||
expect(body["discover.maxSeeds"]).toBe("25");
|
||||
expect(body["discover.chunkSize"]).toBe("25");
|
||||
expect(await prisma.config.findUnique({ where: { key: "nope" } })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,10 +3,11 @@ import { prisma } from "@/lib/db";
|
||||
const DEFAULTS: Record<string, string> = {
|
||||
"discover.enabled": "false",
|
||||
"discover.intervalHours": "168",
|
||||
"discover.maxSeeds": "50",
|
||||
"discover.similarPerSeed": "20",
|
||||
"discover.albumsPerArtist": "1",
|
||||
"discover.minScore": "0",
|
||||
"discover.chunkSize": "5",
|
||||
"discover.listenBrainzUrl": "",
|
||||
};
|
||||
|
||||
export async function GET() {
|
||||
|
||||
@@ -17,7 +17,7 @@ const TABS: Tab[] = ["Qobuz", "Soulseek", "Library", "Monitor", "Discovery"];
|
||||
|
||||
const DISCOVERY_FIELDS: [string, string][] = [
|
||||
["discover.intervalHours", "Interval (hours)"],
|
||||
["discover.maxSeeds", "Max seeds per sweep"],
|
||||
["discover.chunkSize", "Seeds per chunk"],
|
||||
["discover.similarPerSeed", "Similar per seed"],
|
||||
["discover.albumsPerArtist", "Albums per artist"],
|
||||
["discover.minScore", "Min score"],
|
||||
@@ -323,6 +323,11 @@ export function SettingsForm() {
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<label className="field">
|
||||
<span>ListenBrainz base URL (blank = default)</span>
|
||||
<input value={discoverCfg["discover.listenBrainzUrl"] ?? ""}
|
||||
onChange={(e) => setCfg("discover.listenBrainzUrl", e.target.value)} />
|
||||
</label>
|
||||
<div className="save-row">
|
||||
<button type="submit" className="btn">Save discovery settings</button>
|
||||
{discoverSaved ? <span className="saved-note">Saved</span> : null}
|
||||
|
||||
Reference in New Issue
Block a user