Просмотр исходного кода

companion-client,provider-views: send uppy-client header/query

Ifedapo Olarewaju 6 лет назад
Родитель
Сommit
a7282379ae

+ 3 - 1
packages/@uppy/companion-client/src/RequestClient.js

@@ -23,7 +23,9 @@ module.exports = class RequestClient {
   get defaultHeaders () {
   get defaultHeaders () {
     return {
     return {
       'Accept': 'application/json',
       'Accept': 'application/json',
-      'Content-Type': 'application/json'
+      'Content-Type': 'application/json',
+      // @todo remove this hardcoded version
+      'uppy-client': 'companion-client:1.0.2'
     }
     }
   }
   }
 
 

+ 3 - 1
packages/@uppy/provider-views/src/index.js

@@ -411,7 +411,9 @@ module.exports = class ProviderView {
 
 
   handleAuth () {
   handleAuth () {
     const authState = btoa(JSON.stringify({ origin: location.origin }))
     const authState = btoa(JSON.stringify({ origin: location.origin }))
-    const link = `${this.provider.authUrl()}?state=${authState}`
+    // @todo remove this hardcoded version
+    const clientVersion = 'companion-client:1.0.2'
+    const link = `${this.provider.authUrl()}?state=${authState}&uppyClient=${clientVersion}`
 
 
     const authWindow = window.open(link, '_blank')
     const authWindow = window.open(link, '_blank')
     const handleToken = (e) => {
     const handleToken = (e) => {