style: auto format
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { RouteHandler} from '@hono/zod-openapi';
|
||||
import { createRoute, z } from '@hono/zod-openapi';
|
||||
|
||||
import { namespaces } from '@/registry';
|
||||
import { z, createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
|
||||
const categoryList: Record<string, typeof namespaces> = {};
|
||||
|
||||
@@ -78,4 +80,4 @@ const handler: RouteHandler<typeof route> = (ctx) => {
|
||||
return ctx.json(result);
|
||||
};
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { RouteHandler } from '@hono/zod-openapi';
|
||||
import { createRoute } from '@hono/zod-openapi';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
import { gitHash, gitDate } from '@/utils/git-hash';
|
||||
import { gitDate, gitHash } from '@/utils/git-hash';
|
||||
|
||||
const route = createRoute({
|
||||
method: 'get',
|
||||
@@ -24,4 +26,4 @@ const handler: RouteHandler<typeof route> = (ctx) =>
|
||||
gitDate: gitDate?.getTime(),
|
||||
});
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
+7
-6
@@ -1,13 +1,14 @@
|
||||
// import { route as rulesRoute, handler as rulesHandler } from '@/api/radar/rules';
|
||||
import { route as namespaceAllRoute, handler as namespaceAllHandler } from '@/api/namespace/all';
|
||||
import { route as namespaceOneRoute, handler as namespaceOneHandler } from '@/api/namespace/one';
|
||||
import { route as radarRulesAllRoute, handler as radarRulesAllHandler } from '@/api/radar/rules/all';
|
||||
import { route as radarRulesOneRoute, handler as radarRulesOneHandler } from '@/api/radar/rules/one';
|
||||
import { route as categoryOneRoute, handler as categoryOneHandler } from '@/api/category/one';
|
||||
import { route as followConfigRoute, handler as followConfigHandler } from '@/api/follow/config';
|
||||
import { OpenAPIHono } from '@hono/zod-openapi';
|
||||
import { Scalar } from '@scalar/hono-api-reference';
|
||||
|
||||
import { handler as categoryOneHandler, route as categoryOneRoute } from '@/api/category/one';
|
||||
import { handler as followConfigHandler, route as followConfigRoute } from '@/api/follow/config';
|
||||
import { handler as namespaceAllHandler, route as namespaceAllRoute } from '@/api/namespace/all';
|
||||
import { handler as namespaceOneHandler, route as namespaceOneRoute } from '@/api/namespace/one';
|
||||
import { handler as radarRulesAllHandler, route as radarRulesAllRoute } from '@/api/radar/rules/all';
|
||||
import { handler as radarRulesOneHandler, route as radarRulesOneRoute } from '@/api/radar/rules/one';
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
app.openapi(namespaceAllRoute, namespaceAllHandler);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { RouteHandler } from '@hono/zod-openapi';
|
||||
import { createRoute } from '@hono/zod-openapi';
|
||||
|
||||
import { namespaces } from '@/registry';
|
||||
import { createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
|
||||
const route = createRoute({
|
||||
method: 'get',
|
||||
@@ -14,4 +16,4 @@ const route = createRoute({
|
||||
|
||||
const handler: RouteHandler<typeof route> = (ctx) => ctx.json(namespaces);
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { RouteHandler} from '@hono/zod-openapi';
|
||||
import { createRoute, z } from '@hono/zod-openapi';
|
||||
|
||||
import { namespaces } from '@/registry';
|
||||
import { z, createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
|
||||
const ParamsSchema = z.object({
|
||||
namespace: z.string().openapi({
|
||||
@@ -30,4 +32,4 @@ const handler: RouteHandler<typeof route> = (ctx) => {
|
||||
return ctx.json(namespaces[namespace]);
|
||||
};
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { namespaces } from '@/registry';
|
||||
import type { RouteHandler } from '@hono/zod-openapi';
|
||||
import { createRoute } from '@hono/zod-openapi';
|
||||
import { parse } from 'tldts';
|
||||
import { RadarDomain } from '@/types';
|
||||
import { createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
|
||||
import { namespaces } from '@/registry';
|
||||
import type { RadarDomain } from '@/types';
|
||||
|
||||
const radar: {
|
||||
[domain: string]: RadarDomain;
|
||||
@@ -53,4 +55,4 @@ const route = createRoute({
|
||||
|
||||
const handler: RouteHandler<typeof route> = (ctx) => ctx.json(radar);
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { namespaces } from '@/registry';
|
||||
import type { RouteHandler} from '@hono/zod-openapi';
|
||||
import { createRoute, z } from '@hono/zod-openapi';
|
||||
import { parse } from 'tldts';
|
||||
import { RadarDomain } from '@/types';
|
||||
import { z, createRoute, RouteHandler } from '@hono/zod-openapi';
|
||||
|
||||
import { namespaces } from '@/registry';
|
||||
import type { RadarDomain } from '@/types';
|
||||
|
||||
const radar: {
|
||||
[domain: string]: RadarDomain;
|
||||
@@ -69,4 +71,4 @@ const handler: RouteHandler<typeof route> = (ctx) => {
|
||||
return ctx.json(radar[domain]);
|
||||
};
|
||||
|
||||
export { route, handler };
|
||||
export { handler, route };
|
||||
|
||||
+13
-15
@@ -1,24 +1,22 @@
|
||||
import { Hono } from 'hono';
|
||||
|
||||
import { compress } from 'hono/compress';
|
||||
import mLogger from '@/middleware/logger';
|
||||
import cache from '@/middleware/cache';
|
||||
import template from '@/middleware/template';
|
||||
import sentry from '@/middleware/sentry';
|
||||
import accessControl from '@/middleware/access-control';
|
||||
import debug from '@/middleware/debug';
|
||||
import header from '@/middleware/header';
|
||||
import antiHotlink from '@/middleware/anti-hotlink';
|
||||
import parameter from '@/middleware/parameter';
|
||||
import trace from '@/middleware/trace';
|
||||
import { jsxRenderer } from 'hono/jsx-renderer';
|
||||
import { trimTrailingSlash } from 'hono/trailing-slash';
|
||||
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
import { notFoundHandler, errorHandler } from '@/errors';
|
||||
import registry from '@/registry';
|
||||
import api from '@/api';
|
||||
import { errorHandler, notFoundHandler } from '@/errors';
|
||||
import accessControl from '@/middleware/access-control';
|
||||
import antiHotlink from '@/middleware/anti-hotlink';
|
||||
import cache from '@/middleware/cache';
|
||||
import debug from '@/middleware/debug';
|
||||
import header from '@/middleware/header';
|
||||
import mLogger from '@/middleware/logger';
|
||||
import parameter from '@/middleware/parameter';
|
||||
import sentry from '@/middleware/sentry';
|
||||
import template from '@/middleware/template';
|
||||
import trace from '@/middleware/trace';
|
||||
import registry from '@/registry';
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
process.on('uncaughtException', (e) => {
|
||||
logger.error('uncaughtException: ' + e);
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import undici from 'undici';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import app from '@/app';
|
||||
import undici from 'undici';
|
||||
|
||||
const { config } = await import('@/config');
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, afterEach, vi } from 'vitest';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
afterEach(() => {
|
||||
vi.resetModules();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dotenv/config';
|
||||
|
||||
import { ofetch } from 'ofetch';
|
||||
|
||||
type ConfigEnvKeys =
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { describe, expect, it, afterAll } from 'vitest';
|
||||
import supertest from 'supertest';
|
||||
import server from '@/index';
|
||||
import { load } from 'cheerio';
|
||||
import supertest from 'supertest';
|
||||
import { afterAll, describe, expect, it } from 'vitest';
|
||||
|
||||
import { config } from '@/config';
|
||||
import server from '@/index';
|
||||
|
||||
const request = supertest(server);
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { type NotFoundHandler, type ErrorHandler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
import { getDebugInfo, setDebugInfo } from '@/utils/debug-info';
|
||||
import { config } from '@/config';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { type ErrorHandler, type NotFoundHandler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { getDebugInfo, setDebugInfo } from '@/utils/debug-info';
|
||||
import logger from '@/utils/logger';
|
||||
import { requestMetric } from '@/utils/otel';
|
||||
import Error from '@/views/error';
|
||||
|
||||
import NotFoundError from './types/not-found';
|
||||
|
||||
import { requestMetric } from '@/utils/otel';
|
||||
|
||||
export const errorHandler: ErrorHandler = (error, ctx) => {
|
||||
const requestPath = ctx.req.path;
|
||||
const matchedRoute = routePath(ctx);
|
||||
|
||||
+8
-6
@@ -1,12 +1,14 @@
|
||||
import { serve } from '@hono/node-server';
|
||||
import logger from '@/utils/logger';
|
||||
import { getLocalhostAddress } from '@/utils/common-utils';
|
||||
import { config } from '@/config';
|
||||
import app from '@/app';
|
||||
import os from 'node:os';
|
||||
import cluster from 'node:cluster';
|
||||
import os from 'node:os';
|
||||
import process from 'node:process';
|
||||
|
||||
import { serve } from '@hono/node-server';
|
||||
|
||||
import app from '@/app';
|
||||
import { config } from '@/config';
|
||||
import { getLocalhostAddress } from '@/utils/common-utils';
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
const port = config.connect.port;
|
||||
const hostIPList = getLocalhostAddress();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi, afterEach } from 'vitest';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import md5 from '@/utils/md5';
|
||||
|
||||
process.env.NODE_NAME = 'mock';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
|
||||
import { config } from '@/config';
|
||||
import md5 from '@/utils/md5';
|
||||
import RejectError from '@/errors/types/reject';
|
||||
import md5 from '@/utils/md5';
|
||||
|
||||
const reject = (requestPath) => {
|
||||
throw new RejectError(`Authentication failed. Access denied.\n${requestPath}`);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi, afterEach, afterAll } from 'vitest';
|
||||
import Parser from 'rss-parser';
|
||||
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const parser = new Parser();
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { config } from '@/config';
|
||||
import { load, type CheerioAPI } from 'cheerio';
|
||||
import logger from '@/utils/logger';
|
||||
import { type CheerioAPI, load } from 'cheerio';
|
||||
import { type MiddlewareHandler } from 'hono';
|
||||
import { Data } from '@/types';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Data } from '@/types';
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
const templateRegex = /\${([^{}]+)}/g;
|
||||
const allowedUrlProperties = new Set(['hash', 'host', 'hostname', 'href', 'origin', 'password', 'pathname', 'port', 'protocol', 'search', 'searchParams', 'username']);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it, vi, afterEach } from 'vitest';
|
||||
import Parser from 'rss-parser';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import wait from '@/utils/wait';
|
||||
|
||||
process.env.CACHE_EXPIRE = '1';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import xxhash from 'xxhash-wasm';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import xxhash from 'xxhash-wasm';
|
||||
|
||||
import { config } from '@/config';
|
||||
import RequestInProgressError from '@/errors/types/request-in-progress';
|
||||
import type { Data } from '@/types';
|
||||
import cacheModule from '@/utils/cache/index';
|
||||
import { Data } from '@/types';
|
||||
|
||||
const bypassList = new Set(['/', '/robots.txt', '/logo.png', '/favicon.ico']);
|
||||
// only give cache string, as the `!` condition tricky
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import app from '@/app';
|
||||
import { load } from 'cheerio';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import app from '@/app';
|
||||
|
||||
process.env.NODE_NAME = 'mock';
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
|
||||
import { getDebugInfo, setDebugInfo } from '@/utils/debug-info';
|
||||
|
||||
const middleware: MiddlewareHandler = async (ctx, next) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, afterAll, vi, afterEach } from 'vitest';
|
||||
import { afterAll, afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
afterAll(() => {
|
||||
delete process.env.FILTER_REGEX_ENGINE;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, expect, it, afterAll } from 'vitest';
|
||||
import { afterAll, describe, expect, it } from 'vitest';
|
||||
|
||||
process.env.NODE_NAME = 'mock';
|
||||
process.env.ALLOW_ORIGIN = 'rsshub.mock';
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
import etagCalculate from 'etag';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { Data } from '@/types';
|
||||
import type { Data } from '@/types';
|
||||
|
||||
const headers: Record<string, string> = {
|
||||
'Access-Control-Allow-Methods': 'GET',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { requestMetric } from '@/utils/otel';
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import logger from '@/utils/logger';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
|
||||
import { getPath, time } from '@/utils/helpers';
|
||||
import logger from '@/utils/logger';
|
||||
import { requestMetric } from '@/utils/otel';
|
||||
|
||||
enum LogPrefix {
|
||||
Outgoing = '-->',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import Parser from 'rss-parser';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
process.env.OPENAI_API_KEY = 'sk-1234567890';
|
||||
process.env.OPENAI_API_ENDPOINT = 'https://api.openai.mock/v1';
|
||||
|
||||
+14
-13
@@ -1,17 +1,18 @@
|
||||
import * as entities from 'entities';
|
||||
import { load, type CheerioAPI } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { simplecc } from 'simplecc-wasm';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { config } from '@/config';
|
||||
import { RE2JS } from 're2js';
|
||||
import markdownit from 'markdown-it';
|
||||
import { convert } from 'html-to-text';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import cache from '@/utils/cache';
|
||||
import Parser from '@postlight/parser';
|
||||
import { Data, DataItem } from '@/types';
|
||||
import { type CheerioAPI, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import * as entities from 'entities';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import { convert } from 'html-to-text';
|
||||
import markdownit from 'markdown-it';
|
||||
import { RE2JS } from 're2js';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
import { simplecc } from 'simplecc-wasm';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Data, DataItem } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
|
||||
const md = markdownit({
|
||||
html: true,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import logger from '@/utils/logger';
|
||||
import { config } from '@/config';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { getRouteNameFromPath } from '@/utils/helpers';
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
if (config.sentry.dsn) {
|
||||
Sentry.init({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import app from '@/app';
|
||||
import Parser from 'rss-parser';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import app from '@/app';
|
||||
|
||||
const parser = new Parser();
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { rss3, json, RSS, Atom } from '@/utils/render';
|
||||
import { config } from '@/config';
|
||||
import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
import { Data } from '@/types';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Data } from '@/types';
|
||||
import cacheModule from '@/utils/cache/index';
|
||||
import { collapseWhitespace, convertDateToISO8601 } from '@/utils/common-utils';
|
||||
import { Atom, json, RSS, rss3 } from '@/utils/render';
|
||||
|
||||
const middleware: MiddlewareHandler = async (ctx, next) => {
|
||||
// Set RSS <ttl> (minute) according to the availability of cache
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { MiddlewareHandler } from 'hono';
|
||||
import { getPath } from '@/utils/helpers';
|
||||
import type { MiddlewareHandler } from 'hono';
|
||||
|
||||
import { config } from '@/config';
|
||||
import { getPath } from '@/utils/helpers';
|
||||
import { tracer } from '@/utils/otel';
|
||||
|
||||
const middleware: MiddlewareHandler = async (ctx, next) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { init, request } from './pkg';
|
||||
|
||||
describe('pkg', () => {
|
||||
|
||||
+5
-3
@@ -1,7 +1,9 @@
|
||||
import { type ConfigEnv, setConfig } from '@/config';
|
||||
import { Handler, Hono } from 'hono';
|
||||
import type { Handler, Hono } from 'hono';
|
||||
|
||||
import type { RoutePath } from '@/../assets/build/route-paths';
|
||||
import type { Data, Route, Namespace } from './types';
|
||||
import { type ConfigEnv, setConfig } from '@/config';
|
||||
|
||||
import type { Data, Namespace, Route } from './types';
|
||||
|
||||
export * from '@/types';
|
||||
export { default as ofetch } from '@/utils/ofetch';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import app from '@/app';
|
||||
import { config } from '@/config';
|
||||
|
||||
|
||||
+9
-8
@@ -1,15 +1,16 @@
|
||||
import type { APIRoute, Namespace, Route } from '@/types';
|
||||
import { directoryImport } from 'directory-import';
|
||||
import { Hono, type Handler } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
import path from 'node:path';
|
||||
import { serveStatic } from '@hono/node-server/serve-static';
|
||||
import { config } from '@/config';
|
||||
|
||||
import index from '@/routes/index';
|
||||
import { serveStatic } from '@hono/node-server/serve-static';
|
||||
import { directoryImport } from 'directory-import';
|
||||
import { type Handler, Hono } from 'hono';
|
||||
import { routePath } from 'hono/route';
|
||||
|
||||
import { config } from '@/config';
|
||||
import healthz from '@/routes/healthz';
|
||||
import robotstxt from '@/routes/robots.txt';
|
||||
import index from '@/routes/index';
|
||||
import metrics from '@/routes/metrics';
|
||||
import robotstxt from '@/routes/robots.txt';
|
||||
import type { APIRoute, Namespace, Route } from '@/types';
|
||||
import logger from '@/utils/logger';
|
||||
|
||||
const __dirname = import.meta.dirname;
|
||||
|
||||
+5
-3
@@ -1,9 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import app from '@/app';
|
||||
import Parser from 'rss-parser';
|
||||
const parser = new Parser();
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import app from '@/app';
|
||||
import { config } from '@/config';
|
||||
|
||||
const parser = new Parser();
|
||||
|
||||
process.env.ALLOW_USER_SUPPLY_UNSAFE_DOMAIN = 'true';
|
||||
|
||||
const routes = {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
export const handler = async (ctx) => {
|
||||
const { category = 'zx' } = ctx.req.param();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { art } from '@/utils/render';
|
||||
import { type Cheerio, type CheerioAPI, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { type CheerioAPI, type Cheerio, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
import path from 'node:path';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const handler = async (ctx: Context): Promise<Data> => {
|
||||
const { filter } = ctx.req.param();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { art } from '@/utils/render';
|
||||
import { type Cheerio, type CheerioAPI, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate, parseRelativeDate } from '@/utils/parse-date';
|
||||
|
||||
import { type CheerioAPI, type Cheerio, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
import path from 'node:path';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const handler = async (ctx: Context): Promise<Data> => {
|
||||
const { category = 'newslists', id } = ctx.req.param();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import iconv from 'iconv-lite';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const handler = async (ctx) => {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
|
||||
import { art } from '@/utils/render';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import path from 'node:path';
|
||||
|
||||
import { type CheerioAPI, load } from 'cheerio';
|
||||
import { type Context } from 'hono';
|
||||
import path from 'node:path';
|
||||
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const handler = async (ctx: Context): Promise<Data> => {
|
||||
const limit: number = Number.parseInt(ctx.req.query('limit') ?? '100', 10);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { config } from '@/config';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import { config } from '@/config';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
|
||||
const rootUrl = 'https://kyfw.12306.cn';
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import got from '@/utils/got';
|
||||
import * as cheerio from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
import cache from '@/utils/cache';
|
||||
|
||||
import { Route } from '@/types';
|
||||
|
||||
const handler = async (ctx) => {
|
||||
const { category = 'zxfb' } = ctx.req.param();
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:type/:keyword{.*}?',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:type/:keyword{.*}?',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
const root_url = 'https://inf.ds.163.com';
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
import { parseDyArticle } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
import { parseDyArticle } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
const ids = {
|
||||
'': {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/music/artist/songs/:id',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/music/artist/:id',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import cache from '@/utils/cache';
|
||||
import { config } from '@/config';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/music/djradio/:id/:info?',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { config } from '@/config';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/music/playlist/:id',
|
||||
categories: ['multimedia'],
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
const renderDescription = (info) => art(path.join(__dirname, '../templates/music/userevents.art'), info);
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/music/user/playlist/:uid',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { config } from '@/config';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import { config } from '@/config';
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
const headers = {
|
||||
cookie: config.ncm.cookies,
|
||||
Referer: 'https://music.163.com/',
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import iconv from 'iconv-lite';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
const rootUrl = 'https://news.163.com';
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
const typeMap = {
|
||||
1: '轻松一刻',
|
||||
2: '槽值',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/open/vip',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import iconv from 'iconv-lite';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/today/:need_content?',
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
const parseDyArticle = (item, tryGet) =>
|
||||
tryGet(item.link, async () => {
|
||||
const response = await got(item.link, {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
import { defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/album/:id',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { defaultDomain, getRootUrl } from './utils';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
|
||||
import { defaultDomain, getRootUrl, ProcessItems } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import cache from '@/utils/cache';
|
||||
|
||||
import { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/search/:option?/:category?/:keyword?/:time?/:order?',
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
import { config } from '@/config';
|
||||
import ConfigNotFoundError from '@/errors/types/config-not-found';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import md5 from '@/utils/md5';
|
||||
import CryptoJS from 'crypto-js';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
const defaultDomain = 'jmcomic1.me';
|
||||
// list of address: https://jmcomic2.bet
|
||||
@@ -151,4 +153,4 @@ const ProcessItems = async (ctx, currentUrl, rootUrl) => {
|
||||
};
|
||||
};
|
||||
|
||||
export { defaultDomain, getRootUrl, ProcessItems, getApiUrl, processApiItems, apiMapCategory };
|
||||
export { apiMapCategory, defaultDomain, getApiUrl, getRootUrl, processApiItems, ProcessItems };
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { art } from '@/utils/render';
|
||||
import { type Cheerio, type CheerioAPI, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { type CheerioAPI, type Cheerio, load } from 'cheerio';
|
||||
import type { Element } from 'domhandler';
|
||||
import { type Context } from 'hono';
|
||||
import path from 'node:path';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const handler = async (ctx: Context): Promise<Data> => {
|
||||
const { category = 'newly' } = ctx.req.param();
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import iconv from 'iconv-lite';
|
||||
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import iconv from 'iconv-lite';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { isValidHost } from '@/utils/valid-host';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
|
||||
const setCookie = function (cookieName, cookieValue, seconds, path, domain, secure) {
|
||||
let expires = null;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
const rootUrl = 'https://www.1lou.me';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils';
|
||||
|
||||
import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/category/:id?/:type?/:order?',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import path from 'node:path';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/offer/:year?/:major?/:school?',
|
||||
categories: ['bbs'],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils';
|
||||
|
||||
import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils';
|
||||
|
||||
const sections = {
|
||||
257: '留学申请',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { rootUrl, apiRootUrl, types, ProcessThreads } from './utils';
|
||||
|
||||
import { apiRootUrl, ProcessThreads, rootUrl, types } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/thread/:type?/:order?',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import bbobHTML from '@bbob/html';
|
||||
import presetHTML5 from '@bbob/preset-html5';
|
||||
import type { BBobCoreTagNodeTree } from '@bbob/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import type { BBobCoreTagNodeTree } from '@bbob/types';
|
||||
import bbobHTML from '@bbob/html';
|
||||
import presetHTML5 from '@bbob/preset-html5';
|
||||
|
||||
const rootUrl = 'https://instant.1point3acres.com';
|
||||
const apiRootUrl = 'https://api.1point3acres.com';
|
||||
@@ -137,4 +139,4 @@ const ProcessThreads = async (tryGet, apiUrl, order) => {
|
||||
return items;
|
||||
};
|
||||
|
||||
export { rootUrl, apiRootUrl, types, ProcessThreads };
|
||||
export { apiRootUrl, ProcessThreads, rootUrl, types };
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { art } from '@/utils/render';
|
||||
|
||||
export const handler = async (ctx) => {
|
||||
const { category = 'latest/awarded' } = ctx.req.param();
|
||||
const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit'), 10) : 30;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Data, DataItem, Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import type { Context } from 'hono';
|
||||
|
||||
import type { Data, DataItem, Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { load } from 'cheerio';
|
||||
import { Context } from 'hono';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:category?/:tab?',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { load } from 'cheerio';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:id?',
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { type CheerioAPI, load } from 'cheerio';
|
||||
import { type Context } from 'hono';
|
||||
|
||||
import { type DataItem, type Route, type Data, ViewType } from '@/types';
|
||||
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import { type Data, type DataItem, type Route, ViewType } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate, parseRelativeDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
|
||||
const processMenu = (data: any[]) => {
|
||||
const result = {};
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import iconv from 'iconv-lite';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
import iconv from 'iconv-lite';
|
||||
|
||||
// http://www.2cycd.com/forum.php?mod=forumdisplay&fid=43&orderby=dateline
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Data, Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Data, Route } from '@/types';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
|
||||
import { processList } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/category/:category?/:subCategory?',
|
||||
categories: ['programming'],
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Data, Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
import { processList, rootUrl } from './utils';
|
||||
|
||||
import type { Data, Route } from '@/types';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
|
||||
import { processList, rootUrl } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/latest',
|
||||
categories: ['programming'],
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { DataItem } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { DataItem } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import ofetch from '@/utils/ofetch';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import cache from '@/utils/cache';
|
||||
|
||||
export const rootUrl = 'https://www.30secondsofcode.org';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { rootUrl, ProcessItem } from './utils';
|
||||
import InvalidParameterError from '@/errors/types/invalid-parameter';
|
||||
import { ProcessItem, rootUrl } from './utils';
|
||||
|
||||
const categories = {
|
||||
24: {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Route } from '@/types';
|
||||
import { getSubPath } from '@/utils/common-utils';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import { getSubPath } from '@/utils/common-utils';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { rootUrl, ProcessItem } from './utils';
|
||||
import { ProcessItem, rootUrl } from './utils';
|
||||
|
||||
const shortcuts = {
|
||||
'/information': '/information/web_news',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
import got from '@/utils/got';
|
||||
|
||||
const rootUrl = 'https://www.36kr.com';
|
||||
|
||||
const ProcessItem = (item, tryGet) =>
|
||||
@@ -32,4 +33,4 @@ const ProcessItem = (item, tryGet) =>
|
||||
return item;
|
||||
});
|
||||
|
||||
export { rootUrl, ProcessItem };
|
||||
export { ProcessItem, rootUrl };
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
import { parseArticle } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { Route } from '@/types';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
import { parseArticle } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Data, DataItem, Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
import type { Context } from 'hono';
|
||||
|
||||
import type { Data, DataItem, Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import { load } from 'cheerio';
|
||||
import { Context } from 'hono';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:filters?/:order?',
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { Route } from '@/types';
|
||||
import path from 'node:path';
|
||||
|
||||
import { load } from 'cheerio';
|
||||
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const handler = async (ctx) => {
|
||||
const { category = '' } = ctx.req.param();
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseList, parseItem, getCategories } from './utils';
|
||||
|
||||
import { getCategories, parseItem, parseList } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: ['/', '/category/:category'],
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Route } from '@/types';
|
||||
import type { Route } from '@/types';
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseList, parseItem } from './utils';
|
||||
|
||||
import { parseItem, parseList } from './utils';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/tag/:tag',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user