Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
xjbeta committed Aug 28, 2024
2 parents 0979407 + 1664880 commit 50878f7
Show file tree
Hide file tree
Showing 7 changed files with 434 additions and 364 deletions.
16 changes: 10 additions & 6 deletions IINA+.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
011E4D3321E99CA400997633 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011E4D3221E99CA300997633 /* Log.swift */; };
0120934227A40869002C7FD3 /* JSPlayerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0120934127A40869002C7FD3 /* JSPlayerWindowController.swift */; };
0120934427A4F632002C7FD3 /* JSPlayerWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0120934327A4F632002C7FD3 /* JSPlayerWebView.swift */; };
0120FDBF2C725E9800526079 /* DouyinCookiesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0120FDBE2C725E9800526079 /* DouyinCookiesManager.swift */; };
01260171211948BF00C9C639 /* PreferencesTabViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01260170211948BF00C9C639 /* PreferencesTabViewController.swift */; };
012601742119FBF400C9C639 /* BilibiliCardTableCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012601732119FBF400C9C639 /* BilibiliCardTableCellView.swift */; };
01260178211ABD3B00C9C639 /* VideoViewsFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01260177211ABD3B00C9C639 /* VideoViewsFormatter.swift */; };
012738C12C731EEB0031E643 /* TaskExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012738C02C731EEB0031E643 /* TaskExtension.swift */; };
0132B2E32123D05E001EB7DC /* BilibiliCardProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0132B2E22123D05E001EB7DC /* BilibiliCardProgressView.swift */; };
0132B2E52123D68D001EB7DC /* BilibiliCardImageBoxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0132B2E42123D68D001EB7DC /* BilibiliCardImageBoxView.swift */; };
013850FA214EA2AA003817CE /* huya.js in Resources */ = {isa = PBXBuildFile; fileRef = 013850F9214EA2AA003817CE /* huya.js */; };
Expand All @@ -46,7 +48,6 @@
01479CD7210B35480046AAAD /* MainMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01479CD6210B35480046AAAD /* MainMenu.swift */; };
014B447D210069FF00E7AA6A /* Bookmark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014B447B210069FF00E7AA6A /* Bookmark.swift */; };
014B447E210069FF00E7AA6A /* BookmarkExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014B447C210069FF00E7AA6A /* BookmarkExtension.swift */; };
0153BFF12C3023F100AF5871 /* DouyinCookiesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0153BFF02C3023F100AF5871 /* DouyinCookiesManager.swift */; };
015C19DC218B0D4F003B2F3A /* VideoGetStructs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 015C19DB218B0D4F003B2F3A /* VideoGetStructs.swift */; };
015C19F7218FC9A8003B2F3A /* Block-List-Plus.xml in Resources */ = {isa = PBXBuildFile; fileRef = 015C19F5218FC9A8003B2F3A /* Block-List-Plus.xml */; };
015C19F8218FC9A8003B2F3A /* Block-List-Basic.xml in Resources */ = {isa = PBXBuildFile; fileRef = 015C19F6218FC9A8003B2F3A /* Block-List-Basic.xml */; };
Expand Down Expand Up @@ -198,9 +199,11 @@
0120932A27A3B441002C7FD3 /* flvplayer.htm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = flvplayer.htm; sourceTree = "<group>"; };
0120934127A40869002C7FD3 /* JSPlayerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSPlayerWindowController.swift; sourceTree = "<group>"; };
0120934327A4F632002C7FD3 /* JSPlayerWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JSPlayerWebView.swift; sourceTree = "<group>"; };
0120FDBE2C725E9800526079 /* DouyinCookiesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DouyinCookiesManager.swift; sourceTree = "<group>"; };
01260170211948BF00C9C639 /* PreferencesTabViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferencesTabViewController.swift; sourceTree = "<group>"; };
012601732119FBF400C9C639 /* BilibiliCardTableCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BilibiliCardTableCellView.swift; sourceTree = "<group>"; };
01260177211ABD3B00C9C639 /* VideoViewsFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoViewsFormatter.swift; sourceTree = "<group>"; };
012738C02C731EEB0031E643 /* TaskExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskExtension.swift; sourceTree = "<group>"; };
0132B2E22123D05E001EB7DC /* BilibiliCardProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BilibiliCardProgressView.swift; sourceTree = "<group>"; };
0132B2E42123D68D001EB7DC /* BilibiliCardImageBoxView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BilibiliCardImageBoxView.swift; sourceTree = "<group>"; };
013850F9214EA2AA003817CE /* huya.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = huya.js; sourceTree = "<group>"; };
Expand All @@ -219,7 +222,6 @@
014B447B210069FF00E7AA6A /* Bookmark.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bookmark.swift; sourceTree = "<group>"; };
014B447C210069FF00E7AA6A /* BookmarkExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BookmarkExtension.swift; sourceTree = "<group>"; };
014FD3A42115CB3000F05399 /* Bookmark v0.2.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Bookmark v0.2.xcdatamodel"; sourceTree = "<group>"; };
0153BFF02C3023F100AF5871 /* DouyinCookiesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DouyinCookiesManager.swift; sourceTree = "<group>"; };
015C19DB218B0D4F003B2F3A /* VideoGetStructs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoGetStructs.swift; sourceTree = "<group>"; };
015C19F5218FC9A8003B2F3A /* Block-List-Plus.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Block-List-Plus.xml"; sourceTree = "<group>"; };
015C19F6218FC9A8003B2F3A /* Block-List-Basic.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Block-List-Basic.xml"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -485,7 +487,7 @@
0199489D2742852E00C71708 /* SupportSites.swift */,
018F4F692812D95C0045B67C /* CC163.swift */,
01892C7727C0CDA400494AFD /* DouYin.swift */,
0153BFF02C3023F100AF5871 /* DouyinCookiesManager.swift */,
0120FDBE2C725E9800526079 /* DouyinCookiesManager.swift */,
018F4F652812C3EB0045B67C /* Douyu.swift */,
018F4F6028126FFD0045B67C /* Huya.swift */,
01A183DA2B789728006FA874 /* HuyaUrl.swift */,
Expand Down Expand Up @@ -596,6 +598,7 @@
01942A3527C49D850092FA5A /* WKWebViewExtension.swift */,
01010124211DBC27002F0F7F /* StringExtension.swift */,
0184D7112B2025FF00C7901A /* DateExtension.swift */,
012738C02C731EEB0031E643 /* TaskExtension.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -778,12 +781,14 @@
0189533F279FBC470011BAAC /* ColorPickButton.swift in Sources */,
01DCD2F9259710D800D286C8 /* BilibiliDMMessage.swift in Sources */,
01A183DB2B789728006FA874 /* HuyaUrl.swift in Sources */,
012738C12C731EEB0031E643 /* TaskExtension.swift in Sources */,
010F0F1920FE4F0900F33553 /* DataModel.xcdatamodeld in Sources */,
0120934227A40869002C7FD3 /* JSPlayerWindowController.swift in Sources */,
013CE8F62185D992000271FB /* HttpServer.swift in Sources */,
016792E6212BDEE5003517A7 /* SelectVideoCollectionViewItem.swift in Sources */,
0101013921200DC5002F0F7F /* LiveUrlTableCellView.swift in Sources */,
018F4F6A2812D95C0045B67C /* CC163.swift in Sources */,
0120FDBF2C725E9800526079 /* DouyinCookiesManager.swift in Sources */,
01C338B528E47B3F004CC0B8 /* MBGA.swift in Sources */,
01479CD3210AF5F40046AAAD /* DataManager.swift in Sources */,
01398985210F27A600B7042F /* PreferencesWindowController.swift in Sources */,
Expand Down Expand Up @@ -853,7 +858,6 @@
016D772427B0CD4300358E2F /* WaitTimer.swift in Sources */,
01E6A09C211AD62800C6EF98 /* VideoDurationFormatter.swift in Sources */,
018739EE2852135200156F3F /* QQLive.swift in Sources */,
0153BFF12C3023F100AF5871 /* DouyinCookiesManager.swift in Sources */,
0169098021CF472F008CDF0E /* SideBarImageView.swift in Sources */,
0132B2E32123D05E001EB7DC /* BilibiliCardProgressView.swift in Sources */,
016792E1212BBB43003517A7 /* SelectVideoViewController.swift in Sources */,
Expand Down Expand Up @@ -1046,7 +1050,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.8.2;
MARKETING_VERSION = 0.8.3;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -1073,7 +1077,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.8.2;
MARKETING_VERSION = 0.8.3;
PRODUCT_BUNDLE_IDENTIFIER = "com.xjbeta.iina-plus";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "9446deb32a3da7eb6f718bd9d122561507cc76295435ffdb46184cca0f53082f",
"originHash" : "002db082d67dd04ceef35a0e7fc98dc59d5b2928b472f339c49f8bce81f0f426",
"pins" : [
{
"identity" : "alamofire",
Expand Down
16 changes: 7 additions & 9 deletions IINA+/Utils/Danmaku/DouYinDM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ class DouYinDM: NSObject {
var url = ""

let douyin = Processes.shared.videoDecoder.douyin
var ua: String {
douyin.douyinUA
}

var privateKeys: [String] {
douyin.privateKeys
douyin.cookiesManager.privateKeys
}

private var webView = WKWebView()
var requestPrepared: ((URLRequest) -> Void)?

func initWS(_ roomId: String, cookies: [String: String]) async throws -> URLRequest {
func initWS(_ roomId: String, cookies: [String: String], ua: String) async throws -> URLRequest {
let s = "bGl2ZV9pZD0xLGFpZD02MzgzLHZlcnNpb25fY29kZT0xODA4MDAsd2ViY2FzdF9zZGtfdmVyc2lvbj0xLjMuMCxyb29tX2lkPQ==".base64Decode()
+ roomId
+ "LHN1Yl9yb29tX2lkPSxzdWJfY2hhbm5lbF9pZD0sZGlkX3J1bGU9Myx1c2VyX3VuaXF1ZV9pZD0sZGV2aWNlX3BsYXRmb3JtPXdlYixkZXZpY2VfdHlwZT0sYWM9LGlkZW50aXR5PWF1ZGllbmNl".base64Decode()
Expand Down Expand Up @@ -56,7 +53,7 @@ class DouYinDM: NSObject {

req.setValue(cookieString, forHTTPHeaderField: "Cookie")
req.setValue("https://live.douyin.com", forHTTPHeaderField: "referer")
req.setValue(self.ua, forHTTPHeaderField: "User-Agent")
req.setValue(ua, forHTTPHeaderField: "User-Agent")

return req
}
Expand Down Expand Up @@ -89,7 +86,7 @@ class DouYinDM: NSObject {
func prepareCookies() async {

let storageDic = await MainActor.run {
return douyin.storageDic
return douyin.cookiesManager.storageDic
}

let kvs = [
Expand All @@ -112,10 +109,11 @@ class DouYinDM: NSObject {
Task {
do {
let rid = try await getRoomId()
let cookies = await douyin.cookiesManager.cookies
let cookies = try await douyin.cookiesManager.cookies()
let ua = await douyin.cookiesManager.douyinUA()

await prepareCookies()
let req = try await initWS(rid, cookies: cookies)
let req = try await initWS(rid, cookies: cookies, ua: ua)

await MainActor.run {
self.requestPrepared?(req)
Expand Down
19 changes: 19 additions & 0 deletions IINA+/Utils/Extensions/TaskExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// TaskExtension.swift
// IINA+
//
// Created by xjbeta on 2024/8/19.
// Copyright © 2024 xjbeta. All rights reserved.
//

import Cocoa

extension Task where Success == Never, Failure == Never {
public static func sleep(seconds duration: UInt64) async throws {
try await sleep(nanoseconds: duration * 1_000_000_000)
}

public static func sleep(milliseconds duration: UInt64) async throws {
try await sleep(nanoseconds: duration * 1_000_000)
}
}
Loading

0 comments on commit 50878f7

Please sign in to comment.