diff --git a/.github/workflows/build-qv2ray-cmake.yml b/.github/workflows/build-qv2ray-cmake.yml
index 65c3caf..de5737d 100644
--- a/.github/workflows/build-qv2ray-cmake.yml
+++ b/.github/workflows/build-qv2ray-cmake.yml
@@ -35,7 +35,7 @@ jobs:
if: steps.cache-common.outputs.cache-hit != 'true'
uses: actions/setup-go@v3
with:
- go-version: 1.19.2
+ go-version: 1.19.4
- name: Build golang parts
if: steps.cache-common.outputs.cache-hit != 'true'
shell: bash
@@ -57,7 +57,6 @@ jobs:
matrix:
platform: [ windows-2022, ubuntu-20.04, macos-10.15 ]
arch: [ x64 ]
- qt_version: [ 5.15.2 ]
fail-fast: false
runs-on: ${{ matrix.platform }}
@@ -87,12 +86,12 @@ jobs:
if: matrix.platform == 'macos-10.15'
uses: jurplel/install-qt-action@v3
with:
- version: ${{ matrix.qt_version }}
+ version: 5.15.2
py7zrversion: ' '
aqtversion: ' '
setup-python: false
cache: true
- cache-key-prefix: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }}
+ cache-key-prefix: QtCache-${{ matrix.platform }}-${{ matrix.arch }}
- name: Windows - Download Custom Qt 5.15 SDK
shell: bash
if: matrix.platform == 'windows-2022'
@@ -116,14 +115,14 @@ jobs:
uses: actions/cache@v3
with:
path: libs/deps
- key: DepsCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }}-${{ hashFiles('libs/build_deps_*.sh') }}
+ key: DepsCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ hashFiles('libs/build_deps_*.sh') }}
- name: Build Dependencies
shell: bash
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
./libs/build_deps_all.sh
# ========================================================================================================= Generate MakeFile and Build
- - name: Windows - ${{ matrix.qt_version }} - Generate MakeFile and Build
+ - name: Windows - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'windows-2022'
env:
@@ -137,7 +136,7 @@ jobs:
ninja
cd ..
./libs/deploy_windows64.sh
- - name: Linux - ${{ matrix.qt_version }} - Generate MakeFile and Build
+ - name: Linux - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'ubuntu-20.04'
run: |
@@ -147,7 +146,7 @@ jobs:
ninja
cd ..
./libs/deploy_linux64.sh
- - name: macOS - ${{ matrix.qt_version }} - Generate MakeFile and Build
+ - name: macOS - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'macos-10.15'
run: |
diff --git a/go/cmd/nekobox_core/grpc_box.go b/go/cmd/nekobox_core/grpc_box.go
index e4718a6..c17131a 100644
--- a/go/cmd/nekobox_core/grpc_box.go
+++ b/go/cmd/nekobox_core/grpc_box.go
@@ -12,7 +12,6 @@ import (
"neko/pkg/speedtest"
"nekobox_core/box_main"
"reflect"
- "time"
"unsafe"
box "github.com/sagernet/sing-box"
@@ -39,16 +38,6 @@ func (s *server) Start(ctx context.Context, in *gen.LoadConfigReq) (out *gen.Err
log.Println("Start:", in.CoreConfig)
}
- if neko_common.GetBuildTime() > 0 {
- if time.Now().Unix() >= neko_common.GetExpireTime() {
- err = errors.New("Your version is too old! Please update!! 版本太旧,请升级!")
- return
- } else if time.Now().Unix() >= (neko_common.GetExpireTime() - 30*24*60*60) {
- log.Println("Your version is too old! Please update!! 版本太旧,请升级!")
- log.Println("This version expires on " + time.Unix(neko_common.GetExpireTime(), 0).Format("2006-01-02"))
- }
- }
-
if instance != nil {
err = errors.New("instance already started")
return
diff --git a/go/cmd/nekoray_core/grpc_ray.go b/go/cmd/nekoray_core/grpc_ray.go
index 0de35f9..1cd12ca 100644
--- a/go/cmd/nekoray_core/grpc_ray.go
+++ b/go/cmd/nekoray_core/grpc_ray.go
@@ -8,7 +8,6 @@ import (
"io"
"libcore"
"libcore/stun"
- "log"
"neko/gen"
"neko/pkg/grpc_server"
"neko/pkg/neko_common"
@@ -39,16 +38,6 @@ func (s *server) Start(ctx context.Context, in *gen.LoadConfigReq) (out *gen.Err
logrus.Println("Start:", in.CoreConfig, in.TryDomains)
}
- if neko_common.GetBuildTime() > 0 {
- if time.Now().Unix() >= neko_common.GetExpireTime() {
- err = errors.New("Your version is too old! Please update!! 版本太旧,请升级!")
- return
- } else if time.Now().Unix() >= (neko_common.GetExpireTime() - 30*24*60*60) {
- log.Println("Your version is too old! Please update!! 版本太旧,请升级!")
- log.Println("This version expires on " + time.Unix(neko_common.GetExpireTime(), 0).Format("2006-01-02"))
- }
- }
-
if instance != nil {
err = errors.New("instance already started")
return
diff --git a/go/pkg/neko_common/common.go b/go/pkg/neko_common/common.go
index e6cdebf..ac1b01b 100644
--- a/go/pkg/neko_common/common.go
+++ b/go/pkg/neko_common/common.go
@@ -2,8 +2,6 @@ package neko_common
import (
"net/http"
- "strings"
- "time"
)
var Version_v2ray string = "N/A"
@@ -20,19 +18,3 @@ const (
)
var GetProxyHttpClient func() *http.Client
-
-func GetBuildTime() int64 {
- if !strings.HasPrefix(Version_neko, "nekoray-") {
- return 0
- }
- ver := strings.TrimLeft(Version_neko, "nekoray-")
- buildDate := ver[strings.Index(ver, "-")+1:]
- buildTime, _ := time.Parse("2006-01-02", buildDate)
- return buildTime.Unix()
-}
-
-func GetExpireTime() int64 {
- buildTime := time.Unix(GetBuildTime(), 0)
- expireTime := buildTime.AddDate(0, 6, 0) // current force update: 6 months
- return expireTime.Unix()
-}
diff --git a/main/NekoRay.cpp b/main/NekoRay.cpp
index 6700500..15060e2 100644
--- a/main/NekoRay.cpp
+++ b/main/NekoRay.cpp
@@ -67,6 +67,7 @@ namespace NekoRay {
_add(new configItem("sub_clear", &sub_clear, itemType::boolean));
_add(new configItem("sub_insecure", &sub_insecure, itemType::boolean));
_add(new configItem("enable_js_hook", &enable_js_hook, itemType::integer));
+ _add(new configItem("log_ignore", &log_ignore, itemType::stringList));
}
void DataStore::UpdateStartedId(int id) {
diff --git a/main/NekoRay_DataStore.hpp b/main/NekoRay_DataStore.hpp
index 5eeafbc..eab5b37 100644
--- a/main/NekoRay_DataStore.hpp
+++ b/main/NekoRay_DataStore.hpp
@@ -76,6 +76,7 @@ namespace NekoRay {
QString mw_size = "";
bool check_include_pre = false;
QString system_proxy_format = "";
+ QStringList log_ignore = {};
// Subscription
QString user_agent = "Nekoray/1.0 (Prefer Clash Format)";
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index 6e13e98..c45c4d6 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -1205,6 +1205,28 @@ End: %2
Open Config Folder
打开配置目录
+
+ Set ignore keyword
+ 设置忽略关键字
+
+
+ Set the following keywords to ignore?
+Split by line.
+ 将以下关键字设置为忽略?
+一行一个。
+
+
+ Save as route
+ 保存为路由规则
+
+
+ Save "%1" as a routing rule?
+ 将"%1"保存为一条路由规则?
+
+
+ Edit
+ 编辑
+
ProxyItem
diff --git a/ui/mainwindow.cpp b/ui/mainwindow.cpp
index dd7cfcb..78fb151 100644
--- a/ui/mainwindow.cpp
+++ b/ui/mainwindow.cpp
@@ -558,7 +558,7 @@ void MainWindow::on_menu_exit_triggered() {
QProcess::startDetached("./updater", QStringList{});
} else if (exit_reason == 2) {
QDir::setCurrent(QApplication::applicationDirPath());
- QProcess::startDetached(qEnvironmentVariable("NKR_FROM_LAUNCHER") == "1" ? "./launcher" : "./nekoray", QStringList{});
+ QProcess::startDetached(qEnvironmentVariable("NKR_FROM_LAUNCHER") == "1" ? "./launcher" : QApplication::applicationFilePath(), QStringList{});
}
tray->hide();
QCoreApplication::quit();
@@ -1277,9 +1277,15 @@ inline void FastAppendTextDocument(const QString &message, QTextDocument *doc) {
}
void MainWindow::show_log_impl(const QString &log) {
- if (log.trimmed().isEmpty()) return;
+ auto log2 = log.trimmed();
+ if (log2.isEmpty()) return;
- FastAppendTextDocument(log, qvLogDocument);
+ auto log_ignore = NekoRay::dataStore->log_ignore;
+ for (const auto &str: log_ignore) {
+ if (log2.contains(str)) return;
+ }
+
+ FastAppendTextDocument(log2, qvLogDocument);
// qvLogDocument->setPlainText(qvLogDocument->toPlainText() + log);
// From https://gist.github.com/jemyzhang/7130092
auto maxLines = 200;
@@ -1298,6 +1304,8 @@ void MainWindow::show_log_impl(const QString &log) {
}
}
+#define ADD_TO_CURRENT_ROUTE(a, b) NekoRay::dataStore->routing->a = (SplitLines(NekoRay::dataStore->routing->a) << b).join("\n");
+
void MainWindow::on_masterLogBrowser_customContextMenuRequested(const QPoint &pos) {
QMenu *menu = ui->masterLogBrowser->createStandardContextMenu();
@@ -1305,14 +1313,74 @@ void MainWindow::on_masterLogBrowser_customContextMenuRequested(const QPoint &po
sep->setSeparator(true);
menu->addAction(sep);
+ auto action_add_ignore = new QAction;
+ action_add_ignore->setText(tr("Set ignore keyword"));
+ connect(action_add_ignore, &QAction::triggered, this, [=] {
+ auto list = NekoRay::dataStore->log_ignore;
+ auto newStr = ui->masterLogBrowser->textCursor().selectedText().trimmed();
+ if (!newStr.isEmpty()) list << newStr;
+ bool ok;
+ newStr = QInputDialog::getMultiLineText(GetMessageBoxParent(), tr("Set ignore keyword"), tr("Set the following keywords to ignore?\nSplit by line."), list.join("\n"), &ok);
+ if (ok) {
+ NekoRay::dataStore->log_ignore = SplitLines(newStr);
+ NekoRay::dataStore->Save();
+ }
+ });
+ menu->addAction(action_add_ignore);
+
+ auto action_add_route = new QAction;
+ action_add_route->setText(tr("Save as route"));
+ connect(action_add_route, &QAction::triggered, this, [=] {
+ auto newStr = ui->masterLogBrowser->textCursor().selectedText().trimmed();
+ if (newStr.isEmpty()) return;
+ //
+ bool ok;
+ newStr = QInputDialog::getText(GetMessageBoxParent(), tr("Save as route"), tr("Edit"), {}, newStr, &ok).trimmed();
+ if (!ok) return;
+ if (newStr.isEmpty()) return;
+ //
+ auto select = IsIpAddress(newStr) ? 0 : 3;
+ QStringList items = {"proxyIP", "bypassIP", "blockIP", "proxyDomain", "bypassDomain", "blockDomain"};
+ auto item = QInputDialog::getItem(GetMessageBoxParent(), tr("Save as route"),
+ tr("Save \"%1\" as a routing rule?").arg(newStr),
+ items, select, false, &ok);
+ if (ok) {
+ auto index = items.indexOf(item);
+ switch (index) {
+ case 0:
+ ADD_TO_CURRENT_ROUTE(proxy_ip, newStr);
+ break;
+ case 1:
+ ADD_TO_CURRENT_ROUTE(direct_ip, newStr);
+ break;
+ case 2:
+ ADD_TO_CURRENT_ROUTE(block_ip, newStr);
+ break;
+ case 3:
+ ADD_TO_CURRENT_ROUTE(proxy_domain, newStr);
+ break;
+ case 4:
+ ADD_TO_CURRENT_ROUTE(direct_domain, newStr);
+ break;
+ case 5:
+ ADD_TO_CURRENT_ROUTE(block_domain, newStr);
+ break;
+ default:
+ break;
+ }
+ MW_dialog_message("", "UpdateDataStore,RouteChanged");
+ }
+ });
+ menu->addAction(action_add_route);
+
auto action_clear = new QAction;
action_clear->setText(tr("Clear"));
- action_clear->setData(-1);
connect(action_clear, &QAction::triggered, this, [=] {
qvLogDocument->clear();
ui->masterLogBrowser->clear();
});
menu->addAction(action_clear);
+
menu->exec(ui->masterLogBrowser->viewport()->mapToGlobal(pos)); // 弹出菜单
}