Skip to content

Commit

Permalink
fix(route/caixin): filter out articles that does not have ID (DIYgod#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dzx-dzx authored Nov 7, 2024
1 parent 8ea3ee3 commit c8f182d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/routes/caixin/utils-fulltext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export async function getFulltext(url: string) {
if (!config.caixin.cookie) {
return;
}
if (!/(\d+)\.html/.test(url)) {
return;
}
const articleID = url.match(/(\d+)\.html/)[1];

const nonce = crypto.randomUUID().replaceAll('-', '').toUpperCase();

Expand All @@ -20,7 +24,6 @@ export async function getFulltext(url: string) {
.find((e) => e.includes('SA_USER_UID'))
?.split('=')[1]; //

const articleID = url.match(/(\d+)\.html/)[1];
const rawString = `id=${articleID}&uid=${userID}&${nonce}=nonce`;

const sig = new KJUR.crypto.Signature({ alg: 'SHA256withRSA' });
Expand Down

0 comments on commit c8f182d

Please sign in to comment.