-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from timas130/sit/chinese-server
feat: add support for chinese server
- Loading branch information
Showing
8 changed files
with
41 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { ServerArea, ServerAreaEnum } from "@/types/ServerArea"; | ||
|
||
/** | ||
* Returns the base upstream server URL for the specified server area. | ||
* | ||
* @example | ||
* const area = ServerArea.global; | ||
* const baseUrl = getServerUrlByArea(area); // https://gmserver-api.aki-game2.net | ||
* | ||
* @param area the server area | ||
* @returns base URL for the area | ||
*/ | ||
export default function getServerUrlByArea(area: ServerAreaEnum): string { | ||
switch (area) { | ||
case ServerArea.global: | ||
return "https://gmserver-api.aki-game2.net"; | ||
case ServerArea.cn: | ||
return "https://gmserver-api.aki-game2.com"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export default function isValidConveneHistoryUrl(s: string) { | ||
const conveneHistoryUrlRegex = | ||
/^https:\/\/aki-gm-resources-oversea\.aki-game\.net\/aki\/gacha\/index\.html\#\/record\?(?=.*\bplayer_id=\w+\b)(?=.*\brecord_id=\w+\b)(?=.*\bsvr_id=\w+\b).*$/; | ||
/^https:\/\/(?:aki-gm-resources-oversea\.aki-game\.net|aki-gm-resources\.aki-game\.com)\/aki\/gacha\/index\.html\#\/record\?(?=.*\bplayer_id=\w+\b)(?=.*\brecord_id=\w+\b)(?=.*\bsvr_id=\w+\b).*$/; | ||
return conveneHistoryUrlRegex.test(s); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { z } from "zod"; | ||
|
||
export const ServerArea = { | ||
global: "global", | ||
cn: "cn", | ||
} as const; | ||
|
||
export const ServerAreaEnumSchema = z | ||
.nativeEnum(ServerArea) | ||
.default(ServerArea.global); | ||
export type ServerAreaEnum = z.infer<typeof ServerAreaEnumSchema>; |