diff --git a/data/common/settings/app.ini b/data/common/settings/app.ini index 115e8f054..73dafa3b2 100644 --- a/data/common/settings/app.ini +++ b/data/common/settings/app.ini @@ -22,3 +22,5 @@ ToggleBar=Tab path=/usbhd0/1/kolibri.img autoclose=0 +[WebView] +proxy=http://176.223.130.192:82/?site= \ No newline at end of file diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 2e8d46356..f5ce82d4c 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -1,10 +1,9 @@ //Copyright 2007-2025 by Veliant & Leency -//Asper, lev, Lrz, Barsuk, Nable, hidnplayr... +//Asper, lev, Lrz, Barsuk, Nable, hidnplayr, Burer... //BUGS //if maximize a window on image load => crash //issues with a long line -//add proxy settings //===================================================// // // @@ -13,6 +12,7 @@ //===================================================// #define MEMSIZE 1024 * 160 + #include "..\lib\gui.h" #include "..\lib\draw_buf.h" #include "..\lib\list_box.h" @@ -21,6 +21,7 @@ #include "..\lib\random.h" #include "..\lib\clipboard.h" +#include "..\lib\obj\libini.h" #include "..\lib\obj\box_lib.h" #include "..\lib\obj\libimg.h" #include "..\lib\obj\http.h" @@ -67,6 +68,9 @@ _http http = 0; progress_bar prbar; proc_info Form; +char proxy_address[4096]; + +#include "settings.h" #include "tabs.h" dword cur_img_url; @@ -90,6 +94,7 @@ edit_box omnibox_edit = {250, 0, 0, 0xffffff, void LoadLibraries() { + load_dll(libini, #lib_init,1); load_dll(boxlib, #box_lib_init,0); load_dll(libimg, #libimg_init,1); load_dll(libHTTP, #http_lib_init,1); @@ -130,6 +135,7 @@ void main() TOOLBAR_H = PADDING+TSZE+PADDING+2; LoadLibraries(); + LoadIniConfig(); HandleParam(); omnibox_edit.left = PADDING+TSZE*2+PADDING+6; @@ -521,10 +527,13 @@ bool GetUrl(dword _http_url) http.get(_http_url); return true; } else if (!strncmp(_http_url,"https://",8)) { - strcpy(#new_url_full, "http://176.223.130.192:82/?site="); - strncat(#new_url_full, _http_url, URL_SIZE); - http.get(#new_url_full); - return true; + if (proxy_address) { + strcpy(#new_url_full, proxy_address); + strncat(#new_url_full, _http_url, URL_SIZE); + http.get(#new_url_full); + return true; + } + return false; } return false; } diff --git a/programs/cmm/browser/settings.h b/programs/cmm/browser/settings.h new file mode 100644 index 000000000..d64ef75b8 --- /dev/null +++ b/programs/cmm/browser/settings.h @@ -0,0 +1,9 @@ +_ini ini; + +void LoadIniConfig() +{ + ini.path = GetIni("/sys/settings/app.ini", "app.ini"); + ini.section = "WebView"; + + ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL); +} \ No newline at end of file diff --git a/programs/cmm/downloader/dl.c b/programs/cmm/downloader/dl.c index addd9f1d8..0ebd9f5d4 100644 --- a/programs/cmm/downloader/dl.c +++ b/programs/cmm/downloader/dl.c @@ -1,7 +1,11 @@ +//Copyright 2020 - 2025 by Leency + #define MEMSIZE 1024 * 40 -//Copyright 2020 - 2021 by Leency + #include "../lib/gui.h" #include "../lib/random.h" + +#include "../lib/obj/libini.h" #include "../lib/obj/box_lib.h" #include "../lib/obj/http.h" @@ -20,6 +24,9 @@ checkbox autoclose = { T_AUTOCLOSE, false }; char uEdit[URL_SIZE]; char filepath[4096]; char save_dir[4096]; +char proxy_address[4096]; + +#include "settings.h" char* active_status; @@ -32,9 +39,13 @@ progress_bar pb = {0, GAPX, 52, WIN_W - GAPX - GAPX, 17, 0, NULL, NULL, void main() { dword shared_url; + + load_dll(libini, #lib_init,1); load_dll(boxlib, #box_lib_init,0); load_dll(libHTTP, #http_lib_init,1); + LoadIniConfig(); + strcpy(#save_dir, DEFAULT_SAVE_DIR); if (!dir_exists(#save_dir)) CreateDir(#save_dir); SetCurDir(#save_dir); @@ -168,7 +179,8 @@ void StartDownloading() ResetDownloadSpeed(); pb.back_color = 0xFFFfff; if (!strncmp(#uEdit,"https:",6)) { - miniprintf(#get_url, "http://176.223.130.192:82/?site=%s", #uEdit); + // Build: "" + miniprintf(#get_url, "%s%s", proxy_address, #uEdit); // notify("'HTTPS for download temporary is not supported,\ntrying to download the file via HTTP' -W"); // miniprintf(#uEdit, "http://%s", #uEdit+8); } diff --git a/programs/cmm/downloader/settings.h b/programs/cmm/downloader/settings.h new file mode 100644 index 000000000..d64ef75b8 --- /dev/null +++ b/programs/cmm/downloader/settings.h @@ -0,0 +1,9 @@ +_ini ini; + +void LoadIniConfig() +{ + ini.path = GetIni("/sys/settings/app.ini", "app.ini"); + ini.section = "WebView"; + + ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL); +} \ No newline at end of file diff --git a/programs/cmm/lib/obj/http.h b/programs/cmm/lib/obj/http.h index 6b7a9a371..1d23e6c0a 100644 --- a/programs/cmm/lib/obj/http.h +++ b/programs/cmm/lib/obj/http.h @@ -112,7 +112,7 @@ struct _http dword _http::get(dword _url) { cur_url = _url; - if (streqrp(cur_url, "http://176.223.130.192:82/?site=")) cur_url += 29; + // if (streqrp(cur_url, "http://176.223.130.192:82/?site=")) cur_url += 29; http_get stdcall (_url, 0, 0, #accept_language); transfer = EAX; return EAX; @@ -138,7 +138,7 @@ bool _http::stop() transfer=0; */ hfree(); - return true; + return true; } return false; }