vpndetection-next 2.0.9 → 2.1.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 +13 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,14 +13,14 @@ It classifies the visitor behind each request — VPN, residential proxy, Tor, h
|
|
|
13
13
|
npm install vpndetection-next
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Requires Node.js 22 or newer and Next.js 15 or newer.
|
|
16
|
+
Requires Node.js 22 or newer and Next.js 15 or newer. The proxy runs on the Node.js runtime and, on Next 15, on the Edge runtime too.
|
|
17
17
|
|
|
18
18
|
You need an API key. Create one in the [console](https://app.vpndetection.io); the free tier's allowance is counted per source address, and a deployment is a single source address, so a key is what makes this usable in production rather than optional.
|
|
19
19
|
|
|
20
20
|
Next 16 renamed the file convention from `middleware.ts` to `proxy.ts`, and the export from `middleware` to `proxy`. Both work on 16 — `middleware.ts` logs a deprecation — so use whichever your version supports.
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
-
// proxy.ts
|
|
23
|
+
// proxy.ts
|
|
24
24
|
import { createProxy } from 'vpndetection-next';
|
|
25
25
|
|
|
26
26
|
export const proxy = createProxy({ apiKey: process.env.VPNDETECTION_API_KEY });
|
|
@@ -28,6 +28,17 @@ export const proxy = createProxy({ apiKey: process.env.VPNDETECTION_API_KEY });
|
|
|
28
28
|
export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'] };
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
On Next 15 the file is `middleware.ts`, and it runs on the Edge runtime unless its `config` asks for `runtime: 'nodejs'`, which is stable from 15.5. Either works:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// middleware.ts, on Next 15
|
|
35
|
+
import { createProxy } from 'vpndetection-next';
|
|
36
|
+
|
|
37
|
+
export const middleware = createProxy({ apiKey: process.env.VPNDETECTION_API_KEY });
|
|
38
|
+
|
|
39
|
+
export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'] };
|
|
40
|
+
```
|
|
41
|
+
|
|
31
42
|
Then read the answer anywhere downstream:
|
|
32
43
|
|
|
33
44
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vpndetection-next",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Official Next.js proxy/middleware for the VPNDetection API. Detect VPNs, proxies, Tor, hosting and CDN visitors on every request.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"node": ">=22"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"vpndetection": "^5.
|
|
47
|
+
"vpndetection": "^5.5.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"next": ">=15"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@mslmio/eslint-config": "^1.1.0",
|
|
54
54
|
"@types/node": "^26.2.0",
|
|
55
55
|
"eslint": "^10.10.0",
|
|
56
|
-
"next": "16.3.
|
|
56
|
+
"next": "16.3.8",
|
|
57
57
|
"react": "19.2.0",
|
|
58
58
|
"typescript": "^6.0.3"
|
|
59
59
|
},
|