chore(ci): fix lint and swiftformat failures
This commit is contained in:
@@ -11,7 +11,7 @@ struct GeneralSettings: View {
|
||||
@State private var remoteStatus: RemoteStatus = .idle
|
||||
@State private var showRemoteAdvanced = false
|
||||
|
||||
var body: some View {
|
||||
var body: some View {
|
||||
ScrollView(.vertical) {
|
||||
VStack(alignment: .leading, spacing: 18) {
|
||||
if !self.state.onboardingSeen {
|
||||
@@ -128,7 +128,8 @@ var body: some View {
|
||||
}
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
.disabled(self.remoteStatus == .checking || self.state.remoteTarget.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||
.disabled(self.remoteStatus == .checking || self.state.remoteTarget
|
||||
.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
|
||||
|
||||
switch self.remoteStatus {
|
||||
case .idle:
|
||||
@@ -307,7 +308,7 @@ extension GeneralSettings {
|
||||
}
|
||||
|
||||
@MainActor
|
||||
fileprivate func testRemote() async {
|
||||
private func testRemote() async {
|
||||
self.remoteStatus = .checking
|
||||
let command = CommandResolver.clawdisCommand(subcommand: "status", extraArgs: ["--json"])
|
||||
let response = await ShellRunner.run(command: command, cwd: nil, env: nil, timeout: 10)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import OSLog
|
||||
import SwiftUI
|
||||
|
||||
struct HealthSnapshot: Codable, Sendable {
|
||||
struct Web: Codable, Sendable {
|
||||
|
||||
@@ -257,7 +257,8 @@ struct OnboardingView: View {
|
||||
self.onboardingPage {
|
||||
Text("Link WhatsApp")
|
||||
.font(.largeTitle.weight(.semibold))
|
||||
Text("Run `clawdis login` where the relay runs (local if local mode, remote if remote). Scan the QR to pair your account.")
|
||||
Text(
|
||||
"Run `clawdis login` where the relay runs (local if local mode, remote if remote). Scan the QR to pair your account.")
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
.multilineTextAlignment(.center)
|
||||
@@ -367,7 +368,11 @@ struct OnboardingView: View {
|
||||
.frame(width: self.pageWidth, alignment: .top)
|
||||
}
|
||||
|
||||
private func onboardingCard(spacing: CGFloat = 12, padding: CGFloat = 16, @ViewBuilder _ content: () -> some View) -> some View {
|
||||
private func onboardingCard(
|
||||
spacing: CGFloat = 12,
|
||||
padding: CGFloat = 16,
|
||||
@ViewBuilder _ content: () -> some View) -> some View
|
||||
{
|
||||
VStack(alignment: .leading, spacing: spacing) {
|
||||
content()
|
||||
}
|
||||
|
||||
@@ -282,7 +282,11 @@ enum CommandResolver {
|
||||
|
||||
static func clawdisCommand(subcommand: String, extraArgs: [String] = []) -> [String] {
|
||||
let settings = self.connectionSettings()
|
||||
if settings.mode == .remote, let ssh = self.sshCommand(subcommand: subcommand, extraArgs: extraArgs, settings: settings) {
|
||||
if settings.mode == .remote, let ssh = self.sshCommand(
|
||||
subcommand: subcommand,
|
||||
extraArgs: extraArgs,
|
||||
settings: settings)
|
||||
{
|
||||
return ssh
|
||||
}
|
||||
if let bundled = self.bundledRelayCommand(subcommand: subcommand, extraArgs: extraArgs) {
|
||||
@@ -337,7 +341,11 @@ enum CommandResolver {
|
||||
let target = UserDefaults.standard.string(forKey: remoteTargetKey) ?? ""
|
||||
let identity = UserDefaults.standard.string(forKey: remoteIdentityKey) ?? ""
|
||||
let projectRoot = UserDefaults.standard.string(forKey: remoteProjectRootKey) ?? ""
|
||||
return RemoteSettings(mode: mode, target: self.sanitizedTarget(target), identity: identity, projectRoot: projectRoot)
|
||||
return RemoteSettings(
|
||||
mode: mode,
|
||||
target: self.sanitizedTarget(target),
|
||||
identity: identity,
|
||||
projectRoot: projectRoot)
|
||||
}
|
||||
|
||||
private static func sanitizedTarget(_ raw: String) -> String {
|
||||
|
||||
@@ -60,7 +60,6 @@ struct VoiceWakeSettings: View {
|
||||
self.micPicker
|
||||
self.levelMeter
|
||||
|
||||
|
||||
VoiceWakeTestCard(
|
||||
testState: self.$testState,
|
||||
isTesting: self.$isTesting,
|
||||
@@ -267,7 +266,7 @@ struct VoiceWakeSettings: View {
|
||||
}
|
||||
}
|
||||
.labelsHidden()
|
||||
.frame(width: 220)
|
||||
.frame(width: 220)
|
||||
|
||||
Button {
|
||||
guard self.state.voiceWakeAdditionalLocaleIDs.indices.contains(idx) else { return }
|
||||
|
||||
@@ -162,27 +162,27 @@ final class WebChatServer: @unchecked Sendable {
|
||||
|
||||
private func statusText(_ code: Int) -> String {
|
||||
switch code {
|
||||
case 200: return "OK"
|
||||
case 403: return "Forbidden"
|
||||
case 404: return "Not Found"
|
||||
default: return "Error"
|
||||
case 200: "OK"
|
||||
case 403: "Forbidden"
|
||||
case 404: "Not Found"
|
||||
default: "Error"
|
||||
}
|
||||
}
|
||||
|
||||
private func mimeType(forExtension ext: String) -> String {
|
||||
switch ext.lowercased() {
|
||||
case "html", "htm": return "text/html; charset=utf-8"
|
||||
case "js", "mjs": return "application/javascript; charset=utf-8"
|
||||
case "css": return "text/css; charset=utf-8"
|
||||
case "json", "map": return "application/json; charset=utf-8"
|
||||
case "svg": return "image/svg+xml"
|
||||
case "png": return "image/png"
|
||||
case "jpg", "jpeg": return "image/jpeg"
|
||||
case "gif": return "image/gif"
|
||||
case "woff2": return "font/woff2"
|
||||
case "woff": return "font/woff"
|
||||
case "ttf": return "font/ttf"
|
||||
default: return "application/octet-stream"
|
||||
case "html", "htm": "text/html; charset=utf-8"
|
||||
case "js", "mjs": "application/javascript; charset=utf-8"
|
||||
case "css": "text/css; charset=utf-8"
|
||||
case "json", "map": "application/json; charset=utf-8"
|
||||
case "svg": "image/svg+xml"
|
||||
case "png": "image/png"
|
||||
case "jpg", "jpeg": "image/jpeg"
|
||||
case "gif": "image/gif"
|
||||
case "woff2": "font/woff2"
|
||||
case "woff": "font/woff"
|
||||
case "ttf": "font/ttf"
|
||||
default: "application/octet-stream"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ final class WebChatWindowController: NSWindowController, WKScriptMessageHandler,
|
||||
private let webView: WKWebView
|
||||
private let sessionKey: String
|
||||
private let initialMessagesJSON: String
|
||||
private let logger = Logger(subsystem: "com.steipete.clawdis", category: "WebChat")
|
||||
|
||||
init(sessionKey: String) {
|
||||
webChatLogger.debug("init WebChatWindowController sessionKey=\(sessionKey, privacy: .public)")
|
||||
|
||||
Reference in New Issue
Block a user