better-auth-studio 1.0.79-beta.5 → 1.0.79-beta.51
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 +10 -0
- package/dist/adapters/elysia.d.ts +7 -0
- package/dist/adapters/elysia.d.ts.map +1 -0
- package/dist/adapters/elysia.js +101 -0
- package/dist/adapters/elysia.js.map +1 -0
- package/dist/adapters/hono.d.ts +7 -0
- package/dist/adapters/hono.d.ts.map +1 -0
- package/dist/adapters/hono.js +78 -0
- package/dist/adapters/hono.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +28 -6
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/core/handler.d.ts.map +1 -1
- package/dist/core/handler.js +184 -57
- package/dist/core/handler.js.map +1 -1
- package/dist/data.d.ts +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +3 -7
- package/dist/data.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/public/assets/main-BFTT3mZM.js +1150 -0
- package/dist/public/assets/main-BjWPiv1k.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +758 -150
- package/dist/routes.js.map +1 -1
- package/dist/studio.d.ts.map +1 -1
- package/dist/studio.js +15 -2
- package/dist/studio.js.map +1 -1
- package/package.json +10 -7
- package/public/assets/main-BFTT3mZM.js +1150 -0
- package/public/assets/main-BjWPiv1k.css +1 -0
- package/public/favicon.svg +6 -0
- package/public/index.html +14 -0
- package/public/logo.png +0 -0
- package/public/vite.svg +5 -0
- package/scripts/download-geolite2.js +35 -0
- package/scripts/generate-default-db.js +462 -0
- package/scripts/postinstall.js +96 -0
- package/data/GeoLite2-City.mmdb +0 -0
- package/data/GeoLite2-City.tar.gz +0 -1
- package/dist/public/assets/main-3NIBCudD.js +0 -1155
- package/dist/public/assets/main-DbXDm13A.css +0 -1
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
|
|
6
|
+
// Comprehensive IP ranges covering most of the internet
|
|
7
|
+
const IP_RANGES = [
|
|
8
|
+
// North America
|
|
9
|
+
{
|
|
10
|
+
country: 'United States',
|
|
11
|
+
countryCode: 'US',
|
|
12
|
+
city: 'New York',
|
|
13
|
+
region: 'New York',
|
|
14
|
+
ranges: [
|
|
15
|
+
{ min: '8.0.0.0', max: '8.255.255.255' },
|
|
16
|
+
{ min: '24.0.0.0', max: '24.255.255.255' },
|
|
17
|
+
{ min: '32.0.0.0', max: '32.255.255.255' },
|
|
18
|
+
{ min: '40.0.0.0', max: '40.255.255.255' },
|
|
19
|
+
{ min: '50.0.0.0', max: '50.255.255.255' },
|
|
20
|
+
{ min: '64.0.0.0', max: '64.255.255.255' },
|
|
21
|
+
{ min: '66.0.0.0', max: '66.255.255.255' },
|
|
22
|
+
{ min: '68.0.0.0', max: '68.255.255.255' },
|
|
23
|
+
{ min: '70.0.0.0', max: '70.255.255.255' },
|
|
24
|
+
{ min: '72.0.0.0', max: '72.255.255.255' },
|
|
25
|
+
{ min: '74.0.0.0', max: '74.255.255.255' },
|
|
26
|
+
{ min: '76.0.0.0', max: '76.255.255.255' },
|
|
27
|
+
{ min: '98.0.0.0', max: '98.255.255.255' },
|
|
28
|
+
{ min: '104.0.0.0', max: '104.255.255.255' },
|
|
29
|
+
{ min: '108.0.0.0', max: '108.255.255.255' },
|
|
30
|
+
{ min: '173.0.0.0', max: '173.255.255.255' },
|
|
31
|
+
{ min: '174.0.0.0', max: '174.255.255.255' },
|
|
32
|
+
{ min: '184.0.0.0', max: '184.255.255.255' },
|
|
33
|
+
{ min: '192.0.0.0', max: '192.255.255.255' },
|
|
34
|
+
{ min: '198.0.0.0', max: '198.255.255.255' },
|
|
35
|
+
{ min: '204.0.0.0', max: '204.255.255.255' },
|
|
36
|
+
{ min: '208.0.0.0', max: '208.255.255.255' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
country: 'Canada',
|
|
41
|
+
countryCode: 'CA',
|
|
42
|
+
city: 'Toronto',
|
|
43
|
+
region: 'Ontario',
|
|
44
|
+
ranges: [
|
|
45
|
+
{ min: '24.0.0.0', max: '24.255.255.255' },
|
|
46
|
+
{ min: '70.0.0.0', max: '70.255.255.255' },
|
|
47
|
+
{ min: '142.0.0.0', max: '142.255.255.255' },
|
|
48
|
+
{ min: '162.0.0.0', max: '162.255.255.255' },
|
|
49
|
+
{ min: '174.0.0.0', max: '174.255.255.255' },
|
|
50
|
+
{ min: '184.0.0.0', max: '184.255.255.255' },
|
|
51
|
+
{ min: '199.0.0.0', max: '199.255.255.255' },
|
|
52
|
+
{ min: '205.0.0.0', max: '205.255.255.255' },
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
// Europe
|
|
57
|
+
{
|
|
58
|
+
country: 'United Kingdom',
|
|
59
|
+
countryCode: 'GB',
|
|
60
|
+
city: 'London',
|
|
61
|
+
region: 'England',
|
|
62
|
+
ranges: [
|
|
63
|
+
{ min: '2.0.0.0', max: '2.255.255.255' },
|
|
64
|
+
{ min: '5.0.0.0', max: '5.255.255.255' },
|
|
65
|
+
{ min: '25.0.0.0', max: '25.255.255.255' },
|
|
66
|
+
{ min: '31.0.0.0', max: '31.255.255.255' },
|
|
67
|
+
{ min: '46.0.0.0', max: '46.255.255.255' },
|
|
68
|
+
{ min: '51.0.0.0', max: '51.255.255.255' },
|
|
69
|
+
{ min: '77.0.0.0', max: '77.255.255.255' },
|
|
70
|
+
{ min: '80.0.0.0', max: '80.255.255.255' },
|
|
71
|
+
{ min: '81.0.0.0', max: '81.255.255.255' },
|
|
72
|
+
{ min: '82.0.0.0', max: '82.255.255.255' },
|
|
73
|
+
{ min: '86.0.0.0', max: '86.255.255.255' },
|
|
74
|
+
{ min: '87.0.0.0', max: '87.255.255.255' },
|
|
75
|
+
{ min: '88.0.0.0', max: '88.255.255.255' },
|
|
76
|
+
{ min: '89.0.0.0', max: '89.255.255.255' },
|
|
77
|
+
{ min: '90.0.0.0', max: '90.255.255.255' },
|
|
78
|
+
{ min: '91.0.0.0', max: '91.255.255.255' },
|
|
79
|
+
{ min: '92.0.0.0', max: '92.255.255.255' },
|
|
80
|
+
{ min: '93.0.0.0', max: '93.255.255.255' },
|
|
81
|
+
{ min: '94.0.0.0', max: '94.255.255.255' },
|
|
82
|
+
{ min: '95.0.0.0', max: '95.255.255.255' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
country: 'Germany',
|
|
87
|
+
countryCode: 'DE',
|
|
88
|
+
city: 'Berlin',
|
|
89
|
+
region: 'Berlin',
|
|
90
|
+
ranges: [
|
|
91
|
+
{ min: '46.0.0.0', max: '46.255.255.255' },
|
|
92
|
+
{ min: '62.0.0.0', max: '62.255.255.255' },
|
|
93
|
+
{ min: '78.0.0.0', max: '78.255.255.255' },
|
|
94
|
+
{ min: '80.0.0.0', max: '80.255.255.255' },
|
|
95
|
+
{ min: '85.0.0.0', max: '85.255.255.255' },
|
|
96
|
+
{ min: '88.0.0.0', max: '88.255.255.255' },
|
|
97
|
+
{ min: '91.0.0.0', max: '91.255.255.255' },
|
|
98
|
+
{ min: '134.0.0.0', max: '134.255.255.255' },
|
|
99
|
+
{ min: '136.0.0.0', max: '136.255.255.255' },
|
|
100
|
+
{ min: '141.0.0.0', max: '141.255.255.255' },
|
|
101
|
+
{ min: '145.0.0.0', max: '145.255.255.255' },
|
|
102
|
+
{ min: '149.0.0.0', max: '149.255.255.255' },
|
|
103
|
+
{ min: '178.0.0.0', max: '178.255.255.255' },
|
|
104
|
+
{ min: '188.0.0.0', max: '188.255.255.255' },
|
|
105
|
+
{ min: '195.0.0.0', max: '195.255.255.255' },
|
|
106
|
+
{ min: '212.0.0.0', max: '212.255.255.255' },
|
|
107
|
+
{ min: '217.0.0.0', max: '217.255.255.255' },
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
country: 'France',
|
|
112
|
+
countryCode: 'FR',
|
|
113
|
+
city: 'Paris',
|
|
114
|
+
region: 'Île-de-France',
|
|
115
|
+
ranges: [
|
|
116
|
+
{ min: '37.0.0.0', max: '37.255.255.255' },
|
|
117
|
+
{ min: '62.0.0.0', max: '62.255.255.255' },
|
|
118
|
+
{ min: '78.0.0.0', max: '78.255.255.255' },
|
|
119
|
+
{ min: '80.0.0.0', max: '80.255.255.255' },
|
|
120
|
+
{ min: '81.0.0.0', max: '81.255.255.255' },
|
|
121
|
+
{ min: '82.0.0.0', max: '82.255.255.255' },
|
|
122
|
+
{ min: '83.0.0.0', max: '83.255.255.255' },
|
|
123
|
+
{ min: '84.0.0.0', max: '84.255.255.255' },
|
|
124
|
+
{ min: '85.0.0.0', max: '85.255.255.255' },
|
|
125
|
+
{ min: '86.0.0.0', max: '86.255.255.255' },
|
|
126
|
+
{ min: '87.0.0.0', max: '87.255.255.255' },
|
|
127
|
+
{ min: '88.0.0.0', max: '88.255.255.255' },
|
|
128
|
+
{ min: '89.0.0.0', max: '89.255.255.255' },
|
|
129
|
+
{ min: '90.0.0.0', max: '90.255.255.255' },
|
|
130
|
+
{ min: '91.0.0.0', max: '91.255.255.255' },
|
|
131
|
+
{ min: '92.0.0.0', max: '92.255.255.255' },
|
|
132
|
+
{ min: '93.0.0.0', max: '93.255.255.255' },
|
|
133
|
+
{ min: '94.0.0.0', max: '94.255.255.255' },
|
|
134
|
+
{ min: '95.0.0.0', max: '95.255.255.255' },
|
|
135
|
+
{ min: '109.0.0.0', max: '109.255.255.255' },
|
|
136
|
+
{ min: '134.0.0.0', max: '134.255.255.255' },
|
|
137
|
+
{ min: '136.0.0.0', max: '136.255.255.255' },
|
|
138
|
+
{ min: '141.0.0.0', max: '141.255.255.255' },
|
|
139
|
+
{ min: '145.0.0.0', max: '145.255.255.255' },
|
|
140
|
+
{ min: '149.0.0.0', max: '149.255.255.255' },
|
|
141
|
+
{ min: '178.0.0.0', max: '178.255.255.255' },
|
|
142
|
+
{ min: '188.0.0.0', max: '188.255.255.255' },
|
|
143
|
+
{ min: '195.0.0.0', max: '195.255.255.255' },
|
|
144
|
+
{ min: '212.0.0.0', max: '212.255.255.255' },
|
|
145
|
+
{ min: '217.0.0.0', max: '217.255.255.255' },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
// Asia
|
|
150
|
+
{
|
|
151
|
+
country: 'Japan',
|
|
152
|
+
countryCode: 'JP',
|
|
153
|
+
city: 'Tokyo',
|
|
154
|
+
region: 'Tokyo',
|
|
155
|
+
ranges: [
|
|
156
|
+
{ min: '126.0.0.0', max: '126.255.255.255' },
|
|
157
|
+
{ min: '210.0.0.0', max: '210.255.255.255' },
|
|
158
|
+
{ min: '218.0.0.0', max: '218.255.255.255' },
|
|
159
|
+
{ min: '219.0.0.0', max: '219.255.255.255' },
|
|
160
|
+
{ min: '220.0.0.0', max: '220.255.255.255' },
|
|
161
|
+
{ min: '221.0.0.0', max: '221.255.255.255' },
|
|
162
|
+
{ min: '222.0.0.0', max: '222.255.255.255' },
|
|
163
|
+
{ min: '223.0.0.0', max: '223.255.255.255' },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
country: 'China',
|
|
168
|
+
countryCode: 'CN',
|
|
169
|
+
city: 'Beijing',
|
|
170
|
+
region: 'Beijing',
|
|
171
|
+
ranges: [
|
|
172
|
+
{ min: '1.0.0.0', max: '1.255.255.255' },
|
|
173
|
+
{ min: '14.0.0.0', max: '14.255.255.255' },
|
|
174
|
+
{ min: '27.0.0.0', max: '27.255.255.255' },
|
|
175
|
+
{ min: '36.0.0.0', max: '36.255.255.255' },
|
|
176
|
+
{ min: '39.0.0.0', max: '39.255.255.255' },
|
|
177
|
+
{ min: '42.0.0.0', max: '42.255.255.255' },
|
|
178
|
+
{ min: '49.0.0.0', max: '49.255.255.255' },
|
|
179
|
+
{ min: '58.0.0.0', max: '58.255.255.255' },
|
|
180
|
+
{ min: '59.0.0.0', max: '59.255.255.255' },
|
|
181
|
+
{ min: '60.0.0.0', max: '60.255.255.255' },
|
|
182
|
+
{ min: '61.0.0.0', max: '61.255.255.255' },
|
|
183
|
+
{ min: '101.0.0.0', max: '101.255.255.255' },
|
|
184
|
+
{ min: '103.0.0.0', max: '103.255.255.255' },
|
|
185
|
+
{ min: '106.0.0.0', max: '106.255.255.255' },
|
|
186
|
+
{ min: '110.0.0.0', max: '110.255.255.255' },
|
|
187
|
+
{ min: '111.0.0.0', max: '111.255.255.255' },
|
|
188
|
+
{ min: '112.0.0.0', max: '112.255.255.255' },
|
|
189
|
+
{ min: '113.0.0.0', max: '113.255.255.255' },
|
|
190
|
+
{ min: '114.0.0.0', max: '114.255.255.255' },
|
|
191
|
+
{ min: '115.0.0.0', max: '115.255.255.255' },
|
|
192
|
+
{ min: '116.0.0.0', max: '116.255.255.255' },
|
|
193
|
+
{ min: '117.0.0.0', max: '117.255.255.255' },
|
|
194
|
+
{ min: '118.0.0.0', max: '118.255.255.255' },
|
|
195
|
+
{ min: '119.0.0.0', max: '119.255.255.255' },
|
|
196
|
+
{ min: '120.0.0.0', max: '120.255.255.255' },
|
|
197
|
+
{ min: '121.0.0.0', max: '121.255.255.255' },
|
|
198
|
+
{ min: '122.0.0.0', max: '122.255.255.255' },
|
|
199
|
+
{ min: '123.0.0.0', max: '123.255.255.255' },
|
|
200
|
+
{ min: '124.0.0.0', max: '124.255.255.255' },
|
|
201
|
+
{ min: '125.0.0.0', max: '125.255.255.255' },
|
|
202
|
+
{ min: '171.0.0.0', max: '171.255.255.255' },
|
|
203
|
+
{ min: '175.0.0.0', max: '175.255.255.255' },
|
|
204
|
+
{ min: '180.0.0.0', max: '180.255.255.255' },
|
|
205
|
+
{ min: '182.0.0.0', max: '182.255.255.255' },
|
|
206
|
+
{ min: '183.0.0.0', max: '183.255.255.255' },
|
|
207
|
+
{ min: '202.0.0.0', max: '202.255.255.255' },
|
|
208
|
+
{ min: '203.0.0.0', max: '203.255.255.255' },
|
|
209
|
+
{ min: '210.0.0.0', max: '210.255.255.255' },
|
|
210
|
+
{ min: '211.0.0.0', max: '211.255.255.255' },
|
|
211
|
+
{ min: '218.0.0.0', max: '218.255.255.255' },
|
|
212
|
+
{ min: '219.0.0.0', max: '219.255.255.255' },
|
|
213
|
+
{ min: '220.0.0.0', max: '220.255.255.255' },
|
|
214
|
+
{ min: '221.0.0.0', max: '221.255.255.255' },
|
|
215
|
+
{ min: '222.0.0.0', max: '222.255.255.255' },
|
|
216
|
+
{ min: '223.0.0.0', max: '223.255.255.255' },
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
country: 'India',
|
|
221
|
+
countryCode: 'IN',
|
|
222
|
+
city: 'Mumbai',
|
|
223
|
+
region: 'Maharashtra',
|
|
224
|
+
ranges: [
|
|
225
|
+
{ min: '103.0.0.0', max: '103.255.255.255' },
|
|
226
|
+
{ min: '117.0.0.0', max: '117.255.255.255' },
|
|
227
|
+
{ min: '122.0.0.0', max: '122.255.255.255' },
|
|
228
|
+
{ min: '180.0.0.0', max: '180.255.255.255' },
|
|
229
|
+
{ min: '182.0.0.0', max: '182.255.255.255' },
|
|
230
|
+
{ min: '183.0.0.0', max: '183.255.255.255' },
|
|
231
|
+
{ min: '202.0.0.0', max: '202.255.255.255' },
|
|
232
|
+
{ min: '203.0.0.0', max: '203.255.255.255' },
|
|
233
|
+
{ min: '210.0.0.0', max: '210.255.255.255' },
|
|
234
|
+
{ min: '211.0.0.0', max: '211.255.255.255' },
|
|
235
|
+
{ min: '218.0.0.0', max: '218.255.255.255' },
|
|
236
|
+
{ min: '219.0.0.0', max: '219.255.255.255' },
|
|
237
|
+
{ min: '220.0.0.0', max: '220.255.255.255' },
|
|
238
|
+
{ min: '221.0.0.0', max: '221.255.255.255' },
|
|
239
|
+
{ min: '222.0.0.0', max: '222.255.255.255' },
|
|
240
|
+
{ min: '223.0.0.0', max: '223.255.255.255' },
|
|
241
|
+
],
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
// Oceania
|
|
245
|
+
{
|
|
246
|
+
country: 'Australia',
|
|
247
|
+
countryCode: 'AU',
|
|
248
|
+
city: 'Sydney',
|
|
249
|
+
region: 'New South Wales',
|
|
250
|
+
ranges: [
|
|
251
|
+
{ min: '1.0.0.0', max: '1.255.255.255' },
|
|
252
|
+
{ min: '14.0.0.0', max: '14.255.255.255' },
|
|
253
|
+
{ min: '27.0.0.0', max: '27.255.255.255' },
|
|
254
|
+
{ min: '36.0.0.0', max: '36.255.255.255' },
|
|
255
|
+
{ min: '39.0.0.0', max: '39.255.255.255' },
|
|
256
|
+
{ min: '42.0.0.0', max: '42.255.255.255' },
|
|
257
|
+
{ min: '49.0.0.0', max: '49.255.255.255' },
|
|
258
|
+
{ min: '58.0.0.0', max: '58.255.255.255' },
|
|
259
|
+
{ min: '59.0.0.0', max: '59.255.255.255' },
|
|
260
|
+
{ min: '60.0.0.0', max: '60.255.255.255' },
|
|
261
|
+
{ min: '61.0.0.0', max: '61.255.255.255' },
|
|
262
|
+
{ min: '101.0.0.0', max: '101.255.255.255' },
|
|
263
|
+
{ min: '103.0.0.0', max: '103.255.255.255' },
|
|
264
|
+
{ min: '106.0.0.0', max: '106.255.255.255' },
|
|
265
|
+
{ min: '110.0.0.0', max: '110.255.255.255' },
|
|
266
|
+
{ min: '111.0.0.0', max: '111.255.255.255' },
|
|
267
|
+
{ min: '112.0.0.0', max: '112.255.255.255' },
|
|
268
|
+
{ min: '113.0.0.0', max: '113.255.255.255' },
|
|
269
|
+
{ min: '114.0.0.0', max: '114.255.255.255' },
|
|
270
|
+
{ min: '115.0.0.0', max: '115.255.255.255' },
|
|
271
|
+
{ min: '116.0.0.0', max: '116.255.255.255' },
|
|
272
|
+
{ min: '117.0.0.0', max: '117.255.255.255' },
|
|
273
|
+
{ min: '118.0.0.0', max: '118.255.255.255' },
|
|
274
|
+
{ min: '119.0.0.0', max: '119.255.255.255' },
|
|
275
|
+
{ min: '120.0.0.0', max: '120.255.255.255' },
|
|
276
|
+
{ min: '121.0.0.0', max: '121.255.255.255' },
|
|
277
|
+
{ min: '122.0.0.0', max: '122.255.255.255' },
|
|
278
|
+
{ min: '123.0.0.0', max: '123.255.255.255' },
|
|
279
|
+
{ min: '124.0.0.0', max: '124.255.255.255' },
|
|
280
|
+
{ min: '125.0.0.0', max: '125.255.255.255' },
|
|
281
|
+
{ min: '171.0.0.0', max: '171.255.255.255' },
|
|
282
|
+
{ min: '175.0.0.0', max: '175.255.255.255' },
|
|
283
|
+
{ min: '180.0.0.0', max: '180.255.255.255' },
|
|
284
|
+
{ min: '182.0.0.0', max: '182.255.255.255' },
|
|
285
|
+
{ min: '183.0.0.0', max: '183.255.255.255' },
|
|
286
|
+
{ min: '202.0.0.0', max: '202.255.255.255' },
|
|
287
|
+
{ min: '203.0.0.0', max: '203.255.255.255' },
|
|
288
|
+
{ min: '210.0.0.0', max: '210.255.255.255' },
|
|
289
|
+
{ min: '211.0.0.0', max: '211.255.255.255' },
|
|
290
|
+
{ min: '218.0.0.0', max: '218.255.255.255' },
|
|
291
|
+
{ min: '219.0.0.0', max: '219.255.255.255' },
|
|
292
|
+
{ min: '220.0.0.0', max: '220.255.255.255' },
|
|
293
|
+
{ min: '221.0.0.0', max: '221.255.255.255' },
|
|
294
|
+
{ min: '222.0.0.0', max: '222.255.255.255' },
|
|
295
|
+
{ min: '223.0.0.0', max: '223.255.255.255' },
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
// South America
|
|
300
|
+
{
|
|
301
|
+
country: 'Brazil',
|
|
302
|
+
countryCode: 'BR',
|
|
303
|
+
city: 'São Paulo',
|
|
304
|
+
region: 'São Paulo',
|
|
305
|
+
ranges: [
|
|
306
|
+
{ min: '177.0.0.0', max: '177.255.255.255' },
|
|
307
|
+
{ min: '201.0.0.0', max: '201.255.255.255' },
|
|
308
|
+
{ min: '186.0.0.0', max: '186.255.255.255' },
|
|
309
|
+
{ min: '189.0.0.0', max: '189.255.255.255' },
|
|
310
|
+
{ min: '200.0.0.0', max: '200.255.255.255' },
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
|
|
314
|
+
// Africa
|
|
315
|
+
{
|
|
316
|
+
country: 'South Africa',
|
|
317
|
+
countryCode: 'ZA',
|
|
318
|
+
city: 'Cape Town',
|
|
319
|
+
region: 'Western Cape',
|
|
320
|
+
ranges: [
|
|
321
|
+
{ min: '41.0.0.0', max: '41.255.255.255' },
|
|
322
|
+
{ min: '102.0.0.0', max: '102.255.255.255' },
|
|
323
|
+
{ min: '105.0.0.0', max: '105.255.255.255' },
|
|
324
|
+
{ min: '196.0.0.0', max: '196.255.255.255' },
|
|
325
|
+
{ min: '197.0.0.0', max: '197.255.255.255' },
|
|
326
|
+
],
|
|
327
|
+
},
|
|
328
|
+
|
|
329
|
+
// Russia
|
|
330
|
+
{
|
|
331
|
+
country: 'Russia',
|
|
332
|
+
countryCode: 'RU',
|
|
333
|
+
city: 'Moscow',
|
|
334
|
+
region: 'Moscow',
|
|
335
|
+
ranges: [
|
|
336
|
+
{ min: '5.0.0.0', max: '5.255.255.255' },
|
|
337
|
+
{ min: '31.0.0.0', max: '31.255.255.255' },
|
|
338
|
+
{ min: '37.0.0.0', max: '37.255.255.255' },
|
|
339
|
+
{ min: '46.0.0.0', max: '46.255.255.255' },
|
|
340
|
+
{ min: '62.0.0.0', max: '62.255.255.255' },
|
|
341
|
+
{ min: '77.0.0.0', max: '77.255.255.255' },
|
|
342
|
+
{ min: '78.0.0.0', max: '78.255.255.255' },
|
|
343
|
+
{ min: '80.0.0.0', max: '80.255.255.255' },
|
|
344
|
+
{ min: '81.0.0.0', max: '81.255.255.255' },
|
|
345
|
+
{ min: '82.0.0.0', max: '82.255.255.255' },
|
|
346
|
+
{ min: '83.0.0.0', max: '83.255.255.255' },
|
|
347
|
+
{ min: '84.0.0.0', max: '84.255.255.255' },
|
|
348
|
+
{ min: '85.0.0.0', max: '85.255.255.255' },
|
|
349
|
+
{ min: '86.0.0.0', max: '86.255.255.255' },
|
|
350
|
+
{ min: '87.0.0.0', max: '87.255.255.255' },
|
|
351
|
+
{ min: '88.0.0.0', max: '88.255.255.255' },
|
|
352
|
+
{ min: '89.0.0.0', max: '89.255.255.255' },
|
|
353
|
+
{ min: '90.0.0.0', max: '90.255.255.255' },
|
|
354
|
+
{ min: '91.0.0.0', max: '91.255.255.255' },
|
|
355
|
+
{ min: '92.0.0.0', max: '92.255.255.255' },
|
|
356
|
+
{ min: '93.0.0.0', max: '93.255.255.255' },
|
|
357
|
+
{ min: '94.0.0.0', max: '94.255.255.255' },
|
|
358
|
+
{ min: '95.0.0.0', max: '95.255.255.255' },
|
|
359
|
+
{ min: '109.0.0.0', max: '109.255.255.255' },
|
|
360
|
+
{ min: '134.0.0.0', max: '134.255.255.255' },
|
|
361
|
+
{ min: '136.0.0.0', max: '136.255.255.255' },
|
|
362
|
+
{ min: '141.0.0.0', max: '141.255.255.255' },
|
|
363
|
+
{ min: '145.0.0.0', max: '145.255.255.255' },
|
|
364
|
+
{ min: '149.0.0.0', max: '149.255.255.255' },
|
|
365
|
+
{ min: '178.0.0.0', max: '178.255.255.255' },
|
|
366
|
+
{ min: '188.0.0.0', max: '188.255.255.255' },
|
|
367
|
+
{ min: '195.0.0.0', max: '195.255.255.255' },
|
|
368
|
+
{ min: '212.0.0.0', max: '212.255.255.255' },
|
|
369
|
+
{ min: '217.0.0.0', max: '217.255.255.255' },
|
|
370
|
+
],
|
|
371
|
+
},
|
|
372
|
+
];
|
|
373
|
+
|
|
374
|
+
// Convert IP to number for range checking
|
|
375
|
+
function ipToNumber(ip) {
|
|
376
|
+
return ip.split('.').reduce((acc, part) => (acc << 8) + parseInt(part, 10), 0) >>> 0;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Check if IP is in range
|
|
380
|
+
function isIPInRange(ip, minIP, maxIP) {
|
|
381
|
+
const ipNum = ipToNumber(ip);
|
|
382
|
+
const minNum = ipToNumber(minIP);
|
|
383
|
+
const maxNum = ipToNumber(maxIP);
|
|
384
|
+
return ipNum >= minNum && ipNum <= maxNum;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// Find location for IP
|
|
388
|
+
function findLocationForIP(ip) {
|
|
389
|
+
for (const countryData of IP_RANGES) {
|
|
390
|
+
for (const range of countryData.ranges) {
|
|
391
|
+
if (isIPInRange(ip, range.min, range.max)) {
|
|
392
|
+
return {
|
|
393
|
+
country: countryData.country,
|
|
394
|
+
countryCode: countryData.countryCode,
|
|
395
|
+
city: countryData.city,
|
|
396
|
+
region: countryData.region,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Default fallback
|
|
403
|
+
return {
|
|
404
|
+
country: 'Unknown',
|
|
405
|
+
countryCode: '',
|
|
406
|
+
city: 'Unknown',
|
|
407
|
+
region: 'Unknown',
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Generate a simple database file (JSON format for now)
|
|
412
|
+
function generateDatabase() {
|
|
413
|
+
const database = {
|
|
414
|
+
version: '1.0.0',
|
|
415
|
+
generated: new Date().toISOString(),
|
|
416
|
+
description: 'Default IP geolocation database for Better Auth Studio',
|
|
417
|
+
coverage: 'Major IP ranges worldwide',
|
|
418
|
+
ranges: IP_RANGES,
|
|
419
|
+
totalRanges: IP_RANGES.reduce((sum, country) => sum + country.ranges.length, 0),
|
|
420
|
+
countries: IP_RANGES.length,
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const outputPath = path.join(__dirname, '..', 'data', 'default-geo.json');
|
|
424
|
+
const outputDir = path.dirname(outputPath);
|
|
425
|
+
|
|
426
|
+
// Create directory if it doesn't exist
|
|
427
|
+
if (!fs.existsSync(outputDir)) {
|
|
428
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
fs.writeFileSync(outputPath, JSON.stringify(database, null, 2));
|
|
432
|
+
|
|
433
|
+
return outputPath;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Test the database with some sample IPs
|
|
437
|
+
function testDatabase() {
|
|
438
|
+
const testIPs = [
|
|
439
|
+
'8.8.8.8', // Google DNS (US)
|
|
440
|
+
'1.1.1.1', // Cloudflare (US)
|
|
441
|
+
'208.67.222.222', // OpenDNS (US)
|
|
442
|
+
'46.4.0.1', // Germany
|
|
443
|
+
'5.5.5.5', // UK
|
|
444
|
+
'126.0.0.1', // Japan
|
|
445
|
+
'103.0.0.1', // India
|
|
446
|
+
'1.0.0.1', // Australia
|
|
447
|
+
'177.0.0.1', // Brazil
|
|
448
|
+
'41.0.0.1', // South Africa
|
|
449
|
+
];
|
|
450
|
+
|
|
451
|
+
testIPs.forEach((ip) => {
|
|
452
|
+
const _location = findLocationForIP(ip);
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// Main execution
|
|
457
|
+
if (require.main === module) {
|
|
458
|
+
generateDatabase();
|
|
459
|
+
testDatabase();
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
module.exports = { IP_RANGES, findLocationForIP, generateDatabase };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Postinstall script to ensure public directory exists
|
|
5
|
+
* This runs after npm/pnpm install to handle edge cases where
|
|
6
|
+
* the public directory isn't extracted properly (e.g., Vercel with pnpm)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = path.dirname(__filename);
|
|
15
|
+
|
|
16
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
17
|
+
const distDir = path.join(packageRoot, 'dist');
|
|
18
|
+
const publicInDist = path.join(distDir, 'public');
|
|
19
|
+
const publicInRoot = path.join(packageRoot, 'public');
|
|
20
|
+
|
|
21
|
+
console.log('[better-auth-studio] Running postinstall...');
|
|
22
|
+
console.log('[better-auth-studio] Package root:', packageRoot);
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const packageContents = fs.readdirSync(packageRoot);
|
|
26
|
+
console.log('[better-auth-studio] Package contents:', packageContents.join(', '));
|
|
27
|
+
|
|
28
|
+
if (fs.existsSync(distDir)) {
|
|
29
|
+
const distContents = fs.readdirSync(distDir);
|
|
30
|
+
console.log('[better-auth-studio] dist/ contents:', distContents.join(', '));
|
|
31
|
+
} else {
|
|
32
|
+
console.log('[better-auth-studio] dist/ directory does not exist');
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.warn('[better-auth-studio] Could not list package contents:', err.message);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Check if either public directory exists
|
|
39
|
+
const hasPublicInDist =
|
|
40
|
+
fs.existsSync(publicInDist) && fs.existsSync(path.join(publicInDist, 'index.html'));
|
|
41
|
+
const hasPublicInRoot =
|
|
42
|
+
fs.existsSync(publicInRoot) && fs.existsSync(path.join(publicInRoot, 'index.html'));
|
|
43
|
+
|
|
44
|
+
console.log('[better-auth-studio] Checking public directories...');
|
|
45
|
+
console.log('[better-auth-studio] - dist/public exists:', hasPublicInDist);
|
|
46
|
+
console.log('[better-auth-studio] - public/ exists:', hasPublicInRoot);
|
|
47
|
+
|
|
48
|
+
if (hasPublicInDist || hasPublicInRoot) {
|
|
49
|
+
console.log('[better-auth-studio] ✓ Public directory found');
|
|
50
|
+
|
|
51
|
+
// Ensure both locations have the public files for maximum compatibility
|
|
52
|
+
if (hasPublicInRoot && !hasPublicInDist) {
|
|
53
|
+
try {
|
|
54
|
+
if (!fs.existsSync(distDir)) {
|
|
55
|
+
fs.mkdirSync(distDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
copyRecursive(publicInRoot, publicInDist);
|
|
58
|
+
console.log('[better-auth-studio] ✓ Copied public/ to dist/public/');
|
|
59
|
+
} catch (err) {
|
|
60
|
+
console.warn('[better-auth-studio] Warning: Could not copy to dist/public:', err.message);
|
|
61
|
+
}
|
|
62
|
+
} else if (hasPublicInDist && !hasPublicInRoot) {
|
|
63
|
+
try {
|
|
64
|
+
copyRecursive(publicInDist, publicInRoot);
|
|
65
|
+
console.log('[better-auth-studio] ✓ Copied dist/public/ to public/');
|
|
66
|
+
} catch (err) {
|
|
67
|
+
console.warn('[better-auth-studio] Warning: Could not copy to public:', err.message);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
console.warn(
|
|
72
|
+
'[better-auth-studio] ⚠ Warning: Public directory not found. Studio UI may not work correctly.'
|
|
73
|
+
);
|
|
74
|
+
console.warn(
|
|
75
|
+
'[better-auth-studio] Please report this issue at: https://github.com/better-auth/better-auth-studio/issues'
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function copyRecursive(src, dest) {
|
|
80
|
+
if (!fs.existsSync(dest)) {
|
|
81
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
85
|
+
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
const srcPath = path.join(src, entry.name);
|
|
88
|
+
const destPath = path.join(dest, entry.name);
|
|
89
|
+
|
|
90
|
+
if (entry.isDirectory()) {
|
|
91
|
+
copyRecursive(srcPath, destPath);
|
|
92
|
+
} else {
|
|
93
|
+
fs.copyFileSync(srcPath, destPath);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
package/data/GeoLite2-City.mmdb
DELETED
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Invalid license key
|