mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 18:24:58 +00:00
Enhancements
Fix dependency bug for compiling on some platforms. Add specifying port via environment variable. Add BacktoCN.list extracted from ConnersHua's original BakctoCN configuration.
This commit is contained in:
5 files changed
+109
-3
No files matched your search
+13
-1
@@ -10,9 +10,21 @@ ADD_DEFINITIONS(-Wall -Wextra -Wno-unused-parameter -Wno-unused-result)
|
|||||||
OPTION(USING_STD_REGEX "Use std::regex from C++ library instead of PCRECPP." OFF)
|
OPTION(USING_STD_REGEX "Use std::regex from C++ library instead of PCRECPP." OFF)
|
||||||
OPTION(USING_MALLOC_TRIM "Call malloc_trim after processing request to lower memory usage (Your system must support malloc_trim)." OFF)
|
OPTION(USING_MALLOC_TRIM "Call malloc_trim after processing request to lower memory usage (Your system must support malloc_trim)." OFF)
|
||||||
|
|
||||||
IF(MACOS)
|
INCLUDE(CheckCXXSourceCompiles)
|
||||||
|
CHECK_CXX_SOURCE_COMPILES(
|
||||||
|
"
|
||||||
|
#include<string>
|
||||||
|
int main(){std::to_string(0);return 0;}
|
||||||
|
" HAVE_TO_STRING)
|
||||||
|
|
||||||
|
IF(APPLE)
|
||||||
ADD_DEFINITIONS(-D_MACOS)
|
ADD_DEFINITIONS(-D_MACOS)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(HAVE_TO_STRING)
|
||||||
|
ADD_DEFINITIONS(-DHAVE_TO_STRING)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
IF(USING_MALLOC_TRIM)
|
IF(USING_MALLOC_TRIM)
|
||||||
ADD_DEFINITIONS(-DMALLOC_TRIM)
|
ADD_DEFINITIONS(-DMALLOC_TRIM)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# (Video)
|
||||||
|
# AcFun
|
||||||
|
USER-AGENT,AcFun*
|
||||||
|
DOMAIN-SUFFIX,acfun.cn
|
||||||
|
DOMAIN-SUFFIX,acfun.com
|
||||||
|
DOMAIN-SUFFIX,aixifan.com
|
||||||
|
# > bilibili
|
||||||
|
USER-AGENT,bili-universal
|
||||||
|
USER-AGENT,Bilibili*
|
||||||
|
DOMAIN-SUFFIX,acgvideo.com
|
||||||
|
DOMAIN-SUFFIX,bilibili.com
|
||||||
|
DOMAIN-SUFFIX,hdslb.com
|
||||||
|
# > HunanTV
|
||||||
|
USER-AGENT,MGTV*
|
||||||
|
DOMAIN-SUFFIX,hitv.com
|
||||||
|
DOMAIN-SUFFIX,hunantv.com
|
||||||
|
DOMAIN-SUFFIX,mgtv.com
|
||||||
|
# > Migu
|
||||||
|
USER-AGENT,MiguVideo*
|
||||||
|
USER-AGENT,%E5%92%AA%E5%92%95%E8%A7%86%E9%A2%91
|
||||||
|
DOMAIN-SUFFIX,cmvideo.cn
|
||||||
|
DOMAIN-SUFFIX,migu.cn
|
||||||
|
DOMAIN-SUFFIX,miguvideo.com
|
||||||
|
# > iQiyi
|
||||||
|
USER-AGENT,iQiYi*
|
||||||
|
USER-AGENT,PPStream*
|
||||||
|
USER-AGENT,QIYI*
|
||||||
|
USER-AGENT,QYPlayer*
|
||||||
|
DOMAIN-SUFFIX,iqiyi.com
|
||||||
|
DOMAIN-SUFFIX,iqiyipic.com
|
||||||
|
DOMAIN-SUFFIX,qy.net
|
||||||
|
DOMAIN-SUFFIX,71.am
|
||||||
|
# > Sohu
|
||||||
|
DOMAIN-SUFFIX,56.com
|
||||||
|
DOMAIN-SUFFIX,sohu.com
|
||||||
|
DOMAIN-SUFFIX,sohu.com.cn
|
||||||
|
DOMAIN-SUFFIX,itc.cn
|
||||||
|
DOMAIN-SUFFIX,v-56.com
|
||||||
|
# > Tencent
|
||||||
|
USER-AGENT,live4iphone*
|
||||||
|
USER-AGENT,qqlive4iphone*
|
||||||
|
USER-AGENT,TencentMidasConnect*
|
||||||
|
DOMAIN-SUFFIX,video.qq.com
|
||||||
|
# > Youku
|
||||||
|
USER-AGENT,Youku*
|
||||||
|
USER-AGENT,%E4%BC%98%E9%85%B7*
|
||||||
|
DOMAIN-SUFFIX,soku.com
|
||||||
|
DOMAIN-SUFFIX,youku.com
|
||||||
|
DOMAIN-SUFFIX,ykimg.com
|
||||||
|
|
||||||
|
# (Music)
|
||||||
|
# > Alibaba
|
||||||
|
USER-AGENT,walkman*
|
||||||
|
USER-AGENT,xiami*
|
||||||
|
DOMAIN-SUFFIX,xiami.com
|
||||||
|
DOMAIN-SUFFIX,xiami.net
|
||||||
|
# > Netease
|
||||||
|
USER-AGENT,NeteaseMusic*
|
||||||
|
USER-AGENT,%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90*
|
||||||
|
DOMAIN-SUFFIX,music.126.net
|
||||||
|
DOMAIN-SUFFIX,music.163.com
|
||||||
|
# > Tencent
|
||||||
|
USER-AGENT,MOO%E9%9F%B3%E4%B9%90*
|
||||||
|
USER-AGENT,QQ%E9%9F%B3%E4%B9%90
|
||||||
|
DOMAIN-SUFFIX,qqmusic.qq.com
|
||||||
|
DOMAIN-SUFFIX,y.qq.com
|
||||||
|
DOMAIN,aqqmusic.tc.qq.com
|
||||||
|
# Kugou and Kuwo
|
||||||
|
DOMAIN-SUFFIX,kugou.com
|
||||||
|
USER-AGENT,%E9%85%B7%E6%88%91%E9%9F%B3%E4%B9%90*
|
||||||
|
DOMAIN-SUFFIX,kuwo.cn
|
||||||
|
DOMAIN-SUFFIX,koowo.com
|
||||||
|
# > Baidu
|
||||||
|
USER-AGENT,baiduyinyue
|
||||||
|
DOMAIN-SUFFIX,qianqian.com
|
||||||
@@ -839,6 +839,9 @@ int main(int argc, char *argv[])
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string env_port = GetEnv("PORT");
|
||||||
|
if(env_port.size())
|
||||||
|
listen_port = to_int(env_port, listen_port);
|
||||||
listener_args args = {listen_address, listen_port, max_pending_connections, max_concurrent_threads};
|
listener_args args = {listen_address, listen_port, max_pending_connections, max_concurrent_threads};
|
||||||
std::cout<<"Serving HTTP @ http://"<<listen_address<<":"<<listen_port<<std::endl;
|
std::cout<<"Serving HTTP @ http://"<<listen_address<<":"<<listen_port<<std::endl;
|
||||||
start_web_server_multi(&args);
|
start_web_server_multi(&args);
|
||||||
|
|||||||
@@ -320,6 +320,21 @@ std::vector<std::string> split(const std::string &s, const std::string &seperato
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GetEnv(std::string name)
|
||||||
|
{
|
||||||
|
std::string retVal;
|
||||||
|
#ifdef _WIN32
|
||||||
|
char chrData[1024] = {};
|
||||||
|
if(GetEnvironmentVariable(name.c_str(), chrData, 1023))
|
||||||
|
retVal.assign(chrData);
|
||||||
|
#else
|
||||||
|
char *env = getenv(name.c_str());
|
||||||
|
if(env != NULL)
|
||||||
|
retVal.assign(env);
|
||||||
|
#endif // _WIN32
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
std::string getSystemProxy()
|
std::string getSystemProxy()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
+3
-2
@@ -54,6 +54,7 @@ int shortAssemble(unsigned short num_a, unsigned short num_b);
|
|||||||
void shortDisassemble(int source, unsigned short &num_a, unsigned short &num_b);
|
void shortDisassemble(int source, unsigned short &num_a, unsigned short &num_b);
|
||||||
int to_int(std::string &s, int def_vaule = 0);
|
int to_int(std::string &s, int def_vaule = 0);
|
||||||
std::string UTF8ToCodePoint(std::string data);
|
std::string UTF8ToCodePoint(std::string data);
|
||||||
|
std::string GetEnv(std::string name);
|
||||||
|
|
||||||
std::string fileGet(std::string path, bool binary = true);
|
std::string fileGet(std::string path, bool binary = true);
|
||||||
int fileWrite(std::string path, std::string content, bool overwrite);
|
int fileWrite(std::string path, std::string content, bool overwrite);
|
||||||
@@ -78,7 +79,7 @@ template <typename T> static inline void eraseElements(T &target)
|
|||||||
T().swap(target);
|
T().swap(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MACOS
|
#ifndef HAVE_TO_STRING
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
namespace __cxx11
|
namespace __cxx11
|
||||||
@@ -91,7 +92,7 @@ namespace std
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // _MACOS
|
#endif // HAVE_TO_STRING
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void StringToWstring(std::wstring& szDst, std::string str);
|
void StringToWstring(std::wstring& szDst, std::string str);
|
||||||
|
|||||||
Reference in new issue
Block a user