diff --git a/Vernissage/Models/AppMetadata.swift b/Vernissage/Models/AppMetadata.swift index 6cace8d..2f528f1 100644 --- a/Vernissage/Models/AppMetadata.swift +++ b/Vernissage/Models/AppMetadata.swift @@ -5,47 +5,16 @@ // import Foundation +import PixelfedKit public struct AppMetadata: Codable { public let instructionsUrl: String public let serversUrl: String - public let instances: [String] + public let instances: [Instance] init() { self.instructionsUrl = "https://pixelfed.org/how-to-join" self.serversUrl = "https://pixelfed.org/servers" - self.instances = [ - "https://pixelfed.de", - "https://pixelfed.social", - "https://pxlmo.com", - "https://metapixl.com", - "https://pixey.org", - "https://pixel.tchncs.de", - "https://pixelfed.tokyo", - "https://pixelfed.fr", - "https://pixelfed.nz", - "https://pixelfed.au", - "https://pixelfed.eus", - "https://pixelfed.bachgau.social", - "https://pixelfed.es", - "https://pixelfed.cz", - "https://pixelfed.automat.click", - "https://gram.social", - "https://nixorigin.one", - "https://miniature.photography", - "https://fedifilm.art", - "https://fedipix.de", - "https://pixel.jabbxi.de", - "https://nodegray.com", - "https://socialpixels.xyz", - "https://pixel.mamutut.space", - "https://pixelfed.fioverse.zone", - "https://pixel.artemai.art", - "https://pix.anduin.net", - "https://faf.photos", - "https://pix.vleij.com", - "https://pixels.gsi.li", - "https://eorzea.photos" - ] + self.instances = [] } } diff --git a/Vernissage/Services/AppMetadataService.swift b/Vernissage/Services/AppMetadataService.swift index be86079..790431d 100644 --- a/Vernissage/Services/AppMetadataService.swift +++ b/Vernissage/Services/AppMetadataService.swift @@ -12,7 +12,7 @@ public class AppMetadataService { public static let shared = AppMetadataService() private init() { } - private let metadataUrl = URL(string: "https://raw.githubusercontent.com/VernissageApp/Home/main/instances.json")! + private let metadataUrl = URL(string: "https://raw.githubusercontent.com/VernissageApp/Home/main/instances2.json")! private let metadataCacheKey = "metadataCacheKey" private var memoryCacheData = MemoryCache(entryLifetime: 600) diff --git a/Vernissage/Views/SignInView/SignInView.swift b/Vernissage/Views/SignInView/SignInView.swift index 82a2253..f973424 100644 --- a/Vernissage/Views/SignInView/SignInView.swift +++ b/Vernissage/Views/SignInView/SignInView.swift @@ -74,7 +74,7 @@ struct SignInView: View { } } - ForEach(self.instances, id: \.uri) { instance in + ForEach(self.instances.filter { self.serverAddress.isEmpty || $0.uri.contains(self.serverAddress) }, id: \.uri) { instance in InstanceRowView(instance: instance) { uri in let baseAddress = self.getServerAddress(uri: uri) self.signIn(baseAddress: baseAddress) @@ -84,7 +84,7 @@ struct SignInView: View { } .onFirstAppear { let metadata = await AppMetadataService.shared.metadata() - self.instances = await self.client.instances.instances(instanceUrls: metadata.instances) + self.instances = metadata.instances self.instructionsUrlString = metadata.instructionsUrl } .navigationTitle("signin.navigationBar.title")