Skip to content

Commit

Permalink
watchOS稍后再看添加删除功能,iOS验证登录手机号 (#256)
Browse files Browse the repository at this point in the history
* Added visionOS target(non-buildable)

* Removed some data unused

* Merging code for watchOS into MeowBili folder

* feat: watchOS delete watch later, iOS verify phone number input
  • Loading branch information
WindowsMEMZ authored Feb 20, 2024
1 parent 1b2eaa2 commit d0e5ec0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 28 deletions.
14 changes: 14 additions & 0 deletions DarockBili Watch App/PersonalCenter/WatchLaterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
})
}
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions DarockBili.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
40 changes: 22 additions & 18 deletions MeowBili/Others/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
//===----------------------------------------------------------------------===//

import SwiftUI
import EFQRCode
import Alamofire
import DarockKit
import SwiftyJSON
import Alamofire
import EFQRCode
import AuthenticationServices

struct LoginView: View {
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit d0e5ec0

Please sign in to comment.