Skip to content

Commit

Permalink
feat(server): set magnet href2
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jul 24, 2024
1 parent a42b883 commit ef10254
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/server/src/query/detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ export async function getDmhyResourceDetail(ctx: Context) {
return ctx.json({ message: '404 NOT FOUND' }, 404);
}

// Set magnet href and magnet user
await database
.update(resources)
.set({ magnet2: resp.magnet.href2, magnetUser: resp.magnet.user })
.where(and(eq(resources.provider, 'dmhy'), eq(resources.providerId, resp.providerId)))
.execute()
.catch(() => {});

logger.info(`Set resouce detail ${id} cache`);

// Ignore cache put error
Expand Down
4 changes: 4 additions & 0 deletions scripts/api.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
GET https://garden.breadio.wiki/api/resources
Content-Type: application/json

### List the first page of resources with its magnet url
GET https://garden.breadio.wiki/api/resources?magnet=true
Content-Type: application/json

### Get the resource detail
GET https://garden.breadio.wiki/api/resource/638270_Nemuri_THE_iDOLM_STER_CINDERELLA_GIRLS_2012-2023_Discography_Collection_268_CDs_FLAC.html
Content-Type: application/json
Expand Down

0 comments on commit ef10254

Please sign in to comment.