Skip to content

Commit

Permalink
Merge branch 'meta-dev' into meta
Browse files Browse the repository at this point in the history
  • Loading branch information
mrFq1 committed Aug 29, 2022
2 parents b9bf533 + 20eb51b commit 684de92
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 72 deletions.
31 changes: 13 additions & 18 deletions ClashX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1084,15 +1084,15 @@ extension AppDelegate {
@IBAction func tunMode(_ sender: NSMenuItem) {
let nc = NSUserNotificationCenter.default
guard let config = ApiRequest.shared.currentConfigContent else {
nc.post(title: "Tun Mode", info: "Not found current config.")
nc.post(title: "Tun Mode", info: NSLocalizedString("Not found current config.", comment: ""))
return
}

sender.isEnabled = false
ApiRequest.requestConfig {
guard let path = ClashMetaConfig.updateConfigTun(config, enable: !$0.tun.enable) else {
sender.isEnabled = true
nc.post(title: "Tun Mode", info: "Decode current config failed.")
nc.post(title: "Tun Mode", info: NSLocalizedString("Decode current config failed.", comment: ""))
return
}

Expand Down Expand Up @@ -1136,33 +1136,33 @@ extension AppDelegate {
guard $0.error == nil,
let data = $0.data,
let tagName = try? JSON(data: data)["tag_name"].string else {
unc.postUpdateNotice(msg: "Some thing failed.")
unc.postUpdateNotice(msg: NSLocalizedString("Some thing failed.", comment: ""))
return
}

if tagName != AppVersionUtil.currentVersion {
let alert = NSAlert()
alert.messageText = "Open github release page to download \(tagName)"
alert.messageText = NSLocalizedString("Open github release page to download ", comment: "") + "\(tagName)"
alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
if alert.runModal() == .alertFirstButtonReturn {
NSWorkspace.shared.open(.init(string: "https://github.com/MetaCubeX/ClashX.Meta/releases/latest")!)
}
} else {
unc.postUpdateNotice(msg: "No new release found.")
unc.postUpdateNotice(msg: NSLocalizedString("No new release found.", comment: ""))
}
}
}

@IBAction func updateGEO(_ sender: NSMenuItem) {
ApiRequest.updateGEO { _ in
NSUserNotificationCenter.default.post(title: "Updating GEO Databases...", info: "Good luck to you 🙃")
NSUserNotificationCenter.default.post(title: NSLocalizedString("Updating GEO Databases...", comment: ""), info: NSLocalizedString("Good luck to you 🙃", comment: ""))
}
}

@IBAction func flushFakeipCache(_ sender: NSMenuItem) {
ApiRequest.flushFakeipCache {
NSUserNotificationCenter.default.post(title: "Flush fake-ip cache", info: $0 ? "Success" : "Failed")
NSUserNotificationCenter.default.post(title: NSLocalizedString("Flush fake-ip cache", comment: ""), info: $0 ? "Success" : "Failed")
}
}

Expand All @@ -1176,12 +1176,7 @@ extension AppDelegate {
@IBAction func useAlphaMeta(_ sender: NSMenuItem) {
if UserDefaults.standard.object(forKey: "useAlphaCore") as? Bool == nil {
let alert = NSAlert()
alert.messageText = """
If you don't know what you're doing, never turn this switch on.
如果你不知道你在做什么, 请绝对不要打开这个开关.
Running Meta Core without any authentication under sudo privileges can have devastating consequences.
在sudo 权限下运行未经验证的 Meta 核心, 可能造成严重后果.
"""
alert.messageText = NSLocalizedString("Alpha Meta core Warning", comment: "")
alert.alertStyle = .warning
alert.addButton(withTitle: NSLocalizedString("Continue", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
Expand Down Expand Up @@ -1285,7 +1280,7 @@ Running Meta Core without any authentication under sudo privileges can have deva
return
}
self.updateAlphaVersion(version)
dlResult("Version: \(version)")
dlResult(NSLocalizedString("Version: ", comment: "") + version)
} catch let error {
dlResult("Something error \(error.localizedDescription)")
}
Expand All @@ -1298,12 +1293,12 @@ Running Meta Core without any authentication under sudo privileges can have deva
useAlphaMetaMenuItem.isEnabled = enable
alphaMetaVersionMenuItem.isEnabled = enable
if let v = version {
let info = "Version: \(v)"
let info = NSLocalizedString("Version: ", comment: "") + v
alphaMetaVersionMenuItem.title = info
updateAlphaMetaMenuItem.title = "Update Meta core"
updateAlphaMetaMenuItem.title = NSLocalizedString("Update Alpha Meta core", comment: "")
} else {
alphaMetaVersionMenuItem.title = "Version: none"
updateAlphaMetaMenuItem.title = "Download Meta core"
alphaMetaVersionMenuItem.title = NSLocalizedString("Version: ", comment: "") + "none"
updateAlphaMetaMenuItem.title = NSLocalizedString("Download Meta core", comment: "")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ClashX/General/Managers/MenuItemFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MenuItemFactory {
}
}

static let updateAllProvidersTitle = "Update All Providers"
static let updateAllProvidersTitle = NSLocalizedString("Update All Providers", comment: "")

// MARK: - Public

Expand Down Expand Up @@ -405,7 +405,7 @@ extension MenuItemFactory {
!date.timeIntervalSinceNow.isInfinite,
let re = dateCF.string(from: abs(date.timeIntervalSinceNow)) else { return nil }

return "\(re) ago"
return re + NSLocalizedString(" ago", comment: "Provider update time title")
}

@objc static func actionUpdateAllProviders(sender: NSMenuItem) {
Expand Down
4 changes: 4 additions & 0 deletions ClashX/Models/ClashProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ enum ClashProxyType: String, Codable {
case snell = "Snell"
case trojan = "Trojan"
case relay = "Relay"

case vless = "Vless"
case hysteria = "Hysteria"

case unknown = "Unknown"

static let proxyGroups: [ClashProxyType] = [.select, .urltest, .fallback, .loadBalance]
Expand Down
50 changes: 42 additions & 8 deletions ClashX/Support Files/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* Provider update time title */
" ago" = " ago";

/* No comment provided by engineer. */
"Add a remote config" = "Add a remote config";

/* No comment provided by engineer. */
"Add a remote control config" = "Add a remote control config";

/* No comment provided by engineer. */
"Apply and Quit" = "Apply and Quit";
"Alpha Meta core Warning" = "If you don't know what you're doing, never turn this switch on.\nRunning Meta Core without any authentication under 'su' privileges may damage your mac.";

/* No comment provided by engineer. */
"Auto Close Connection" = "Auto Close Connection";
Expand Down Expand Up @@ -40,9 +43,15 @@
/* No comment provided by engineer. */
"Config loading Fail!" = "Config loading Fail!";

/* No comment provided by engineer. */
"Continue" = "Continue";

/* No comment provided by engineer. */
"Custom your GEOIP MMDB download address." = "Custom your GEOIP MMDB download address.";

/* No comment provided by engineer. */
"Decode current config failed." = "Decode current config failed.";

/* No comment provided by engineer. */
"Details" = "Details";

Expand All @@ -55,6 +64,9 @@
/* No comment provided by engineer. */
"Download fail" = "Download fail";

/* No comment provided by engineer. */
"Download Meta core" = "Download Meta core";

/* No comment provided by engineer. */
"Enhance proxy list render" = "Enhance proxy list render";

Expand All @@ -64,9 +76,15 @@
/* No comment provided by engineer. */
"Fail:" = "Fail:";

/* No comment provided by engineer. */
"Flush fake-ip cache" = "Flush fake-ip cache";

/* No comment provided by engineer. */
"Global" = "Global";

/* No comment provided by engineer. */
"Good luck to you 🙃" = "Good luck to you 🙃";

/* No comment provided by engineer. */
"hours" = "hours";

Expand All @@ -82,17 +100,21 @@
/* No comment provided by engineer. */
"Load Balance" = "Load Balance";

"Mode" = "Mode";
/* No comment provided by engineer. */
"Never" = "Never";

/* No comment provided by engineer. */
"Need to Restart the ClashX to Take effect, Please start clashX manually" = "Need to Restart the ClashX to Take effect, Please start clashX manually";
"No new release found." = "No new release found.";

/* No comment provided by engineer. */
"Never" = "Never";
"Not found current config." = "Not found current config.";

/* No comment provided by engineer. */
"OK" = "OK";

/* No comment provided by engineer. */
"Open github release page to download " = "Open github release page to download ";

/* No comment provided by engineer. */
"Ports Open Fail, Please try to restart ClashX" = "Ports Open Fail, Please try to restart ClashX";

Expand Down Expand Up @@ -129,18 +151,18 @@
/* No comment provided by engineer. */
"Rule" = "Rule";

/* No comment provided by engineer. */
"Script" = "Script";

/* No comment provided by engineer. */
"Should be a least 1 hour" = "Should be a least 1 hour";

/* No comment provided by engineer. */
"Show speedTest at top" = "Show speedTest at top";
"Some thing failed." = "Some thing failed.";

/* No comment provided by engineer. */
"Stable" = "Stable";

/* No comment provided by engineer. */
"Start Meta Fail!" = "Start Meta Fail!";

/* No comment provided by engineer. */
"Succeed!" = "Succeed!";

Expand All @@ -165,6 +187,12 @@
/* No comment provided by engineer. */
"This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly." = "This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly.";

/* No comment provided by engineer. */
"Update All Providers" = "Update All Providers";

/* No comment provided by engineer. */
"Update Alpha Meta core" = "Update Alpha Meta core";

/* No comment provided by engineer. */
"Update GEOIP Database" = "Update GEOIP Database";

Expand All @@ -174,6 +202,9 @@
/* No comment provided by engineer. */
"Updating" = "Updating";

/* No comment provided by engineer. */
"Updating GEO Databases..." = "Updating GEO Databases...";

/* No comment provided by engineer. */
"Upgrade Channel" = "Upgrade Channel";

Expand All @@ -185,3 +216,6 @@

/* No comment provided by engineer. */
"Use reload config to try reconnect." = "Use reload config to try reconnect.";

/* No comment provided by engineer. */
"Version: " = "Version: ";
52 changes: 43 additions & 9 deletions ClashX/Support Files/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/* Provider update time title */
" ago" = "前";

/* No comment provided by engineer. */
"Add a remote config" = "添加托管配置文件";

/* No comment provided by engineer. */
"Add a remote control config" = "添加远程控制器配置";

/* No comment provided by engineer. */
"Apply and Quit" = "应用并退出";
"Alpha Meta core Warning" = "如果你不知道你在做什么, 请绝对不要打开这个开关.\n在 'su' 权限下运行未经验证的 Meta 核心, 可能损坏你的 mac.";

/* No comment provided by engineer. */
"Auto Close Connection" = "切换代理时中断连接";
Expand Down Expand Up @@ -40,9 +43,15 @@
/* No comment provided by engineer. */
"Config loading Fail!" = "配置文件加载失败";

/* No comment provided by engineer. */
"Continue" = "继续";

/* No comment provided by engineer. */
"Custom your GEOIP MMDB download address." = "自定义下载地址";

/* No comment provided by engineer. */
"Decode current config failed." = "无法解析当前的配置文件.";

/* No comment provided by engineer. */
"Details" = "查看详情";

Expand All @@ -55,6 +64,9 @@
/* No comment provided by engineer. */
"Download fail" = "下载失败";

/* No comment provided by engineer. */
"Download Meta core" = "下载 Meta 内核";

/* No comment provided by engineer. */
"Enhance proxy list render" = "增强渲染代理列表";

Expand All @@ -64,9 +76,15 @@
/* No comment provided by engineer. */
"Fail:" = "失败:";

/* No comment provided by engineer. */
"Flush fake-ip cache" = "清空 fake-ip 缓存";

/* No comment provided by engineer. */
"Global" = "全局";

/* No comment provided by engineer. */
"Good luck to you 🙃" = "祝你好运 🙃";

/* No comment provided by engineer. */
"hours" = "小时";

Expand All @@ -82,17 +100,21 @@
/* No comment provided by engineer. */
"Load Balance" = "负载均衡";

"Mode" = "模式";
/* No comment provided by engineer. */
"Never" = "从未";

/* No comment provided by engineer. */
"Need to Restart the ClashX to Take effect, Please start clashX manually" = "需要重启ClashX生效,请手动启动ClashX";
"No new release found." = "未找到更新.";

/* No comment provided by engineer. */
"Never" = "从未";
"Not found current config." = "未找到当前的配置文件.";

/* No comment provided by engineer. */
"OK" = "确定";

/* No comment provided by engineer. */
"Open github release page to download " = "打开 GitHub Release 下载 ";

/* No comment provided by engineer. */
"Ports Open Fail, Please try to restart ClashX" = "端口打开失败,请尝试重启ClashX";

Expand Down Expand Up @@ -129,18 +151,18 @@
/* No comment provided by engineer. */
"Rule" = "规则";

/* No comment provided by engineer. */
"Script" = "脚本";

/* No comment provided by engineer. */
"Should be a least 1 hour" = "至少需要1小时间隔";

/* No comment provided by engineer. */
"Show speedTest at top" = "顶端显示测速按钮";
"Some thing failed." = "发生了一些错误.";

/* No comment provided by engineer. */
"Stable" = "Stable";

/* No comment provided by engineer. */
"Start Meta Fail!" = "打开Meta 失败!";

/* No comment provided by engineer. */
"Succeed!" = "成功!";

Expand All @@ -166,14 +188,23 @@
"This version of ClashX contains a break change due to clash core 1.0 released. Check if your config is not working properly." = "由于Clash Core发布1.0版本,使用此版本的 ClashX 可能需要更新配置内容\n前往 https://github.com/Dreamacro/clash/wiki/breaking-changes-in-1.0.0 查看详情";

/* No comment provided by engineer. */
"Update GEOIP Database" = "更新IP数据库";
"Update All Providers" = "更新所有 Providers";

/* No comment provided by engineer. */
"Update Alpha Meta core" = "更新 Alpha Meta 内核";

/* No comment provided by engineer. */
"Update GEOIP Database" = "更新 GEOIP 数据库";

/* No comment provided by engineer. */
"Update remote config update interval" = "远程配置自动更新间隔";

/* No comment provided by engineer. */
"Updating" = "更新中";

/* No comment provided by engineer. */
"Updating GEO Databases..." = "更新 GEO 数据库...";

/* No comment provided by engineer. */
"Upgrade Channel" = "更新通道";

Expand All @@ -185,3 +216,6 @@

/* No comment provided by engineer. */
"Use reload config to try reconnect." = "使用重载配置文件按钮尝试重新连接";

/* No comment provided by engineer. */
"Version: " = "版本: ";
Loading

0 comments on commit 684de92

Please sign in to comment.