Socket
Socket
Sign inDemoInstall

@uppy/companion-client

Package Overview
Dependencies
Maintainers
5
Versions
88
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 0.28.2 to 0.28.3

16

lib/Provider.js

@@ -33,3 +33,4 @@ 'use strict';

_this.name = _this.opts.name || _getName(_this.id);
_this.tokenKey = 'companion-' + _this.id + '-auth-token';
_this.pluginId = _this.opts.pluginId;
_this.tokenKey = 'companion-' + _this.pluginId + '-auth-token';
return _this;

@@ -41,5 +42,9 @@ }

// @todo(i.olarewaju) add fallback for OOM storage
localStorage.setItem(this.tokenKey, token);
this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey, token);
};
Provider.prototype.getAuthToken = function getAuthToken() {
return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey);
};
Provider.prototype.checkAuth = function checkAuth() {

@@ -69,3 +74,3 @@ return this.get(this.id + '/authorized').then(function (payload) {

return this.get(this.id + '/logout?redirect=' + redirect).then(function (res) {
localStorage.removeItem(_this2.tokenKey);
_this2.uppy.getPlugin(_this2.pluginId).storage.removeItem(_this2.tokenKey);
return res;

@@ -81,2 +86,3 @@ });

}
if (opts.serverPattern) {

@@ -97,2 +103,4 @@ var pattern = opts.serverPattern;

}
plugin.storage = plugin.opts.storage || localStorage;
};

@@ -103,3 +111,3 @@

get: function get() {
return _extends({}, _RequestClient.prototype.defaultHeaders, { 'uppy-auth-token': localStorage.getItem(this.tokenKey) });
return _extends({}, _RequestClient.prototype.defaultHeaders, { 'uppy-auth-token': this.getAuthToken() });
}

@@ -106,0 +114,0 @@ }]);

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

@@ -26,3 +26,3 @@ "main": "lib/index.js",

},
"gitHead": "f94bc77debd56e75bb605a268ad2c8cd67dd6678"
"gitHead": "27899d944f0ffb551d0473955236734c24eb4fff"
}

@@ -16,7 +16,8 @@ 'use strict'

this.name = this.opts.name || _getName(this.id)
this.tokenKey = `companion-${this.id}-auth-token`
this.pluginId = this.opts.pluginId
this.tokenKey = `companion-${this.pluginId}-auth-token`
}
get defaultHeaders () {
return Object.assign({}, super.defaultHeaders, {'uppy-auth-token': localStorage.getItem(this.tokenKey)})
return Object.assign({}, super.defaultHeaders, {'uppy-auth-token': this.getAuthToken()})
}

@@ -27,5 +28,9 @@

// @todo(i.olarewaju) add fallback for OOM storage
localStorage.setItem(this.tokenKey, token)
this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey, token)
}
getAuthToken () {
return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey)
}
checkAuth () {

@@ -53,3 +58,3 @@ return this.get(`${this.id}/authorized`)

.then((res) => {
localStorage.removeItem(this.tokenKey)
this.uppy.getPlugin(this.pluginId).storage.removeItem(this.tokenKey)
return res

@@ -65,2 +70,3 @@ })

}
if (opts.serverPattern) {

@@ -81,3 +87,5 @@ const pattern = opts.serverPattern

}
plugin.storage = plugin.opts.storage || localStorage
}
}
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