mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Screenshot resizing works in the UI now. Still missing rate limiting.
This commit is contained in:
parent
e56d757cde
commit
c0d02c4e3a
8 changed files with 43 additions and 47 deletions
|
@ -1,9 +1,6 @@
|
|||
var http = require('http')
|
||||
var util = require('util')
|
||||
|
||||
var express = require('express')
|
||||
var Promise = require('bluebird')
|
||||
var gm = require('gm')
|
||||
|
||||
var logger = require('../../../../util/logger')
|
||||
|
||||
|
@ -21,8 +18,8 @@ module.exports = function(options) {
|
|||
app.set('case sensitive routing', true)
|
||||
app.set('trust proxy', true)
|
||||
|
||||
app.get('/api/v1/resources/:id/*', function(req, res) {
|
||||
get(req.params.id, options)
|
||||
app.get('/api/v1/s/image/:id/*', function(req, res) {
|
||||
get(req.url, options)
|
||||
.then(function(stream) {
|
||||
return transform(stream, {
|
||||
crop: parseCrop(req.query.crop)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
var util = require('util')
|
||||
var http = require('http')
|
||||
var url = require('url')
|
||||
|
||||
var Promise = require('bluebird')
|
||||
|
||||
module.exports = function(id, options) {
|
||||
module.exports = function(path, options) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
http.get(util.format('%sapi/v1/resources/%s', options.storageUrl, id))
|
||||
http.get(url.resolve(options.storageUrl, path))
|
||||
.on('response', function(res) {
|
||||
if (res.statusCode !== 200) {
|
||||
reject(new Error(util.format('HTTP %d', res.statusCode)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue