Skip to content

Commit f7029ad

Browse files
committed
Add token support for private pomf hosts
1 parent 4dd1144 commit f7029ad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

app/components/screenshot.js

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ module.exports = class {
6363
if (service) {
6464
serviceModule = require('./services/pomf')
6565
serviceModule.setPath(service.uploadPath, service.resultPath)
66+
67+
if (service.token) {
68+
serviceModule.setToken(service.token)
69+
}
6670
}
6771
} else if (service === 'cubeupload') {
6872
serviceModule = require('./services/cubeupload')

app/components/services/pomf.js

+10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ module.exports = class {
99
url: this.uploadPath
1010
}
1111

12+
if (this.token) {
13+
options.headers = {
14+
'token': this.token
15+
}
16+
}
17+
1218
const post = request.post(options, (error, req, body) => {
1319
if (error) {
1420
return callback(null, error)
@@ -45,4 +51,8 @@ module.exports = class {
4551
this.uploadPath = uploadPath
4652
this.resultPath = resultPath
4753
}
54+
55+
static setToken (token) {
56+
this.token = token
57+
}
4858
}

0 commit comments

Comments
 (0)