Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dzx-dzx committed May 3, 2024
1 parent 8139cff commit a039843
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@stylistic/comma-style": 2,
"@stylistic/function-call-spacing": 2,
"@stylistic/keyword-spacing": 2,
"@stylistic/linebreak-style": 2,
"@stylistic/linebreak-style": 0,
"@stylistic/lines-around-comment": ["error", { "beforeBlockComment": false }],
"@stylistic/no-multiple-empty-lines": 2,
"@stylistic/no-trailing-spaces": 2,
Expand Down
6 changes: 3 additions & 3 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ const calculateValue = () => {
cache: {
type: envs.CACHE_TYPE || (envs.CACHE_TYPE === '' ? '' : 'memory'), // 缓存类型,支持 'memory' 和 'redis',设为空可以禁止缓存
requestTimeout: toInt(envs.CACHE_REQUEST_TIMEOUT, 60),
routeExpire: toInt(envs.CACHE_EXPIRE, 5 * 60), // 路由缓存时间,单位为秒
routeExpire: toInt(envs.CACHE_EXPIRE, 1), // 路由缓存时间,单位为秒
contentExpire: toInt(envs.CACHE_CONTENT_EXPIRE, 1 * 60 * 60), // 不变内容缓存时间,单位为秒
},
memory: {
Expand All @@ -377,7 +377,7 @@ const calculateValue = () => {
url: envs.REDIS_URL || 'redis://localhost:6379/',
},
// proxy
proxyUri: envs.PROXY_URI,
proxyUri: envs.PROXY_URI || '127.0.0.1:7890',
proxy: {
protocol: envs.PROXY_PROTOCOL,
host: envs.PROXY_HOST,
Expand All @@ -393,7 +393,7 @@ const calculateValue = () => {
// logging
// 是否显示 Debug 信息,取值 'true' 'false' 'some_string' ,取值为 'true' 时永久显示,取值为 'false' 时永远隐藏,取值为 'some_string' 时请求带上 '?debug=some_string' 显示
debugInfo: envs.DEBUG_INFO || 'true',
loggerLevel: envs.LOGGER_LEVEL || 'info',
loggerLevel: envs.LOGGER_LEVEL || 'debug',
noLogfiles: toBoolean(envs.NO_LOGFILES, false),
showLoggerTimestamp: toBoolean(envs.SHOW_LOGGER_TIMESTAMP, false),
sentry: {
Expand Down
4 changes: 4 additions & 0 deletions lib/routes/scmp/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export const parseItem = async (item) => {
item.updated = parseDate(article.updatedDate, 'x');
item.category = [...new Set([...article.topics.map((t) => t.name), ...article.sections.flatMap((t) => t.value.map((v) => v.name)), ...article.keywords.map((k) => k?.split(', '))])];

item.enclosure_length = item.enclosure.length;
item.enclosure_url = item.enclosure.url;
item.enclosure_type = item.enclosure.type;

// N.B. gallery in article is not rendered
// e.g., { type: 'div', attribs: { class: 'scmp-photo-gallery', 'data-gallery-nid': '3239409' }}
// from https://www.scmp.com/news/china/politics/article/3239355/li-keqiang-former-premier-china-dead
Expand Down

0 comments on commit a039843

Please sign in to comment.