diff --git a/lib/units/app/index.js b/lib/units/app/index.js index 4f71b0af..fb4a7ac9 100644 --- a/lib/units/app/index.js +++ b/lib/units/app/index.js @@ -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) { diff --git a/lib/units/auth/ldap.js b/lib/units/auth/ldap.js index 3b4ec75c..222a60cb 100644 --- a/lib/units/auth/ldap.js +++ b/lib/units/auth/ldap.js @@ -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'])) { diff --git a/lib/units/auth/mock.js b/lib/units/auth/mock.js index 0d817fd5..5a421522 100644 --- a/lib/units/auth/mock.js +++ b/lib/units/auth/mock.js @@ -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'])) { diff --git a/lib/units/device/support/storage.js b/lib/units/device/support/storage.js index df196deb..b74a058a 100644 --- a/lib/units/device/support/storage.js +++ b/lib/units/device/support/storage.js @@ -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) { diff --git a/lib/units/poorxy/index.js b/lib/units/poorxy/index.js index 95885116..0c20ba39 100644 --- a/lib/units/poorxy/index.js +++ b/lib/units/poorxy/index.js @@ -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 diff --git a/lib/units/storage/plugins/apk/index.js b/lib/units/storage/plugins/apk/index.js index 6f34c731..43b02545 100644 --- a/lib/units/storage/plugins/apk/index.js +++ b/lib/units/storage/plugins/apk/index.js @@ -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 }) diff --git a/lib/units/storage/plugins/image/index.js b/lib/units/storage/plugins/image/index.js index 88b16d31..6bd3e596 100644 --- a/lib/units/storage/plugins/image/index.js +++ b/lib/units/storage/plugins/image/index.js @@ -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) { diff --git a/lib/units/storage/temp.js b/lib/units/storage/temp.js index 376f6926..179bffa6 100644 --- a/lib/units/storage/temp.js +++ b/lib/units/storage/temp.js @@ -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) diff --git a/res/app/components/stf/device/device-service.js b/res/app/components/stf/device/device-service.js index 44f04ccd..5baa8e42 100644 --- a/res/app/components/stf/device/device-service.js +++ b/res/app/components/stf/device/device-service.js @@ -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 }) diff --git a/res/app/components/stf/screen/screen.jade b/res/app/components/stf/screen/screen.jade index 365eea2e..042dceed 100644 --- a/res/app/components/stf/screen/screen.jade +++ b/res/app/components/stf/screen/screen.jade @@ -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. diff --git a/res/app/components/stf/storage/storage-service.js b/res/app/components/stf/storage/storage-service.js index 3e25f525..26cce46c 100644 --- a/res/app/components/stf/storage/storage-service.js +++ b/res/app/components/stf/storage/storage-service.js @@ -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 }) diff --git a/res/app/views/index.jade b/res/app/views/index.jade index 0388efed..89559f8d 100644 --- a/res/app/views/index.jade +++ b/res/app/views/index.jade @@ -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') diff --git a/res/auth/ldap/scripts/controllers/SignInCtrl.js b/res/auth/ldap/scripts/controllers/SignInCtrl.js index 9218ca17..bc096850 100644 --- a/res/auth/ldap/scripts/controllers/SignInCtrl.js +++ b/res/auth/ldap/scripts/controllers/SignInCtrl.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) diff --git a/res/auth/mock/scripts/controllers/SignInCtrl.js b/res/auth/mock/scripts/controllers/SignInCtrl.js index fc969175..57c2eb3b 100644 --- a/res/auth/mock/scripts/controllers/SignInCtrl.js +++ b/res/auth/mock/scripts/controllers/SignInCtrl.js @@ -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)