Commit Graph

57 Commits

Author SHA1 Message Date
cnzgray e5aa28a79b fix: can not get cache (#1143)
本补丁主要解决了以下两个问题:

1. 在 a1f060f3d2 提交时,缓存get方法发生了变化。
**cache的get方法未正确返回值**,这将导致所有使用自定义缓存的地方缓存丢失!

2. 同时修正了未设置缓存时系统报`tryGet`方法未定义的问题。
2018-11-14 12:14:43 +08:00
cnzgray d1c50b0c7e 提案: 添加一个`tryGet`方法到cache工具中。 (#1130)
在抓取一些博客或者论坛的时候,有时候会系统抓取内容页面作为desc。
大多数的做法是获取子页面的地址,然后判断是否已经缓存结果,如果没有则获取,然后设置到缓存中。
这做法固然没有问题,这里只是提供一种新的思路,以将子页面的抓取逻辑独立出去便于逻辑实现。

使用方法:
```
const loadContent = async (link) => {
    // 执行页面加载,解析内容等操作。
    // 最终返回一个结果,该结果将被缓存。
    return result;
}
const result = await ctx.cache.tryGet(link, async () => loadContent(link), 3 * 60 * 60);
```
2018-11-13 10:57:13 +08:00
DIYgod 2cd41076da
app: remove json in type regrx 2018-11-11 15:13:37 +08:00
凉凉 8eb175cf35 Enhancement: Remove JSON output (#1115)
* Enhancement: Remove JSON output

* Update docs/README.md
2018-11-11 15:04:34 +08:00
DIYgod a1f060f3d2
verify cache value 2018-11-03 11:25:39 +08:00
DarkSky defa39be66 rss: telegram instant view mode param (#977)
close #975
2018-10-26 11:03:30 +08:00
DIYgod d92170bdd7
format 2018-10-19 01:06:08 +08:00
Henry Wang 465324b67d 精简缓存逻辑,精简文档 (#915)
https://github.com/HenryQW/RSSHub/issues/6
https://github.com/HenryQW/RSSHub/issues/7
2018-10-18 09:44:45 +08:00
Henry Wang dba68e67fb 修复黑白名单逻辑 (#844)
#840 可能没这么快 merge, 剥离这部分出来
2018-10-09 01:21:22 +08:00
Henry Wang 8ac4146b0f 修复黑白名单逻辑 (#836) 2018-10-07 16:10:14 +08:00
DIYgod a48a276485
app: exclude cache for root router 2018-09-30 17:02:18 +08:00
DIYgod 07e4adcca5
stricter data handling 2018-09-18 19:10:02 +08:00
DIYgod 6279a16078
fix tugua, close #733 2018-09-18 00:01:37 +08:00
DIYgod 7c6344010e
decode HTML entity 2018-09-17 00:18:37 +08:00
叡山电车 658a58278c 修复当feed item没有description时filterout参数无法起作用的BUG (#710)
RT
2018-09-16 22:42:23 +08:00
Henry Wang 818e0cd077 拯救翻车的 API (#698) 2018-09-15 13:55:59 +08:00
DIYgod 5eb2450e6b
app: remove useless console.log 2018-09-12 17:38:14 +08:00
DIYgod 27371c4bc8
app: fix error handing 2018-09-12 17:18:43 +08:00
Henry Wang c835fa5c02 Add middlewares for API and various improvements (#685) 2018-09-12 12:00:47 +08:00
Henry Wang 8d1a071ab3 Add option to set value for limiting title length (#671)
Related to #663
2018-09-10 15:00:08 +08:00
DIYgod 2e122373e0
app: limit title length by bytes, close #663 2018-09-10 01:29:37 +08:00
Henry Wang 571636b4a8 Add a global title length cap. And localisation for Instagram. (#670) 2018-09-10 00:45:55 +08:00
Henry Wang 54d07cb85c Add http basic authentication (#584)
* Add http basic authentication

closes #560

* Add docs

* Add http basic authentication middleware

* Minor update

* Move settings to config.js
2018-08-31 10:46:17 +08:00
叡山电车 b83a6786fb Fix (#546)
fix issue #544
2018-08-27 23:00:01 +08:00
DIYgod d750ffa963
app: sentry track req 2018-08-21 18:19:20 +08:00
DIYgod ac42d919c5
app: support sentry tracker 2018-08-21 18:00:03 +08:00
DIYgod b4133e6005
rss: limit param 2018-07-29 02:20:58 +08:00
DIYgod 09a616d2b8
app: return 500 -> 404 when error happens 2018-06-03 00:18:36 +08:00
DIYgod 46feb2a1ce
app: wrap error message in <pre> 2018-06-02 19:42:02 +08:00
DIYgod f5b4874ba7
app: move some variables outside module.exports for a better performance 2018-06-02 17:31:33 +08:00
DIYgod 2f9fc20285
app: cut Cache-Control header in half 2018-06-02 17:24:54 +08:00
DIYgod 36e565d388
app: add Cache-Control header 2018-06-02 17:22:56 +08:00
DIYgod 16bc48b723
docs: rename 2018-06-02 16:50:09 +08:00
DIYgod 0ca3b9b07f
app: access contorl 2018-06-02 16:39:52 +08:00
DIYgod b12e45fa2a
app: more precise template typeRegrx 2018-05-24 16:22:14 +08:00
tgly307 ead78bbd89 添加exclude过滤功能 (#186)
* 知乎日报全文rss

* reverse router.js

* 知乎日报当天全文rss

* Update daily.js

去除JSON处理方法,添加对redis的异步get兼容,统一缓存保留时间。

* git ignore

* 即刻topic广场信息

* Delete .gitignore

* Revert "Merge branch 'master' into master"

This reverts commit d2acb89f0b243c9313266f4cf959db4f37935db8, reversing
changes made to 2c401dba0aefc1a9a124c1ba42f5f6c2cc7744f1.

* fix bug

* delete request for topic info

* 把缩略图改成原图

* 添加exclude过滤

* fix md
2018-05-23 14:23:03 +08:00
Liu 0e258bf14d app: use JSON Feed as json format (#179) 2018-05-22 23:18:35 +08:00
DIYgod 88b58a0b80
app: support json format output 2018-05-22 18:53:43 +08:00
阿卡琳 93ff5c61c4 feat(template): add atom.art (#167)
* feat(template): add atom.art

* docs(template): add atom.art

* Update template.js
2018-05-21 14:15:21 +08:00
DIYgod 108f4bf0ce
app: remove empty password 2018-05-18 14:59:04 +08:00
DIYgod 405c2bfd12
app: unify cache set to seconds value 2018-05-18 11:30:29 +08:00
DIYgod c893d1ad17
app: expose cache function to koa context 2018-05-18 01:31:51 +08:00
DIYgod 005670acee
app: debug: add hot ips 2018-05-17 15:48:35 +08:00
DIYgod 77014458d0
app: try to get real client ip 2018-05-17 15:31:50 +08:00
DIYgod 3d57e5ca75
app: debug: add hot routes 2018-05-17 15:01:45 +08:00
DIYgod a96dd28d0b
app: debug info 2018-05-17 12:22:52 +08:00
さくら 49de384d2e feat: add prettier and commit hooks (#144)
* feat: add prettier and commit hooks

* style(*): prettier format

* fix(eslint): parsing error: Unexpected token ...

* style(eslint): eslint --fix

* style(bilibili): fix `no-undef` and `no-unused-vars`

* style(jiandan): fix eqeqeq

* style(pixiv): disable `no-constant-condition` rule for eslint

* fix(pixiv): use template string

* style(toutiao): remove unused variables

* style(weibo): use `forEach` instead of `map`

The array has no return value, you should use `forEach` instead of `map`

* chore(hooks): add eslint hooks

* chore(hooks): switch from husky to yorkie

* style(zhihu): prettier format

* style(docs): fix vuepress custom container

https://vuepress.vuejs.org/guide/markdown.html#custom-containers

* chore(prettier): set a more reasonable `printWidth` value

* style(*): better prettier format
2018-05-17 10:52:29 +08:00
DIYgod 16c32f7824
app: fix redis cache 2018-05-16 01:17:06 +08:00
DIYgod 36ad5f2415
app: welcome page 2018-05-15 01:55:19 +08:00
DIYgod 1fb172045c
generate template after filter for a better performance 2018-05-11 18:50:41 +08:00