diff --git a/docs/en/game.md b/docs/en/game.md index 89d7eb821f..33e4b2c50c 100755 --- a/docs/en/game.md +++ b/docs/en/game.md @@ -62,6 +62,25 @@ Language codes +## FINAL FANTASY XIV + +### FINAL FANTASY XIV (The Lodestone) + + + +Region + +| North Ameria | Europe | France | Germany | Japan | +| ------------ | ------ | ------ | ------- | ----- | +| na | eu | fr | de | jp | + +Category + +| all | topics | notices | maintenance | updates | status | developers | +| --- | ------ | ------- | ----------- | ------- | -------- | ---------- | + + + ## Gamer Secret ### Latest News diff --git a/docs/game.md b/docs/game.md index de115e2406..36b69c8445 100644 --- a/docs/game.md +++ b/docs/game.md @@ -765,13 +765,13 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 用户文章 - + ## 最终幻想 14 ### 最终幻想 14 国服 - + | 新闻 | 公告 | 活动 | 广告 | 所有 | | ---- | -------- | ------ | --------- | ---- | @@ -781,14 +781,15 @@ Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547` ### 最终幻想 14 国际服 (Lodestone) - + + | 北美 | 欧洲(英语) | 法国 | 德国 | 日本 | | ---- | ------------ | ---- | ---- | ---- | | na | eu | fr | de | jp | -| 话题 | 公告 | 维护 | 更新 | 服务状态 | 开发者博客 | -| ------ | ------- | ----------- | ------- | -------- | ---------- | -| topics | notices | maintenance | updates | status | developers | +| 所有 | 话题 | 公告 | 维护 | 更新 | 服务状态 | 开发者博客 | +| ---- | ------ | ------- | ----------- | ------- | -------- | ---------- | +| all | topics | notices | maintenance | updates | status | developers | diff --git a/lib/router.js b/lib/router.js index 40701788b9..3e4e63a63b 100644 --- a/lib/router.js +++ b/lib/router.js @@ -1915,9 +1915,9 @@ router.get('/arknights/japan', lazyloadRouteHandler('./routes/arknights/japan')) // 塞壬唱片 router.get('/siren/news', lazyloadRouteHandler('./routes/siren/index')); -// ff14 -router.get('/ff14/ff14_zh/:type', lazyloadRouteHandler('./routes/ff14/ff14_zh')); -router.get('/ff14/ff14_global/:lang/:type', lazyloadRouteHandler('./routes/ff14/ff14_global')); +// ff14 migrated to v2 +// router.get('/ff14/ff14_zh/:type', lazyloadRouteHandler('./routes/ff14/ff14_zh')); +// router.get('/ff14/ff14_global/:lang/:type', lazyloadRouteHandler('./routes/ff14/ff14_global')); // 学堂在线 router.get('/xuetangx/course/:cid/:type', lazyloadRouteHandler('./routes/xuetangx/course_info')); diff --git a/lib/routes/ff14/ff14_global.js b/lib/v2/ff14/ff14_global.js similarity index 67% rename from lib/routes/ff14/ff14_global.js rename to lib/v2/ff14/ff14_global.js index 849cf05e4e..ab89e7c6e8 100644 --- a/lib/routes/ff14/ff14_global.js +++ b/lib/v2/ff14/ff14_global.js @@ -1,8 +1,11 @@ const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); +const { art } = require('@/utils/render'); +const path = require('path'); module.exports = async (ctx) => { - const type = ctx.params.type; const lang = ctx.params.lang; + const type = ctx.params.type ?? 'all'; const response = await got({ method: 'get', @@ -23,8 +26,11 @@ module.exports = async (ctx) => { item: data.map(({ id, url, title, time, description, image }) => ({ title, link: url, - description: `
${description}
`, - pubDate: time, + description: art(path.join(__dirname, 'templates/description.art'), { + image, + description, + }), + pubDate: parseDate(time), guid: id, })), }; diff --git a/lib/routes/ff14/ff14_zh.js b/lib/v2/ff14/ff14_zh.js similarity index 69% rename from lib/routes/ff14/ff14_zh.js rename to lib/v2/ff14/ff14_zh.js index b638f01874..1912ba2f22 100644 --- a/lib/routes/ff14/ff14_zh.js +++ b/lib/v2/ff14/ff14_zh.js @@ -1,8 +1,12 @@ const got = require('@/utils/got'); const timezone = require('@/utils/timezone'); +const { parseDate } = require('@/utils/parse-date'); +const { art } = require('@/utils/render'); +const path = require('path'); + module.exports = async (ctx) => { - const referer = 'http://ff.sdo.com/web8/index.html'; - const type = ctx.params.type; + const referer = 'https://ff.sdo.com/web8/index.html'; + const type = ctx.params.type ?? 'all'; const type_number = { news: '5310', @@ -29,8 +33,11 @@ module.exports = async (ctx) => { item: data.map(({ Title, Summary, Author, PublishDate, HomeImagePath }) => ({ title: Title, link: Author, - description: `
${Summary}`, - pubDate: timezone(new Date(PublishDate), +8), + description: art(path.join(__dirname, 'templates/description.art'), { + image: HomeImagePath, + description: Summary, + }), + pubDate: timezone(parseDate(PublishDate), +8), })), }; }; diff --git a/lib/v2/ff14/maintainer.js b/lib/v2/ff14/maintainer.js new file mode 100644 index 0000000000..8ab9d19461 --- /dev/null +++ b/lib/v2/ff14/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/global/:lang/:type?': ['chengyuhui'], + '/zh/:type?': ['Kiotlin', 'ZeroClad', '15x15G'], +}; diff --git a/lib/v2/ff14/router.js b/lib/v2/ff14/router.js new file mode 100644 index 0000000000..0fec0efa04 --- /dev/null +++ b/lib/v2/ff14/router.js @@ -0,0 +1,7 @@ +module.exports = (router) => { + router.get('/global/:lang/:type?', require('./ff14_global')); + router.get('/zh/:type?', require('./ff14_zh')); + // Deprecated + router.get('/ff14_global/:lang/:type?', require('./ff14_global')); + router.get('/ff14_zh/:type?', require('./ff14_zh')); +}; diff --git a/lib/v2/ff14/templates/description.art b/lib/v2/ff14/templates/description.art new file mode 100644 index 0000000000..6529ddc370 --- /dev/null +++ b/lib/v2/ff14/templates/description.art @@ -0,0 +1,4 @@ +{{ if image }} +
+{{ /if }} +{{ description }}