Skip to content

Commit 5ba5ae3

Browse files
authored
fix bug (#4)
1 parent d3c61da commit 5ba5ae3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ export default {
2828
async fetch(request: Request): Promise<Response> {
2929
const path: string = new URL(request.url).pathname;
3030

31-
const continent = request.headers.get('continent')?.toLowerCase() ?? 'default';
31+
const continent: string = (request.cf?.continent as string) || 'default';
3232
let tag: string;
33-
if (continent === 'as') {
34-
const country = request.headers.get('country')?.toLowerCase() ?? 'default';
35-
if (country === 'cn') {
33+
if (continent === 'AS') {
34+
const country = request.cf?.country || 'default';
35+
if (country === 'CN') {
3636
tag = 'cn';
3737
} else {
38-
tag = continent;
38+
tag = continent.toLowerCase();
3939
}
4040
} else {
41-
tag = continent;
41+
tag = continent.toLowerCase();
4242
}
4343

4444
let r: Server | Client | undefined;

0 commit comments

Comments
 (0)