@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 +9 -3
- package/package.json +1 -1
- package/src/index.js +1 -1
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
|
-
|
|
24
|
-
|
|
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
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
|
};
|