Skip to content

Commit

Permalink
EnkaAPI // Change the Mainland China mirror for EnkaDB files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ShikiSuen committed Aug 1, 2024
1 parent f961659 commit 4f1a6eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension HttpMethod {
) {
homeRequest(
method,
urlStr,
urlStr + hostType.hostSuffix,
cachedPolicy: cachedPolicy,
baseStr: hostType.hostBase,
keyDecodingStrategy: .useDefaultKeys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public enum PizzaHelperAPI {
}
}()
let urlStr = EnkaGI.ResourceType.characters.subURLComponents(serverType: serverType)
print("Fetching: \(urlPrefix + urlStr)")
print("Fetching: \(urlPrefix + urlStr + hostType.hostSuffix)")

// 请求
return try await withCheckedThrowingContinuation { continuation in
Expand Down Expand Up @@ -114,7 +114,7 @@ public enum PizzaHelperAPI {
}
}()
let urlStr = EnkaGI.ResourceType.loc.subURLComponents(serverType: serverType)
print("Fetching: \(urlPrefix + urlStr)")
print("Fetching: \(urlPrefix + urlStr + hostType.hostSuffix)")

// 请求
return try await withCheckedThrowingContinuation { continuation in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,19 @@ public enum HostType: String {
case generalHost = "https://gi.pizzastudio.org/"
case artifactRatingHost = "https://artifact-rating.pizzastudio.org/"
case abyssHost = "http://81.70.76.222/"
case enkaJSONGitCN = "https://gitcode.net/SHIKISUEN/Enka-API-docs/-/raw/master/"
case enkaJSONGitCN = """
https://gitlink.org.cn/attachments/entries/get_file?download_url=https://www.gitlink.org.cn/api/ShikiSuen/Enka-API-docs/raw/
"""
case enkaJSONGitGlobal = "https://raw.githubusercontent.com/EnkaNetwork/API-docs/master/"

// MARK: Public

public var hostBase: String { rawValue }

public var hostSuffix: String {
switch self {
case .enkaJSONGitCN: return "?ref=master"
default: return ""
}
}
}

0 comments on commit 4f1a6eb

Please sign in to comment.