Skip to content

Commit

Permalink
enforce use https, try fixing #81
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Aug 16, 2023
1 parent 6a63bd0 commit 6e91fce
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class CommonPlayerViewController: AVPlayerViewController {
let danmuDurationMenu = UIMenu(title: "弹幕展示时长", options: [.displayInline, .singleSelection], children: [4, 6, 8].map { dur in
UIAction(title: "\(dur)", state: dur == Settings.danmuDuration ? .on : .off) { _ in Settings.danmuDuration = dur }
})
let danmuAILevelMenu = UIMenu(title: "弹幕屏蔽等级", options: [.displayInline, .singleSelection], children: [Int32](1 ... 10).map { level in
let danmuAILevelMenu = UIMenu(title: "弹幕屏蔽等级", options: [.displayInline, .singleSelection], children: [Int32](1...10).map { level in
UIAction(title: "\(level)", state: level == Settings.danmuAILevel ? .on : .off) { _ in Settings.danmuAILevel = level }
})
let danmuSettingMenu = UIMenu(title: "弹幕设置", image: UIImage(systemName: "keyboard.badge.ellipsis"), children: [danmuDurationMenu, danmuAILevelMenu])
Expand Down
2 changes: 1 addition & 1 deletion BilibiliLive/Module/Personal/ToViewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ToViewViewController: StandardVideoCollectionViewController<ToViewData> {
func del(with toViewItem: ToViewData) {
let aid = toViewItem.aid
guard let csrf = CookieHandler.shared.csrf() else { return }
AF.request("http://api.bilibili.com/x/v2/history/toview/del", method: .post, parameters: ["aid": aid, "csrf": csrf]).responseData {
AF.request("https://api.bilibili.com/x/v2/history/toview/del", method: .post, parameters: ["aid": aid, "csrf": csrf]).responseData {
[weak self] resp in
print(resp.result)
self?.reloadData()
Expand Down
2 changes: 1 addition & 1 deletion BilibiliLive/Request/ApiRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ enum ApiRequest {
}

static func requestDislike(aid: Int, dislike: Bool) {
requestJSON("http://app.biliapi.net/x/v2/view/dislike", method: .post, parameters: ["aid": aid, "dislike": dislike ? 0 : 1])
requestJSON("https://app.biliapi.net/x/v2/view/dislike", method: .post, parameters: ["aid": aid, "dislike": dislike ? 0 : 1])
}

struct BangumiInfo: Codable, Hashable {
Expand Down
18 changes: 9 additions & 9 deletions BilibiliLive/Request/WebRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ enum WebRequest {

extension WebRequest {
static func requestBangumiInfo(epid: Int) async throws -> BangumiInfo {
let info: BangumiInfo = try await request(url: "http://api.bilibili.com/pgc/view/web/season", parameters: ["ep_id": epid], dataObj: "result")
let info: BangumiInfo = try await request(url: "https://api.bilibili.com/pgc/view/web/season", parameters: ["ep_id": epid], dataObj: "result")
return info
}

Expand All @@ -256,7 +256,7 @@ extension WebRequest {
}

static func requestHistory(complete: (([HistoryData]) -> Void)?) {
request(url: "http://api.bilibili.com/x/v2/history") {
request(url: "https://api.bilibili.com/x/v2/history") {
(result: Result<[HistoryData], RequestError>) in
if let data = try? result.get() {
complete?(data)
Expand All @@ -278,7 +278,7 @@ extension WebRequest {
}

static func requestDetailVideo(aid: Int) async throws -> VideoDetail {
try await request(url: "http://api.bilibili.com/x/web-interface/view/detail", parameters: ["aid": aid])
try await request(url: "https://api.bilibili.com/x/web-interface/view/detail", parameters: ["aid": aid])
}

static func requestFavVideosList() async throws -> [FavListData] {
Expand Down Expand Up @@ -336,7 +336,7 @@ extension WebRequest {
}

static func requestCoinStatus(aid: Int, complete: ((Int) -> Void)?) {
requestJSON(url: "http://api.bilibili.com/x/web-interface/archive/coins", parameters: ["aid": aid]) {
requestJSON(url: "https://api.bilibili.com/x/web-interface/archive/coins", parameters: ["aid": aid]) {
response in
switch response {
case let .success(data):
Expand All @@ -348,7 +348,7 @@ extension WebRequest {
}

static func requestTodayCoins(complete: ((Int) -> Void)?) {
requestData(url: "http://www.bilibili.com/plus/account/exp.php") {
requestData(url: "https://www.bilibili.com/plus/account/exp.php") {
response in
switch response {
case let .success(data):
Expand All @@ -361,11 +361,11 @@ extension WebRequest {
}

static func requestFavorite(aid: Int, mid: Int) {
requestJSON(method: .post, url: "http://api.bilibili.com/x/v3/fav/resource/deal", parameters: ["rid": aid, "type": 2, "add_media_ids": mid])
requestJSON(method: .post, url: "https://api.bilibili.com/x/v3/fav/resource/deal", parameters: ["rid": aid, "type": 2, "add_media_ids": mid])
}

static func requestFavoriteStatus(aid: Int, complete: ((Bool) -> Void)?) {
requestJSON(url: "http://api.bilibili.com/x/v2/fav/video/favoured", parameters: ["aid": aid]) {
requestJSON(url: "https://api.bilibili.com/x/v2/fav/video/favoured", parameters: ["aid": aid]) {
response in
switch response {
case let .success(data):
Expand Down Expand Up @@ -416,7 +416,7 @@ extension WebRequest {
}

static func requestReplys(aid: Int, complete: ((Replys) -> Void)?) {
request(url: "http://api.bilibili.com/x/v2/reply", parameters: ["type": 1, "oid": aid, "sort": 1, "nohot": 0]) {
request(url: "https://api.bilibili.com/x/v2/reply", parameters: ["type": 1, "oid": aid, "sort": 1, "nohot": 0]) {
(result: Result<Replys, RequestError>) in
if let details = try? result.get() {
complete?(details)
Expand Down Expand Up @@ -469,7 +469,7 @@ extension WebRequest {
}

static func requestLoginInfo(complete: ((Result<JSON, RequestError>) -> Void)?) {
requestJSON(url: "http://api.bilibili.com/x/web-interface/nav", complete: complete)
requestJSON(url: "https://api.bilibili.com/x/web-interface/nav", complete: complete)
}
}

Expand Down

0 comments on commit 6e91fce

Please sign in to comment.