nodebb-plugin-onekite-calendar 2.0.69 → 2.0.70

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.
package/lib/discord.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const https = require('https');
4
4
  const { URL } = require('url');
5
- const { formatFRShort } = require('./shared');
5
+ const { formatFRShort, forumBaseUrl } = require('./shared');
6
6
 
7
7
  function isEnabled(v, defaultValue) {
8
8
  if (v === undefined || v === null || v === '') return defaultValue !== false;
@@ -53,7 +53,7 @@ function postWebhook(webhookUrl, payload) {
53
53
  }
54
54
 
55
55
  function buildReservationMessage(kind, reservation) {
56
- const calUrl = 'https://www.onekite.com/calendar';
56
+ const calUrl = forumBaseUrl() + '/calendar';
57
57
  const username = reservation && reservation.username ? String(reservation.username) : '';
58
58
  const items = (reservation && Array.isArray(reservation.itemNames) && reservation.itemNames.length)
59
59
  ? reservation.itemNames.map(String)
@@ -87,7 +87,7 @@ function buildWebhookPayload(kind, reservation) {
87
87
  ? 'Onekite • Paiement'
88
88
  : (kind === 'cancelled' ? 'Onekite • Annulation' : 'Onekite • Réservation');
89
89
 
90
- const calUrl = 'https://www.onekite.com/calendar';
90
+ const calUrl = forumBaseUrl() + '/calendar';
91
91
  const username = reservation && reservation.username ? String(reservation.username) : '';
92
92
  const items = (reservation && Array.isArray(reservation.itemNames) && reservation.itemNames.length)
93
93
  ? reservation.itemNames.map(String)
@@ -186,7 +186,7 @@ async function notifyReservationCancelled(settings, reservation) {
186
186
 
187
187
  function buildSimpleCalendarPayload(kind, label, entity, opts) {
188
188
  const options = opts || {};
189
- const calUrl = options.calUrl || 'https://www.onekite.com/calendar';
189
+ const calUrl = options.calUrl || forumBaseUrl() + '/calendar';
190
190
  const webhookUsername = options.webhookUsername || `Onekite • ${label}`;
191
191
 
192
192
  const title = kind === 'deleted' ? '❌ ' + label + ' annulé(e)' : label + ' créé(e)';
package/lib/shared.js CHANGED
@@ -44,6 +44,7 @@ function hmacSecret() {
44
44
  const s = String(nconf.get('secret') || '').trim();
45
45
  if (s) return s;
46
46
  } catch (_) { /* ignore */ }
47
+ console.warn('[calendar-onekite] nconf.secret not set — ICS URLs use weak fallback key');
47
48
  return 'calendar-onekite';
48
49
  }
49
50
 
package/lib/widgets.js CHANGED
@@ -17,8 +17,7 @@ function makeDomId() {
17
17
  }
18
18
 
19
19
  function widgetCalendarUrl() {
20
- // Per request, keep the public URL fixed (even if forum base differs)
21
- return 'https://www.onekite.com/calendar';
20
+ return forumBaseUrl() + '/calendar';
22
21
  }
23
22
 
24
23
  const widgets = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-onekite-calendar",
3
- "version": "2.0.69",
3
+ "version": "2.0.70",
4
4
  "description": "FullCalendar-based equipment reservation workflow with admin approval & HelloAsso payment for NodeBB",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "acpScripts": [
40
40
  "public/admin.js"
41
41
  ],
42
- "version": "2.0.66"
42
+ "version": "2.0.70"
43
43
  }
package/public/client.js CHANGED
@@ -1266,8 +1266,14 @@ function toDatetimeLocalValue(date) {
1266
1266
  }
1267
1267
 
1268
1268
  if (typeof FullCalendar === 'undefined') {
1269
- showAlert('error', 'FullCalendar non chargé');
1270
- return;
1269
+ const loaded = await new Promise((resolve) => {
1270
+ const start = Date.now();
1271
+ const iv = setInterval(() => {
1272
+ if (typeof FullCalendar !== 'undefined') { clearInterval(iv); resolve(true); }
1273
+ else if (Date.now() - start > 5000) { clearInterval(iv); resolve(false); }
1274
+ }, 50);
1275
+ });
1276
+ if (!loaded) { showAlert('error', 'FullCalendar non chargé'); return; }
1271
1277
  }
1272
1278
 
1273
1279
  const items = await loadItems();