Yattee v2 rewrite

This commit is contained in:
Arkadiusz Fal
2026-02-08 18:31:16 +01:00
parent 20d0cfc0c7
commit 05f921d605
1043 changed files with 163875 additions and 68430 deletions

View File

@@ -0,0 +1,47 @@
//
// PeerTubeDirectoryInstance.swift
// Yattee
//
// Model for PeerTube instances from the public directory.
//
import Foundation
/// Represents a PeerTube instance from the public directory at instances.joinpeertube.org.
struct PeerTubeDirectoryInstance: Identifiable, Decodable, Sendable {
let id: Int
let host: String
let name: String
let shortDescription: String?
let version: String?
let signupAllowed: Bool
let languages: [String]
let country: String?
let totalUsers: Int
let totalVideos: Int
let totalLocalVideos: Int?
let health: Int?
let createdAt: String?
/// Constructs the full URL for this instance.
var url: URL? {
URL(string: "https://\(host)")
}
}
/// Response wrapper for the PeerTube instances directory API.
struct PeerTubeDirectoryResponse: Decodable, Sendable {
let total: Int
let data: [PeerTubeDirectoryInstance]
}
/// Filters for browsing the PeerTube instance directory.
struct PeerTubeDirectoryFilters: Equatable, Sendable {
var searchText: String = ""
var language: String? = nil
var country: String? = nil
var isDefault: Bool {
searchText.isEmpty && language == nil && country == nil
}
}