-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(route): add 机核网文章 * fix: missing reference * fix typo
- Loading branch information
Showing
5 changed files
with
462 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { type Data, type Route, ViewType } from '@/types'; | ||
|
||
import { getCurrentPath } from '@/utils/helpers'; | ||
import { type Context } from 'hono'; | ||
|
||
import { baseUrl, processItems } from './util'; | ||
|
||
export const __dirname = getCurrentPath(import.meta.url); | ||
|
||
export const handler = async (ctx: Context): Promise<Data> => { | ||
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '30', 10); | ||
|
||
const targetUrl: string = new URL('articles', baseUrl).href; | ||
const apiUrl: string = new URL(`gapi/v1/articles`, baseUrl).href; | ||
|
||
const query = { | ||
'filter[is-news]': 0, | ||
}; | ||
|
||
return await processItems(limit, query, apiUrl, targetUrl); | ||
}; | ||
|
||
export const route: Route = { | ||
path: '/articles', | ||
name: '文章', | ||
url: 'www.gcores.com', | ||
maintainers: ['nczitzk'], | ||
handler, | ||
example: '/gcores/articles', | ||
parameters: undefined, | ||
description: undefined, | ||
categories: ['game'], | ||
features: { | ||
requireConfig: false, | ||
requirePuppeteer: false, | ||
antiCrawler: false, | ||
supportRadar: true, | ||
supportBT: false, | ||
supportPodcast: false, | ||
supportScihub: false, | ||
}, | ||
radar: [ | ||
{ | ||
source: ['www.gcores.com/articles'], | ||
target: '/gcores/articles', | ||
}, | ||
], | ||
view: ViewType.Articles, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.