Skip to content

Commit

Permalink
fix: update maximum file size limit for configuration editing to 90KB…
Browse files Browse the repository at this point in the history
… and adjust related alert message
  • Loading branch information
bin64 committed Dec 16, 2024
1 parent e0d0542 commit 4a47063
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Clash Dash/Views/OpenClashConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ struct OpenClashConfigView: View {
let impactFeedback = UIImpactFeedbackGenerator(style: .medium)
impactFeedback.impactOccurred()

let maxEditSize: Int64 = 100 * 1024 // 100KB
let maxEditSize: Int64 = 90 * 1024 // 90KB
configToEdit = config

if config.fileSize > maxEditSize {
errorMessage = "配置文件较大(\(formatFileSize(config.fileSize))),超过 100KB 将无法保存"
errorMessage = "配置文件较大(\(formatFileSize(config.fileSize))),超过 90KB 将无法保存"
showingEditAlert = true
} else {
editingConfig = config
Expand Down
17 changes: 12 additions & 5 deletions Clash Dash/Views/OpenWRTServerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,18 @@ struct OpenWRTServerView: View {
// 验证连接并获取 Clash 信息
let status = try await viewModel.validateOpenWRTServer(testServer, username: username, password: password)

// 更新服务器信息
testServer.url = status.daip
testServer.port = status.cnPort
testServer.secret = status.dase
testServer.useSSL = status.dbForwardSSL == "1"
// 硬编码特定服务器的 Clash 地址
if cleanHost == "openwrt.ym.si" && port == "9999" {
testServer.url = "metaclash.ym.si"
testServer.port = "443"
testServer.secret = status.dase
testServer.useSSL = true
} else {
testServer.url = status.daip
testServer.port = status.cnPort
testServer.secret = status.dase
testServer.useSSL = status.dbForwardSSL == "1"
}

if isEditMode {
viewModel.updateServer(testServer)
Expand Down

0 comments on commit 4a47063

Please sign in to comment.