feat: esm standard for routes

This commit is contained in:
DIYgod 2024-03-02 03:25:26 +08:00
parent f0e09ee9e0
commit df57bb5d50
No known key found for this signature in database
3035 changed files with 3040 additions and 3038 deletions

View File

@ -20,7 +20,11 @@ const routes: Record<string, (root: Root) => void> = {};
for (const path in imports) {
const name = path.split('/').find(Boolean);
if (name) {
routes[name] = imports[path] as (root: Root) => void;
routes[name] = (
imports[path] as {
default: (root: Root) => void;
}
).default;
}
}
@ -31,7 +35,7 @@ export default function (app: Hono) {
get: (routePath, filePath) => {
const wrapedHandler: Handler = async (ctx, ...args) => {
if (!ctx.get('data')) {
const handler = require(path.join(__dirname, 'routes', name, filePath));
const { default: handler } = await import(path.join(__dirname, 'routes', name, filePath));
await handler(ctx, ...args);
}
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
module.exports = async (ctx) => {
export default async (ctx) => {
const baseUrl = 'http://www.0818tuan.com';
const listId = ctx.req.param('listId') || '1';
const url = `${baseUrl}/list-${listId}-0.html`;

View File

@ -1,3 +1,3 @@
module.exports = (router) => {
export default (router) => {
router.get('/:listId?', './index');
};

View File

@ -46,7 +46,7 @@ function getStationInfo(stationName) {
});
}
module.exports = async (ctx) => {
export default async (ctx) => {
const date = ctx.req.param('date');
const fromStationInfo = await getStationInfo(ctx.req.param('from'));
const toStationInfo = await getStationInfo(ctx.req.param('to'));

View File

@ -1,4 +1,4 @@
module.exports = function (router) {
export default (router) => {
router.get('/:date/:from/:to/:type?', './index');
router.get('/zxdt/:id?', './zxdt');
};

View File

@ -3,7 +3,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
const url = require('url');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') || -1;
const link = id === -1 ? 'https://www.12306.cn/mormhweb/zxdt/index_zxdt.html' : `https://www.12306.cn/mormhweb/1/${id}/index_fl.html`;

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const rootUrl = 'https://www.141jav.com';
const currentUrl = `${rootUrl}${getSubPath(ctx)}`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('*', './index');
};

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const rootUrl = 'https://www.141ppv.com';
const currentUrl = `${rootUrl}${getSubPath(ctx)}`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('*', './index');
};

View File

@ -5,7 +5,7 @@ import * as path from 'node:path';
const root_url = 'https://inf.ds.163.com';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const current_url = `${root_url}/v1/web/feed/basic/getSomeOneFeeds?feedTypes=1,2,3,4,6,7,10,11&someOneUid=${id}`;

View File

@ -4,7 +4,7 @@ import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const { parseDyArticle } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const response = await got(`https://dy.163.com/v2/article/list.do?pageNo=1&wemediaId=${id}&size=10`);

View File

@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const { parseDyArticle } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const limit = ctx.req.query('limit') ?? 30;
const url = `https://www.163.com/dy/media/${id}.html`;

View File

@ -73,7 +73,7 @@ const ids = {
},
};
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '';
const rootUrl = 'https://3g.163.com';

View File

@ -2,7 +2,7 @@ import got from '@/utils/got';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const { data } = await got(`https://music.163.com/api/v1/artist/songs`, {

View File

@ -2,7 +2,7 @@ import got from '@/utils/got';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const response = await got(`https://music.163.com/api/artist/albums/${id}`, {

View File

@ -3,7 +3,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const ProcessFeed = (limit, offset) =>

View File

@ -3,7 +3,7 @@ import { config } from '@/config';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
if (!config.ncm || !config.ncm.cookies) {
throw new Error('163 Music RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>');
}

View File

@ -3,7 +3,7 @@ import got from '@/utils/got';
import { art } from '@/utils/render';
const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info);
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const response = await got(`https://music.163.com/api/event/get/${id}`, {

View File

@ -2,7 +2,7 @@ import got from '@/utils/got';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const uid = ctx.req.param('uid');
const response = await got.post('https://music.163.com/api/user/playlist', {

View File

@ -37,7 +37,7 @@ function getItem(records) {
});
}
module.exports = async (ctx) => {
export default async (ctx) => {
const uid = ctx.req.param('uid');
const type = Number.parseInt(ctx.req.param('type')) || 0;

View File

@ -76,7 +76,7 @@ const timeRange = {
},
};
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category') || 'whole';
const type = ctx.req.param('type') || 'click';
const time = ctx.req.param('time') || 'day';

View File

@ -19,7 +19,7 @@ const typeMap = {
14: '浪潮',
15: '沸点',
};
module.exports = async (ctx) => {
export default async (ctx) => {
if (!ctx.req.param('type')) {
throw new Error('Bad parameter. See <a href="https://docs.rsshub.app/routes/game#wang-yi-da-shen">https://docs.rsshub.app/routes/game#wang-yi-da-shen</a>');
}

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const url = 'https://vip.open.163.com';
const list_response = await got(url);

View File

@ -13,7 +13,7 @@ const titles = {
kanke: '看客',
};
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category') ?? 'texie';
const rootUrl = 'https://renjian.163.com';

View File

@ -1,4 +1,4 @@
module.exports = function (router) {
export default (router) => {
router.get('/exclusive/:id?', './exclusive');
router.get('/ds/:id', './ds');
router.get('/dy/:id', './dy');

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const needContent = /t|y/i.test(ctx.req.param('need_content') ?? 'true');
const rootUrl = 'https://gw.m.163.com';

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
const { defaultDomain, getRootUrl } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const { domain = defaultDomain } = ctx.req.query();
const rootUrl = getRootUrl(domain);

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
const { defaultDomain, getRootUrl } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category') ?? '';
const { domain = defaultDomain } = ctx.req.query();
const rootUrl = getRootUrl(domain);

View File

@ -1,6 +1,6 @@
const { defaultDomain, getRootUrl, ProcessItems } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category') ?? 'all';
const keyword = ctx.req.param('keyword') ?? '';
const time = ctx.req.param('time') ?? 'a';

View File

@ -1,4 +1,4 @@
module.exports = function (router) {
export default (router) => {
router.get('/album/:id', './album');
router.get('/blogs/:category?', './blogs');
router.get('/search/:option?/:category?/:keyword?/:time?/:order?', './search');

View File

@ -1,6 +1,6 @@
const { defaultDomain, getRootUrl, ProcessItems } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const option = ctx.req.param('option') ?? 'photos';
const category = ctx.req.param('category') ?? 'all';
const keyword = ctx.req.param('keyword') ?? '';

View File

@ -15,7 +15,7 @@ const setCookie = function (cookieName, cookieValue, seconds, path, domain, secu
return [encodeURI(cookieName), '=', encodeURI(cookieValue), expires ? '; expires=' + expires.toGMTString() : '', path ? '; path=' + path : '/', domain ? '; domain=' + domain : '', secure ? '; secure' : ''].join('');
};
module.exports = async (ctx) => {
export default async (ctx) => {
const city = ctx.req.param('city') ?? 'www';
if (!isValidHost(city)) {
throw new Error('Invalid city');

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:city?', './index');
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const path = ctx.req.param('path') ?? '';
const rootUrl = `https://www.1lou.me`;
const currentUrl = `${rootUrl}/${path}`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:path?', './index');
};

View File

@ -2,7 +2,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const categoryMap = {
studyinusa: {
title: '留学申请',

View File

@ -1,7 +1,7 @@
import cache from '@/utils/cache';
const { rootUrl, apiRootUrl, types, ProcessThreads } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '';
const type = ctx.req.param('type') ?? 'hot';
const order = ctx.req.param('order') ?? '';

View File

@ -3,7 +3,7 @@ import { art } from '@/utils/render';
import { parseDate } from '@/utils/parse-date';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
// year 2017-2022
// 2017:6 2018:11 2019:12 2020:13 2021:14 2022:15
// CS:1 MIS:2

View File

@ -1,4 +1,4 @@
module.exports = function (router) {
export default (router) => {
router.get('/blog/:category?', './blog');
router.get('/category/:id?/:type?/:order?', './category');
router.get('/offer/:year?/:major?/:school?', './offer');

View File

@ -12,7 +12,7 @@ const sections = {
265: '签证移民',
};
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '';
const type = ctx.req.param('type') ?? 'hot';
const order = ctx.req.param('order') ?? '';

View File

@ -1,7 +1,7 @@
import cache from '@/utils/cache';
const { rootUrl, apiRootUrl, types, ProcessThreads } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const type = ctx.req.param('type') ?? 'hot';
const order = ctx.req.param('order') ?? '';
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 10;

View File

@ -1,6 +1,6 @@
import got from '@/utils/got';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const { posts } = (await got.get(`https://instant.1point3acres.com/v2/api/user/post?pg=1&ps=10&user_id=${id}`)).data;

View File

@ -1,6 +1,6 @@
import got from '@/utils/got';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const { threads } = (await got.get(`https://instant.1point3acres.com/v2/api/user/thread?pg=1&ps=10&user_id=${id}`)).data;

View File

@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '2';
const rootUrl = 'https://hjd2048.com';

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:id?', './index');
};

View File

@ -7,7 +7,7 @@ const iconv = require('iconv-lite');
// http://www.2cycd.com/forum.php?mod=forumdisplay&fid=43&orderby=dateline
module.exports = async (ctx) => {
export default async (ctx) => {
const fid = ctx.req.param('fid') ?? '43';
const sort = ctx.req.param('sort') ?? 'dateline';

View File

@ -1,3 +1,3 @@
module.exports = (router) => {
export default (router) => {
router.get('/:fid/:sort?', './index');
};

View File

@ -23,7 +23,7 @@ const categories = {
},
};
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category') ?? '24';
const currentUrl = category === '24' ? rootUrl : `${rootUrl}/hot-list/catalog`;

View File

@ -15,7 +15,7 @@ const shortcuts = {
'/information/workplace': '/information/web_zhichang',
};
module.exports = async (ctx) => {
export default async (ctx) => {
const path = getSubPath(ctx)
.replace(/^\/news(?!flashes)/, '/information')
.replace(/\/search\/article/, '/search/articles');

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/hot-list/:category?', './hot-list');
router.get('*', './index');
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
const { parseArticle } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const { name, type = 'news' } = ctx.req.param();
const url = `https://www.3dmgame.com/games/${name}/${type}/`;

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
const { parseArticle } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const { category = '' } = ctx.req.param();
const isArcPost = category && !isNaN(category); // https://www.3dmgame.com/news/\d+/
const url = `https://www.3dmgame.com/${category && category !== 'news_36_1' ? 'news/' : ''}${category ?? 'news'}/`;

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/news/:category?', './news-center');
router.get('/:name/:type?', './game');
};

View File

@ -65,7 +65,7 @@ const titleMap = {
},
};
module.exports = async (ctx) => {
export default async (ctx) => {
const { category, type } = ctx.req.param();
const url = `${rootUrl}/${categeoryMap[category][type]}`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:category/:type?', './index');
};

View File

@ -2,7 +2,7 @@ import cache from '@/utils/cache';
import got from '@/utils/got';
const { parseList, parseItem, getCategories } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const category = ctx.req.param('category');
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
const isLatest = !category;

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/', './category');
router.get('/category/:category', './category');
router.get('/tag/:tag', './tag');

View File

@ -2,7 +2,7 @@ import cache from '@/utils/cache';
import got from '@/utils/got';
const { parseList, parseItem } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const tag = ctx.req.param('tag');
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;

View File

@ -2,7 +2,7 @@ import cache from '@/utils/cache';
import got from '@/utils/got';
const { parseList, parseItem } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const topic = ctx.req.param('topic');
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;

View File

@ -7,7 +7,7 @@ import { art } from '@/utils/render';
import * as path from 'node:path';
const iconv = require('iconv-lite');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '2-1';
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/forum/:id?', './forum');
};

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/tribe/set/:id', './tribe-set');
router.get('/user/works/:id', './user');
};

View File

@ -5,7 +5,7 @@ import * as path from 'node:path';
const { baseUrl, getTribeDetail, getTribeSets } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id');
const limit = Number.parseInt(ctx.req.query('limit')) || 100;

View File

@ -4,7 +4,7 @@ import { parseDate } from '@/utils/parse-date';
import * as path from 'node:path';
const { baseUrl, getUserInfoFromUsername, getUserInfoFromId, getUserWorks } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
let { id } = ctx.req.param();
const limit = Number.parseInt(ctx.req.query('limit')) || 100;

View File

@ -1,3 +1,3 @@
module.exports = (router) => {
export default (router) => {
router.get('/', './zhuanjia');
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
import timezone from '@/utils/timezone';
module.exports = async (ctx) => {
export default async (ctx) => {
const rootUrl = 'http://www.50forum.org.cn';
const response = await got({
method: 'get',

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const area = ctx.req.param('area') ?? 'global';
const type = ctx.req.param('type') ?? '';

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/symposium/:id?/:classId?', './symposium');
router.get('/:area?/:type?', './');
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? '';
const classId = ctx.req.param('classId') ?? '';

View File

@ -1,7 +1,7 @@
import cache from '@/utils/cache';
const { rootUrl, fetchItems } = require('./util');
module.exports = async (ctx) => {
export default async (ctx) => {
const { category = '1_1' } = ctx.req.param();
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/class/:category?', './class');
router.get('/top/:category?', './top');
};

View File

@ -1,7 +1,7 @@
import cache from '@/utils/cache';
const { rootUrl, fetchItems } = require('./util');
module.exports = async (ctx) => {
export default async (ctx) => {
const { category = 'weekvisit' } = ctx.req.param();
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;

View File

@ -103,7 +103,7 @@ async function getHouseList(houseListURL) {
const renderHouse = (house) => art(path.join(__dirname, 'templates/house.art'), { house });
module.exports = async (ctx) => {
export default async (ctx) => {
const query = ctx.req.param('query') ?? '';
const country = ctx.req.param('country') ?? 'tw';

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:country/rent/:query?', './list');
};

View File

@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date';
import { config } from '@/config';
const { getAcwScV2ByArg1 } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const rootUrl = 'https://csgo.5eplay.com/';
const apiUrl = `${rootUrl}api/article?page=1&type_id=0&time=0&order_by=0`;
const articleUrl = `${rootUrl}article`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/article', '.');
};

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const id = ctx.req.param('id') ?? 'chan1';
const type = ctx.req.param('type') ?? '';
const keyword = ctx.req.param('keyword') ?? '';

View File

@ -4,7 +4,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const site = ctx.req.param('site') ?? 'newspark';
const id = ctx.req.param('id') ?? '';
const keyword = ctx.req.param('keyword') ?? '';

View File

@ -1,4 +1,4 @@
module.exports = function (router) {
export default (router) => {
router.get('/news/:site?/:id?/:keyword?', './news');
router.get('/:id?/:type?/:keyword?', './');
};

View File

@ -2,7 +2,7 @@ const { processItems } = require('./utils');
const baseURL = 'https://www.hao6v.cc/gvod/zx.html';
module.exports = async (ctx) => {
export default async (ctx) => {
const item = await processItems(ctx, baseURL);
ctx.set('data', {

View File

@ -2,7 +2,7 @@ const { processItems } = require('./utils');
const baseURL = 'https://www.hao6v.tv/gvod/dsj.html';
module.exports = async (ctx) => {
export default async (ctx) => {
const item = await processItems(ctx, baseURL);
ctx.set('data', {

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/latestMovies', './latest-movies');
router.get('/latestTVSeries', './latest-tvseries');
};

View File

@ -7,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const rootUrl = 'https://www.78dm.net';
const currentUrl = `${rootUrl}${getSubPath(ctx) === '/' ? '/news' : /\/\d+$/.test(getSubPath(ctx)) ? `${getSubPath(ctx)}.html` : getSubPath(ctx)}`;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('*', './index');
};

View File

@ -5,7 +5,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const language = ctx.req.param('language') ?? 'en';
const category = ctx.req.param('category') ?? 'censored_list';
const type = ctx.req.param('type') ?? 'all';

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/:language?/:category?/:type?', './index');
};

View File

@ -5,7 +5,7 @@ import { load } from 'cheerio';
import timezone from '@/utils/timezone';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const thePath = getSubPath(ctx).replace(/^\/81rc/, '');
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('/81rc/*', './81rc');
};

View File

@ -7,7 +7,7 @@ import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import * as path from 'node:path';
module.exports = async (ctx) => {
export default async (ctx) => {
const { id = '751' } = ctx.req.param();
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;

View File

@ -1,3 +1,3 @@
module.exports = (router) => {
export default (router) => {
router.get('/list/:id?', './list');
};

View File

@ -3,7 +3,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
const loadArticle = require('./article');
module.exports = async (ctx) => {
export default async (ctx) => {
const limit = Number.parseInt(ctx.req.query('limit'));
const { cat = '8kasianidol' } = ctx.req.param();
const url = `${SUB_URL}category/${cat}/`;

View File

@ -5,7 +5,7 @@ const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
const loadArticle = require('./article');
const url = SUB_URL;
module.exports = async (ctx) => {
export default async (ctx) => {
const limit = Number.parseInt(ctx.req.query('limit'));
const response = await got(url);
const itemRaw = load(response.body)('ul.post-loop li.item').toArray();

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/', './latest');
router.get('/cat/:cat*', './cat');
router.get('/tag/:tag', './tag');

View File

@ -3,7 +3,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
const { SUB_NAME_PREFIX, SUB_URL } = require('./const');
const loadArticle = require('./article');
module.exports = async (ctx) => {
export default async (ctx) => {
const limit = Number.parseInt(ctx.req.query('limit'));
const tag = ctx.req.param('tag');
const url = `${SUB_URL}tag/${tag}/`;

View File

@ -4,7 +4,7 @@ import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
module.exports = async (ctx) => {
export default async (ctx) => {
const path = getSubPath(ctx) === '/' ? '/realtime' : getSubPath(ctx);
const rootUrl = 'https://www.8world.com';

View File

@ -1,3 +1,3 @@
module.exports = function (router) {
export default (router) => {
router.get('*', './index');
};

View File

@ -6,7 +6,7 @@ import { art } from '@/utils/render';
import * as path from 'node:path';
const { domainValidation } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const { domain = '91porn.com' } = ctx.req.query();
const { uid, lang = 'en_US' } = ctx.req.param();
const siteUrl = `https://${domain}/uvideos.php?UID=${uid}&type=public`;

View File

@ -6,7 +6,7 @@ import { art } from '@/utils/render';
import * as path from 'node:path';
const { domainValidation } = require('./utils');
module.exports = async (ctx) => {
export default async (ctx) => {
const { domain = '91porn.com' } = ctx.req.query();
const siteUrl = `https://${domain}/index.php`;
const { lang = 'en_US' } = ctx.req.param();

View File

@ -1,4 +1,4 @@
module.exports = (router) => {
export default (router) => {
router.get('/author/:uid/:lang?', './author');
router.get('/:lang?', './index');
};

Some files were not shown because too many files have changed in this diff Show More