Skip to content

Commit

Permalink
Merge next branch to main (#19)(Rebase from legacy code)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
WindowsMEMZ committed Oct 12, 2024
1 parent 41b505a commit 5f25fdc
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 55 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion .github/workflows/statuscheck-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ jobs:
workflow: status-check.yml
ref: ${{ needs.get-head-sha.outputs.psha }}
inputs: '{ "psha": "${{ needs.get-head-sha.outputs.psha }}"}'

Binary file modified DarockBili Watch App/.DS_Store
Binary file not shown.
53 changes: 0 additions & 53 deletions DarockBili Watch App/Extension/CodeExt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,59 +211,6 @@ func biliWbiSign(paramEncoded: String, completion: @escaping (String?) -> 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 ++
Expand Down
1 change: 0 additions & 1 deletion DarockBili Watch App/PersonalCenter/UserDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down

0 comments on commit 5f25fdc

Please sign in to comment.