diff options
author | Sam Bingner <sam@bingner.com> | 2019-12-05 13:14:11 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2019-12-05 13:14:11 -1000 |
commit | 30b292f444d667e767d138fa1333d67cb19e6dbb (patch) | |
tree | 1665f89140bb236e1330975fee886a6658fd28fe /data/_apt1.8 | |
parent | 01905d5847baae1ab3e6e4aebe16038efe87da95 (diff) |
Updates to APT
Diffstat (limited to 'data/_apt1.8')
-rw-r--r-- | data/_apt1.8/apt_nito.diff | 106 | ||||
-rw-r--r-- | data/_apt1.8/make.sh | 2 |
2 files changed, 108 insertions, 0 deletions
diff --git a/data/_apt1.8/apt_nito.diff b/data/_apt1.8/apt_nito.diff new file mode 100644 index 000000000..eec3b1b61 --- /dev/null +++ b/data/_apt1.8/apt_nito.diff @@ -0,0 +1,106 @@ +diff --git a/methods/http.cc b/methods/http.cc +index 16c0de611..508cf5727 100644 +--- a/methods/http.cc ++++ b/methods/http.cc +@@ -35,6 +35,7 @@ + #include <stddef.h> + #include <stdio.h> + #include <stdlib.h> ++#include <sys/fcntl.h> + #include <sys/select.h> + #include <sys/sysctl.h> + #include <sys/stat.h> +@@ -50,6 +51,8 @@ + #include <lockdown.h> + #include <CoreFoundation/CoreFoundation.h> + #include <CFNetwork/CFNetwork.h> ++#include <TargetConditionals.h> ++ + extern "C" CFDictionaryRef SCDynamicStoreCopyProxies(void *); + /*}}}*/ + using namespace std; +@@ -163,6 +166,45 @@ std::unique_ptr<ServerState> HttpMethod::CreateServerState(URI const &uri)/*{{{* + void HttpMethod::RotateDNS() /*{{{*/ + { + } ++ ++#if TARGET_OS_TV ++char * createCookie() { ++ FILE *fp; ++ long lSize; ++ char *buffer; ++ const char *tp = "/var/mobile/Documents/nitoStoreToken"; ++ if (access(tp, R_OK)) return NULL; ++ fp = fopen ( tp , "rb" ); ++ if( !fp ) { ++ perror(tp); ++ return NULL; ++ } ++ fseek( fp , 0L , SEEK_END); ++ lSize = ftell( fp ); ++ rewind( fp ); ++ ++ /* allocate memory for entire content */ ++ buffer = static_cast<char*>(calloc( 1, lSize+1 )); ++ if( !buffer ) { ++ fclose(fp); ++ return NULL; ++ } ++ ++ /* copy the file into the buffer */ ++ if( 1!=fread( buffer , lSize, 1 , fp) ) ++ { ++ fclose(fp); ++ free(buffer); ++ return NULL; ++ } ++ /* do your work here, buffer is a string contains the whole text */ ++ ++ fclose(fp); ++ ++ return buffer; ++} ++#endif ++ + /*}}}*/ + BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &Res, RequestState &Req)/*{{{*/ + { +@@ -253,6 +295,17 @@ int HttpMethod::Loop() + } + + CFStringRef sr = CFStringCreateWithCString(kCFAllocatorDefault, urs.c_str(), se); ++#if TARGET_OS_TV ++ bool isNito = false; ++ if (sr) { ++ CFStringRef nitoBaseURL = CFSTR("https://nito.tv/"); ++ size_t nitoURLLength = CFStringGetLength(nitoBaseURL); ++ size_t srLength = CFStringGetLength(sr); ++ if (srLength >= nitoURLLength && CFStringCompareWithOptions(sr, nitoBaseURL, CFRangeMake(0, nitoURLLength), kCFCompareCaseInsensitive) == kCFCompareEqualTo) { ++ isNito = true; ++ } ++ } ++#endif + CFURLRef ur = CFURLCreateWithString(kCFAllocatorDefault, sr, NULL); + CFRelease(sr); + CFHTTPMessageRef hm = CFHTTPMessageCreateRequest(kCFAllocatorDefault, CFSTR("GET"), ur, kCFHTTPVersion1_1); +@@ -290,6 +343,20 @@ int HttpMethod::Loop() + + CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("User-Agent"), CFSTR("Telesphoreo APT-HTTP/1.0.592")); + ++#if TARGET_OS_TV ++ if (isNito) { ++ char *cookie = createCookie(); ++ if (cookie) { ++ size_t cookie_len = strlen(cookie); ++ CFStringRef cookieString = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, (unsigned char *)cookie, cookie_len, kCFStringEncodingUTF8, false, kCFAllocatorDefault); ++ if (cookieString) { ++ CFHTTPMessageSetHeaderFieldValue(hm, CFSTR("Set-Cookie"), cookieString); ++ CFRelease(cookieString); ++ } ++ } ++ } ++#endif ++ + CFReadStreamRef rs = CFReadStreamCreateForHTTPRequest(kCFAllocatorDefault, hm); + CFRelease(hm); + diff --git a/data/_apt1.8/make.sh b/data/_apt1.8/make.sh index 8c8b118ac..67762cc86 100644 --- a/data/_apt1.8/make.sh +++ b/data/_apt1.8/make.sh @@ -17,6 +17,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(DPKG_DATADIR /usr/share/dpkg) +set(CMAKE_C_SYSROOT_FLAG "") +set(CMAKE_CXX_SYSROOT_FLAG "") set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG ") set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ") set(CMAKE_OSX_DEPLOYMENT_TARGET "${IPHONEOS_DEPLOYMENT_TARGET}" CACHE STRING "Min IOS version") |