summaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-05-25 14:52:22 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-05-25 14:52:22 +0900
commit3f54fb8a2a46da9ee24c893f70c2635a5ca33f9a (patch)
treef587946eb2b5e3f9b3c22a6924b7e8cfbbf0bc28 /src/web
parent[Client] Fix bug (diff)
downloadsharkey-3f54fb8a2a46da9ee24c893f70c2635a5ca33f9a.tar.gz
sharkey-3f54fb8a2a46da9ee24c893f70c2635a5ca33f9a.tar.bz2
sharkey-3f54fb8a2a46da9ee24c893f70c2635a5ca33f9a.zip
Use external service for rss xml to json
Diffstat (limited to 'src/web')
-rw-r--r--src/web/app/desktop/tags/home-widgets/rss-reader.tag14
-rw-r--r--src/web/server.ts1
-rw-r--r--src/web/service/rss-proxy.ts15
3 files changed, 6 insertions, 24 deletions
diff --git a/src/web/app/desktop/tags/home-widgets/rss-reader.tag b/src/web/app/desktop/tags/home-widgets/rss-reader.tag
index b8cfd8bddc..9a2b2fce1f 100644
--- a/src/web/app/desktop/tags/home-widgets/rss-reader.tag
+++ b/src/web/app/desktop/tags/home-widgets/rss-reader.tag
@@ -64,8 +64,6 @@
</style>
<script>
- this.mixin('api');
-
this.url = 'http://news.yahoo.co.jp/pickup/rss.xml';
this.items = [];
this.initializing = true;
@@ -80,12 +78,12 @@
});
this.fetch = () => {
- this.api('/api:rss', {
- url: this.url
- }).then(feed => {
- this.update({
- initializing: false,
- items: feed.rss.channel.item
+ fetch(`https://api.rss2json.com/v1/api.json?rss_url=${this.url}`).then(res => {
+ res.json().then(feed => {
+ this.update({
+ initializing: false,
+ items: feed.items
+ });
});
});
};
diff --git a/src/web/server.ts b/src/web/server.ts
index d701d83b28..dde4eca5ec 100644
--- a/src/web/server.ts
+++ b/src/web/server.ts
@@ -47,7 +47,6 @@ app.use('/assets', express.static(`${__dirname}/assets`, {
* Common API
*/
app.get(/\/api:url/, require('./service/url-preview'));
-app.post(/\/api:rss/, require('./service/rss-proxy'));
/**
* Serve config
diff --git a/src/web/service/rss-proxy.ts b/src/web/service/rss-proxy.ts
deleted file mode 100644
index 6819427ff8..0000000000
--- a/src/web/service/rss-proxy.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import * as express from 'express';
-import * as request from 'request';
-import xml2json = require('xml2json');
-
-module.exports = (req: express.Request, res: express.Response) => {
- const url: string = req.body.url;
-
- request(url, (err, response, xml) => {
- if (err) {
- res.sendStatus(500);
- } else {
- res.send(xml2json.toJson(xml));
- }
- });
-};