From bee758cba71b1f986d4e148fb5156b5e91cc85ae Mon Sep 17 00:00:00 2001 From: Ne0W0r1d Date: Tue, 6 Jan 2026 21:34:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=E5=8A=A0=E5=85=A5=E5=9F=BA?= =?UTF-8?q?=E4=BA=8E=E6=B5=8F=E8=A7=88=E5=99=A8=E7=9A=84=20USTC=20&=20NJU?= =?UTF-8?q?=20=E6=B5=8B=E9=80=9F=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/About.cpp | 5 +- src/About.h | 2 + src/CipherTools.pro | 3 + src/Home.cpp | 123 ++++++++++++++++++++++------------- src/Home.h | 6 ++ src/Home.ui | 18 +++++ src/main.cpp | 9 ++- src/settings.cpp | 5 +- src/settings.h | 2 + src/tools/multiout.cpp | 13 +++- src/tools/multiout.h | 3 + src/tools/testspeed.cpp | 19 ++++++ src/tools/testspeed.h | 27 ++++++++ src/tools/testspeed.ui | 41 ++++++++++++ src/tools/testspeed_ustc.cpp | 14 ++++ src/tools/wakenow.h | 2 + src/version.h | 4 ++ 17 files changed, 237 insertions(+), 59 deletions(-) create mode 100644 src/tools/testspeed.cpp create mode 100644 src/tools/testspeed.h create mode 100644 src/tools/testspeed.ui create mode 100644 src/tools/testspeed_ustc.cpp diff --git a/src/About.cpp b/src/About.cpp index 63da6b3..aaaebb4 100755 --- a/src/About.cpp +++ b/src/About.cpp @@ -1,8 +1,7 @@ /* ******** Cipher Tools ******** -******** 2025© Ne0W0r1d ******** -******** 2024-2025© Yumeyo ******** -******** LGPL 3 License ******** +******** 2025-2026 Ne0W0r1d ******** +******** MIT License ******** ******** About ******** */ diff --git a/src/About.h b/src/About.h index ab50a74..35d20cc 100755 --- a/src/About.h +++ b/src/About.h @@ -9,6 +9,8 @@ #ifndef ABOUT_H #define ABOUT_H +#pragma once + #include #include #include diff --git a/src/CipherTools.pro b/src/CipherTools.pro index 58bd952..01cd5c7 100755 --- a/src/CipherTools.pro +++ b/src/CipherTools.pro @@ -16,6 +16,7 @@ SOURCES += \ settings.cpp \ tools/deviceinfo.cpp \ tools/multiout.cpp \ + tools/testspeed.cpp \ tools/wakenow.cpp HEADERS += \ @@ -24,6 +25,7 @@ HEADERS += \ settings.h \ tools/deviceinfo.h \ tools/multiout.h \ + tools/testspeed.h \ tools/wakenow.h \ version.h @@ -33,6 +35,7 @@ FORMS += \ settings.ui \ tools/deviceinfo.ui \ tools/multiout.ui \ + tools/testspeed.ui \ tools/wakenow.ui # Default rules for deployment. diff --git a/src/Home.cpp b/src/Home.cpp index 9b81be0..343e170 100755 --- a/src/Home.cpp +++ b/src/Home.cpp @@ -1,8 +1,7 @@ /* ******** Cipher Tools ******** -******** 2025© Ne0W0r1d ******** -******** 2024-2025© Yumeyo ******** -******** LGPL 3 License ******** +******** 2025-2026 Ne0W0r1d ******** +******** MIT License ******** ******** Home ******** */ @@ -12,25 +11,25 @@ #include "ui_Home.h" #include "version.h" #include "tools/multiout.h" +#include "tools/testspeed.h" home::home(QWidget *parent) : QMainWindow(parent) , ui(new Ui::home) { ui->setupUi(this); - setFixedSize(this->width(),this->height()); //固定大小(Fixed site) + setFixedSize(this->width(),this->height()); //固定大小 - QString systemname = QSysInfo::kernelType();// 获取内核信息(Get Kernel Information) - QString distro = QSysInfo::prettyProductName();// 获取发行版名称(Get Distro Name) - QString systemver = QSysInfo::productVersion();// 获取系统版本(Get System Version) + QString systemname = QSysInfo::kernelType();// 获取内核信息 + QString distro = QSysInfo::prettyProductName();// 获取发行版名称 + QString systemver = QSysInfo::productVersion();// 获取系统版本 - ui -> Version ->setText(AK_VERSION); // 主页应用版本(Home App Version) - ui -> test_waring -> setText("Alpha 版本 || 请勿用于生产环境 || 请及时汇报BUG || 请勿滥用接口"); // 主页测试版警告(Home Testing Version Warning) + ui -> Version ->setText(AK_VERSION); // 主页应用版本 + ui -> test_waring -> setText("Alpha 版本 || 请勿用于生产环境 || 请及时汇报BUG || 请勿滥用接口"); // 主页测试版警告 home::HomeInfo_Refresh(); // 启动首次触发刷新(Trigger Auto Refresh) - - qInfo()<<"系统环境:"< about, &QAction::triggered, this, &home::help_About_trigger); // 菜单栏 - 帮助:关于 @@ -49,7 +48,8 @@ home::home(QWidget *parent) /* 菜单-工具 */ connect(ui -> MOWeb, &QAction::triggered, this, &home::Tools_MOWeb_Trigger); // 工具:多出口 - + connect(ui -> spd_USTC, &QAction::triggered, this, &home::Tools_USTCspd_Trigger); // 工具:多出口 + connect(ui -> spd_NJU, &QAction::triggered, this, &home::Tools_NJUspd_Trigger); // 工具:多出口 /*主页:主机名*/ QString localHostname = QHostInfo::localHostName(); // 主机名实现 QString beforPCname = "主机名:";// setText | hostname 前的信息 @@ -66,7 +66,7 @@ home::home(QWidget *parent) home::~home() { - qInfo()<get(request); - connect(ispreply, &QNetworkReply::finished, this, [this, ispreply]() { - if (ispreply->error() == QNetworkReply::NoError) { + static QNetworkAccessManager *ispget = new QNetworkAccessManager(this); // QNAM 静态化,ispget + QNetworkRequest request(QUrl("https://cip.cc/"+ ipv4)); //请求 QUrl 地址 + QNetworkReply *ispreply = ispget->get(request); // 设置 reply + connect(ispreply, &QNetworkReply::finished, this, [this, ispreply]() { // 连接 ispreply + if (ispreply->error() == QNetworkReply::NoError) { // 如果返回无失败 - QString replyText = QString::fromUtf8(ispreply->readAll()); - QString isp; + qDebug()<<" ISP 一切正常 "; - static const QRegularExpression regex(R"(数据二\s*:\s*(.*))");// 正则表达式提取 - QRegularExpressionMatch match = regex.match(replyText); + QString replyText = QString::fromUtf8(ispreply->readAll()); // 将获取到的地址转向可读的 UTF8 地址 + QString isp; // 定义 ISP 变量 + + static const QRegularExpression regex(R"(数据二\s*:\s*(.*))");// 正则表达式 + QRegularExpressionMatch match = regex.match(replyText); // 正则匹配 if (match.hasMatch()) { - isp = match.captured(1).trimmed(); - ui->ispinfo->setText(isp); + isp = match.captured(1).trimmed(); // 取正则匹配的第一个选择 + ui->ispinfo->setText(isp); // 输出到 UI } else { - isp = "查询不到喵🐱,请检查日志🐱"; - ui->ispinfo->setText(isp); - qWarning() << "查询不到喵:" <errorString(); + isp = "查询不到喵🐱,请检查日志🐱"; // 反之变量即错误信息(无法查询的话) + ui->ispinfo->setText(isp); // 传递给前端 + qWarning() << "查询不到喵:" <errorString(); // 日志 } }else{ - qCritical() << "请求失败喵:" <errorString(); - ui -> ispinfo -> setText("请求失败喵,请检查日志🐱"); + qCritical() << "请求失败喵:" <errorString(); // 上面的 ispreply 如果请求失败的话 + ui -> ispinfo -> setText("请求失败喵,请检查日志🐱"); // 返给 UI } - ispreply->abort(); - ispreply->deleteLater(); + ispreply->abort(); // 退出 ISP Reply + ispreply->deleteLater(); // 从内存里面删除 ISP Reply }); } @@ -239,30 +241,30 @@ void home::getlan(){ } } - QString lanip_tooltip, MAC_tooltip; + QString lanip_tooltip, MAC_tooltip; // 弹出气泡的问题 - for (const QNetworkInterface &iface : QNetworkInterface::allInterfaces()) { + for (const QNetworkInterface &iface : QNetworkInterface::allInterfaces()) { // 使用上面循环检测的数据 - lanip_tooltip += "" + iface.humanReadableName() + "
"; - MAC_tooltip += "" + iface.humanReadableName() + "
"; - MAC_tooltip += "  MAC: " + iface.hardwareAddress() + "
"; + lanip_tooltip += "" + iface.humanReadableName() + "
"; // 本地 IP 地址的 Tooltip 的弹出窗口 - 接口信息 + MAC_tooltip += "" + iface.humanReadableName() + "
"; // MAC 地址的 Tooltip 的弹出窗口 - 接口信息 + MAC_tooltip += "  MAC: " + iface.hardwareAddress() + "
";// MAC 地址的 Tooltip 的弹出窗口 - MAC 地址 - for (const QNetworkAddressEntry &entry : iface.addressEntries()) { - QHostAddress ip = entry.ip(); + for (const QNetworkAddressEntry &entry : iface.addressEntries()) { // 使用上面循环检测的数据 + QHostAddress ip = entry.ip(); // 使用 QHostAddress 获取 IP 地址 - if (ip.protocol() == QAbstractSocket::IPv4Protocol) { - lanip_tooltip += "  IPv4: " + ip.toString() + "
"; - } else if (ip.protocol() == QAbstractSocket::IPv6Protocol && - !ip.toString().startsWith("fe80")) { - lanip_tooltip += "  IPv6: " + ip.toString() + "
"; + if (ip.protocol() == QAbstractSocket::IPv4Protocol) { // 检测 V4 协议 + lanip_tooltip += "  IPv4: " + ip.toString() + "
"; // 追加 V4 的字符串 + } else if (ip.protocol() == QAbstractSocket::IPv6Protocol && // 反之检测到 V6 的地址 + !ip.toString().startsWith("fe80")) { // 排除 fe80 地址 + lanip_tooltip += "  IPv6: " + ip.toString() + "
"; // 追加 V6 字符串 } } lanip_tooltip += "
"; } - ui->localv4->setToolTip(lanip_tooltip); - ui->currentMac->setToolTip(MAC_tooltip); + ui->localv4->setToolTip(lanip_tooltip); // 输出到前端弹出气泡 + ui->currentMac->setToolTip(MAC_tooltip); // 输出到前端弹出气泡 } } @@ -292,9 +294,36 @@ void home::Tools_MOWeb_Trigger(){ qDebug() << "请检查窗口 MutiOutWeb"; } +/* USTC 测速站 - 使用 Qt Web Engine */ +void home::Tools_USTCspd_Trigger(){ + qInfo()<<"已触发打开测速"; -/*打开文档页*/ + TestSpeed_USTC *USTC_SPD = new TestSpeed_USTC(this); // 加载窗口 + + USTC_SPD->setAttribute(Qt::WA_DeleteOnClose); // 关闭窗口后删除对象 + USTC_SPD->setModal(false); // 关闭 + USTC_SPD->show(); + USTC_SPD->targetURL("USTC",QUrl("https://test.ustc.edu.cn")); + qDebug() << "请检查测速窗口"; +} + +/* NJU 测速站 - 使用 Qt Web Engine */ +void home::Tools_NJUspd_Trigger(){ + qInfo()<<"已触发打开测速"; + TestSpeed_USTC *USTC_SPD = new TestSpeed_USTC(this); // 加载窗口 + + USTC_SPD->setAttribute(Qt::WA_DeleteOnClose); // 关闭窗口后删除对象 + USTC_SPD->setModal(false); + USTC_SPD->show(); + USTC_SPD->targetURL("NJU",QUrl("https://test.nju.edu.cn")); + + qDebug() << "请检查测速窗口"; +} + +/* 帮助实现 */ + +/*打开文档页*/ void home::help_Blog_trigger(){ qInfo()<<"已触发help_Wiki_trigger"; diff --git a/src/Home.h b/src/Home.h index e551ab3..b758bc4 100755 --- a/src/Home.h +++ b/src/Home.h @@ -26,6 +26,8 @@ #include // 动态数组支持 #include // 正则表达式支持 +#pragma once + QT_BEGIN_NAMESPACE namespace Ui { class home; @@ -73,6 +75,10 @@ private slots: /* Tools */ void Tools_MOWeb_Trigger(); // 在线版多出口信号槽 //void Tools_MOQt_Trigger(); + +/* 工具 */ + void Tools_USTCspd_Trigger(); // 在线打开 USTC 测速 + void Tools_NJUspd_Trigger(); // 在线打开 USTC 测速 private: Ui::home *ui; QNetworkAccessManager *sessionNet; diff --git a/src/Home.ui b/src/Home.ui index 8055449..c986516 100755 --- a/src/Home.ui +++ b/src/Home.ui @@ -398,12 +398,20 @@ + + + 测速 + + + + + @@ -572,6 +580,16 @@ 捐赠 + + + USTC - 中科大 + + + + + NJU - 南京大学 + + diff --git a/src/main.cpp b/src/main.cpp index ea53f7f..466dfbd 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,7 @@ /* ******** Cipher Tools ******** -******** 2025© Ne0W0r1d ******** -******** 2024-2025© Yumeyo ******** -******** LGPL 3 License ******** +******** 2025-2026 Ne0W0r1d ******** +******** MIT License ******** ******** Version/Program Other Logic ******** */ @@ -15,8 +14,8 @@ #include "version.h" // 统一输出版本号 // 版本号 -QString AK_VERSION = "CIPHER.rana.alpha_snapshot.20251231"; //主程序版本号 -QString BUILDDATE="20251231"; +QString AK_VERSION = "CIPHER.rana.alpha_snapshot.20260106"; //主程序版本号 +QString BUILDDATE="20260106"; QString AKT_VERSION = "RANATOOLKIT.astra.prototype"; //该程序版本号请根据 Ne0W0r1d/Rana_Toolkit 进行编写,目前 Prototype 是因为工具箱并没有实现 diff --git a/src/settings.cpp b/src/settings.cpp index ec52075..0d64689 100755 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1,8 +1,7 @@ /* ******** Cipher Tools ******** -******** 2025© Ne0W0r1d ******** -******** 2024-2025© Yumeyo ******** -******** LGPL 3 License ******** +******** 2025-2026 Ne0W0r1d ******** +******** MIT License ******** ******** Settings ******** */ diff --git a/src/settings.h b/src/settings.h index 2bc4979..a52c4ac 100755 --- a/src/settings.h +++ b/src/settings.h @@ -4,6 +4,8 @@ #include #include +#pragma once + namespace Ui { class Settings; } diff --git a/src/tools/multiout.cpp b/src/tools/multiout.cpp index db471f2..9aa7db9 100755 --- a/src/tools/multiout.cpp +++ b/src/tools/multiout.cpp @@ -1,5 +1,6 @@ #include "multiout.h" #include "ui_multiout.h" +#include MultiOut::MultiOut(QWidget *parent) : QDialog(parent), @@ -14,8 +15,18 @@ MultiOut::MultiOut(QWidget *parent) : "--ignore-gpu-blocklist " "--enable-features=CSSBackdropFilter"); QFile mout(":/Resource/checker-web.html"); + if (!mout.open(QIODevice::ReadOnly)) { - qWarning() << "未能打开文件!"; + QString err = "无法打开文件!" + mout.errorString(); + qWarning() << err; // + + /* 弹窗警告 */ + QMessageBox openFileErr; + openFileErr.setIcon(QMessageBox::Warning); + openFileErr.setWindowTitle("无法打开文件!"); + openFileErr.setText(err); + openFileErr.exec(); + qDebug()<<"打开文件失败已经弹窗"; return; } QString html = QString::fromUtf8(mout.readAll()); diff --git a/src/tools/multiout.h b/src/tools/multiout.h index c0c0906..b29000c 100755 --- a/src/tools/multiout.h +++ b/src/tools/multiout.h @@ -3,6 +3,9 @@ #include #include + +#pragma once + namespace Ui { class MultiOut; } diff --git a/src/tools/testspeed.cpp b/src/tools/testspeed.cpp new file mode 100644 index 0000000..67c828d --- /dev/null +++ b/src/tools/testspeed.cpp @@ -0,0 +1,19 @@ +#include "testspeed.h" +#include "ui_testspeed.h" + +TestSpeed_USTC::TestSpeed_USTC(QWidget *parent) : + QDialog(parent), + ui(new Ui::TestSpeed_USTC) +{ + ui->setupUi(this); +} + +TestSpeed_USTC::~TestSpeed_USTC() +{ + delete ui; +} + +void TestSpeed_USTC::targetURL(const QString &name, const QUrl &url) { + setWindowTitle(name + "测速"); + ui->webEngineView->load(url); +} diff --git a/src/tools/testspeed.h b/src/tools/testspeed.h new file mode 100644 index 0000000..7976b2d --- /dev/null +++ b/src/tools/testspeed.h @@ -0,0 +1,27 @@ +#ifndef TESTSPEED_H +#define TESTSPEED_H + +#include +#include + +#pragma once + +namespace Ui { +class TestSpeed_USTC; +} + +class TestSpeed_USTC : public QDialog +{ + Q_OBJECT + +public: + explicit TestSpeed_USTC(QWidget *parent = nullptr); + ~TestSpeed_USTC(); + + void targetURL(const QString &name, const QUrl &url); + +private: + Ui::TestSpeed_USTC *ui; +}; + +#endif // TESTSPEED_H diff --git a/src/tools/testspeed.ui b/src/tools/testspeed.ui new file mode 100644 index 0000000..a454464 --- /dev/null +++ b/src/tools/testspeed.ui @@ -0,0 +1,41 @@ + + + TestSpeed_USTC + + + + 0 + 0 + 640 + 480 + + + + Dialog + + + + + 0 + 0 + 640 + 480 + + + + + about:blank + + + + + + + QWebEngineView + QWidget +
QtWebEngineWidgets/QWebEngineView
+
+
+ + +
diff --git a/src/tools/testspeed_ustc.cpp b/src/tools/testspeed_ustc.cpp new file mode 100644 index 0000000..85e387e --- /dev/null +++ b/src/tools/testspeed_ustc.cpp @@ -0,0 +1,14 @@ +#include "testspeed_ustc.h" +#include "ui_testspeed_ustc.h" + +TestSpeed_USTC::TestSpeed_USTC(QWidget *parent) : + QDialog(parent), + ui(new Ui::TestSpeed_USTC) +{ + ui->setupUi(this); +} + +TestSpeed_USTC::~TestSpeed_USTC() +{ + delete ui; +} diff --git a/src/tools/wakenow.h b/src/tools/wakenow.h index 4145973..3ec9abb 100755 --- a/src/tools/wakenow.h +++ b/src/tools/wakenow.h @@ -3,6 +3,8 @@ #include +#pragma once + namespace Ui { class WakeNow; } diff --git a/src/version.h b/src/version.h index 20c11aa..8ea22c5 100755 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,10 @@ #ifndef VERSION_H #define VERSION_H + #include + +#pragma once + class Version { public: From 02b37975c0f32ec3cd29cab85bdd7eb4951a66c4 Mon Sep 17 00:00:00 2001 From: Ne0W0r1d Date: Tue, 6 Jan 2026 21:41:54 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=92=9A=E4=BC=98=E5=8C=96=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3280dba..2d614c8 100755 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,6 +2,8 @@ name: QMake Ci on: push: + paths: + - 'src/**' pull_request: jobs: From 79478a55ee6d48d51453b8315713129e1a1aeaa4 Mon Sep 17 00:00:00 2001 From: Ne0W0r1d Date: Tue, 6 Jan 2026 21:45:34 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E2=80=9C=E2=9A=A1=EF=B8=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E4=B8=80=E4=BA=9B=E5=9C=B0=E6=96=B9=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Home.cpp | 4 ++-- src/tools/testspeed.cpp | 3 +-- src/tools/testspeed.h | 2 +- src/tools/testspeed.ui | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Home.cpp b/src/Home.cpp index 343e170..44ea992 100755 --- a/src/Home.cpp +++ b/src/Home.cpp @@ -303,7 +303,7 @@ void home::Tools_USTCspd_Trigger(){ USTC_SPD->setAttribute(Qt::WA_DeleteOnClose); // 关闭窗口后删除对象 USTC_SPD->setModal(false); // 关闭 USTC_SPD->show(); - USTC_SPD->targetURL("USTC",QUrl("https://test.ustc.edu.cn")); + USTC_SPD->targetURL(QUrl("https://test.ustc.edu.cn")); qDebug() << "请检查测速窗口"; } @@ -316,7 +316,7 @@ void home::Tools_NJUspd_Trigger(){ USTC_SPD->setAttribute(Qt::WA_DeleteOnClose); // 关闭窗口后删除对象 USTC_SPD->setModal(false); USTC_SPD->show(); - USTC_SPD->targetURL("NJU",QUrl("https://test.nju.edu.cn")); + USTC_SPD->targetURL(QUrl("https://test.nju.edu.cn")); qDebug() << "请检查测速窗口"; } diff --git a/src/tools/testspeed.cpp b/src/tools/testspeed.cpp index 67c828d..32ced78 100644 --- a/src/tools/testspeed.cpp +++ b/src/tools/testspeed.cpp @@ -13,7 +13,6 @@ TestSpeed_USTC::~TestSpeed_USTC() delete ui; } -void TestSpeed_USTC::targetURL(const QString &name, const QUrl &url) { - setWindowTitle(name + "测速"); +void TestSpeed_USTC::targetURL(const QUrl &url) { ui->webEngineView->load(url); } diff --git a/src/tools/testspeed.h b/src/tools/testspeed.h index 7976b2d..ead0362 100644 --- a/src/tools/testspeed.h +++ b/src/tools/testspeed.h @@ -18,7 +18,7 @@ class TestSpeed_USTC : public QDialog explicit TestSpeed_USTC(QWidget *parent = nullptr); ~TestSpeed_USTC(); - void targetURL(const QString &name, const QUrl &url); + void targetURL(const QUrl &url); private: Ui::TestSpeed_USTC *ui; diff --git a/src/tools/testspeed.ui b/src/tools/testspeed.ui index a454464..2eb6fff 100644 --- a/src/tools/testspeed.ui +++ b/src/tools/testspeed.ui @@ -11,7 +11,7 @@ - Dialog + SpdTest 测速