nodebb-plugin-calendar-onekite 10.0.15 → 10.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/library.js +13 -2
  2. package/package.json +1 -1
package/library.js CHANGED
@@ -559,8 +559,19 @@ plugin.init = async function (params) {
559
559
  });
560
560
 
561
561
  // Admin API: get/save settings
562
- router.get('/api/admin/plugins/calendar-onekite', ensureLoggedIn, adminsOnly, async (req, res) => {
563
- const settings = await meta.settings.get(PLUGIN_NS);
562
+ // Admin API route for ajaxify: /api/admin/plugins/calendar-onekite
563
+ router.get('/api/admin/plugins/calendar-onekite', ensureLoggedIn, async (req, res, next) => {
564
+ try {
565
+ const isAdmin = await user.isAdministrator(req.uid);
566
+ if (!isAdmin) return res.status(403).json({ error: 'not-allowed' });
567
+ next();
568
+ } catch (e) {
569
+ return res.status(500).json({ error: e.message });
570
+ }
571
+ }, middleware.buildHeader, async (req, res) => {
572
+ return res.render('admin/plugins/calendar-onekite', { title: 'Calendar OneKite' });
573
+ });
574
+
564
575
  res.json(settings);
565
576
  });
566
577
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-calendar-onekite",
3
- "version": "10.0.15",
3
+ "version": "10.0.17",
4
4
  "description": "NodeBB calendar booking plugin using FullCalendar and HelloAsso checkout intents",
5
5
  "main": "library.js",
6
6
  "license": "MIT",