mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Initial PeerTube Support
This commit is contained in:
@@ -8,7 +8,7 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
|
||||
var app: VideosApp?
|
||||
let instanceID: String?
|
||||
var name: String?
|
||||
let url: String
|
||||
let urlString: String
|
||||
var username: String
|
||||
var password: String?
|
||||
let anonymous: Bool
|
||||
@@ -20,7 +20,7 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
|
||||
app: VideosApp? = nil,
|
||||
instanceID: String? = nil,
|
||||
name: String? = nil,
|
||||
url: String? = nil,
|
||||
urlString: String? = nil,
|
||||
username: String? = nil,
|
||||
password: String? = nil,
|
||||
anonymous: Bool = false,
|
||||
@@ -29,10 +29,10 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
|
||||
) {
|
||||
self.anonymous = anonymous
|
||||
|
||||
self.id = id ?? (anonymous ? "anonymous-\(instanceID ?? url ?? UUID().uuidString)" : UUID().uuidString)
|
||||
self.id = id ?? (anonymous ? "anonymous-\(instanceID ?? urlString ?? UUID().uuidString)" : UUID().uuidString)
|
||||
self.instanceID = instanceID
|
||||
self.name = name
|
||||
self.url = url ?? ""
|
||||
self.urlString = urlString ?? ""
|
||||
self.username = username ?? ""
|
||||
self.password = password ?? ""
|
||||
self.country = country
|
||||
@@ -40,6 +40,10 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
|
||||
self.app = app ?? instance.app
|
||||
}
|
||||
|
||||
var url: URL! {
|
||||
URL(string: urlString)
|
||||
}
|
||||
|
||||
var token: String? {
|
||||
KeychainModel.shared.getAccountKey(self, "token")
|
||||
}
|
||||
@@ -49,7 +53,7 @@ struct Account: Defaults.Serializable, Hashable, Identifiable {
|
||||
}
|
||||
|
||||
var instance: Instance! {
|
||||
Defaults[.instances].first { $0.id == instanceID } ?? Instance(app: app ?? .invidious, name: url, apiURL: url)
|
||||
Defaults[.instances].first { $0.id == instanceID } ?? Instance(app: app ?? .invidious, name: urlString, apiURLString: urlString)
|
||||
}
|
||||
|
||||
var isPublic: Bool {
|
||||
|
Reference in New Issue
Block a user