[apps/cmm] add new proxy for https sources (#277)

Deployed new https proxy for WebView and Downloader.
Made it configurable through /sys/settings/app.ini.

Reviewed-on: #277
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Co-authored-by: Burer <burer@kolibrios.org>
Co-committed-by: Burer <burer@kolibrios.org>
repo.commit.merged_in_pr%!(EXTRA template.HTML=#277)
This commit is contained in:
2025-10-17 11:04:08 +02:00
committed by Burer
parent c65da0d96f
commit 7b0867a6cf
7 changed files with 56 additions and 15 deletions

View File

@@ -22,3 +22,5 @@ ToggleBar=Tab
path=/usbhd0/1/kolibri.img
autoclose=0
[WebView]
proxy=http://proxy.kolibrios.org: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,10 @@ _http http = 0;
progress_bar prbar;
proc_info Form;
char settings_file[256];
char proxy_address[768];
#include "settings.h"
#include "tabs.h"
dword cur_img_url;
@@ -90,6 +95,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 +136,7 @@ void main()
TOOLBAR_H = PADDING+TSZE+PADDING+2;
LoadLibraries();
LoadIniConfig();
HandleParam();
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
@@ -517,14 +524,17 @@ bool GetLocalFileData(dword _path)
bool GetUrl(dword _http_url)
{
char new_url_full[URL_SIZE+1];
if (!strncmp(_http_url,"http:",5)) {
if (!strncmp(_http_url,"http://",7)) {
http.get(_http_url);
return true;
} else if (!strncmp(_http_url,"https://",8)) {
strcpy(#new_url_full, "http://gate.aspero.pro/?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

@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.91";
char version[]="WebView 3.92";

View File

@@ -0,0 +1,9 @@
_ini ini;
void LoadIniConfig()
{
ini.path = GetIni(#settings_file, "app.ini");
ini.section = "WebView";
ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL);
}

View File

@@ -1,7 +1,12 @@
//Copyright 2020 - 2025 by Leency
//Burer...
#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"
@@ -21,6 +26,11 @@ char uEdit[URL_SIZE];
char filepath[4096];
char save_dir[4096];
char settings_file[256];
char proxy_address[768];
#include "settings.h"
char* active_status;
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
@@ -32,9 +42,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);
@@ -167,10 +181,8 @@ void StartDownloading()
if (http.transfer > 0) return;
ResetDownloadSpeed();
pb.back_color = 0xFFFfff;
if (!strncmp(#uEdit,"https:",6)) {
//miniprintf(#get_url, "http://gate.aspero.pro/?site=%s", #uEdit);
notify("'HTTPS for download temporary is not supported,\ntrying to download the file via HTTP' -W");
miniprintf(#uEdit, "http://%s", #uEdit+8);
if (!strncmp(#uEdit,"https://",8)) {
miniprintf(#get_url, "%s%s", #proxy_address, #uEdit);
}
strcpy(#get_url, #uEdit);

View File

@@ -0,0 +1,9 @@
_ini ini;
void LoadIniConfig()
{
ini.path = GetIni(#settings_file, "app.ini");
ini.section = "WebView";
ini.GetString("proxy", #proxy_address, sizeof(proxy_address), NULL);
}

View File

@@ -112,7 +112,6 @@ struct _http
dword _http::get(dword _url)
{
cur_url = _url;
if (streqrp(cur_url, "http://gate.aspero.pro/?site=")) cur_url += 29;
http_get stdcall (_url, 0, 0, #accept_language);
transfer = EAX;
return EAX;
@@ -138,7 +137,7 @@ bool _http::stop()
transfer=0;
*/
hfree();
return true;
return true;
}
return false;
}