From 5f25fdc0c10e462cc8e8f6250f8092682cefb09e Mon Sep 17 00:00:00 2001 From: Mark Chan <45706356+WindowsMEMZ@users.noreply.github.com> Date: Sat, 2 Dec 2023 14:49:48 +0800 Subject: [PATCH] Merge next branch to main (#19)(Rebase from legacy code) * Fix Crash Issue when Seeing User's Videos in UserDetailsView (#15) * Update UserDetailView.swift * Merge main workflows (#16) * Update status-check.yml * Update statuscheck-runner.yml * Update CodeExt.swift * Update UserDetailView.swift Fixed optional unwrap issue * Update status-check.yml * Update status-check.yml * Update status-check.yml * Update status-check.yml * Update status-check.yml * Update status-check.yml * Update UserDetailView.swift * Add local wbi sign feature (#18) * Update CodeExt.swift Added wbi calculation logic * Update MainView.swift * Update PersonAccountView.swift * Update UserDetailView.swift Might fix the article access issue at the same time. * Update CodeExt.swift * Update CodeExt.swift * Update CodeExt.swift * Update status-check.yml * Update status-check.yml * Update CodeExt.swift --- .DS_Store | Bin 10244 -> 10244 bytes .github/.DS_Store | Bin 0 -> 6148 bytes .github/workflows/statuscheck-runner.yml | 1 - DarockBili Watch App/.DS_Store | Bin 8196 -> 10244 bytes DarockBili Watch App/Extension/CodeExt.swift | 53 ------------------ .../PersonalCenter/UserDetailView.swift | 1 - 6 files changed, 55 deletions(-) create mode 100644 .github/.DS_Store diff --git a/.DS_Store b/.DS_Store index 53266d0d819148c5e3413e395f75e65de393a76b..f37c8a4da3ae9c95f13d4d9176d80547b3c47dbe 100644 GIT binary patch literal 10244 zcmeHNy>AmS6n{=zlH*GqU|>L;#K2b@+E7(OFr*-+4rOf9k_`t0OT-Ui-Kp7`a|0M1!UHjeNW;I3iDJU zJyqs!F_^z|V4ga@XMKF%lb$*;(K71sTW0k=6ohvS1<-g`!w^3SqE|xCWE4}&AU8h{9Q>;6cWuZ_nR{*(orS6p7 zUe4`0<+ji*cpoe)WzCQ7Sy{Ud^#)k^K&fAqw~`K3nF zaqoNlFh9o7jsRZ|@H;?4qdHkwbek;?X?+MInr=St8_r|Y=Nr!386B!T0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*#d$+r=@4)TI0O;|I6ipDOv^DH8mdDF3Vj3sok6uuc*Z$E%Xl#@$8>0@ z7Db=t^q^u<6(2E_5l6en?4aeC4h=Qpq>MPJcw`lyP?R1Wa-L=4grV2VFdW> zew@~EZjZK z0AA5o4(chMOpFDOK$L#OFjRuhcQLno;1{AIsK2uE zy_%YynVl;XN`?8t`?cM0Q0v$Gdr_s{yTNbQ!m!;KJ=YtXEq}1J@a#qy^y{s_?`eTn z(+A6Y@3w+wIH-hsK{L{_HPcWk6-!$S&+YH8o?AV;BDZ@1Bnuiy&xpEwo(O=F|$l#RDdc=y((IvR) zO-yV|bLpn39kkn1TJTCMs=ucDvi1LXYNz=6hk99yK5WhNc%;r(SmzV;2G!_odW){= zAhw6a5$H)*rw*1^8?~v$qQlsiRv4S84`JiDVJB^qh9O#7pM9XayIF>J?9DkB|zlO25=j_$#=cQBQG>=ZoO&@MOM)YP7VLz{Zp3Tr>%+QW|OBR%muz-3!bcn)X+g&Zkq{ThF=b2xLX z&gIVBE9G!YEA>ZhmNsD(?=C}W83#IHnZ+rrQJ*iu8mrZ|;Op6B1`Ccqwa(@cnyN<_ zz$J%(L*NNSVA|;H@%{gW{Qv)-K+BxU4grV2qzI^)YOPuU_vqdtEy#E69`a3OPRutn zREwa{*YTkGIvy{4bN3Q5^R6)Egy(WhhlZjC>EHM>U>)Py=b?$t;$nN{&i}r>p#+|z agFte=&)M=P?P4?O&i@TySp0|1|9=1l523*T delta 148 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAsIxI(H$S7!WF7&f$vFZWCqEaQ zJ-J_a*5pu;1(PjB&rH@8%b)BZzH~C1 Void) } } -// AV & BV ID Convert Logic -fileprivate let XOR_CODE: UInt64 = 23442827791579 -fileprivate let MASK_CODE: UInt64 = 2251799813685247 -fileprivate let MAX_AID: UInt64 = 1 << 51 - -fileprivate let data: [UInt8] = [70, 99, 119, 65, 80, 78, 75, 84, 77, 117, 103, 51, 71, 86, 53, 76, 106, 55, 69, 74, 110, 72, 112, 87, 115, 120, 52, 116, 98, 56, 104, 97, 89, 101, 118, 105, 113, 66, 122, 54, 114, 107, 67, 121, 49, 50, 109, 85, 83, 68, 81, 88, 57, 82, 100, 111, 90, 102] - -fileprivate let BASE: UInt64 = 58 -fileprivate let BV_LEN: Int = 12 -fileprivate let PREFIX: String = "BV1" - -func av2bv(avid: UInt64) -> String { - var bytes: [UInt8] = [66, 86, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48] - var bvIdx = BV_LEN - 1 - var tmp = (MAX_AID | avid) ^ XOR_CODE - - while tmp != 0 { - bytes[bvIdx] = data[Int(tmp % BASE)] - tmp /= BASE - bvIdx -= 1 - } - - bytes.swapAt(3, 9) - bytes.swapAt(4, 7) - - return String(decoding: bytes, as: UTF8.self) -} - -func bv2av(bvid: String) -> UInt64 { - let fixedBvid: String - if bvid.hasPrefix("BV") { - fixedBvid = bvid - } else { - fixedBvid = "BV" + bvid - } - var bvidArray = Array(fixedBvid.utf8) - - bvidArray.swapAt(3, 9) - bvidArray.swapAt(4, 7) - - let trimmedBvid = String(decoding: bvidArray[3...], as: UTF8.self) - - var tmp: UInt64 = 0 - - for char in trimmedBvid { - if let idx = data.firstIndex(of: char.utf8.first!) { - tmp = tmp * BASE + UInt64(idx) - } - } - - return (tmp & MASK_CODE) ^ XOR_CODE -} - postfix operator ++ postfix operator -- prefix operator ++ diff --git a/DarockBili Watch App/PersonalCenter/UserDetailView.swift b/DarockBili Watch App/PersonalCenter/UserDetailView.swift index 6906d2d29..400923b8f 100644 --- a/DarockBili Watch App/PersonalCenter/UserDetailView.swift +++ b/DarockBili Watch App/PersonalCenter/UserDetailView.swift @@ -560,7 +560,6 @@ struct UserDetailView: View { func RefreshVideos() { videos = [[String: String]]() let headers: HTTPHeaders = [ - "accept-language": "en,zh-CN;q=0.9,zh;q=0.8", "cookie": "SESSDATA=\(sessdata);", "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" ]