mirror of
https://github.com/Mahdi-zarei/nekoray.git
synced 2025-12-19 05:30:06 +08:00
Make built-in profiles save-able and deletable
This commit is contained in:
parent
24d3bf6176
commit
25f29500f8
@ -106,14 +106,23 @@ namespace Configs {
|
||||
profileManager->AddGroup(defaultGroup);
|
||||
}
|
||||
|
||||
// First setup
|
||||
if (routes.empty()) {
|
||||
auto defaultRoute = RoutingChain::GetDefaultChain();
|
||||
profileManager->AddRouteChain(defaultRoute);
|
||||
}
|
||||
|
||||
routes[IranBypassChainID] = RoutingChain::GetIranDefaultChain();
|
||||
routes[ChinaBypassChainID] = RoutingChain::GetChinaDefaultChain();
|
||||
routes[RussiaBypassChainID] = RoutingChain::GetRussiaDefaultChain();
|
||||
routes[IranBypassChainID] = RoutingChain::GetIranDefaultChain();
|
||||
routesIdOrder.push_back(IranBypassChainID);
|
||||
routes[IranBypassChainID]->Save();
|
||||
|
||||
routes[ChinaBypassChainID] = RoutingChain::GetChinaDefaultChain();
|
||||
routesIdOrder.push_back(ChinaBypassChainID);
|
||||
routes[ChinaBypassChainID]->Save();
|
||||
|
||||
routes[RussiaBypassChainID] = RoutingChain::GetRussiaDefaultChain();
|
||||
routesIdOrder.push_back(RussiaBypassChainID);
|
||||
routes[RussiaBypassChainID]->Save();
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileManager::SaveManager() {
|
||||
|
||||
@ -597,7 +597,7 @@ namespace Configs {
|
||||
auto chain = std::make_shared<RoutingChain>();
|
||||
chain->name = "Bypass Iran";
|
||||
chain->id = IranBypassChainID;
|
||||
chain->save_control_no_save = true;
|
||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
||||
|
||||
auto rule0 = std::make_shared<RouteRule>();
|
||||
rule0->name = "Route DNS";
|
||||
@ -624,7 +624,7 @@ namespace Configs {
|
||||
auto chain = std::make_shared<RoutingChain>();
|
||||
chain->name = "Bypass China";
|
||||
chain->id = ChinaBypassChainID;
|
||||
chain->save_control_no_save = true;
|
||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
||||
|
||||
auto rule0 = std::make_shared<RouteRule>();
|
||||
rule0->name = "Route DNS";
|
||||
@ -651,7 +651,7 @@ namespace Configs {
|
||||
auto chain = std::make_shared<RoutingChain>();
|
||||
chain->name = "Bypass Russia";
|
||||
chain->id = RussiaBypassChainID;
|
||||
chain->save_control_no_save = true;
|
||||
chain->fn = QString("route_profiles/%1.json").arg(chain->id);
|
||||
|
||||
auto rule0 = std::make_shared<RouteRule>();
|
||||
rule0->name = "Route DNS";
|
||||
@ -894,7 +894,7 @@ namespace Configs {
|
||||
bool RoutingChain::Save() {
|
||||
castedRules.clear();
|
||||
for (const auto &item: Rules) {
|
||||
castedRules.push_back(dynamic_cast<JsonStore*>(item.get()));
|
||||
castedRules.push_back(item.get());
|
||||
}
|
||||
return JsonStore::Save();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user