diff --git a/src/routes/test/cloudron-test.js b/src/routes/test/cloudron-test.js index 8e9b825a3..41406b287 100644 --- a/src/routes/test/cloudron-test.js +++ b/src/routes/test/cloudron-test.js @@ -463,7 +463,7 @@ describe('Cloudron', function () { after(cleanup); it('fails without token', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', subject: 'some subject', description: 'some description' }) .end(function (error, result) { expect(result.statusCode).to.equal(401); @@ -472,7 +472,7 @@ describe('Cloudron', function () { }); it('fails without type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -482,7 +482,7 @@ describe('Cloudron', function () { }); it('fails with empty type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: '', subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -492,7 +492,7 @@ describe('Cloudron', function () { }); it('fails with unknown type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'foobar', subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -502,7 +502,7 @@ describe('Cloudron', function () { }); it('succeeds with ticket type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -512,7 +512,7 @@ describe('Cloudron', function () { }); it('succeeds with app type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'app_missing', subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -522,7 +522,7 @@ describe('Cloudron', function () { }); it('fails without description', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', subject: 'some subject' }) .query({ access_token: token }) .end(function (error, result) { @@ -532,7 +532,7 @@ describe('Cloudron', function () { }); it('fails with empty subject', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', subject: '', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -542,7 +542,7 @@ describe('Cloudron', function () { }); it('fails with empty description', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', subject: 'some subject', description: '' }) .query({ access_token: token }) .end(function (error, result) { @@ -552,7 +552,7 @@ describe('Cloudron', function () { }); it('succeeds with feedback type', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'feedback', subject: 'some subject', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { @@ -562,7 +562,7 @@ describe('Cloudron', function () { }); it('fails without subject', function (done) { - superagent.post(SERVER_URL + '/api/v1/cloudron/feedback') + superagent.post(SERVER_URL + '/api/v1/feedback') .send({ type: 'ticket', description: 'some description' }) .query({ access_token: token }) .end(function (error, result) { diff --git a/src/server.js b/src/server.js index e8e0d9edb..a546fef8e 100644 --- a/src/server.js +++ b/src/server.js @@ -120,9 +120,6 @@ function initializeExpressSync() { router.get ('/api/v1/cloudron/ssh/authorized_keys/:identifier', cloudronScope, routes.user.requireAdmin, routes.ssh.getAuthorizedKey); router.del ('/api/v1/cloudron/ssh/authorized_keys/:identifier', cloudronScope, routes.user.requireAdmin, routes.ssh.delAuthorizedKey); - // feedback - router.post('/api/v1/cloudron/feedback', usersScope, routes.cloudron.feedback); - // profile api, working off the user behind the provided token router.get ('/api/v1/profile', profileScope, routes.profile.get); router.post('/api/v1/profile', profileScope, routes.profile.update); @@ -216,6 +213,9 @@ function initializeExpressSync() { // eventlog route router.get('/api/v1/eventlog', settingsScope, routes.user.requireAdmin, routes.eventlog.get); + // feedback + router.post('/api/v1/feedback', usersScope, routes.cloudron.feedback); + // backup routes router.get ('/api/v1/backups', settingsScope, routes.user.requireAdmin, routes.backups.get); router.post('/api/v1/backups', settingsScope, routes.user.requireAdmin, routes.backups.create); diff --git a/webadmin/src/js/client.js b/webadmin/src/js/client.js index 8ce79ffd3..ca7475310 100644 --- a/webadmin/src/js/client.js +++ b/webadmin/src/js/client.js @@ -810,7 +810,7 @@ angular.module('Application').service('Client', ['$http', 'md5', 'Notification', description: description }; - post('/api/v1/cloudron/feedback', data).success(function (data, status) { + post('/api/v1/feedback', data).success(function (data, status) { if (status !== 201) return callback(new ClientError(status, data)); callback(null); }).error(defaultErrorHandler(callback));