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