Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
regnete committed Jan 29, 2024
1 parent 5c69d05 commit 512f441
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

<dependency id="cordova-plugin-file" version=">=5.0.0" />

<!-- make these preferences available to the plugin impl (currently not required) -->
<!-- <preference name="OverrideUserAgent" default="" />-->
<!-- <preference name="AppendUserAgent" default="" />-->

<js-module src="www/FileTransferError.js" name="FileTransferError">
<clobbers target="window.FileTransferError" />
</js-module>
Expand Down
21 changes: 17 additions & 4 deletions src/electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ const DOWNLOAD_IMPLS = {
{
// ISSUES
// - undici.request ignores system/os trust store -> self-signed enterprise CA's won't work
// - how to apply OverrideUserAgent/AppendUserAgent ?
return new Promise(async (resolve, reject) =>
{
try
Expand Down Expand Up @@ -394,6 +395,7 @@ const DOWNLOAD_IMPLS = {
{
// ISSUES
// - fetch ignores system/os trust store -> self-signed enterprise CA's won't work
// - how to apply OverrideUserAgent/AppendUserAgent ?
return new Promise(async (resolve, reject) =>
{
try
Expand Down Expand Up @@ -459,7 +461,7 @@ const DOWNLOAD_IMPLS = {
}


const fileTransferPlugin = {
const pluginAPI = {

/**
* @param {string} source
Expand Down Expand Up @@ -519,7 +521,10 @@ const fileTransferPlugin = {
form.append(key, params[key]);
})

// progress currently not supported
// ISSUES
// - system/os trust store
// - progress
// - how to apply OverrideUserAgent/AppendUserAgent ?
fetch(target, {
headers: form.getHeaders(headers),
method: httpMethod,
Expand Down Expand Up @@ -619,6 +624,10 @@ const fileTransferPlugin = {
form.append(key, params[key]);
})

// ISSUES
// - system/os trust store
// - how to apply OverrideUserAgent/AppendUserAgent ?

xhr.open(httpMethod, target);

for (const header in headers)
Expand Down Expand Up @@ -757,6 +766,10 @@ const fileTransferPlugin = {
form.append(key, params[key]);
})

// ISSUES
// - system/os trust store ?
// - how to apply OverrideUserAgent/AppendUserAgent ?

req = (target.startsWith("https:") ? https : http).request(target, {
method: httpMethod,
headers: form.getHeaders(headers),
Expand Down Expand Up @@ -932,11 +945,11 @@ const fileTransferPlugin = {
*/
const plugin = function (action, args, callbackContext)
{
if (!fileTransferPlugin[action])
if (!pluginAPI[action])
return false;
try
{
fileTransferPlugin[action](args, callbackContext)
pluginAPI[action](args, callbackContext)
} catch (e)
{
console.error(action + ' failed', e);
Expand Down

0 comments on commit 512f441

Please sign in to comment.