Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/companion-client

Package Overview
Dependencies
Maintainers
6
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/companion-client - npm Package Compare versions

Comparing version 2.0.0-alpha.0 to 2.0.0

20

lib/Provider.js
'use strict';
const qsStringify = require('qs-stringify');
const RequestClient = require('./RequestClient');

@@ -9,3 +7,3 @@

const _getName = id => {
const getName = id => {
return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');

@@ -19,3 +17,3 @@ };

this.id = this.provider;
this.name = this.opts.name || _getName(this.id);
this.name = this.opts.name || getName(this.id);
this.pluginId = this.opts.pluginId;

@@ -71,5 +69,3 @@ this.tokenKey = `companion-${this.pluginId}-auth-token`;

let strigifiedQueries = qsStringify(queries);
strigifiedQueries = strigifiedQueries ? `?${strigifiedQueries}` : strigifiedQueries;
return `${this.hostname}/${this.id}/connect${strigifiedQueries}`;
return `${this.hostname}/${this.id}/connect?${new URLSearchParams(queries)}`;
}

@@ -125,9 +121,7 @@

plugin.opts.companionAllowedHosts = pattern;
} else if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
// does not start with https://
plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`;
} else {
// does not start with https://
if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`;
} else {
plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin;
}
plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin;
}

@@ -134,0 +128,0 @@

@@ -160,3 +160,3 @@ 'use strict';

}), _class.VERSION = "2.0.0-alpha.0", _class.defaultHeaders = {
}), _class.VERSION = "2.0.0", _class.defaultHeaders = {
Accept: 'application/json',

@@ -163,0 +163,0 @@ 'Content-Type': 'application/json',

@@ -5,3 +5,3 @@ 'use strict';

const _getName = id => {
const getName = id => {
return id.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join(' ');

@@ -15,3 +15,3 @@ };

this.id = this.provider;
this.name = this.opts.name || _getName(this.id);
this.name = this.opts.name || getName(this.id);
this.pluginId = this.opts.pluginId;

@@ -18,0 +18,0 @@ }

{
"name": "@uppy/companion-client",
"description": "Client library for communication with Companion. Intended for use in Uppy plugins.",
"version": "2.0.0-alpha.0",
"version": "2.0.0",
"license": "MIT",

@@ -24,7 +24,6 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^4.0.0-alpha.0",
"namespace-emitter": "^2.0.1",
"qs-stringify": "^1.1.0"
"@uppy/utils": "^4.0.0",
"namespace-emitter": "^2.0.1"
},
"gitHead": "113b627dd0ef5aa5d198dc309dda05da2117dfe5"
"gitHead": "ab771cbe1cd87affd87c97bc983b19058e2e72bd"
}
'use strict'
const qsStringify = require('qs-stringify')
const RequestClient = require('./RequestClient')
const tokenStorage = require('./tokenStorage')
const _getName = (id) => {
const getName = (id) => {
return id.split('-').map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(' ')

@@ -16,3 +15,3 @@ }

this.id = this.provider
this.name = this.opts.name || _getName(this.id)
this.name = this.opts.name || getName(this.id)
this.pluginId = this.opts.pluginId

@@ -63,5 +62,3 @@ this.tokenKey = `companion-${this.pluginId}-auth-token`

let strigifiedQueries = qsStringify(queries)
strigifiedQueries = strigifiedQueries ? `?${strigifiedQueries}` : strigifiedQueries
return `${this.hostname}/${this.id}/connect${strigifiedQueries}`
return `${this.hostname}/${this.id}/connect?${new URLSearchParams(queries)}`
}

@@ -116,9 +113,7 @@

plugin.opts.companionAllowedHosts = pattern
} else if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
// does not start with https://
plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`
} else {
// does not start with https://
if (/^(?!https?:\/\/).*$/i.test(opts.companionUrl)) {
plugin.opts.companionAllowedHosts = `https://${opts.companionUrl.replace(/^\/\//, '')}`
} else {
plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin
}
plugin.opts.companionAllowedHosts = new URL(opts.companionUrl).origin
}

@@ -125,0 +120,0 @@

@@ -5,3 +5,3 @@ 'use strict'

const _getName = (id) => {
const getName = (id) => {
return id.split('-').map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(' ')

@@ -15,3 +15,3 @@ }

this.id = this.provider
this.name = this.opts.name || _getName(this.id)
this.name = this.opts.name || getName(this.id)
this.pluginId = this.opts.pluginId

@@ -18,0 +18,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc