Major update for stability

This commit is contained in:
Mark Gregory
2026-09-08 15:22:19 +01:00
parent 3b95f53a25
commit b2f3c5aef6
24 changed files with 1059 additions and 212 deletions
+2
View File
@@ -34,6 +34,7 @@ final class SyncJob {
var watchPath: String = ""
var watchDebounceSeconds: Int = 3
var lastWatchEventAt: Date? = nil
var allowUnattendedDelete: Bool = false
init(
name: String = "New Sync Job",
@@ -71,6 +72,7 @@ final class SyncJob {
self.watchPath = ""
self.watchDebounceSeconds = 3
self.lastWatchEventAt = nil
self.allowUnattendedDelete = false
}
var exclusions: [String] {
+21
View File
@@ -43,6 +43,27 @@ final class SyncRun {
RsyncSummary.parse(output + "\n" + errorOutput)
}
static func sanitizedLog(_ value: String, maxBytes: Int = 2_000_000) -> String {
let stripped = stripANSI(value)
let redacted = stripped
.replacingOccurrences(of: #"(?i)--password-file(?:=|\s+)[^\s]+"#, with: "--password-file=[REDACTED]", options: .regularExpression)
.replacingOccurrences(of: #"(?i)(password|passwd|token|secret)=([^\s]+)"#, with: "$1=[REDACTED]", options: .regularExpression)
let data = Data(redacted.utf8)
guard data.count > maxBytes else { return redacted }
let prefix = data.prefix(maxBytes)
return String(decoding: prefix, as: UTF8.self) + "\n\n[Log truncated by Rsync Manager for safety and storage limits.]\n"
}
private static func stripANSI(_ value: String) -> String {
value.replacingOccurrences(
of: #"\u001B\[[0-9;?]*[ -/]*[@-~]"#,
with: "",
options: .regularExpression
)
}
var exportText: String {
var text = "Rsync Manager Run Log\n"
text += "Job: \(jobName)\n"