nodebb-plugin-onekite-calendar 2.0.69 → 2.0.71

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.71",
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
@@ -169,6 +169,13 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
169
169
  .replace(/'/g, ''');
170
170
  }
171
171
 
172
+ function linkifyNotes(str) {
173
+ return escapeHtml(str).replace(
174
+ /https?:\/\/[^\s<>"']+/g,
175
+ url => `<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`
176
+ );
177
+ }
178
+
172
179
  function getCsrfToken() {
173
180
  try {
174
181
  return (
@@ -1266,8 +1273,14 @@ function toDatetimeLocalValue(date) {
1266
1273
  }
1267
1274
 
1268
1275
  if (typeof FullCalendar === 'undefined') {
1269
- showAlert('error', 'FullCalendar non chargé');
1270
- return;
1276
+ const loaded = await new Promise((resolve) => {
1277
+ const start = Date.now();
1278
+ const iv = setInterval(() => {
1279
+ if (typeof FullCalendar !== 'undefined') { clearInterval(iv); resolve(true); }
1280
+ else if (Date.now() - start > 5000) { clearInterval(iv); resolve(false); }
1281
+ }, 50);
1282
+ });
1283
+ if (!loaded) { showAlert('error', 'FullCalendar non chargé'); return; }
1271
1284
  }
1272
1285
 
1273
1286
  const items = await loadItems();
@@ -1803,7 +1816,7 @@ function toDatetimeLocalValue(date) {
1803
1816
  ${calHtml}
1804
1817
  ${participantsHtml}
1805
1818
  ${addr ? `<div class="mb-2"><strong>Adresse</strong><br>${addrHtml}</div>` : ''}
1806
- ${notes ? `<div class="mb-2"><strong>Notes</strong><br>${escapeHtml(notes).replace(/\n/g,'<br>')}</div>` : ''}
1819
+ ${notes ? `<div class="mb-2"><strong>Notes</strong><br>${linkifyNotes(notes).replace(/\n/g,'<br>')}</div>` : ''}
1807
1820
  `;
1808
1821
  const canDel = !!(p.canDeleteSpecial || canDeleteSpecial);
1809
1822
  const canEdit = !!p.canEditSpecial;
@@ -1981,7 +1994,7 @@ function toDatetimeLocalValue(date) {
1981
1994
  ${calHtml}
1982
1995
  ${participantsHtml}
1983
1996
  ${addr ? `<div class="mb-2"><strong>Adresse</strong><br>${addrHtml}</div>` : ''}
1984
- ${notes ? `<div class="mb-2"><strong>Notes</strong><br>${escapeHtml(notes).replace(/\n/g,'<br>')}</div>` : ''}
1997
+ ${notes ? `<div class="mb-2"><strong>Notes</strong><br>${linkifyNotes(notes).replace(/\n/g,'<br>')}</div>` : ''}
1985
1998
  `;
1986
1999
  const canDel = !!(p.canDeleteOuting);
1987
2000
  const canEditOuting = !!p.canEditOuting;
@@ -2154,7 +2167,7 @@ function toDatetimeLocalValue(date) {
2154
2167
  ${pickupAddress ? `${escapeHtml(pickupAddress)}<br>` : ''}
2155
2168
  ${pickupTime ? `Heure : ${escapeHtml(pickupTime)}<br>` : ''}
2156
2169
  ${hasCoords ? `<a href="${osmLink}" target="_blank" rel="noopener">Voir sur la carte</a><br>` : ''}
2157
- ${notes ? `<div class="mt-1"><strong>Notes</strong><br>${escapeHtml(notes)}</div>` : ''}
2170
+ ${notes ? `<div class="mt-1"><strong>Notes</strong><br>${linkifyNotes(notes).replace(/\n/g,'<br>')}</div>` : ''}
2158
2171
  </div>
2159
2172
  `
2160
2173
  : '';