Changeset 45041
- Timestamp:
- 12/20/20 21:32:33 (3 years ago)
- Location:
- titan
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/tithek/tithek.c
r44942 r45041 1 1 #define HTTPAUTH "aXBrLUdaRmg6RkhaVkJHaG56ZnZFaEZERlRHenVpZjU2NzZ6aGpHVFVHQk5Iam0=" 2 #define HTTPUSER "aUtzhFRTzuDFa" 3 #define HTTPPASS "JNHZbghnjuz" 2 4 3 5 -
titan/plugins/tithek/tithek.h
r44955 r45041 667 667 if(ostrncmp("http://", link, 7) && ostrncmp("https://", link, 8) && ostrncmp("/tmp/localhoster/hoster.sh", link, 26)) return NULL; 668 668 669 // link = stringreplacecharonce(link, '"', '\0'); 670 // link = stringreplacecharonce(link, ' ', '\0'); 669 link = stringreplacecharonce(link, ' ', '\0'); 671 670 672 671 if(!ostrncmp("/tmp/localhoster/hoster.sh", link, 26)) … … 747 746 if(dnode != NULL) 748 747 { 749 // if(ssl == 1)748 //+ if(ssl == 1) 750 749 // dnode->link = ostrcat(link, NULL, 0, 0); 751 750 if(usecmd == 1) … … 2090 2089 } 2091 2090 //#endif 2092 if( !ostrncmp("http://", tmpstr1, 7) && (file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack"))))2091 if((!ostrncmp("http://", tmpstr1, 7) || !ostrncmp("https://", tmpstr1, 8)) && (file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack")))) 2093 2092 // if(!ostrncmp("http", tmpstr1, 4) && (file_exist(getconfig("rec_streampath", NULL)) && (file_exist("/mnt/swapextensions/etc/.codecpack") || file_exist("/var/swap/etc/.codecpack") || file_exist("/var/etc/.codecpack")))) 2094 2093 { … … 2122 2121 screenplay(tmpstr1, filename, 2, flag); 2123 2122 delconfigtmp("playerbuffersize"); 2123 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2124 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2124 2125 } 2125 2126 else if(ostrcmp(keyconf, "Streaming Playback Caching (0.5MB)") == 0) … … 2128 2129 screenplay(tmpstr1, filename, 2, flag); 2129 2130 delconfigtmp("playerbuffersize"); 2131 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2132 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2130 2133 } 2131 2134 else if(ostrcmp(keyconf, "Streaming Playback Caching (1MB)") == 0) … … 2134 2137 screenplay(tmpstr1, filename, 2, flag); 2135 2138 delconfigtmp("playerbuffersize"); 2139 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2140 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2136 2141 } 2137 2142 else if(ostrcmp(keyconf, "Streaming Playback Caching (2MB)") == 0) … … 2140 2145 screenplay(tmpstr1, filename, 2, flag); 2141 2146 delconfigtmp("playerbuffersize"); 2147 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2148 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2142 2149 } 2143 2150 else if(ostrcmp(keyconf, "Streaming Playback Caching (3MB)") == 0) … … 2146 2153 screenplay(tmpstr1, filename, 2, flag); 2147 2154 delconfigtmp("playerbuffersize"); 2155 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2156 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2148 2157 } 2149 2158 else if(ostrcmp(keyconf, "Streaming Playback Caching (4MB)") == 0) … … 2152 2161 screenplay(tmpstr1, filename, 2, flag); 2153 2162 delconfigtmp("playerbuffersize"); 2163 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2164 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2154 2165 } 2155 2166 else if(ostrcmp(keyconf, "Streaming Playback Caching (5MB)") == 0) … … 2158 2169 screenplay(tmpstr1, filename, 2, flag); 2159 2170 delconfigtmp("playerbuffersize"); 2171 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2172 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2160 2173 } 2161 2174 else if(ostrcmp(keyconf, "Streaming Playback Caching (7.5MB)") == 0) … … 2164 2177 screenplay(tmpstr1, filename, 2, flag); 2165 2178 delconfigtmp("playerbuffersize"); 2179 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2180 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2166 2181 } 2167 2182 else if(ostrcmp(keyconf, "Streaming Playback Caching (10MB)") == 0) … … 2170 2185 screenplay(tmpstr1, filename, 2, flag); 2171 2186 delconfigtmp("playerbuffersize"); 2187 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2188 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2172 2189 } 2173 2190 else if(ostrcmp(keyconf, "File Caching Playback (10MB / 120s)") == 0) 2174 2191 { 2175 2192 cacheplay(tmpstr1, filename, 1); 2193 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2194 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2176 2195 } 2177 2196 else if(ostrcmp(keyconf, "File Caching Playback (20MB / 240s)") == 0) 2178 2197 { 2179 2198 cacheplay(tmpstr1, filename, 2); 2199 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2200 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2180 2201 } 2181 2202 else if(ostrcmp(keyconf, "File Caching Playback (30MB / 360s)") == 0) 2182 2203 { 2183 2204 cacheplay(tmpstr1, filename, 3); 2205 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2206 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2184 2207 } 2185 2208 else if(ostrcmp(keyconf, "Download Full File") == 0) … … 2198 2221 screenplay(tmpstr2, filename, 2, flag); 2199 2222 free(tmpstr2); tmpstr2 = NULL; 2223 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 0) 2224 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 2200 2225 } 2201 2226 } … … 2275 2300 2276 2301 mkdir("/tmp/tithek", 777); 2277 if(status.mcaktiv == 0 )2302 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 1) 2278 2303 { 2279 2304 rcret = servicestop(status.aktservice, 1, 1); … … 3288 3313 python = 0; 3289 3314 3290 if(status.mcaktiv == 0 )3315 if(status.mcaktiv == 0 && getconfigint("tithek_delservice", NULL) == 1) 3291 3316 servicecheckret(servicestart(status.lastservice->channel, NULL, NULL, 0), 0); 3292 3317 } -
titan/plugins/tithek/tithek_global.h
r45037 r45041 246 246 } 247 247 248 #include <stdio.h> 249 #include <curl/curl.h> 250 251 /* This callback is, currently, a simple wrapper around fwrite(). You 252 could get it to write to memory, or do anything else you'd like 253 with the output. For more info, see 254 http://curl.haxx.se/libcurl/c/CURLOPT_WRITEFUNCTION.html 255 */ 256 248 257 struct MemoryStruct { 249 258 char *memory; 250 size_t size; 259 size_t size; 251 260 }; 252 261 … … 259 268 mem->memory = realloc(mem->memory, mem->size + realsize + 1); 260 269 if(mem->memory == NULL) { 261 262 263 270 /* out of memory! */ 271 printf("not enough memory (realloc returned NULL)\n"); 272 return 0; 264 273 } 265 274 … … 271 280 } 272 281 282 static size_t writeCallback(void *contents, size_t size, size_t nitems, FILE *file) { 283 return fwrite(contents, size, nitems, file); 284 } 273 285 // flag = 0 (without header in output) 274 286 // flag = 1 (with header in output) … … 276 288 { 277 289 debug(99, "url: %s", url); 278 // if(ostrncmp("http", url, 4)) return NULL;290 printf("url: %s\n", url); 279 291 280 292 int debuglevel = getconfigint("debuglevel", NULL); … … 297 309 if(curl_handle) 298 310 { 299 311 if(localfile != NULL) 300 312 fp = fopen(localfile,"wb"); 301 313 … … 305 317 if(user != NULL && pass != NULL) 306 318 { 307 curl_easy_setopt(curl_handle, CURLOPT_USERNAME, user);308 curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, pass);319 curl_easy_setopt(curl_handle, CURLOPT_USERNAME, HTTPUSER); 320 curl_easy_setopt(curl_handle, CURLOPT_PASSWORD, HTTPPASS); 309 321 curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY); 310 322 } … … 317 329 318 330 /* example.com is redirected, so we tell libcurl to send POST on 301, 302 and 319 303 HTTP response codes */331 303 HTTP response codes */ 320 332 curl_easy_setopt(curl_handle, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL); 321 333 } … … 326 338 // curl_easy_setopt(curl_handle, CURLOPT_RETURNTRANSFER, 1); 327 339 328 /* send all data to this function */ 329 if(localfile == NULL) 340 if(localfile == NULL) 341 { 342 /* send all data to this function */ 330 343 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); 344 } 331 345 else 332 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); 333 334 /* we pass our 'chunk' struct to the callback function */ 335 if(localfile == NULL) 346 { 347 /* When data arrives, curl will call writeCallback. */ 348 curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, writeCallback); 349 // curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, NULL); 350 } 351 352 353 354 if(localfile == NULL) 355 { 356 /* we pass our 'chunk' struct to the callback function */ 336 357 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&chunk); 358 } 337 359 else 338 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, fp); 360 { 361 /* The last argument to writeCallback will be our file: */ 362 curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)fp); 363 } 339 364 340 365 /* some servers don't like requests that are made without a user-agent field, so we provide one */ … … 362 387 curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 3L); 363 388 389 364 390 /* enable all supported built-in compressions */ 365 391 curl_easy_setopt(curl_handle, CURLOPT_ACCEPT_ENCODING, ""); … … 370 396 curl_easy_setopt(curl_handle, CURLOPT_REFERER, referer); 371 397 372 if(getconfig("tithek_proxy", NULL) != NULL )398 if(getconfig("tithek_proxy", NULL) != NULL && getconfigint("tithek_useproxy", NULL) == 1) 373 399 curl_easy_setopt(curl_handle, CURLOPT_PROXY, getconfig("tithek_proxy", NULL)); 374 400 375 401 /* get it! */ 376 402 res = curl_easy_perform(curl_handle); 403 377 404 /* check for errors */ 378 405 if(res != CURLE_OK) … … 398 425 } 399 426 400 tmpstr = ostrcat(chunk.memory, NULL, 0, 0); 427 if(localfile == NULL) 428 tmpstr = ostrcat(chunk.memory, NULL, 0, 0); 429 401 430 free(chunk.memory); 402 /* we're done with libcurl, so clean it up */ 403 curl_global_cleanup(); 404 405 if(localfile != NULL) 431 /* we're done with libcurl, so clean it up */ 432 433 curl_global_cleanup(); 434 435 if(localfile != NULL) 406 436 free(tmpstr), tmpstr = NULL; 437 407 438 return tmpstr; 408 439 } -
titan/plugins/tithek/tithek_settings.h
r45037 r45041 21 21 struct skin* kinox_pic = getscreennode(tithek_settings, "kinox_pic"); 22 22 struct skin* kinox_localhoster = getscreennode(tithek_settings, "kinox_localhoster"); 23 struct skin* useproxy = getscreennode(tithek_settings, "useproxy"); 23 24 struct skin* proxy = getscreennode(tithek_settings, "proxy"); 25 struct skin* delservice = getscreennode(tithek_settings, "delservice"); 24 26 25 27 struct skin* autoupdate = getscreennode(tithek_settings, "autoupdate"); … … 91 93 changeinput(kinox_url, getconfig("tithek_kinox_url", NULL)); 92 94 93 changemask(proxy, "abcdefghijklmnopqrstuvwxyz0123456789://@");94 changeinput(proxy, getconfig("tithek_proxy", NULL));95 96 95 addchoicebox(kinox_pic, "0", _("no")); 97 96 addchoicebox(kinox_pic, "1", _("yes")); … … 102 101 addchoicebox(kinox_localhoster, "2", _("cloudfare")); 103 102 setchoiceboxselection(kinox_localhoster, getconfig("tithek_kinox_localhoster", NULL)); 103 104 changemask(proxy, "abcdefghijklmnopqrstuvwxyz0123456789://@"); 105 changeinput(proxy, getconfig("tithek_proxy", NULL)); 106 107 addchoicebox(useproxy, "0", _("no")); 108 addchoicebox(useproxy, "1", _("yes")); 109 setchoiceboxselection(useproxy, getconfig("tithek_useproxy", NULL)); 110 111 addchoicebox(delservice, "0", _("no")); 112 addchoicebox(delservice, "1", _("yes")); 113 setchoiceboxselection(delservice, getconfig("tithek_delservice", NULL)); 104 114 105 115 if(!file_exist("/mnt/swapextensions/etc/.codecpack") && !file_exist("/var/swap/etc/.codecpack") && !file_exist("/var/etc/.codecpack")) … … 118 128 rcret = waitrc(tithek_settings, 0, 0); 119 129 tmp = listbox->select; 120 130 /* 131 if(useproxy->ret != NULL && ostrcmp(useproxy->ret, "0") == 0) 132 proxy->hidden = YES; 133 else 134 proxy->hidden = NO; 135 */ 121 136 if(rcret == getrcconfigint("rcexit", NULL)) break; 122 137 if(rcret == getrcconfigint("rcok", NULL)) … … 131 146 addconfigscreencheck("tithek_kinox_pic", kinox_pic, NULL); 132 147 addconfigscreencheck("tithek_kinox_localhoster", kinox_localhoster, NULL); 148 addconfigscreencheck("tithek_useproxy", useproxy, NULL); 133 149 addconfigscreen("tithek_proxy", proxy); 150 addconfigscreencheck("tithek_delservice", delservice, NULL); 134 151 /* 135 152 if(amazon_user->ret != NULL && ostrcmp(amazon_user->ret, "****") != 0) … … 193 210 { 194 211 unlink("/mnt/network/cookies"); 212 } 213 else if(rcret == getrcconfigint("rcyellow", NULL)) 214 { 215 char* tmpstr = NULL; 216 char* cmd = NULL; 217 if(kinox_localhoster->ret != NULL && ostrcmp(kinox_localhoster->ret, "0") == 0) 218 tmpstr = gethttp("checkip.dyndns.org", "/", 80, NULL, NULL, 10000, NULL, 0); 219 else if(kinox_localhoster->ret != NULL && ostrcmp(kinox_localhoster->ret, "1") == 0) 220 tmpstr = gethttps("http://checkip.dyndns.org/", NULL, NULL, NULL, NULL, NULL, 1); 221 else if(kinox_localhoster->ret != NULL && ostrcmp(kinox_localhoster->ret, "2") == 0) 222 { 223 // new start 224 cmd = ostrcat("/tmp/localhoster/hoster.sh cloudflare 'http://checkip.dyndns.org/'", NULL, 0, 0); 225 debug(99, "cmd: %s", cmd); 226 227 tmpstr = command(cmd); 228 free(cmd), cmd = NULL; 229 // new end 230 } 231 cmd = string_resub("<body>", "</body>", tmpstr, 0); 232 free(tmpstr), tmpstr = NULL; 233 234 textbox(_("Message"), cmd, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 200, 0, 0); 235 free(cmd), cmd = NULL; 195 236 } 196 237 -
titan/skins/tithek/skin.xml
r45037 r45041 37 37 <node parent="listbox" name="kinox_pic" text="KinoX Load Preview Pic" type="choicebox" valign="middle" width="100%" height="35"> 38 38 <node parent="listbox" name="kinox_localhoster" text="KinoX Localhoster" type="choicebox" valign="middle" width="100%" height="35"> 39 <node parent="listbox" name="useproxy" text="Use Proxy" type="choicebox" valign="middle" width="100%" height="35"> 39 40 <node parent="listbox" name="proxy" text="Proxy" type="inputbox" valign="middle" width="100%" height="35"> 41 <node parent="listbox" name="delservice" text="Del Service" type="choicebox" valign="middle" width="100%" height="35"> 40 42 <node name="buttonbar" posx="0" posy="0" width="100%" height="50" hspace="5" fontcol="black" fontsize="25" bordercol="titlebgcol" bordersize="1" borderradius="8" bgcol="titlebgcol" bgcol2="white" gradient="topmiddle"> 41 43 <node parent="buttonbar" name="b1" picmem="skin/key_ok_70x40.png" posx="0" posy="center" width="70" height="40"> … … 44 46 <node parent="buttonbar" name="b4" picmem="skin/key_red_30x30.png" posx="220" posy="center" width="280" height="30" valign="middle" textposx="40" text="Remove Cookies"> 45 47 <node parent="buttonbar" name="b5" picmem="skin/key_green_30x30.png" posx="440" posy="center" width="280" height="30" valign="middle" textposx="40" text="Screensaver"> 48 <node parent="buttonbar" name="b6" picmem="skin/key_yellow_30x30.png" posx="680" posy="center" width="280" height="30" valign="middle" textposx="40" text="Current IP Check"> 46 49 </screen> 47 50 -
titan/titan/struct.h
r45027 r45041 703 703 char* filename; 704 704 char* auth; 705 char* user; 706 char* pass; 705 707 int connfd; 706 708 int proz;
Note: See TracChangeset
for help on using the changeset viewer.