Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "plugin.js",
"name": "nodebb-widget-rss",
"nbbpm": {
"compatibility": "^3.2.0"
"compatibility": "^4.14.0"
},
"repository": {
"type": "git",
Expand Down
15 changes: 9 additions & 6 deletions plugin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
'use strict';

const helpers = require.main.require('./src/routes/helpers');
const meta = require.main.require('./src/meta');
const meta = nodebb.require('./src/meta');
const routeHelpers = nodebb.require('./src/routes/helpers');

const rssparser = new (require('rss-parser'));
let nodebb = {};
let app;
let rss = { data: {}, updated: Math.round(new Date().getTime() / 1000) };

const updateFeed = async (force = false) => {
Expand Down Expand Up @@ -64,7 +65,7 @@ exports.filterWidgetRenderRss = async (data) => {
body += '<span class="date">' + key + '</span><br/><span>' + rss.data[key]['content'] + '</span><br/></td></tr>';
}
body += '</table>';
data.html = await nodebb.app.renderAsync('widgets/rss', { body: body, title: data.data.title });
data.html = await app.renderAsync('widgets/rss', { body: body, title: data.data.title });
return data;
};
exports.filterWidgetsGetWidgets = async (data) => {
Expand All @@ -78,7 +79,9 @@ exports.filterWidgetsGetWidgets = async (data) => {
};
exports.staticAppLoad = async (data) => {
console.log('Loading Jenkler RSS widget ' + require('./package.json').version);
helpers.setupAdminPageRoute(data.router, '/admin/plugins/rss-widget', renderAdmin);
nodebb.app = data.app;

routeHelpers.setupAdminPageRoute(data.router, '/admin/plugins/rss-widget', renderAdmin);
app = data.app;

await updateFeed(true);
};
8 changes: 4 additions & 4 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
],
"id": "nodebb-widget-rss",
"library": "plugin.js",
"modules": {
"../admin/plugins/rss-widget.js": "public/admin.js"
},
"name": "NodeBB RSS",
"templates": "templates",
"url": "https://github.com/Jenkler/nodebb-widget-rss"
"url": "https://github.com/Jenkler/nodebb-widget-rss",
"modules": {
"../admin/plugins/rss-widget.js": "public/admin.js"
}
}
2 changes: 1 addition & 1 deletion templates/widgets/rss.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

<div class="card mb-3 rss-widget-card">
<div class="card-header text-bg-info">{title}</div>
<div class="card-body">{body}</div>
<div class="card-body">{{body}}</div>
</div>