diff --git a/kplayer/Info.plist b/kplayer/Info.plist index 9943101..86fa10e 100644 --- a/kplayer/Info.plist +++ b/kplayer/Info.plist @@ -22,6 +22,23 @@ 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + + NSFaceIDUsageDescription + cool + UIBackgroundModes + + fetch + processing + remote-notification + + UIFileSharingEnabled + UILaunchStoryboardName LaunchScreen UIMainStoryboardFile @@ -53,14 +70,5 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIFileSharingEnabled - - NSFaceIDUsageDescription - cool - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - diff --git a/kplayer/core/DatabaseManager.swift b/kplayer/core/DatabaseManager.swift index 2089eb7..2443ab3 100644 --- a/kplayer/core/DatabaseManager.swift +++ b/kplayer/core/DatabaseManager.swift @@ -96,7 +96,7 @@ class DatabaseManager { print("\(r.root) \(r.name)") for s in r.snapshots as! Set { print("\(s.thumb)") - let t = s.thumb?.replacingOccurrences(of: "/srv/samba/ren/heg", with: "http://linkstation:8089/ren/thumbs/heg") + let t = s.thumb?.replacingOccurrences(of: "/srv/samba/ren/heg", with: NetworkManager.sharedInstance.vidurl + "/ren/thumbs/heg") print(t) s.thumb = t } diff --git a/kplayer/master/MasterModel.swift b/kplayer/master/MasterModel.swift index d0cab86..afe807c 100644 --- a/kplayer/master/MasterModel.swift +++ b/kplayer/master/MasterModel.swift @@ -29,6 +29,7 @@ class MasterModel : ObservableObject { @Published var showVideo = false @Published var showPhoto = false + @Published var showWeb = false @Published var showFilePicker = false @Published var showSettings = false @Published var isTagging = false @@ -176,12 +177,17 @@ class MasterModel : ObservableObject { self.showPhotos(s.children, selectedItem: selectedItem, categoryItem: categoryItem) } } else if sectionItem.isWeb() { - // showWeb(selectedItem: selectedItem) + showWeb(selectedItem: selectedItem) } else if sectionItem.type == ItemType.DOWNLOAD { // showDownload(sectionItem: sectionItem) } } + func showWeb(selectedItem: MediaItem) { + selectedDetail = selectedItem + showWeb = true + } + func showVideo(selectedItem: MediaItem) { let mode = false var clonedChildren = [MediaItem]() diff --git a/kplayer/master/MasterSplitView.swift b/kplayer/master/MasterSplitView.swift index 30d646c..0c9c120 100644 --- a/kplayer/master/MasterSplitView.swift +++ b/kplayer/master/MasterSplitView.swift @@ -68,6 +68,9 @@ struct MasterSplitView: View { DetailView(model: model) } + if model.showWeb { + KBrowserView(item: model.selectedDetail!.name, completionHandler: { model.showWeb = false }).background(.black) + } if model.showVideo { SVideoPlayer(completionHandler: model.saveVideo, model: model.videoModel).background(.black) } diff --git a/kplayer/video/SVideoPlayer.swift b/kplayer/video/SVideoPlayer.swift index e0b837f..847af8b 100644 --- a/kplayer/video/SVideoPlayer.swift +++ b/kplayer/video/SVideoPlayer.swift @@ -660,6 +660,10 @@ struct SVideoPlayer: View, EditItemDelegate { } func doSnapshot() { + if player.currentItem == nil { + return + } + let currentItem = player.currentItem! let asset = currentItem.asset diff --git a/kplayer/web/WebView.swift b/kplayer/web/WebView.swift index f5cc1ff..8fe0fee 100644 --- a/kplayer/web/WebView.swift +++ b/kplayer/web/WebView.swift @@ -54,6 +54,7 @@ struct WebView: UIViewRepresentable, WebViewHandlerDelegate { let webView = WKWebView(frame: CGRect.zero, configuration: configuration) webView.navigationDelegate = context.coordinator webView.allowsBackForwardNavigationGestures = true + webView.allowsLinkPreview = true webView.scrollView.isScrollEnabled = true viewModel.httpCookieStore = configuration.websiteDataStore.httpCookieStore diff --git a/kplayerTests/kplayerTests.swift b/kplayerTests/kplayerTests.swift index 71f0779..2cdaef8 100644 --- a/kplayerTests/kplayerTests.swift +++ b/kplayerTests/kplayerTests.swift @@ -23,11 +23,8 @@ class kplayerTests: XCTestCase { } func testMyExample() { - // http://linkstation.local/tomcat/media/service/listpicdirs/srv/samba/ren/series/sg - // http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/big/francy-made-in-italy-10000px/francy-made-in-italy-03-10000px.jpg let hqURL = URL(string: "http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/emily/emily-amazing-10000px/emily-amazing-21-10000px.jpg")! - // "http://linkstation:8080/tomcat/media/service/download/srv/samba/ren/heg/big/francy-made-in-italy-10000px/francy-made-in-italy-03-10000px.jpg")! let op = ImageLoadOperation(imageURL: hqURL, succeeder: { i in