Skip to content

Commit ef10254

Browse files
committed
feat(server): set magnet href2
1 parent a42b883 commit ef10254

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/server/src/query/detail.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ export async function getDmhyResourceDetail(ctx: Context) {
4949
return ctx.json({ message: '404 NOT FOUND' }, 404);
5050
}
5151

52+
// Set magnet href and magnet user
53+
await database
54+
.update(resources)
55+
.set({ magnet2: resp.magnet.href2, magnetUser: resp.magnet.user })
56+
.where(and(eq(resources.provider, 'dmhy'), eq(resources.providerId, resp.providerId)))
57+
.execute()
58+
.catch(() => {});
59+
5260
logger.info(`Set resouce detail ${id} cache`);
5361

5462
// Ignore cache put error

scripts/api.http

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
GET https://garden.breadio.wiki/api/resources
33
Content-Type: application/json
44

5+
### List the first page of resources with its magnet url
6+
GET https://garden.breadio.wiki/api/resources?magnet=true
7+
Content-Type: application/json
8+
59
### Get the resource detail
610
GET https://garden.breadio.wiki/api/resource/638270_Nemuri_THE_iDOLM_STER_CINDERELLA_GIRLS_2012-2023_Discography_Collection_268_CDs_FLAC.html
711
Content-Type: application/json

0 commit comments

Comments
 (0)