mirror of
https://github.com/rememberber/MooTool.git
synced 2026-12-01 03:18:19 +08:00
Extend zh/en/ja ToolError coverage for Electron import, workspace validation, favorites, translation words, RSA/SM2 crypto, and remaining Core engines; wire UI language through migration panel and tighten smoke find waits. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
798 B
Swift
23 lines
798 B
Swift
import Foundation
|
|
|
|
public struct SavedHostProfile: Codable, Equatable, Identifiable {
|
|
public var id = UUID()
|
|
public var name: String
|
|
public var content: String
|
|
public var modified = Date()
|
|
|
|
public init(name: String, content: String) {
|
|
self.name = name
|
|
self.content = content
|
|
}
|
|
|
|
public func validate(language: AppLanguage = AppLocalization.preferredLanguage()) throws {
|
|
guard !name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
|
|
throw ToolError(AppLocalization.string("host.error.nameEmpty", language: language))
|
|
}
|
|
guard name.utf8.count <= 120, content.utf8.count <= 512 * 1024 else {
|
|
throw ToolError(AppLocalization.string("host.error.limitExceeded", language: language))
|
|
}
|
|
}
|
|
}
|