1
0
mirror of https://github.com/yattee/yattee.git synced 2025-04-28 16:00:33 +05:30

support for private instances

closes #552

and some formatting
This commit is contained in:
Toni Förster 2023-11-21 18:13:42 +01:00
parent 987f6dcac8
commit 45d2968d9e
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

@ -105,6 +105,7 @@ extension PlayerModel {
func playerAPI(_ video: Video) -> VideosAPI? { func playerAPI(_ video: Video) -> VideosAPI? {
guard let url = video.instanceURL else { return accounts.api } guard let url = video.instanceURL else { return accounts.api }
if accounts.current?.url == url { return accounts.api }
switch video.app { switch video.app {
case .local: case .local:
return nil return nil
@ -263,8 +264,7 @@ extension PlayerModel {
if let video = currentItem.video, if let video = currentItem.video,
video.isLocal, video.isLocal,
video.localStreamIsFile, video.localStreamIsFile,
let localURL = video.localStream?.localURL let localURL = video.localStream?.localURL {
{
logger.info("stopping security scoped resource access for \(localURL)") logger.info("stopping security scoped resource access for \(localURL)")
localURL.stopAccessingSecurityScopedResource() localURL.stopAccessingSecurityScopedResource()
} }
@ -293,8 +293,7 @@ extension PlayerModel {
var restoredQueue = [PlayerQueueItem?]() var restoredQueue = [PlayerQueueItem?]()
if let lastPlayed, if let lastPlayed,
!Defaults[.queue].contains(where: { $0.videoID == lastPlayed.videoID }) !Defaults[.queue].contains(where: { $0.videoID == lastPlayed.videoID }) {
{
restoredQueue.append(lastPlayed) restoredQueue.append(lastPlayed)
self.lastPlayed = nil self.lastPlayed = nil
} }
@ -341,8 +340,7 @@ extension PlayerModel {
var message = error.userMessage var message = error.userMessage
if let errorDictionary = error.json.dictionaryObject, if let errorDictionary = error.json.dictionaryObject,
let errorMessage = errorDictionary["message"] ?? errorDictionary["error"], let errorMessage = errorDictionary["message"] ?? errorDictionary["error"],
let errorString = errorMessage as? String let errorString = errorMessage as? String {
{
message += "\n" message += "\n"
message += errorString message += errorString
} }