Fix support for some non-standard subscription

Add Dockerfile for image auto update.
This commit is contained in:
Tindy X 2020-01-13 15:08:08 +08:00
parent 3a39977253
commit 4374a3e8bd
No known key found for this signature in database
GPG Key ID: C6AD413169968D58
2 changed files with 26 additions and 5 deletions

16
scripts/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM alpine:latest
MAINTAINER Tindy X <tindy.it@gmail.com>
# build minimized
RUN apk add git g++ build-base linux-headers cmake && \
apk add libressl-dev curl-dev rapidjson-dev libevent-dev pcre-dev yaml-cpp-dev && \
git clone https://github.com/tindy2013/subconverter && \
cd subconverter && \
cmake . && \
make -j4 && \
mv subconverter base/ && \
apk add curl yaml-cpp libevent && \
apk del git gcc g++ build-base linux-headers cmake libressl-dev curl-dev rapidjson-dev libevent-dev yaml-cpp-dev
# set entry
CMD /subconverter/base/subconverter

View File

@ -124,7 +124,7 @@ unsigned char FromHex(unsigned char x)
else if (x >= '0' && x <= '9')
y = x - '0';
else
assert(0);
y = x;
return y;
}
@ -154,7 +154,7 @@ std::string UrlEncode(const std::string& str)
std::string UrlDecode(const std::string& str)
{
std::string strTemp = "";
std::string strTemp;
size_t length = str.length();
for (size_t i = 0; i < length; i++)
{
@ -164,9 +164,14 @@ std::string UrlDecode(const std::string& str)
{
if(i + 2 >= length)
return strTemp;
unsigned char high = FromHex((unsigned char)str[++i]);
unsigned char low = FromHex((unsigned char)str[++i]);
strTemp += high * 16 + low;
if(isalnum(str[i + 1]) && isalnum(str[i + 2]))
{
unsigned char high = FromHex((unsigned char)str[++i]);
unsigned char low = FromHex((unsigned char)str[++i]);
strTemp += high * 16 + low;
}
else
strTemp += str[i];
}
else
strTemp += str[i];