Merge pull request #2516 from wipedlifepotato/JS_CLIENT_TORRENT

fix: fix overflow to auto (torrent-js client)
This commit is contained in:
orignal
2026-08-24 15:23:47 -04:00
committed by GitHub
3 changed files with 36 additions and 4 deletions
+6 -1
View File
@@ -102,7 +102,7 @@
background: var(--bg-color);
border-radius: 4px;
height: 6px;
overflow: hidden;
overflow: scroll;
border: 1px solid var(--border-color);
}
@@ -139,6 +139,10 @@
background-color: var(--danger);
color: white;
}
.content {
max-width: 100em; /*fix for torrent interface*/
}
</style>
<div class="torrent-wrapper">
@@ -236,6 +240,7 @@
} catch (err) {
statusIndicator.textContent = 'STATUS: CONNECTION_REFUSED';
statusIndicator.style.color = '#ef4444';
console.log(err)
}
}, 1000);
+6 -2
View File
@@ -1406,16 +1406,20 @@ namespace http {
// todo: to an another method with return;
std::string tunnelname = params["tunnelname"];
auto findTunnelEndpoint = [](const std::string& tunnelname) -> std::pair<uint16_t, std::string> {
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<uint16_t, std::string>(rpcPort, rpcPath);
}
+24 -1
View File
@@ -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)