diff --git a/DarockBili Watch App/PersonalCenter/WatchLaterView.swift b/DarockBili Watch App/PersonalCenter/WatchLaterView.swift index 01d7f5a04..0d8b5fddb 100644 --- a/DarockBili Watch App/PersonalCenter/WatchLaterView.swift +++ b/DarockBili Watch App/PersonalCenter/WatchLaterView.swift @@ -31,6 +31,20 @@ struct WatchLaterView: View { if laters.count != 0 { ForEach(0...laters.count - 1, id: \.self) { i in VideoCard(laters[i]) + .swipeActions { + Button(role: .destructive, action: { + let headers: HTTPHeaders = [ + "cookie": "SESSDATA=\(sessdata)", + "User-Agent": "Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" + ] + AF.request("https://api.bilibili.com/x/v2/history/toview/del", method: .post, parameters: ["aid": bv2av(bvid: laters[i]["BV"]!), "csrf": biliJct], headers: headers).response { response in + debugPrint(response) + tipWithText("已移除", symbol: "checkmark.circle.fill") + } + }, label: { + Image(systemName: "trash.fill") + }) + } } } } diff --git a/DarockBili.xcodeproj/project.pbxproj b/DarockBili.xcodeproj/project.pbxproj index bf06c7ef1..21eba47d6 100644 --- a/DarockBili.xcodeproj/project.pbxproj +++ b/DarockBili.xcodeproj/project.pbxproj @@ -1618,7 +1618,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1650,7 +1650,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = "MeowBili/MeowBili Vision App.entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1684,7 +1684,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1730,7 +1730,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = MeowBili/MeowBili.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"MeowBili/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1773,7 +1773,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "DarockBili\\ Watch\\ App/Preview\\ Content"; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1808,7 +1808,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "DarockBili\\ Watch\\ App/Preview\\ Content"; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1964,7 +1964,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -1997,7 +1997,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_ASSET_PATHS = "\"DarockBili Watch App/Preview Content\""; DEVELOPMENT_TEAM = B57D8PP775; ENABLE_PREVIEWS = YES; @@ -2030,7 +2030,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; @@ -2046,7 +2046,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 704; + CURRENT_PROJECT_VERSION = 706; DEVELOPMENT_TEAM = B57D8PP775; INFOPLIST_KEY_CFBundleDisplayName = DarockBili; MARKETING_VERSION = 1.0.0; diff --git a/MeowBili/Others/LoginView.swift b/MeowBili/Others/LoginView.swift index 5f1fa037c..c70b04b95 100644 --- a/MeowBili/Others/LoginView.swift +++ b/MeowBili/Others/LoginView.swift @@ -17,10 +17,10 @@ //===----------------------------------------------------------------------===// import SwiftUI +import EFQRCode +import Alamofire import DarockKit import SwiftyJSON -import Alamofire -import EFQRCode import AuthenticationServices struct LoginView: View { @@ -64,7 +64,7 @@ struct LoginView: View { VStack(alignment: .leading) { Label("Login.step1.title", systemImage: "1.circle") .bold() - // .foregroundStyle(currentStep == 1 ? Color.accentColor : Color.primary) + // .foregroundStyle(currentStep == 1 ? Color.accentColor : Color.primary) HStack { /* Picker("+\(phoneCode)", selection: $phoneCode) { ForEach(callNations.indices) { codeIndex in @@ -90,7 +90,7 @@ struct LoginView: View { VStack(alignment: .leading) { Label("Login.step2.title", systemImage: "2.circle") .bold() - // .foregroundStyle(currentStep == 2 ? Color.accentColor : Color.primary) + // .foregroundStyle(currentStep == 2 ? Color.accentColor : Color.primary) HStack { TextField(validate.isEmpty ? "Login.step2.captcha-first" : "Login.step2.code", text: $passwdInput) .disabled(validate.isEmpty) @@ -106,21 +106,25 @@ struct LoginView: View { print(currentStep) }) Button(action: { - if validate.isEmpty { - UIApplication.shared.open(URL(string: "https://darock.top/geetest?gt=\(gt)&challenge=\(challenge)")!) - } else { - let headers: HTTPHeaders = [ - "Host": "passport.bilibili.com", - "Origin": "https://www.bilibili.com", - "Referer": "https://www.bilibili.com/", - "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15", - "Cookie": "browser_resolution=1580-497; FEED_LIVE_VERSION=V8; buvid4=818BA302-8EAC-0630-67AB-BB978A5797AF60982-023042618-ho21%2BqF6LZokzAShrGptM4EHZm2TE4%2FTXmfZyPpzfCnLuUmUckb8wg%3D%3D; buvid_fp=5a716236853dd1e737d439882c685594; header_theme_version=CLOSE; home_feed_column=5; _uuid=15B5A2103-BBC2-9109A-7458-6410C3CF101028B94909infoc; b_lsid=CCF71993_18991563B31; b_ut=7; i-wanna-go-back=-1; innersign=0; b_nut=1690360493; buvid3=6481EDF5-10C43-9593-251E-89210B4A1C10A193894infoc" - ] - AF.request("https://passport.bilibili.com/x/passport-login/web/sms/send", method: .post, parameters: BiliSmsCodePost(cid: Int(phoneCode)!, tel: Int(accountInput)!, token: loginToken, challenge: challenge, validate: validate, seccode: seccode), headers: headers).response { response in - debugPrint(response) - let json = try! JSON(data: response.data!) - smsLoginToken = json["data"]["captcha_key"].string! + if accountInput.count == 11 && !accountInput.contains(" ") { + if validate.isEmpty { + UIApplication.shared.open(URL(string: "https://darock.top/geetest?gt=\(gt)&challenge=\(challenge)")!) + } else { + let headers: HTTPHeaders = [ + "Host": "passport.bilibili.com", + "Origin": "https://www.bilibili.com", + "Referer": "https://www.bilibili.com/", + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15", + "Cookie": "browser_resolution=1580-497; FEED_LIVE_VERSION=V8; buvid4=818BA302-8EAC-0630-67AB-BB978A5797AF60982-023042618-ho21%2BqF6LZokzAShrGptM4EHZm2TE4%2FTXmfZyPpzfCnLuUmUckb8wg%3D%3D; buvid_fp=5a716236853dd1e737d439882c685594; header_theme_version=CLOSE; home_feed_column=5; _uuid=15B5A2103-BBC2-9109A-7458-6410C3CF101028B94909infoc; b_lsid=CCF71993_18991563B31; b_ut=7; i-wanna-go-back=-1; innersign=0; b_nut=1690360493; buvid3=6481EDF5-10C43-9593-251E-89210B4A1C10A193894infoc" + ] + AF.request("https://passport.bilibili.com/x/passport-login/web/sms/send", method: .post, parameters: BiliSmsCodePost(cid: Int(phoneCode)!, tel: Int(accountInput)!, token: loginToken, challenge: challenge, validate: validate, seccode: seccode), headers: headers).response { response in + debugPrint(response) + let json = try! JSON(data: response.data!) + smsLoginToken = json["data"]["captcha_key"].string! + } } + } else { + AlertKitAPI.present(title: "手机号错误", subtitle: "请输入正确的11位手机号", icon: .error, style: .iOS17AppleMusic, haptic: .error) } }, label: { if validate.isEmpty {