mirror of
https://github.com/yJason/ClashX-Dashboard.git
synced 2026-02-04 10:02:26 +08:00
misc: proxy uuid
This commit is contained in:
@@ -30,7 +30,6 @@ class ClashProviderResp: Codable {
|
||||
}
|
||||
|
||||
class ClashProvider: Codable {
|
||||
let id = UUID().uuidString
|
||||
enum ProviderType: String, Codable {
|
||||
case Proxy
|
||||
case String
|
||||
|
||||
@@ -97,7 +97,7 @@ class ClashProxySpeedHistory: Codable {
|
||||
}
|
||||
|
||||
class ClashProxy: Codable {
|
||||
let id = UUID().uuidString
|
||||
let id: String?
|
||||
let name: ClashProxyName
|
||||
let type: ClashProxyType
|
||||
let all: [ClashProxyName]?
|
||||
@@ -145,7 +145,7 @@ class ClashProxy: Codable {
|
||||
}()
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case type, all, history, now, name, udp, xudp, tfo
|
||||
case type, all, history, now, name, udp, xudp, tfo, id
|
||||
}
|
||||
|
||||
lazy var maxProxyNameLength: CGFloat = {
|
||||
|
||||
@@ -16,7 +16,7 @@ class DBProviderStorage: ObservableObject {
|
||||
}
|
||||
|
||||
class DBProxyProvider: ObservableObject, Identifiable {
|
||||
let id: String
|
||||
let id = UUID().uuidString
|
||||
|
||||
@Published var name: ClashProviderName
|
||||
@Published var proxies: [DBProxy]
|
||||
@@ -29,8 +29,6 @@ class DBProxyProvider: ObservableObject, Identifiable {
|
||||
@Published var updatedAt: String
|
||||
|
||||
init(provider: ClashProvider) {
|
||||
id = provider.id
|
||||
|
||||
name = provider.name
|
||||
proxies = provider.proxies.map(DBProxy.init)
|
||||
type = provider.type
|
||||
|
||||
@@ -22,7 +22,7 @@ class DBProxyStorage: ObservableObject {
|
||||
}
|
||||
|
||||
class DBProxyGroup: ObservableObject, Identifiable {
|
||||
let id: String
|
||||
let id = UUID().uuidString
|
||||
@Published var name: ClashProxyName
|
||||
@Published var type: ClashProxyType
|
||||
@Published var now: ClashProxyName? {
|
||||
@@ -38,7 +38,6 @@ class DBProxyGroup: ObservableObject, Identifiable {
|
||||
@Published var currentProxy: DBProxy?
|
||||
|
||||
init(_ group: ClashProxy, resp: ClashProxyResp) {
|
||||
id = group.id
|
||||
name = group.name
|
||||
type = group.type
|
||||
now = group.now
|
||||
@@ -71,7 +70,7 @@ class DBProxy: ObservableObject {
|
||||
@Published var delayColor: Color
|
||||
|
||||
init(_ proxy: ClashProxy) {
|
||||
id = proxy.id
|
||||
id = proxy.id ?? UUID().uuidString
|
||||
name = proxy.name
|
||||
type = proxy.type
|
||||
tfo = proxy.tfo
|
||||
|
||||
@@ -10,7 +10,7 @@ import SwiftUI
|
||||
typealias SavedServersAppStorage = [ClashServerAppStorage]
|
||||
|
||||
struct ClashServerAppStorage: Codable, Identifiable {
|
||||
let id = UUID().uuidString
|
||||
var id = UUID().uuidString
|
||||
let apiURL: String
|
||||
let secret: String
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user