minor fixes

This commit is contained in:
Nova 2025-03-26 23:37:49 +03:30
parent aec4968f44
commit b87a23dae7
4 changed files with 12 additions and 23 deletions

View File

@ -24,7 +24,7 @@ namespace NekoGui_fmt {
QString DisplayType() override {
if (core == "internal") {
auto obj = QString2QJsonObject(config_simple);
return obj[IS_NEKO_BOX ? "type" : "protocol"].toString();
return obj["type"].toString();
} else if (core == "internal-full") {
return software_core_name + " config";
}

View File

@ -8,8 +8,6 @@
// Switch core support
namespace NekoGui {
inline int coreType = CoreType::SING_BOX;
QString FindCoreAsset(const QString &name);
QString FindNekoBoxCoreRealPath();
@ -21,7 +19,6 @@ namespace NekoGui {
bool NeedGeoAssets();
} // namespace NekoGui
#define IS_NEKO_BOX (NekoGui::coreType == NekoGui::CoreType::SING_BOX)
#define ROUTES_PREFIX_NAME QString("route_profiles")
#define ROUTES_PREFIX QString(ROUTES_PREFIX_NAME + "/")
#define RULE_SETS_DIR QString("rule_sets")

View File

@ -139,22 +139,6 @@ int main(int argc, char* argv[]) {
QIcon::setThemeName("breeze");
}
// Load coreType
auto coreLoaded = ReadFileText("groups/coreType");
if (coreLoaded.isEmpty()) {
NekoGui::coreType = -1;
loadTranslate(QLocale().name());
NekoGui::coreType = NekoGui::CoreType::SING_BOX;
QDir().mkdir("groups");
QFile file;
file.setFileName("groups/coreType");
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
file.write(Int2String(NekoGui::coreType).toUtf8());
file.close();
} else {
NekoGui::coreType = coreLoaded.toInt();
}
// Dir
QDir dir;
bool dir_success = true;

View File

@ -141,9 +141,17 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi
software_name = "Nekoray";
software_core_name = "sing-box";
//
if (QDir("dashboard").count() == 0) {
QDir().mkdir("dashboard");
QFile::copy(":/neko/dashboard-notice.html", "dashboard/index.html");
if (auto dashDir = QDir("dashboard"); !dashDir.exists("dashboard") && QDir().mkdir("dashboard")) {
if (auto dashFile = QFile(":/neko/dashboard-notice.html"); dashFile.exists() && dashFile.open(QIODevice::ReadOnly))
{
auto data = dashFile.readAll();
if (auto dest = QFile("dashboard/index.html"); dest.open(QIODevice::Truncate | QIODevice::WriteOnly))
{
dest.write(data);
dest.close();
}
dashFile.close();
}
}
// top bar