Skip to content

Commit

Permalink
Add CN endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
blead committed Dec 27, 2023
1 parent 66ff078 commit 2cc3356
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var fetchCmd = &cobra.Command{
config.Region = wf.RegionGL
case "kr":
config.Region = wf.RegionKR
case "cn":
config.Region = wf.RegionCN
default:
log.Printf("[WARN] Unknown service region %s, using default (jp)", fetchRegion)
config.Region = wf.RegionJP
Expand All @@ -62,5 +64,5 @@ func init() {
fetchCmd.Flags().StringVarP(&fetchVersion, "version", "v", "0.0.0", "Game version of existing assets")
fetchCmd.Flags().BoolVarP(&fetchDiff, "diff-only", "d", false, "Fetch only new assets (used with --version)")
fetchCmd.Flags().IntVarP(&fetchConcurrency, "concurrency", "c", 5, "Maximum number of concurrent asset downloads")
fetchCmd.Flags().StringVarP(&fetchRegion, "region", "r", "jp", "Service region: jp, gl, kr")
fetchCmd.Flags().StringVarP(&fetchRegion, "region", "r", "jp", "Service region: jp, gl, kr, cn")
}
4 changes: 4 additions & 0 deletions pkg/wf/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
apiEndpointJP = "https://api.worldflipper.jp/latest/api/index.php/gacha/exec"
apiEndpointGL = "https://na.wdfp.kakaogames.com/latest/api/index.php/gacha/exec"
apiEndpointKR = "https://kr.wdfp.kakaogames.com/latest/api/index.php/gacha/exec"
apiEndpointCN = "https://shijtswygamegf.leiting.com/latest/api/index.php/gacha/exec"
cdnAddressGL = "http://patch.wdfp.kakaogames.com/Live/2.0.0"
cdnAddressKR = "http://patch.wdfp.kakaogames.com/Live/2.0.0"
)
Expand All @@ -48,6 +49,7 @@ const (
RegionJP ServiceRegion = iota
RegionGL
RegionKR
RegionCN
)

func getAPIEndpoint(region ServiceRegion) string {
Expand All @@ -58,6 +60,8 @@ func getAPIEndpoint(region ServiceRegion) string {
return apiEndpointGL
case RegionKR:
return apiEndpointKR
case RegionCN:
return apiEndpointCN
}
log.Printf("[WARN] getAPIEndpoint: unknown region, using default (JP), region=%v\n", region)
return apiEndpointJP
Expand Down

0 comments on commit 2cc3356

Please sign in to comment.