feat: replace require with import 5/n
This commit is contained in:
parent
34d889743b
commit
e42ff57cb4
|
|
@ -1,13 +1,6 @@
|
|||
const toZzkx = (ctx) => {
|
||||
// https://www.cs.com.cn/sylm/jsbd/
|
||||
|
||||
const redirectTo = '/cs/sylm/jsbd';
|
||||
ctx.redirect(redirectTo);
|
||||
};
|
||||
|
||||
export default (router) => {
|
||||
router.get('/news/zzkx', toZzkx);
|
||||
router.get('/zzkx', toZzkx);
|
||||
router.get('/news/zzkx', './zzkx');
|
||||
router.get('/zzkx', './zzkx');
|
||||
router.get('/video/:category?', './video');
|
||||
router.get('/:category{.+}?', './');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
export default (ctx) => {
|
||||
// https://www.cs.com.cn/sylm/jsbd/
|
||||
|
||||
const redirectTo = '/cs/sylm/jsbd';
|
||||
ctx.redirect(redirectTo);
|
||||
};
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const { webBaseUrl, generateNonce, sign, getPost } = require('../utils');
|
||||
import { webBaseUrl, generateNonce, sign, getPost } from '../utils';
|
||||
import { config } from '@/config';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import cache from '@/utils/cache';
|
|||
// [] hdjlpt 互动交流
|
||||
|
||||
// 使用方法
|
||||
// const { gdgov } = require('../general/general');
|
||||
// import { gdgov } from '../general/general';
|
||||
//
|
||||
// export default async (ctx) => {
|
||||
// const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { getSubPath } from '@/utils/common-utils';
|
||||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const path = getSubPath(ctx)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const { gdgov } = require('../general/general');
|
||||
import { gdgov } from '../general/general';
|
||||
|
||||
export default async (ctx) => {
|
||||
const info = {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const getContent = require('../utils/common');
|
||||
import getContent from '../utils/common';
|
||||
|
||||
export default async (ctx) => {
|
||||
await getContent(ctx, {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const getContent = require('../utils/common');
|
||||
import getContent from '../utils/common';
|
||||
|
||||
export default async (ctx) => {
|
||||
await getContent(ctx, {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import { ig, login } from './utils';
|
||||
import logger from '@/utils/logger';
|
||||
import { config } from '@/config';
|
||||
const { renderItems } = require('../common-utils');
|
||||
import { renderItems } from '../common-utils';
|
||||
|
||||
// loadContent pulls the desired user/tag/etc
|
||||
async function loadContent(category, nameOrId, tryGet) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import cache from '@/utils/cache';
|
||||
const { CookieJar } = require('tough-cookie');
|
||||
import { config } from '@/config';
|
||||
const { renderItems } = require('../common-utils');
|
||||
import { renderItems } from '../common-utils';
|
||||
import { baseUrl, COOKIE_URL, checkLogin, getUserInfo, getUserFeedItems, getTagsFeedItems, getLoggedOutTagsFeedItems, renderGuestItems } from './utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
import getCookie from '../utils/pypasswaf';
|
||||
const host = 'https://cae.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
import getCookie from '../utils/pypasswaf';
|
||||
const host = 'https://cs.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
import getCookie from '../utils/pypasswaf';
|
||||
const host = 'http://aao.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const getCookie = require('../utils/pypasswaf');
|
||||
import getCookie from '../utils/pypasswaf';
|
||||
const host = 'http://www.graduate.nuaa.edu.cn/';
|
||||
|
||||
const map = new Map([
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import timezone from '@/utils/timezone';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const { parseArticle } = require('../utils');
|
||||
import { parseArticle } from '../utils';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const __dirname = getCurrentPath(import.meta.url);
|
|||
|
||||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
const { parseArticle } = require('../utils');
|
||||
import { parseArticle } from '../utils';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
const assert = require('assert');
|
||||
import queryString from 'query-string';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const got = require('../pixiv-got');
|
||||
import got from '../pixiv-got';
|
||||
const maskHeader = require('../constants').maskHeader;
|
||||
import queryString from 'query-string';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { appsUrl } = require('../utils');
|
||||
import { appsUrl } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { id, lang = '' } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { appsUrl } = require('../utils');
|
||||
import { appsUrl } from '../utils';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { appsUrl } = require('../utils');
|
||||
import { appsUrl } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { id, lang = '' } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { appsUrl, newsUrl, fixImg } = require('../utils');
|
||||
import { appsUrl, newsUrl, fixImg } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { id, lang = '' } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ const __dirname = getCurrentPath(import.meta.url);
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const { ssoUrl, notesUrl } = require('../utils');
|
||||
import { ssoUrl, notesUrl } from '../utils';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { notesUrl, extractNotes } = require('../utils');
|
||||
import { notesUrl, extractNotes } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { topic, lang } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const { notesUrl, extractNotes } = require('../utils');
|
||||
import { notesUrl, extractNotes } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { uid, lang } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
const { userUrl, appsUrl } = require('../utils');
|
||||
import { userUrl, appsUrl } from '../utils';
|
||||
import { art } from '@/utils/render';
|
||||
import * as path from 'node:path';
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export { announcementsRouter as default } from './physics-school-announcements-and-news';
|
||||
|
|
@ -0,0 +1 @@
|
|||
export { newsRouter as default } from './physics-school-announcements-and-news';
|
||||
|
|
@ -44,7 +44,7 @@ const getItemsFromURLs = async (URLs, cache) => {
|
|||
return items;
|
||||
};
|
||||
|
||||
module.exports.announcementsRouter = async (ctx) => {
|
||||
export const announcementsRouter = async (ctx) => {
|
||||
const URLs = {
|
||||
党政: 'https://physics.scnu.edu.cn/NEWS/Notices/PartyAndGovernment/',
|
||||
教务: 'https://physics.scnu.edu.cn/NEWS/Notices/Education/',
|
||||
|
|
@ -61,7 +61,7 @@ module.exports.announcementsRouter = async (ctx) => {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.newsRouter = async (ctx) => {
|
||||
export const newsRouter = async (ctx) => {
|
||||
const URLs = {
|
||||
学院新闻: 'https://physics.scnu.edu.cn/NEWS/News/College/',
|
||||
教务新闻: 'https://physics.scnu.edu.cn/NEWS/News/Education/',
|
||||
|
|
@ -77,7 +77,7 @@ module.exports.newsRouter = async (ctx) => {
|
|||
});
|
||||
};
|
||||
|
||||
module.exports.researchNewsRouter = async (ctx) => {
|
||||
export const researchNewsRouter = async (ctx) => {
|
||||
const URLs = {
|
||||
学术报告: 'https://physics.scnu.edu.cn/RESEARCH/EVENTS/Seminars/',
|
||||
学术会议: 'https://physics.scnu.edu.cn/RESEARCH/EVENTS/Conferences/',
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
export { researchNewsRouter as default } from './physics-school-announcements-and-news';
|
||||
|
|
@ -2,9 +2,9 @@ export default (router) => {
|
|||
router.get('/cs/match', './cs/match');
|
||||
router.get('/jw', './jw');
|
||||
router.get('/library', './library');
|
||||
router.get('/physics-school-announcements', './physics-school-announcements-and-news'.announcementsRouter);
|
||||
router.get('/physics-school-news', './physics-school-announcements-and-news'.newsRouter);
|
||||
router.get('/physics-school-research-news', './physics-school-announcements-and-news'.researchNewsRouter);
|
||||
router.get('/physics-school-announcements', './announcements-router');
|
||||
router.get('/physics-school-news', './news-router');
|
||||
router.get('/physics-school-research-news', './research-news-router');
|
||||
router.get('/ss', './ss');
|
||||
router.get('/yjs', './yjs');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const data = require('../data').wh.jwc;
|
||||
const extractor = require('../extractor');
|
||||
import extractor from '../extractor';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import timezone from '@/utils/timezone';
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import cache from '@/utils/cache';
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
const data = require('../data').wh.news;
|
||||
const extractor = require('../extractor');
|
||||
import extractor from '../extractor';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import got from '@/utils/got';
|
|||
import { load } from 'cheerio';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
import { config } from '@/config';
|
||||
const { getAcwScV2ByArg1 } = require('../5eplay/utils');
|
||||
import { getAcwScV2ByArg1 } from '../5eplay/utils';
|
||||
|
||||
const host = 'https://segmentfault.com';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import cache from '@/utils/cache';
|
||||
const { getRollNewsList, parseRollNewsList, parseArticle } = require('../utils');
|
||||
import { getRollNewsList, parseRollNewsList, parseArticle } from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const map = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import cache from '@/utils/cache';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
const { parseArticle } = require('../../utils');
|
||||
import { parseArticle } from '../../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const { cids = '57045' } = ctx.req.param();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const keyword = ctx.req.param('keyword');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
// import { config } from '@/config';
|
||||
import { getUser, getUserMedia } from './twitter-api';
|
||||
import { initToken } from './token';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { getSearch } from './twitter-api';
|
||||
import { initToken } from './token';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// import { config } from '@/config';
|
||||
import { getUser, getUserTweet } from './twitter-api';
|
||||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { fallback, queryToBoolean } from '@/utils/readable-social';
|
||||
import { config } from '@/config';
|
||||
import { initToken } from './token';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { getUser, getUserTweets, getUserTweetsAndReplies, excludeRetweet } from './twitter-api';
|
||||
import { initToken } from './token';
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import buildData from '@/utils/common-config';
|
||||
const weiboUtils = require('../utils');
|
||||
import weiboUtils from '../utils';
|
||||
|
||||
export default async (ctx) => {
|
||||
const userid = ctx.req.param('userid');
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import { config } from '@/config';
|
|||
import { art } from '@/utils/render';
|
||||
import { load } from 'cheerio';
|
||||
import * as path from 'node:path';
|
||||
// const weiboUtils = require('../utils');
|
||||
// import weiboUtils from '../utils';
|
||||
|
||||
// Default hide all picture
|
||||
let wpic = 'false';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import auth from './auth';
|
||||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import auth from './auth';
|
||||
const { generateData } = require('../pin/utils');
|
||||
import { generateData } from '../pin/utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import auth from './auth';
|
||||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import got from '@/utils/got';
|
||||
import auth from './auth';
|
||||
const utils = require('../utils');
|
||||
import utils from '../utils';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export default async (ctx) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue