diff --git a/package.json b/package.json
index de1f35c..0576eb0 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"main": "plugin.js",
"name": "nodebb-widget-rss",
"nbbpm": {
- "compatibility": "^3.2.0"
+ "compatibility": "^4.14.0"
},
"repository": {
"type": "git",
diff --git a/plugin.js b/plugin.js
index fd0068a..086b367 100644
--- a/plugin.js
+++ b/plugin.js
@@ -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) => {
@@ -64,7 +65,7 @@ exports.filterWidgetRenderRss = async (data) => {
body += '' + key + '
' + rss.data[key]['content'] + '
';
}
body += '';
- 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) => {
@@ -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);
};
diff --git a/plugin.json b/plugin.json
index 5f91602..3a69fda 100644
--- a/plugin.json
+++ b/plugin.json
@@ -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"
+ }
}
diff --git a/templates/widgets/rss.tpl b/templates/widgets/rss.tpl
index 3010f30..8b877f9 100644
--- a/templates/widgets/rss.tpl
+++ b/templates/widgets/rss.tpl
@@ -11,5 +11,5 @@