From 36f07aa7735dda8ff8cb681a229baa81b5b8c5fe Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 27 Nov 2024 19:55:11 +0200 Subject: [PATCH] move guest certificate validator to ggemini library, keep status updates only --- src/app/browser/window/tab/item/page.rs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 16cff998..d021885e 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -23,12 +23,12 @@ use crate::Profile; use gtk::{ gdk::Texture, gdk_pixbuf::Pixbuf, - gio::{Cancellable, SocketClientEvent, TlsCertificate, TlsClientConnection}, + gio::{Cancellable, SocketClientEvent, TlsCertificate}, glib::{ gformat, GString, Priority, Regex, RegexCompileFlags, RegexMatchFlags, Uri, UriFlags, UriHideFlags, }, - prelude::{CancellableExt, Cast, EditableExt, SocketClientExt, TlsConnectionExt}, + prelude::{CancellableExt, EditableExt, SocketClientExt}, }; use sqlite::Transaction; use std::{cell::RefCell, rc::Rc, time::Duration}; @@ -436,7 +436,7 @@ impl Page { let id = id.clone(); let meta = meta.clone(); let update = update.clone(); - move |_, event, _, stream| { + move |_, event, _, _| { meta.set_status(match event { SocketClientEvent::Resolving => Status::Resolving, SocketClientEvent::Resolved => Status::Resolved, @@ -444,17 +444,8 @@ impl Page { SocketClientEvent::Connected => Status::Connected, SocketClientEvent::ProxyNegotiating => Status::ProxyNegotiating, SocketClientEvent::ProxyNegotiated => Status::ProxyNegotiated, - // This match have effect only for unauthorized (random) TLS connection - SocketClientEvent::TlsHandshaking => { - // Handle certificate errors @TODO - // https://geminiprotocol.net/docs/protocol-specification.gmi#tls-server-certificate-validation - stream - .unwrap() - .dynamic_cast_ref::() - .unwrap() - .connect_accept_certificate(|_, _, _| true); - Status::TlsHandshaking - } + // TlsHandshaking have effect only for guest connections! + SocketClientEvent::TlsHandshaking => Status::TlsHandshaking, SocketClientEvent::TlsHandshaked => Status::TlsHandshaked, SocketClientEvent::Complete => Status::Complete, _ => todo!(), // notice on API change