mirror of
https://github.com/openstf/stf
synced 2025-10-04 10:19:30 +02:00
Change all "api" URLs. Ideally the path prefix would be an option.
This commit is contained in:
parent
436fa6eff9
commit
b2e114c9be
14 changed files with 28 additions and 29 deletions
|
@ -91,7 +91,7 @@ module.exports = function(options) {
|
|||
res.render('index')
|
||||
})
|
||||
|
||||
app.get('/api/v1/app/state.js', function(req, res) {
|
||||
app.get('/app/api/v1/state.js', function(req, res) {
|
||||
var state = {
|
||||
config: {
|
||||
websocketUrl: (function() {
|
||||
|
@ -106,14 +106,14 @@ module.exports = function(options) {
|
|||
res.send('var GLOBAL_APPSTATE = ' + JSON.stringify(state))
|
||||
})
|
||||
|
||||
app.get('/api/v1/app/user', function(req, res) {
|
||||
app.get('/app/api/v1/user', function(req, res) {
|
||||
res.json({
|
||||
success: true
|
||||
, user: req.user
|
||||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/app/group', function(req, res) {
|
||||
app.get('/app/api/v1/group', function(req, res) {
|
||||
dbapi.loadGroup(req.user.email)
|
||||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
|
@ -135,7 +135,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/app/devices', function(req, res) {
|
||||
app.get('/app/api/v1/devices', function(req, res) {
|
||||
dbapi.loadDevices()
|
||||
.then(function(cursor) {
|
||||
return Promise.promisify(cursor.toArray, cursor)()
|
||||
|
@ -158,7 +158,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/app/devices/:serial', function(req, res) {
|
||||
app.get('/app/api/v1/devices/:serial', function(req, res) {
|
||||
dbapi.loadDevice(req.params.serial)
|
||||
.then(function(device) {
|
||||
if (device) {
|
||||
|
|
|
@ -71,7 +71,7 @@ module.exports = function(options) {
|
|||
res.render('index')
|
||||
})
|
||||
|
||||
app.post('/api/v1/auth/ldap', function(req, res) {
|
||||
app.post('/auth/api/v1/ldap', function(req, res) {
|
||||
var log = logger.createLogger('auth-ldap')
|
||||
log.setLocalIdentifier(req.ip)
|
||||
switch (req.accepts(['json'])) {
|
||||
|
|
|
@ -70,7 +70,7 @@ module.exports = function(options) {
|
|||
res.render('index')
|
||||
})
|
||||
|
||||
app.post('/api/v1/auth/mock', function(req, res) {
|
||||
app.post('/auth/api/v1/mock', function(req, res) {
|
||||
var log = logger.createLogger('auth-mock')
|
||||
log.setLocalIdentifier(req.ip)
|
||||
switch (req.accepts(['json'])) {
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = syrup.serial()
|
|||
var resolver = Promise.defer()
|
||||
|
||||
var req = request.post({
|
||||
url: util.format('%sapi/v1/s/%s', options.storageUrl, type)
|
||||
url: util.format('%ss/api/v1/%s', options.storageUrl, type)
|
||||
}
|
||||
, function(err, res, body) {
|
||||
if (err) {
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = function(options) {
|
|||
app.set('case sensitive routing', true)
|
||||
app.set('trust proxy', true)
|
||||
|
||||
;['/api/v1/auth/*', '/static/auth/*', '/auth/*'].forEach(function(route) {
|
||||
;['/static/auth/*', '/auth/*'].forEach(function(route) {
|
||||
app.all(route, function(req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.authUrl
|
||||
|
@ -27,7 +27,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
;['/api/v1/s/image/*'].forEach(function(route) {
|
||||
;['/s/api/v1/image/*'].forEach(function(route) {
|
||||
app.all(route, function(req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.storagePluginImageUrl
|
||||
|
@ -35,7 +35,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
;['/api/v1/s/apk/*'].forEach(function(route) {
|
||||
;['/s/api/v1/apk/*'].forEach(function(route) {
|
||||
app.all(route, function(req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.storagePluginApkUrl
|
||||
|
@ -43,7 +43,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
;['/api/v1/s*'].forEach(function(route) {
|
||||
;['/s/api/v1/*'].forEach(function(route) {
|
||||
app.all(route, function(req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.storageUrl
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = function(options) {
|
|||
app.set('case sensitive routing', true)
|
||||
app.set('trust proxy', true)
|
||||
|
||||
app.get('/api/v1/s/apk/:id/*/manifest', function(req, res) {
|
||||
app.get('/s/api/v1/apk/:id/*/manifest', function(req, res) {
|
||||
download(url.resolve(options.storageUrl, req.url), {
|
||||
dir: options.cacheDir
|
||||
})
|
||||
|
@ -43,7 +43,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/s/apk/:id/*', function(req, res) {
|
||||
app.get('/s/api/v1/apk/:id/*', function(req, res) {
|
||||
proxy.web(req, res, {
|
||||
target: options.storageUrl
|
||||
})
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = function(options) {
|
|||
app.set('trust proxy', true)
|
||||
|
||||
app.get(
|
||||
'/api/v1/s/image/:id/*'
|
||||
'/s/api/v1/image/:id/*'
|
||||
, requtil.limit(options.concurrency, function(req, res) {
|
||||
return get(req.url, options)
|
||||
.then(function(stream) {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = function(options) {
|
|||
log.info('Cleaning up inactive resource "%s"', id)
|
||||
})
|
||||
|
||||
app.post('/api/v1/s/:type/download', function(req, res) {
|
||||
app.post('/s/api/v1/:type/download', function(req, res) {
|
||||
requtil.validate(req, function() {
|
||||
req.checkBody('url').notEmpty()
|
||||
})
|
||||
|
@ -55,7 +55,7 @@ module.exports = function(options) {
|
|||
, id: file.id
|
||||
, name: file.name
|
||||
, href: util.format(
|
||||
'/api/v1/s/%s/%s%s'
|
||||
'/s/api/v1/%s/%s%s'
|
||||
, req.params.type
|
||||
, file.id
|
||||
, file.name
|
||||
|
@ -83,7 +83,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
app.post('/api/v1/s/:type', function(req, res) {
|
||||
app.post('/s/api/v1/:type', function(req, res) {
|
||||
var form = new formidable.IncomingForm()
|
||||
Promise.promisify(form.parse, form)(req)
|
||||
.spread(function(fields, files) {
|
||||
|
@ -110,7 +110,7 @@ module.exports = function(options) {
|
|||
, id: file.id
|
||||
, name: file.name
|
||||
, href: util.format(
|
||||
'/api/v1/s/%s/%s%s'
|
||||
'/s/api/v1/%s/%s%s'
|
||||
, req.params.type
|
||||
, file.id
|
||||
, file.name
|
||||
|
@ -133,7 +133,7 @@ module.exports = function(options) {
|
|||
})
|
||||
})
|
||||
|
||||
app.get('/api/v1/s/:type/:id/*', function(req, res) {
|
||||
app.get('/s/api/v1/:type/:id/*', function(req, res) {
|
||||
var file = storage.retrieve(req.params.id)
|
||||
if (file) {
|
||||
res.set('Content-Type', file.type)
|
||||
|
|
|
@ -164,7 +164,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
, digest: false
|
||||
})
|
||||
|
||||
oboe('/api/v1/app/devices')
|
||||
oboe('/app/api/v1/devices')
|
||||
.node('devices[*]', function (device) {
|
||||
tracker.add(device)
|
||||
})
|
||||
|
@ -180,7 +180,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
, digest: true
|
||||
})
|
||||
|
||||
oboe('/api/v1/app/group')
|
||||
oboe('/app/api/v1/group')
|
||||
.node('devices[*]', function (device) {
|
||||
tracker.add(device)
|
||||
})
|
||||
|
@ -189,7 +189,7 @@ module.exports = function DeviceServiceFactory($http, socket, EnhanceDeviceServi
|
|||
}
|
||||
|
||||
deviceService.load = function(serial) {
|
||||
return $http.get('/api/v1/app/devices/' + serial)
|
||||
return $http.get('/app/api/v1/devices/' + serial)
|
||||
.then(function (response) {
|
||||
return response.data.device
|
||||
})
|
||||
|
|
|
@ -4,7 +4,6 @@ div(ng-if='displayError').screen-error
|
|||
.screen-error-message
|
||||
nothing-to-show(message='{{"No device screen"|translate}}', icon='fa-eye-slash', ng-show='true')
|
||||
|
||||
// TODO: PING here to check for connectivity http://172.19.9.107:7401/api/v1/displays/0
|
||||
.well
|
||||
.screen-error-alert(ng-show='displayError === "secure"', translate) The current view is marked secure and cannot be viewed remotely.
|
||||
.screen-error-alert(ng-show='displayError === "timeout"', translate) Retrieving the device screen has timed out.
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function StorageServiceFactory($http, $upload) {
|
|||
|
||||
service.storeUrl = function(type, url) {
|
||||
return $http({
|
||||
url: '/api/v1/s/' + type + '/download'
|
||||
url: '/s/api/v1/' + type + '/download'
|
||||
, method: 'POST'
|
||||
, data: {
|
||||
url: url
|
||||
|
@ -19,7 +19,7 @@ module.exports = function StorageServiceFactory($http, $upload) {
|
|||
|
||||
if (input.length) {
|
||||
$upload.upload({
|
||||
url: '/api/v1/s/' + type
|
||||
url: '/s/api/v1/' + type
|
||||
, method: 'POST'
|
||||
, file: input
|
||||
})
|
||||
|
|
|
@ -26,7 +26,7 @@ html(ng-app='app')
|
|||
div(growl)
|
||||
div(ng-view).fill-height
|
||||
|
||||
script(src='/api/v1/app/state.js')
|
||||
script(src='/app/api/v1/state.js')
|
||||
script(src='static/app/build/entry/commons.entry.js')
|
||||
script(src='static/app/build/entry/app.entry.js')
|
||||
script(src='static/bower_components/stf-analytics/analytics.js')
|
||||
|
|
|
@ -8,7 +8,7 @@ define(['./module'], function(mod) {
|
|||
, password: $scope.signin.password.$modelValue
|
||||
}
|
||||
$scope.invalid = false
|
||||
$http.post('/api/v1/auth/ldap', data)
|
||||
$http.post('/auth/api/v1/ldap', data)
|
||||
.success(function(response) {
|
||||
$scope.error = null
|
||||
location.replace(response.redirect)
|
||||
|
|
|
@ -8,7 +8,7 @@ define(['./module'], function(mod) {
|
|||
, email: $scope.signin.email.$modelValue
|
||||
}
|
||||
$scope.invalid = false
|
||||
$http.post('/api/v1/auth/mock', data)
|
||||
$http.post('/auth/api/v1/mock', data)
|
||||
.success(function(response) {
|
||||
$scope.error = null
|
||||
location.replace(response.redirect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue