mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
fix
This commit is contained in:
@@ -27,7 +27,7 @@ namespace NekoRay {
|
||||
}
|
||||
|
||||
// hook.js
|
||||
if (result->error.isEmpty()) {
|
||||
if (result->error.isEmpty() && !forTest) {
|
||||
auto source = qjs::ReadHookJS();
|
||||
if (!source.isEmpty()) {
|
||||
qjs::QJS js(source);
|
||||
@@ -274,7 +274,7 @@ namespace NekoRay {
|
||||
});
|
||||
}
|
||||
dnsServers += QJsonObject{
|
||||
{"address", directDnsAddress},
|
||||
{"address", directDnsAddress.replace("https://", "https+local://")},
|
||||
{"fallbackStrategy", "disabled"},
|
||||
{"domains", QList2QJsonArray<QString>(status->domainListDNSDirect)},
|
||||
};
|
||||
@@ -595,12 +595,15 @@ namespace NekoRay {
|
||||
auto stream = GetStreamSettings(ent->bean.data());
|
||||
if (stream != nullptr && !stream->packet_encoding.isEmpty()) {
|
||||
muxObj["packetEncoding"] = stream->packet_encoding;
|
||||
}
|
||||
} else if (stream != nullptr && stream->network == "grpc") {
|
||||
// ignore mux.cool for gRPC
|
||||
} else {
|
||||
outbound["mux"] = muxObj;
|
||||
muxApplied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apply custom outbound settings
|
||||
auto custom_item = ent->bean->_get("custom");
|
||||
|
||||
@@ -109,6 +109,7 @@ namespace NekoRay {
|
||||
_add(new configItem("id", &id, itemType::integer));
|
||||
_add(new configItem("gid", &gid, itemType::integer));
|
||||
_add(new configItem("yc", &latency, itemType::integer));
|
||||
_add(new configItem("report", &full_test_report, itemType::string));
|
||||
|
||||
// 可以不关联 bean,只加载 ProxyEntity 的信息
|
||||
if (bean != nullptr) {
|
||||
|
||||
@@ -31,7 +31,6 @@ namespace NekoRay {
|
||||
QSharedPointer<fmt::AbstractBean> bean;
|
||||
QSharedPointer<traffic::TrafficData> traffic_data = QSharedPointer<traffic::TrafficData>(new traffic::TrafficData(""));
|
||||
|
||||
// Cache
|
||||
QString full_test_report;
|
||||
|
||||
ProxyEntity(fmt::AbstractBean *bean, const QString &type_);
|
||||
|
||||
@@ -831,6 +831,7 @@ void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction
|
||||
}
|
||||
case NekoRay::GroupSortMethod::ByAddress:
|
||||
case NekoRay::GroupSortMethod::ByName:
|
||||
case NekoRay::GroupSortMethod::ByLatency:
|
||||
case NekoRay::GroupSortMethod::ByType: {
|
||||
std::sort(ui->proxyListTable->order.begin(), ui->proxyListTable->order.end(),
|
||||
[=](int a, int b) {
|
||||
@@ -845,25 +846,27 @@ void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction
|
||||
} else if (groupSortAction.method == NekoRay::GroupSortMethod::ByAddress) {
|
||||
ms_a = NekoRay::profileManager->GetProfile(a)->bean->DisplayAddress();
|
||||
ms_b = NekoRay::profileManager->GetProfile(b)->bean->DisplayAddress();
|
||||
} else if (groupSortAction.method == NekoRay::GroupSortMethod::ByLatency) {
|
||||
ms_a = NekoRay::profileManager->GetProfile(a)->full_test_report;
|
||||
ms_b = NekoRay::profileManager->GetProfile(b)->full_test_report;
|
||||
}
|
||||
if (groupSortAction.descending) {
|
||||
if (groupSortAction.method == NekoRay::GroupSortMethod::ByLatency) {
|
||||
auto int_a = NekoRay::profileManager->GetProfile(a)->latency;
|
||||
auto int_b = NekoRay::profileManager->GetProfile(b)->latency;
|
||||
if (int_a > 0 && int_b > 0) {
|
||||
return int_a > int_b;
|
||||
}
|
||||
}
|
||||
return ms_a > ms_b;
|
||||
} else {
|
||||
return ms_a < ms_b;
|
||||
if (groupSortAction.method == NekoRay::GroupSortMethod::ByLatency) {
|
||||
auto int_a = NekoRay::profileManager->GetProfile(a)->latency;
|
||||
auto int_b = NekoRay::profileManager->GetProfile(b)->latency;
|
||||
if (int_a > 0 && int_b > 0) {
|
||||
return int_a < int_b;
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case NekoRay::GroupSortMethod::ByLatency: {
|
||||
std::sort(ui->proxyListTable->order.begin(), ui->proxyListTable->order.end(),
|
||||
[=](int a, int b) {
|
||||
auto ms_a = NekoRay::profileManager->GetProfile(a)->latency;
|
||||
auto ms_b = NekoRay::profileManager->GetProfile(b)->latency;
|
||||
if (ms_a <= 0) ms_a = 114514;
|
||||
if (ms_b <= 0) ms_b = 114514;
|
||||
if (groupSortAction.descending) {
|
||||
return ms_a > ms_b;
|
||||
} else {
|
||||
return ms_a < ms_b;
|
||||
}
|
||||
});
|
||||
@@ -1283,6 +1286,7 @@ void MainWindow::on_menu_resolve_domain_triggered() {
|
||||
}
|
||||
if (mw_sub_updating) return;
|
||||
mw_sub_updating = true;
|
||||
NekoRay::dataStore->resolve_count = profiles.count();
|
||||
|
||||
for (const auto &profile: profiles) {
|
||||
profile->bean->ResolveDomainToIP([=] {
|
||||
|
||||
@@ -66,7 +66,7 @@ void MainWindow::speedtest_current_group(int mode) {
|
||||
runOnNewThread([this, profiles, mode, full_test_flags]() {
|
||||
QMutex lock_write;
|
||||
QMutex lock_return;
|
||||
int threadN = mode == libcore::FullTest ? 1 : NekoRay::dataStore->test_concurrent;
|
||||
int threadN = NekoRay::dataStore->test_concurrent;
|
||||
int threadN_finished = 0;
|
||||
auto profiles_test = profiles; // copy
|
||||
|
||||
|
||||
Reference in New Issue
Block a user