feat(drone-dock): 完善真实联调、状态轮询与准备页反馈
开放 Release 真实操作并保留 Debug 拦截;恢复前台 shooting 串行轮询;统一打印机巢请求与完整原值响应;优化长点位名称、未拍摄文案、报备失败及已结束任务提示,移除成功回执 UI。补充相关测试、离线策略检查和联调说明。
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import Foundation
|
||||
|
||||
/// 禁飞期间的请求边界;正式包仅允许用户手动图传,不允许创建或飞控。
|
||||
/// 调试请求边界:Debug 禁止真实设备操作,Release 按用户授权开放已对接的操作。
|
||||
enum DeviceCommandDebugPolicy {
|
||||
/// 飞控与真实待飞任务在所有构建中关闭,不因打 Release 包而解除禁飞。
|
||||
static let blocksFlightRequests = true
|
||||
/// 2026-11-02 用户授权 Release 真机联调;Debug 仍无运行时放行开关。
|
||||
static var blocksFlightRequests: Bool {
|
||||
#if DEBUG
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
}
|
||||
/// 所有 Debug 构建禁止真实设备操作,没有启动参数或设置开关可临时放行。
|
||||
static var blocksLiveRequests: Bool {
|
||||
#if DEBUG
|
||||
@@ -20,12 +26,15 @@ enum DeviceCommandDebugPolicy {
|
||||
static func prepare(_ request: URLRequest, isLocalSimulation: Bool) throws -> URLRequest {
|
||||
guard !isLocalSimulation, let url = request.url else { return request }
|
||||
let path = "/" + url.path.split(separator: "/").joined(separator: "/")
|
||||
// 创建虽不直接起飞,但会改变真实订单状态;禁飞调试使用本地待飞任务。
|
||||
// Debug 创建也必须拦截,避免调试残留真实待飞任务。
|
||||
if path == "/api/yf-handset-app/photog/multi-plane/tasks/create" {
|
||||
throw DeviceCommandDebugBlockedError()
|
||||
guard !blocksFlightRequests, request.httpMethod == "POST" else { throw DeviceCommandDebugBlockedError() }
|
||||
return request
|
||||
}
|
||||
guard path == "/api/app/airport" || path.hasPrefix("/api/app/airport/") else { return request }
|
||||
// 2026-11-02 仅为用户后续手动图传测试提供 Release 入口;Debug 仍禁止开流。
|
||||
let flightPaths: Set<String> = ["/api/app/airport/shoot", "/api/app/airport/start-shoot", "/api/app/airport/command"]
|
||||
if !blocksFlightRequests, request.httpMethod == "POST", flightPaths.contains(path) { return request }
|
||||
// 仅允许已确认的图传和飞控接口;未知设备操作仍阻断。
|
||||
if request.httpMethod == "GET", path == "/api/app/airport/live", !blocksLiveRequests { return request }
|
||||
let readablePaths: Set<String> = [
|
||||
"/api/app/airport/home", "/api/app/airport/plane-status",
|
||||
|
||||
Reference in New Issue
Block a user