feat: show skip offer countdown and transitions
This commit is contained in:
@@ -35,6 +35,7 @@ struct StreamQueue: Sendable {
|
||||
var identities = Set<String>()
|
||||
var reports = Set<String>()
|
||||
let entries = try document.items.map { item -> Entry in
|
||||
guard item.url == item.url.trimmingCharacters(in: .whitespacesAndNewlines) else { throw InvalidQueue() }
|
||||
let stream = try StreamURL.parse(item.url)
|
||||
let url: URL
|
||||
let identity: String
|
||||
@@ -56,12 +57,15 @@ struct StreamQueue: Sendable {
|
||||
var directoryInfo = stat()
|
||||
guard lstat(parent.path, &directoryInfo) == 0,
|
||||
(directoryInfo.st_mode & S_IFMT) == S_IFDIR,
|
||||
directoryInfo.st_uid == geteuid(), (directoryInfo.st_mode & 0o777) == 0o700,
|
||||
parent.resolvingSymlinksInPath().path == parent.path,
|
||||
reports.insert(report.path).inserted else { throw InvalidQueue() }
|
||||
directoryInfo.st_uid == geteuid(), (directoryInfo.st_mode & 0o7777) == 0o700,
|
||||
let resolvedParent = realpath(parent.path, nil) else { throw InvalidQueue() }
|
||||
defer { free(resolvedParent) }
|
||||
let canonicalReport = URL(fileURLWithPath: String(cString: resolvedParent), isDirectory: true)
|
||||
.appendingPathComponent(report.lastPathComponent)
|
||||
guard reports.insert(canonicalReport.path).inserted else { throw InvalidQueue() }
|
||||
var existing = stat()
|
||||
guard lstat(report.path, &existing) != 0, errno == ENOENT else { throw InvalidQueue() }
|
||||
return Entry(url: url, identity: identity, progressFile: report, label: label)
|
||||
guard lstat(canonicalReport.path, &existing) != 0, errno == ENOENT else { throw InvalidQueue() }
|
||||
return Entry(url: url, identity: identity, progressFile: canonicalReport, label: label)
|
||||
}
|
||||
return StreamQueue(entries: entries)
|
||||
} catch { throw InvalidQueue() }
|
||||
|
||||
Reference in New Issue
Block a user