Add screenshots to UI. Still need to implement resizing.

This commit is contained in:
Simo Kinnunen
2014-05-20 11:34:39 +09:00
parent 48726669dc
commit 254b2dc7a3
5 changed files with 49 additions and 19 deletions

View File

@@ -47,10 +47,10 @@ module.exports = syrup.serial()
router.on(wire.ScreenCaptureMessage, function(channel) {
var reply = wireutil.reply(options.serial)
plugin.capture()
.then(function(url) {
.then(function(file) {
push.send([
channel
, reply.okay(url)
, reply.okay('success', file)
])
})
.catch(function(err) {

View File

@@ -32,7 +32,7 @@ module.exports = syrup.serial()
else {
try {
var result = JSON.parse(body)
log.info('Uploaded to %s', result.resources.file)
log.info('Uploaded to %s', result.resources.file.url)
resolver.resolve(result.resources.file)
}
catch (err) {

View File

@@ -43,15 +43,18 @@ module.exports = function(options) {
, resources: (function() {
var mapped = Object.create(null)
storedFiles.forEach(function(file) {
mapped[file.field] = util.format(
'http://%s:%s/api/v1/resources/%s%s'
, options.publicIp
, options.port
, file.id
, file.name
? util.format('/%s', path.basename(file.name))
: ''
)
mapped[file.field] = {
date: new Date()
, url: util.format(
'http://%s:%s/api/v1/resources/%s%s'
, options.publicIp
, options.port
, file.id
, file.name
? util.format('/%s', path.basename(file.name))
: ''
)
}
})
return mapped
})()