diff --git a/Model/InvidiousAPI.swift b/Model/InvidiousAPI.swift index 9806bc9e..479655f9 100644 --- a/Model/InvidiousAPI.swift +++ b/Model/InvidiousAPI.swift @@ -30,11 +30,12 @@ final class InvidiousAPI: Service { $0.pipeline[.parsing].add(SwiftyJSONTransformer, contentTypes: ["*/json"]) } - configure("/auth/**") { + configure(requestMethods: [.get]) { $0.headers["Cookie"] = self.authHeader } configure("**", requestMethods: [.post]) { + $0.headers["Cookie"] = self.authHeader $0.pipeline[.parsing].removeTransformers() } @@ -108,6 +109,10 @@ final class InvidiousAPI: Service { .withParam("region", country.rawValue) } + var home: Resource { + resource(baseURL: InvidiousAPI.instance, path: "/feed/subscriptions") + } + var feed: Resource { resource("/auth/feed") } diff --git a/Model/Profile.swift b/Model/Profile.swift index 91ba8599..d1b8f888 100644 --- a/Model/Profile.swift +++ b/Model/Profile.swift @@ -6,7 +6,6 @@ struct Profile { var skippedSegmentsCategories = [String]() // SponsorBlockSegmentsProvider.categories - // var sid = "B3_WzklziGu8JKefihLrCsTNavdj73KMiPUBfN5HW2M=" var sid = "RpoS7YPPK2-QS81jJF9z4KSQAjmzsOnMpn84c73-GQ8=" var cellsColumns = 3 diff --git a/Shared/Videos/VideoView.swift b/Shared/Videos/VideoView.swift index 09743ccb..891fbd77 100644 --- a/Shared/Videos/VideoView.swift +++ b/Shared/Videos/VideoView.swift @@ -208,7 +208,10 @@ struct VideoView: View { image .resizable() } placeholder: { - ProgressView() + HStack { + ProgressView() + .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity) + } } } else { Image(systemName: "exclamationmark.square") diff --git a/Shared/Views/SubscriptionsView.swift b/Shared/Views/SubscriptionsView.swift index b0f62abe..0f011f84 100644 --- a/Shared/Views/SubscriptionsView.swift +++ b/Shared/Views/SubscriptionsView.swift @@ -12,7 +12,13 @@ struct SubscriptionsView: View { var body: some View { VideosView(videos: store.collection) .onAppear { - resource.loadIfNeeded() + if let home = InvidiousAPI.shared.home.loadIfNeeded() { + home.onSuccess { _ in + resource.loadIfNeeded() + } + } else { + resource.loadIfNeeded() + } } .refreshable { resource.load() diff --git a/Shared/Watch Now/WatchNowView.swift b/Shared/Watch Now/WatchNowView.swift index b9f2f2dd..41ed76bc 100644 --- a/Shared/Watch Now/WatchNowView.swift +++ b/Shared/Watch Now/WatchNowView.swift @@ -2,6 +2,10 @@ import Siesta import SwiftUI struct WatchNowView: View { + init() { + InvidiousAPI.shared.home.loadIfNeeded() + } + var body: some View { ScrollView(.vertical, showsIndicators: false) { VStack(alignment: .leading, spacing: 0) {