@paywalls-net/filter 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -17,12 +17,18 @@ npm install @paywalls-net/filter
17
17
  ```javascript
18
18
  import { init } from '@paywalls-net/filter';
19
19
 
20
+ // Initialize the paywalls.net handler for Cloudflare
20
21
  const handleRequest = await init('cloudflare');
21
22
 
22
23
  export default {
23
- async fetch(request, env, ctx) {
24
- return handleRequest(request, env, ctx);
25
- }
24
+ async fetch(request, env, ctx) {
25
+ let pw_response = await handleRequest(request, env, ctx);
26
+ if (pw_response) {
27
+ // If the handler returns a response, return it
28
+ return pw_response;
29
+ }
30
+ return fetch(request); // Proceed to origin/CDN
31
+ }
26
32
  };
27
33
  ```
28
34
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Client SDK for integrating paywalls.net bot filtering and authorization services into your server or CDN.",
4
4
  "author": "paywalls.net",
5
5
  "license": "MIT",
6
- "version": "1.2.0",
6
+ "version": "1.2.1",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
package/src/index.js CHANGED
@@ -214,7 +214,7 @@ async function cloudflare(config = null) {
214
214
  if (authz.access === 'deny') {
215
215
  return setHeaders(authz);
216
216
  } else {
217
- console.log("Bot-like request allowed. Proceeding to origin/CDN.");
217
+ // console.log("Bot-like request allowed. Proceeding to origin/CDN.");
218
218
  }
219
219
  }
220
220
  };