mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-02 01:33:04 +00:00
Enhancements
Add authorization check before loading scripts. Add detailed logs when loading preference settings.
This commit is contained in:
6 files changed
+17
-12
No files matched your search
@@ -407,6 +407,7 @@ std::string subconverter(RESPONSE_CALLBACK_ARGS)
|
||||
std::string proxy = parseProxy(global.proxySubscription);
|
||||
|
||||
/// check other flags
|
||||
ext.authorized = authorized;
|
||||
ext.append_proxy_type = argAppendType.get(global.appendType);
|
||||
if((argTarget == "clash" || argTarget == "clashr") && argGenClashScript.is_undef())
|
||||
argExpandRulesets.define(true);
|
||||
|
||||
@@ -577,6 +577,7 @@ void readYAMLConf(YAML::Node &node)
|
||||
node["advanced"]["async_fetch_ruleset"] >> global.asyncFetchRuleset;
|
||||
node["advanced"]["skip_failed_links"] >> global.skipFailedLinks;
|
||||
}
|
||||
writeLog(0, "Load preference settings in YAML format completed.", LOG_LEVEL_INFO);
|
||||
}
|
||||
|
||||
template <class T, class... U>
|
||||
@@ -786,13 +787,14 @@ void readTOMLConf(toml::value &root)
|
||||
{
|
||||
global.cacheSubscription = global.cacheConfig = global.cacheRuleset = 0;
|
||||
}
|
||||
|
||||
writeLog(0, "Load preference settings in TOML format completed.", LOG_LEVEL_INFO);
|
||||
}
|
||||
|
||||
void readConf()
|
||||
{
|
||||
guarded_mutex guard(gMutexConfigure);
|
||||
//std::cerr<<"Reading preference settings..."<<std::endl;
|
||||
writeLog(0, "Reading preference settings...", LOG_LEVEL_INFO);
|
||||
writeLog(0, "Loading preference settings...", LOG_LEVEL_INFO);
|
||||
|
||||
eraseElements(global.excludeRemarks);
|
||||
eraseElements(global.includeRemarks);
|
||||
@@ -815,11 +817,14 @@ void readConf()
|
||||
catch (YAML::Exception &e)
|
||||
{
|
||||
//ignore yaml parse error
|
||||
writeLog(0, e.what(), LOG_LEVEL_DEBUG);
|
||||
writeLog(0, "Unable to load preference settings as YAML.", LOG_LEVEL_DEBUG);
|
||||
}
|
||||
catch (toml::exception &e)
|
||||
{
|
||||
//ignore toml parse error
|
||||
writeLog(0, e.what(), LOG_LEVEL_DEBUG);
|
||||
writeLog(0, "Unable to load preference settings as TOML.", LOG_LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
INIReader ini;
|
||||
@@ -828,8 +833,7 @@ void readConf()
|
||||
int retVal = ini.ParseFile(global.prefPath);
|
||||
if(retVal != INIREADER_EXCEPTION_NONE)
|
||||
{
|
||||
//std::cerr<<"Unable to load preference settings. Reason: "<<ini.GetLastError()<<"\n";
|
||||
writeLog(0, "Unable to load preference settings. Reason: " + ini.GetLastError(), LOG_LEVEL_FATAL);
|
||||
writeLog(0, "Unable to load preference settings as INI. Reason: " + ini.GetLastError(), LOG_LEVEL_FATAL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1070,8 +1074,7 @@ void readConf()
|
||||
ini.GetBoolIfExist("async_fetch_ruleset", global.asyncFetchRuleset);
|
||||
ini.GetBoolIfExist("skip_failed_links", global.skipFailedLinks);
|
||||
|
||||
//std::cerr<<"Read preference settings completed."<<std::endl;
|
||||
writeLog(0, "Read preference settings completed.", LOG_LEVEL_INFO);
|
||||
writeLog(0, "Load preference settings in INI format completed.", LOG_LEVEL_INFO);
|
||||
}
|
||||
|
||||
int loadExternalYAML(YAML::Node &node, ExternalConfig &ext)
|
||||
|
||||
@@ -29,7 +29,7 @@ struct Settings
|
||||
bool printDbgInfo = false, CFWChildProcess = false, appendUserinfo = true, asyncFetchRuleset = false, surgeResolveHostname = true;
|
||||
std::string accessToken, basePath = "base";
|
||||
std::string custom_group;
|
||||
int logLevel = LOG_LEVEL_INFO;
|
||||
int logLevel = LOG_LEVEL_VERBOSE;
|
||||
long maxAllowedDownloadSize = 1048576L;
|
||||
string_map aliases;
|
||||
|
||||
|
||||
Reference in new issue
Block a user