diff --git a/include/global/NekoGui_DataStore.hpp b/include/global/NekoGui_DataStore.hpp
index e6e0e18..a5d8679 100644
--- a/include/global/NekoGui_DataStore.hpp
+++ b/include/global/NekoGui_DataStore.hpp
@@ -26,19 +26,6 @@ namespace NekoGui {
static QStringList List();
};
- class ExtraCore : public JsonStore {
- public:
- QString core_map;
-
- explicit ExtraCore();
-
- [[nodiscard]] QString Get(const QString &id) const;
-
- void Set(const QString &id, const QString &path);
-
- void Delete(const QString &id);
- };
-
class DataStore : public JsonStore {
public:
// Running
@@ -169,9 +156,6 @@ namespace NekoGui {
QString core_box_clash_api_secret = "";
QString core_box_underlying_dns = "";
- // Other Core
- ExtraCore *extraCore = new ExtraCore;
-
// Methods
DataStore();
diff --git a/include/ui/profile/edit_custom.ui b/include/ui/profile/edit_custom.ui
index cb1fa41..0235f7b 100644
--- a/include/ui/profile/edit_custom.ui
+++ b/include/ui/profile/edit_custom.ui
@@ -29,32 +29,6 @@
- -
-
-
-
- 0
- 0
-
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
@@ -85,49 +59,6 @@
0
-
-
-
-
- Command
-
-
-
- -
-
-
- %config%
-
-
-
- -
-
-
- Config Suffix
-
-
-
- -
-
-
- true
-
-
-
-
-
-
-
- -
-
- json
-
-
- -
-
- yml
-
-
-
-
@@ -146,39 +77,6 @@
0
- -
-
-
- Random if it's empty or zero.
-
-
- Mapping Port
-
-
-
- -
-
-
- -
-
-
- Random if it's empty or zero.
-
-
- Socks Port
-
-
-
- -
-
-
- -
-
-
- Preview
-
-
-
@@ -195,13 +93,7 @@
- core
as_json
- command
- config_suffix
- mapping_port
- socks_port
- preview
config_simple
diff --git a/src/global/NekoGui.cpp b/src/global/NekoGui.cpp
index 97d87b5..c3f4f51 100644
--- a/src/global/NekoGui.cpp
+++ b/src/global/NekoGui.cpp
@@ -239,8 +239,6 @@ namespace NekoGui {
// datastore
DataStore::DataStore() : JsonStore() {
- _add(new configItem("extraCore", dynamic_cast(extraCore), itemType::jsonStore));
-
_add(new configItem("user_agent2", &user_agent, itemType::string));
_add(new configItem("test_url", &test_latency_url, itemType::string));
_add(new configItem("current_group", ¤t_group, itemType::integer));
@@ -355,32 +353,6 @@ namespace NekoGui {
return {"Default"};
}
- // NO default extra core
-
- ExtraCore::ExtraCore() : JsonStore() {
- _add(new configItem("core_map", &this->core_map, itemType::string));
- }
-
- QString ExtraCore::Get(const QString &id) const {
- auto obj = QString2QJsonObject(core_map);
- for (const auto &c: obj.keys()) {
- if (c == id) return obj[id].toString();
- }
- return "";
- }
-
- void ExtraCore::Set(const QString &id, const QString &path) {
- auto obj = QString2QJsonObject(core_map);
- obj[id] = path;
- core_map = QJsonObject2QString(obj, true);
- }
-
- void ExtraCore::Delete(const QString &id) {
- auto obj = QString2QJsonObject(core_map);
- obj.remove(id);
- core_map = QJsonObject2QString(obj, true);
- }
-
// System Utils
QString FindCoreAsset(const QString &name) {
diff --git a/src/ui/profile/dialog_edit_profile.cpp b/src/ui/profile/dialog_edit_profile.cpp
index cbaae24..83c2f62 100644
--- a/src/ui/profile/dialog_edit_profile.cpp
+++ b/src/ui/profile/dialog_edit_profile.cpp
@@ -222,7 +222,7 @@ void DialogEditProfile::typeSelected(const QString &newType) {
auto _innerWidget = new EditSSH(this);
innerWidget = _innerWidget;
innerEditor = _innerWidget;
- } else if (type == "custom" || type == "internal" || type == "internal-full") {
+ } else if (type == "internal" || type == "internal-full") {
auto _innerWidget = new EditCustom(this);
innerWidget = _innerWidget;
innerEditor = _innerWidget;
diff --git a/src/ui/profile/edit_custom.cpp b/src/ui/profile/edit_custom.cpp
index 3155677..438669e 100644
--- a/src/ui/profile/edit_custom.cpp
+++ b/src/ui/profile/edit_custom.cpp
@@ -24,24 +24,10 @@ EditCustom::~EditCustom() {
delete ui;
}
-#define SAVE_CUSTOM_BEAN \
- P_SAVE_COMBO_STRING(core) \
- bean->command = ui->command->text().split(" "); \
- P_SAVE_STRING_PLAIN(config_simple) \
- P_SAVE_COMBO_STRING(config_suffix) \
- P_SAVE_INT(mapping_port) \
- P_SAVE_INT(socks_port)
-
void EditCustom::onStart(std::shared_ptr _ent) {
this->ent = _ent;
auto bean = this->ent->CustomBean();
- // load known core
- auto core_map = QString2QJsonObject(NekoGui::dataStore->extraCore->core_map);
- for (const auto &key: core_map.keys()) {
- if (key == "naive" || key == "hysteria") continue;
- ui->core->addItem(key);
- }
if (preset_core == "internal") {
preset_command = preset_config = "";
ui->config_simple->setPlaceholderText(
@@ -59,27 +45,10 @@ void EditCustom::onStart(std::shared_ptr _ent) {
}
// load core ui
- P_LOAD_COMBO_STRING(core)
- ui->command->setText(bean->command.join(" "));
ui->config_simple->setPlainText(bean->config_simple);
- P_LOAD_COMBO_STRING(config_suffix)
- P_LOAD_INT(mapping_port)
- P_LOAD_INT(socks_port)
-
- // custom external
- if (!bean->core.isEmpty()) {
- ui->core->setDisabled(true);
- } else if (!preset_core.isEmpty()) {
- bean->core = preset_core;
- ui->core->setDisabled(true);
- ui->core->setCurrentText(preset_core);
- ui->command->setText(preset_command);
- ui->config_simple->setPlainText(preset_config);
- }
// custom internal
if (preset_core == "internal" || preset_core == "internal-full") {
- ui->core->hide();
if (preset_core == "internal") {
ui->core_l->setText(tr("Outbound JSON, please read the documentation."));
} else {
@@ -88,33 +57,6 @@ void EditCustom::onStart(std::shared_ptr _ent) {
ui->w_ext1->hide();
ui->w_ext2->hide();
}
-
- // Preview
- connect(ui->preview, &QPushButton::clicked, this, [=] {
- // CustomBean::BuildExternal
- QStringList th;
- auto mapping_port = ui->mapping_port->text().toInt();
- auto socks_port = ui->socks_port->text().toInt();
- th << "%mapping_port% => " + (mapping_port <= 0 ? "Random" : Int2String(mapping_port));
- th << "%socks_port% => " + (socks_port <= 0 ? "Random" : Int2String(socks_port));
- th << "%server_addr% => " + get_edit_text_serverAddress();
- th << "%server_port% => " + get_edit_text_serverPort();
- MessageBoxInfo(tr("Preview replace"), th.join("\n"));
- // EditCustom::onEnd
- auto tmpEnt = NekoGui::ProfileManager::NewProxyEntity("custom");
- auto bean = tmpEnt->CustomBean();
- SAVE_CUSTOM_BEAN
- // 补充
- bean->serverAddress = get_edit_text_serverAddress();
- bean->serverPort = get_edit_text_serverPort().toInt();
- if (bean->core.isEmpty()) return;
- //
- auto result = NekoGui::BuildConfig(tmpEnt, false, false);
- if (!result->error.isEmpty()) {
- MessageBoxInfo(software_name, result->error);
- return;
- }
- });
}
bool EditCustom::onEnd() {
@@ -122,14 +64,10 @@ bool EditCustom::onEnd() {
MessageBoxWarning(software_name, tr("Name cannot be empty."));
return false;
}
- if (ui->core->currentText().isEmpty()) {
- MessageBoxWarning(software_name, tr("Please pick a core."));
- return false;
- }
auto bean = this->ent->CustomBean();
- SAVE_CUSTOM_BEAN
+ P_SAVE_STRING_PLAIN(config_simple)
return true;
}