nodebb-plugin-pdf-secure2 1.3.2 → 1.3.4

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/library.js CHANGED
@@ -10,7 +10,6 @@ const controllers = require('./lib/controllers');
10
10
  const nonceStore = require('./lib/nonce-store');
11
11
  const pdfHandler = require('./lib/pdf-handler');
12
12
  const geminiChat = require('./lib/gemini-chat');
13
- const topics = require.main.require('./src/topics');
14
13
 
15
14
  const plugin = {};
16
15
 
@@ -230,9 +229,8 @@ plugin.filterMetaTags = async (hookData) => {
230
229
  return hookData;
231
230
  };
232
231
 
233
- // Inject allowed categories into client-side config
232
+ // Inject plugin config into client-side
234
233
  plugin.filterConfig = async function (data) {
235
- data.config.pdfSecureCategories = pluginSettings.allowedCategories || '';
236
234
  return data;
237
235
  };
238
236
 
@@ -243,19 +241,6 @@ plugin.transformPdfLinks = async (data) => {
243
241
  return data;
244
242
  }
245
243
 
246
- // Category check — only transform in allowed categories
247
- const allowedStr = pluginSettings.allowedCategories || '';
248
- const allowed = allowedStr.split(',').map(s => s.trim()).filter(Boolean);
249
- if (allowed.length > 0 && data.postData.tid) {
250
- let cid = data.postData.cid;
251
- if (!cid) {
252
- cid = await topics.getTopicField(data.postData.tid, 'cid');
253
- }
254
- if (cid && !allowed.includes(String(cid))) {
255
- return data;
256
- }
257
- }
258
-
259
244
  // Regex to match PDF links: <a href="...xxx.pdf">text</a>
260
245
  // Captures: full URL path, filename, link text
261
246
  const pdfLinkRegex = /<a\s+[^>]*href=["']([^"']*\/([^"'\/]+\.pdf))["'][^>]*>([^<]*)<\/a>/gi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-pdf-secure2",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Secure PDF viewer plugin for NodeBB - prevents downloading, enables canvas-only rendering with Premium group support",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -283,15 +283,6 @@
283
283
  }
284
284
 
285
285
  function interceptPdfLinks() {
286
- // Category check — only intercept in allowed categories
287
- var allowedCats = (config.pdfSecureCategories || '').split(',').filter(Boolean);
288
- if (allowedCats.length > 0) {
289
- var currentCid = ajaxify && ajaxify.data && String(ajaxify.data.cid || '');
290
- if (currentCid && !allowedCats.includes(currentCid)) {
291
- return;
292
- }
293
- }
294
-
295
286
  var postContents = document.querySelectorAll('[component="post/content"]');
296
287
 
297
288
  postContents.forEach(function (content) {