Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: QMake Ci

on:
push:
paths:
- 'src/**'
pull_request:

jobs:
Expand Down
5 changes: 2 additions & 3 deletions src/About.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
******** Cipher Tools ********
******** 2025© Ne0W0r1d ********
******** 2024-2025© Yumeyo ********
******** LGPL 3 License ********
******** 2025-2026 Ne0W0r1d ********
******** MIT License ********
******** About ********
*/

Expand Down
2 changes: 2 additions & 0 deletions src/About.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef ABOUT_H
#define ABOUT_H

#pragma once

#include <QWidget>
#include <QDialog>
#include <QSysInfo>
Expand Down
3 changes: 3 additions & 0 deletions src/CipherTools.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SOURCES += \
settings.cpp \
tools/deviceinfo.cpp \
tools/multiout.cpp \
tools/testspeed.cpp \
tools/wakenow.cpp

HEADERS += \
Expand All @@ -24,6 +25,7 @@ HEADERS += \
settings.h \
tools/deviceinfo.h \
tools/multiout.h \
tools/testspeed.h \
tools/wakenow.h \
version.h

Expand All @@ -33,6 +35,7 @@ FORMS += \
settings.ui \
tools/deviceinfo.ui \
tools/multiout.ui \
tools/testspeed.ui \
tools/wakenow.ui

# Default rules for deployment.
Expand Down
123 changes: 76 additions & 47 deletions src/Home.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
******** Cipher Tools ********
******** 2025© Ne0W0r1d ********
******** 2024-2025© Yumeyo ********
******** LGPL 3 License ********
******** 2025-2026 Ne0W0r1d ********
******** MIT License ********
******** Home ********
*/

Expand All @@ -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()<<"系统环境:"<<systemname<<";系统:"<<distro<<";系统版本:"<<systemver; // 输出系统版本日志(Echo System Version Log)
qInfo()<<"软件版本:"<<AK_VERSION<<";工具箱版本:"<<AKT_VERSION; // 输出软件版本日志(Echo App Version Log),版本在 Main.cpp(Version in main.cpp)
qInfo()<<"系统环境:"<<systemname<<";系统:"<<distro<<";系统版本:"<<systemver; // 输出系统版本日志
qInfo()<<"软件版本:"<<AK_VERSION<<";工具箱版本:"<<AKT_VERSION; // 输出软件版本日志,版本在 Main.cpp

// 菜单栏:帮助
connect(ui -> about, &QAction::triggered, this, &home::help_About_trigger); // 菜单栏 - 帮助:关于
Expand All @@ -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 前的信息
Expand All @@ -66,7 +66,7 @@ home::home(QWidget *parent)

home::~home()
{
qInfo()<<tr("Exited");
qInfo()<<tr("已经退出!");
delete ui;
}

Expand Down Expand Up @@ -140,33 +140,35 @@ void home::getwanv6()
void home::getisp() {
if (ipv4.isEmpty())
return;
static QNetworkAccessManager *ispget = new QNetworkAccessManager(this);
QNetworkRequest request(QUrl("https://cip.cc/"+ ipv4));
QNetworkReply *ispreply = ispget->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() << "查询不到喵:" <<ispreply->errorString();
isp = "查询不到喵🐱,请检查日志🐱"; // 反之变量即错误信息(无法查询的话)
ui->ispinfo->setText(isp); // 传递给前端
qWarning() << "查询不到喵:" <<ispreply->errorString(); // 日志
}
}else{

qCritical() << "请求失败喵:" <<ispreply->errorString();
ui -> ispinfo -> setText("请求失败喵,请检查日志🐱");
qCritical() << "请求失败喵:" <<ispreply->errorString(); // 上面的 ispreply 如果请求失败的话
ui -> ispinfo -> setText("请求失败喵,请检查日志🐱"); // 返给 UI
}
ispreply->abort();
ispreply->deleteLater();
ispreply->abort(); // 退出 ISP Reply
ispreply->deleteLater(); // 从内存里面删除 ISP Reply
});

}
Expand Down Expand Up @@ -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 += "<b>" + iface.humanReadableName() + "</b><br>";
MAC_tooltip += "<b>" + iface.humanReadableName() + "</b><br>";
MAC_tooltip += "&nbsp;&nbsp;MAC: " + iface.hardwareAddress() + "<br>";
lanip_tooltip += "<b>" + iface.humanReadableName() + "</b><br>"; // 本地 IP 地址的 Tooltip 的弹出窗口 - 接口信息
MAC_tooltip += "<b>" + iface.humanReadableName() + "</b><br>"; // MAC 地址的 Tooltip 的弹出窗口 - 接口信息
MAC_tooltip += "&nbsp;&nbsp;MAC: " + iface.hardwareAddress() + "<br>";// 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 += "&nbsp;&nbsp;IPv4: " + ip.toString() + "<br>";
} else if (ip.protocol() == QAbstractSocket::IPv6Protocol &&
!ip.toString().startsWith("fe80")) {
lanip_tooltip += "&nbsp;&nbsp;IPv6: " + ip.toString() + "<br>";
if (ip.protocol() == QAbstractSocket::IPv4Protocol) { // 检测 V4 协议
lanip_tooltip += "&nbsp;&nbsp;IPv4: " + ip.toString() + "<br>"; // 追加 V4 的字符串
} else if (ip.protocol() == QAbstractSocket::IPv6Protocol && // 反之检测到 V6 的地址
!ip.toString().startsWith("fe80")) { // 排除 fe80 地址
lanip_tooltip += "&nbsp;&nbsp;IPv6: " + ip.toString() + "<br>"; // 追加 V6 字符串
}
}

lanip_tooltip += "<br>";
}

ui->localv4->setToolTip(lanip_tooltip);
ui->currentMac->setToolTip(MAC_tooltip);
ui->localv4->setToolTip(lanip_tooltip); // 输出到前端弹出气泡
ui->currentMac->setToolTip(MAC_tooltip); // 输出到前端弹出气泡
}
}

Expand Down Expand Up @@ -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(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(QUrl("https://test.nju.edu.cn"));

qDebug() << "请检查测速窗口";
}

/* 帮助实现 */

/*打开文档页*/
void home::help_Blog_trigger(){

qInfo()<<"已触发help_Wiki_trigger";
Expand Down
6 changes: 6 additions & 0 deletions src/Home.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <QList> // 动态数组支持
#include <QRegularExpression> // 正则表达式支持

#pragma once

QT_BEGIN_NAMESPACE
namespace Ui {
class home;
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 18 additions & 0 deletions src/Home.ui
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,20 @@
<addaction name="PingCS"/>
<addaction name="PINGGNT"/>
</widget>
<widget class="QMenu" name="spd">
<property name="title">
<string>测速</string>
</property>
<addaction name="spd_USTC"/>
<addaction name="spd_NJU"/>
</widget>
<addaction name="MOWeb"/>
<addaction name="deviceinfo"/>
<addaction name="WOL"/>
<addaction name="track"/>
<addaction name="NAT"/>
<addaction name="Ping"/>
<addaction name="spd"/>
</widget>
<addaction name="tools"/>
<addaction name="helpcenter"/>
Expand Down Expand Up @@ -572,6 +580,16 @@
<string>捐赠</string>
</property>
</action>
<action name="spd_USTC">
<property name="text">
<string>USTC - 中科大</string>
</property>
</action>
<action name="spd_NJU">
<property name="text">
<string>NJU - 南京大学</string>
</property>
</action>
</widget>
<resources>
<include location="Resource.qrc"/>
Expand Down
9 changes: 4 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
******** Cipher Tools ********
******** 2025© Ne0W0r1d ********
******** 2024-2025© Yumeyo ********
******** LGPL 3 License ********
******** 2025-2026 Ne0W0r1d ********
******** MIT License ********
******** Version/Program Other Logic ********
*/

Expand All @@ -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 是因为工具箱并没有实现


Expand Down
5 changes: 2 additions & 3 deletions src/settings.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/*
******** Cipher Tools ********
******** 2025© Ne0W0r1d ********
******** 2024-2025© Yumeyo ********
******** LGPL 3 License ********
******** 2025-2026 Ne0W0r1d ********
******** MIT License ********
******** Settings ********
*/

Expand Down
2 changes: 2 additions & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <QDialog>
#include <QSettings>

#pragma once

namespace Ui {
class Settings;
}
Expand Down
13 changes: 12 additions & 1 deletion src/tools/multiout.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "multiout.h"
#include "ui_multiout.h"
#include <QMessageBox>

MultiOut::MultiOut(QWidget *parent) :
QDialog(parent),
Expand All @@ -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());
Expand Down
3 changes: 3 additions & 0 deletions src/tools/multiout.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include <QDialog>
#include <QtWebEngineWidgets>

#pragma once

namespace Ui {
class MultiOut;
}
Expand Down
Loading