Skip to content

Commit

Permalink
fix(route/rss3): add url validate
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Oct 24, 2024
1 parent 8aeb577 commit 74f8320
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/routes/rss3/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const route: Route = {
categories: ['social-media'],
example: '/rss3/vitalik.eth',
name: 'Account Activities',
maintainers: ['DIYgod'],
maintainers: ['DIYgod', 'pseudoyu'],
url: 'docs.rss3.io/api-reference#tag/decentralized/GET/decentralized/%7Baccount%7D',
handler,
description: 'Retrieve the activities associated with a specified account in the decentralized system.',
Expand Down Expand Up @@ -123,6 +123,11 @@ export const route: Route = {
async function handler(ctx) {
const { account, network, tag } = ctx.req.param();

// Check if account contains "://"
if (account.includes('://')) {
throw new Error('Account should not contain "://"');
}

const { data } = await ofetch(
`https://gi.rss3.io/decentralized/${account}?${new URLSearchParams({
limit: '20',
Expand Down

0 comments on commit 74f8320

Please sign in to comment.