Add .ini settings for proxy address
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 49s
Build system / Build (pull_request) Successful in 1h17m57s

This commit is contained in:
2025-09-27 14:43:35 +03:00
parent c1aac375e2
commit 305595d12d
6 changed files with 51 additions and 10 deletions

View File

@@ -22,3 +22,5 @@ ToggleBar=Tab
path=/usbhd0/1/kolibri.img
autoclose=0
[WebView]
proxy=http://176.223.130.192:82/?site=

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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: "<proxy_address><original https url>"
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);
}

View File

@@ -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);
}

View File

@@ -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;
}