Skip to content

Commit

Permalink
reuse session cookies in file transfer plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
regnete committed Oct 2, 2024
1 parent 512f441 commit 6e8d4f3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
const http = require("http");
const https = require("https");
const undici = require("undici");
const {net} = require("electron");
const {net, session} = require("electron");

// reduce bridge traffic
const PROGRESS_INTERVAL_MILLIS = 400;
Expand Down Expand Up @@ -183,7 +183,9 @@ const DOWNLOAD_IMPLS = {
{
const req = net.request({
method: 'GET',
url: source
url: source,
session: session.fromPartition(''),
credentials: 'include'
});

if (headers)
Expand Down Expand Up @@ -766,9 +768,10 @@ const pluginAPI = {
form.append(key, params[key]);
})

// ISSUES
// TODO
// - system/os trust store ?
// - how to apply OverrideUserAgent/AppendUserAgent ?
// - send credentials/session cookies

req = (target.startsWith("https:") ? https : http).request(target, {
method: httpMethod,
Expand All @@ -789,7 +792,7 @@ const pluginAPI = {

res.on('data', () =>
{
// ensure all chunk are read
// ensure all chunks are read
});
res.on('end', () =>
{
Expand Down

0 comments on commit 6e8d4f3

Please sign in to comment.