From 114f5e4f0577713f7864e4d26e7db911786ac750 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:56:23 +0300 Subject: [PATCH 1/4] fix: fix overflow to auto --- contrib/webconsole/torrent_client.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index 7c178638..9232174f 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -64,7 +64,7 @@ background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); - overflow: hidden; + overflow: auto; } .torrent-wrapper table { From e0e819742649770df1bd3301eece64dcd20b62cd Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:05:39 +0300 Subject: [PATCH 2/4] fix: fix max-width for content --- contrib/webconsole/torrent_client.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index 9232174f..5ed2c71b 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -64,7 +64,7 @@ background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); - overflow: auto; + overflow: hidden; } .torrent-wrapper table { @@ -139,6 +139,10 @@ background-color: var(--danger); color: white; } + + .content { + max-width: 100em; /*fix for torrent interface*/ + }
From 01bae46c0c3870a4378b928f21674798fbf81e44 Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 24 Aug 2026 17:08:54 +0300 Subject: [PATCH 3/4] =?UTF-8?q?scroll=20instead=20auto=20for=20100%=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BB=D0=B8=D1=81=D1=82=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B5=D1=81=D0=BB=D0=B8=20=D0=BC=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B0=20=D0=BD=D0=B5=20=D1=85=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contrib/webconsole/torrent_client.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index 5ed2c71b..2bf91204 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -102,7 +102,7 @@ background: var(--bg-color); border-radius: 4px; height: 6px; - overflow: hidden; + overflow: scroll; border: 1px solid var(--border-color); } From 992de495adafc13ed4f402079d39d0cacc849a7e Mon Sep 17 00:00:00 2001 From: wipedlifepotato <60944239+wipedlifepotato@users.noreply.github.com> Date: Mon, 24 Aug 2026 22:06:12 +0300 Subject: [PATCH 4/4] fix: CORS --- contrib/webconsole/torrent_client.html | 1 + daemon/HTTPServer.cpp | 8 ++++++-- libi2pd_client/TorrentsRPC.cpp | 25 ++++++++++++++++++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/contrib/webconsole/torrent_client.html b/contrib/webconsole/torrent_client.html index 2bf91204..94e0e097 100644 --- a/contrib/webconsole/torrent_client.html +++ b/contrib/webconsole/torrent_client.html @@ -240,6 +240,7 @@ } catch (err) { statusIndicator.textContent = 'STATUS: CONNECTION_REFUSED'; statusIndicator.style.color = '#ef4444'; + console.log(err) } }, 1000); diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 8d65ae4b..999ee059 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -1402,16 +1402,20 @@ namespace http { // todo: to an another method with return; std::string tunnelname = params["tunnelname"]; auto findTunnelEndpoint = [](const std::string& tunnelname) -> std::pair { + LogPrint(eLogDebug,"GetTorrentsRPC"); for (auto& [port, server] : i2p::client::context.GetTorrentsRPCServers()) { - if (!server) continue; + if (!server) { + LogPrint(eLogError,"GetTorrentsRPCServers return nothing"); + continue; + } for (const auto& [rpcPath, weakTunnel] : server->GetTunnels()) { if (auto tunnel = weakTunnel.lock()) { + LogPrint(eLogDebug, "TUNNEL_OPENJS", tunnel->GetName()); if (tunnel->GetName() == tunnelname) { - uint16_t rpcPort = server->GetAcceptor().local_endpoint().port(); return std::pair(rpcPort, rpcPath); } diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index 80bbc79d..7d116df4 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -431,8 +431,31 @@ namespace torrents { if (!ecode) { - if (m_Request.method() == boost::beast::http::verb::post) + if (m_Request.method() == boost::beast::http::verb::options) { + m_Response.version (11); // HTTP/1.1 + m_Response.result (204); + m_Response.set (boost::beast::http::field::access_control_allow_origin, "*"); + m_Response.set (boost::beast::http::field::access_control_allow_methods, "GET, POST, OPTIONS"); + m_Response.set (boost::beast::http::field::access_control_allow_headers, "Content-Type, Authorization"); + + m_Response.keep_alive(m_Request.keep_alive()); + m_Response.prepare_payload (); + boost::beast::http::async_write (m_Socket, m_Response, + [s = shared_from_this ()](const boost::system::error_code& ecode, size_t bytes_transferred) + { + if (ecode) + LogPrint (eLogWarning, "TorrentsRPC: Failed to send response: ", ecode.message ()); + }); + } + else if (m_Request.method() == boost::beast::http::verb::post) + { + m_Response.set( + boost::beast::http::field::access_control_allow_origin, + "*"); + m_Response.set( + boost::beast::http::field::access_control_allow_headers, + "Content-Type, Authorization"); auto path = m_Request.target (); auto tunnel = m_Server.GetTunnel ( {path.data (), path.size ()}); // boost::beast::string_view to std::string_view if (tunnel)