mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 02:02:24 +00:00
Enhancements
Fix compatibility with some broken Shadowrocket links. Add direct option to generator to download subscriptions or use local files directly. Add return code to report generator error. Add output code page restore.
This commit is contained in:
3 files changed
+47
-2
No files matched your search
@@ -1762,6 +1762,33 @@ int simpleGenerator()
|
||||
}
|
||||
else
|
||||
{
|
||||
if(ini.GetBool("direct") == true)
|
||||
{
|
||||
std::string url = ini.Get("url");
|
||||
if(fileExist(url))
|
||||
content = fileGet(url, false);
|
||||
else
|
||||
{
|
||||
//check for proxy settings
|
||||
std::string proxy;
|
||||
if(proxy_subscription == "SYSTEM")
|
||||
proxy = getSystemProxy();
|
||||
else if(proxy_subscription == "NONE")
|
||||
proxy = "";
|
||||
else
|
||||
proxy = proxy_subscription;
|
||||
content = webGet(url, proxy);
|
||||
}
|
||||
if(content.empty())
|
||||
{
|
||||
std::cerr<<"Artifact '"<<x<<"' generate ERROR! Please check your link.\n\n";
|
||||
if(sections.size() == 1)
|
||||
return -1;
|
||||
}
|
||||
// add UTF-8 BOM
|
||||
fileWrite(path, "\xEF\xBB\xBF" + content, true);
|
||||
continue;
|
||||
}
|
||||
ini.GetItems(allItems);
|
||||
allItems.emplace("expand", "true");
|
||||
for(auto &y : allItems)
|
||||
@@ -1776,6 +1803,8 @@ int simpleGenerator()
|
||||
if(ret_code != 200)
|
||||
{
|
||||
std::cerr<<"Artifact '"<<x<<"' generate ERROR! Reason: "<<content<<"\n\n";
|
||||
if(sections.size() == 1)
|
||||
return -1;
|
||||
continue;
|
||||
}
|
||||
fileWrite(path, content, true);
|
||||
|
||||
Reference in new issue
Block a user