forked from KolibriOS/kolibrios
[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: KolibriOS/kolibrios#277 Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com> Co-authored-by: Burer <burer@kolibrios.org> Co-committed-by: Burer <burer@kolibrios.org>
This commit is contained in:
@@ -22,3 +22,5 @@ ToggleBar=Tab
|
|||||||
path=/usbhd0/1/kolibri.img
|
path=/usbhd0/1/kolibri.img
|
||||||
autoclose=0
|
autoclose=0
|
||||||
|
|
||||||
|
[WebView]
|
||||||
|
proxy=http://proxy.kolibrios.org:82/?site=
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
//Copyright 2007-2025 by Veliant & Leency
|
//Copyright 2007-2025 by Veliant & Leency
|
||||||
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr...
|
//Asper, lev, Lrz, Barsuk, Nable, hidnplayr, Burer...
|
||||||
|
|
||||||
//BUGS
|
//BUGS
|
||||||
//if maximize a window on image load => crash
|
//if maximize a window on image load => crash
|
||||||
//issues with a long line
|
//issues with a long line
|
||||||
//add proxy settings
|
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
@@ -13,6 +12,7 @@
|
|||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
#define MEMSIZE 1024 * 160
|
#define MEMSIZE 1024 * 160
|
||||||
|
|
||||||
#include "..\lib\gui.h"
|
#include "..\lib\gui.h"
|
||||||
#include "..\lib\draw_buf.h"
|
#include "..\lib\draw_buf.h"
|
||||||
#include "..\lib\list_box.h"
|
#include "..\lib\list_box.h"
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "..\lib\random.h"
|
#include "..\lib\random.h"
|
||||||
#include "..\lib\clipboard.h"
|
#include "..\lib\clipboard.h"
|
||||||
|
|
||||||
|
#include "..\lib\obj\libini.h"
|
||||||
#include "..\lib\obj\box_lib.h"
|
#include "..\lib\obj\box_lib.h"
|
||||||
#include "..\lib\obj\libimg.h"
|
#include "..\lib\obj\libimg.h"
|
||||||
#include "..\lib\obj\http.h"
|
#include "..\lib\obj\http.h"
|
||||||
@@ -67,6 +68,10 @@ _http http = 0;
|
|||||||
progress_bar prbar;
|
progress_bar prbar;
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
|
char settings_file[256];
|
||||||
|
char proxy_address[768];
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
#include "tabs.h"
|
#include "tabs.h"
|
||||||
|
|
||||||
dword cur_img_url;
|
dword cur_img_url;
|
||||||
@@ -90,6 +95,7 @@ edit_box omnibox_edit = {250, 0, 0, 0xffffff,
|
|||||||
|
|
||||||
void LoadLibraries()
|
void LoadLibraries()
|
||||||
{
|
{
|
||||||
|
load_dll(libini, #lib_init,1);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
load_dll(libHTTP, #http_lib_init,1);
|
load_dll(libHTTP, #http_lib_init,1);
|
||||||
@@ -130,6 +136,7 @@ void main()
|
|||||||
TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
||||||
|
|
||||||
LoadLibraries();
|
LoadLibraries();
|
||||||
|
LoadIniConfig();
|
||||||
HandleParam();
|
HandleParam();
|
||||||
|
|
||||||
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
|
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
|
||||||
@@ -517,14 +524,17 @@ bool GetLocalFileData(dword _path)
|
|||||||
bool GetUrl(dword _http_url)
|
bool GetUrl(dword _http_url)
|
||||||
{
|
{
|
||||||
char new_url_full[URL_SIZE+1];
|
char new_url_full[URL_SIZE+1];
|
||||||
if (!strncmp(_http_url,"http:",5)) {
|
if (!strncmp(_http_url,"http://",7)) {
|
||||||
http.get(_http_url);
|
http.get(_http_url);
|
||||||
return true;
|
return true;
|
||||||
} else if (!strncmp(_http_url,"https://",8)) {
|
} else if (!strncmp(_http_url,"https://",8)) {
|
||||||
strcpy(#new_url_full, "http://gate.aspero.pro/?site=");
|
if (#proxy_address) {
|
||||||
strncat(#new_url_full, _http_url, URL_SIZE);
|
strcpy(#new_url_full, #proxy_address);
|
||||||
http.get(#new_url_full);
|
strncat(#new_url_full, _http_url, URL_SIZE);
|
||||||
return true;
|
http.get(#new_url_full);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
|
|||||||
|
|
||||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||||
|
|
||||||
char version[]="WebView 3.91";
|
char version[]="WebView 3.92";
|
||||||
9
programs/cmm/browser/settings.h
Normal file
9
programs/cmm/browser/settings.h
Normal 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);
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
|
//Copyright 2020 - 2025 by Leency
|
||||||
|
//Burer...
|
||||||
|
|
||||||
#define MEMSIZE 1024 * 40
|
#define MEMSIZE 1024 * 40
|
||||||
//Copyright 2020 - 2021 by Leency
|
|
||||||
#include "../lib/gui.h"
|
#include "../lib/gui.h"
|
||||||
#include "../lib/random.h"
|
#include "../lib/random.h"
|
||||||
|
|
||||||
|
#include "../lib/obj/libini.h"
|
||||||
#include "../lib/obj/box_lib.h"
|
#include "../lib/obj/box_lib.h"
|
||||||
#include "../lib/obj/http.h"
|
#include "../lib/obj/http.h"
|
||||||
|
|
||||||
@@ -21,6 +26,11 @@ char uEdit[URL_SIZE];
|
|||||||
char filepath[4096];
|
char filepath[4096];
|
||||||
char save_dir[4096];
|
char save_dir[4096];
|
||||||
|
|
||||||
|
char settings_file[256];
|
||||||
|
char proxy_address[768];
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
char* active_status;
|
char* active_status;
|
||||||
|
|
||||||
edit_box ed = {WIN_W-GAPX-GAPX,GAPX,20,0xffffff,0x94AECE,0xffffff,0xffffff,
|
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()
|
void main()
|
||||||
{
|
{
|
||||||
dword shared_url;
|
dword shared_url;
|
||||||
|
|
||||||
|
load_dll(libini, #lib_init,1);
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
load_dll(libHTTP, #http_lib_init,1);
|
load_dll(libHTTP, #http_lib_init,1);
|
||||||
|
|
||||||
|
LoadIniConfig();
|
||||||
|
|
||||||
strcpy(#save_dir, DEFAULT_SAVE_DIR);
|
strcpy(#save_dir, DEFAULT_SAVE_DIR);
|
||||||
if (!dir_exists(#save_dir)) CreateDir(#save_dir);
|
if (!dir_exists(#save_dir)) CreateDir(#save_dir);
|
||||||
SetCurDir(#save_dir);
|
SetCurDir(#save_dir);
|
||||||
@@ -167,10 +181,8 @@ void StartDownloading()
|
|||||||
if (http.transfer > 0) return;
|
if (http.transfer > 0) return;
|
||||||
ResetDownloadSpeed();
|
ResetDownloadSpeed();
|
||||||
pb.back_color = 0xFFFfff;
|
pb.back_color = 0xFFFfff;
|
||||||
if (!strncmp(#uEdit,"https:",6)) {
|
if (!strncmp(#uEdit,"https://",8)) {
|
||||||
//miniprintf(#get_url, "http://gate.aspero.pro/?site=%s", #uEdit);
|
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);
|
|
||||||
}
|
}
|
||||||
strcpy(#get_url, #uEdit);
|
strcpy(#get_url, #uEdit);
|
||||||
|
|
||||||
|
|||||||
9
programs/cmm/downloader/settings.h
Normal file
9
programs/cmm/downloader/settings.h
Normal 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);
|
||||||
|
}
|
||||||
@@ -112,7 +112,6 @@ struct _http
|
|||||||
dword _http::get(dword _url)
|
dword _http::get(dword _url)
|
||||||
{
|
{
|
||||||
cur_url = _url;
|
cur_url = _url;
|
||||||
if (streqrp(cur_url, "http://gate.aspero.pro/?site=")) cur_url += 29;
|
|
||||||
http_get stdcall (_url, 0, 0, #accept_language);
|
http_get stdcall (_url, 0, 0, #accept_language);
|
||||||
transfer = EAX;
|
transfer = EAX;
|
||||||
return EAX;
|
return EAX;
|
||||||
@@ -138,7 +137,7 @@ bool _http::stop()
|
|||||||
transfer=0;
|
transfer=0;
|
||||||
*/
|
*/
|
||||||
hfree();
|
hfree();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user