Development #287

Merged
bones7242 merged 58 commits from development into master 2017-12-11 20:53:02 +01:00
3 changed files with 11 additions and 12 deletions
Showing only changes of commit 6fea63dcb3 - Show all commits

View file

@ -28,8 +28,8 @@ spee.ch is a single-serving site that reads and publishes images and videos to a
* example: `curl https://spee.ch/api/resolve/doitlive`
* /api/claim-list/:name
* example: `curl https://spee.ch/api/claim-list/doitlive`
* /api/isClaimAvailable/:name (returns `true`/`false` for whether a name is available through spee.ch)
* example: `curl https://spee.ch/api/isClaimAvailable/doitlive`
* /api/is-claim-available/:name (returns `true`/`false` for whether a name is available through spee.ch)
* example: `curl https://spee.ch/api/is-claim-available/doitlive`
#### POST
* /api/publish

View file

@ -119,13 +119,13 @@ const validationFunctions = {
checkClaimName: function (name) {
const successDisplayElement = document.getElementById('input-success-claim-name');
const errorDisplayElement = document.getElementById('input-error-claim-name');
this.checkAvailability(name, successDisplayElement, errorDisplayElement, this.validateClaimName, 'Sorry, that ending is already taken', '/api/isClaimAvailable/');
this.checkAvailability(name, successDisplayElement, errorDisplayElement, this.validateClaimName, 'Sorry, that ending is already taken', '/api/is-claim-available/');
},
checkChannelName: function (name) {
const successDisplayElement = document.getElementById('input-success-channel-name');
const errorDisplayElement = document.getElementById('input-error-channel-name');
name = `@${name}`;
this.checkAvailability(name, successDisplayElement, errorDisplayElement, this.validateChannelName, 'Sorry, that name is already taken', '/api/isChannelAvailable/');
this.checkAvailability(name, successDisplayElement, errorDisplayElement, this.validateChannelName, 'Sorry, that name is already taken', '/api/is-channel-available/');
},
// validation function which checks all aspects of the publish submission
validateFilePublishSubmission: function (stagedFiles, metadata) {
@ -162,7 +162,7 @@ const validationFunctions = {
return;
}
// if all validation passes, check availability of the name (note: do we need to re-validate channel name vs. credentials as well?)
return that.isNameAvailable(claimName, '/api/isClaimAvailable/')
return that.isNameAvailable(claimName, '/api/is-claim-available/')
.then(result => {
if (result) {
resolve();
@ -193,7 +193,7 @@ const validationFunctions = {
return reject(error);
}
// 3. if all validation passes, check availability of the name
that.isNameAvailable(channelName, '/api/isChannelAvailable/') // validate the availability
that.isNameAvailable(channelName, '/api/is-channel-available/') // validate the availability
.then(function(result) {
if (result) {
resolve();

View file

@ -84,7 +84,7 @@ module.exports = (app) => {
});
// route to check whether spee.ch has published to a claim
app.get('/api/isClaimAvailable/:name', ({ params }, res) => {
app.get('/api/is-claim-available/:name', ({ params }, res) => {
checkClaimNameAvailability(params.name)
.then(result => {
if (result === true) {
@ -99,7 +99,7 @@ module.exports = (app) => {
});
});
// route to check whether spee.ch has published to a channel
app.get('/api/isChannelAvailable/:name', ({ params }, res) => {
app.get('/api/is-channel-available/:name', ({ params }, res) => {
checkChannelAvailability(params.name)
.then(result => {
if (result === true) {
@ -110,7 +110,7 @@ module.exports = (app) => {
}
})
.catch(error => {
logger.debug('api/isChannelAvailable/ error', error);
logger.debug('api/is-channel-available/ error', error);
res.status(500).json(error);
});
});
@ -213,9 +213,8 @@ module.exports = (app) => {
errorHandlers.handleApiError('publish', originalUrl, ip, error, res);
});
});
// route to get a short claim id from long claim Id
app.get('/api/shortClaimId/:longId/:name', ({ params }, res) => {
app.get('/api/short-claim-id/:longId/:name', ({ params }, res) => {
db.Claim.getShortClaimIdFromLongClaimId(params.longId, params.name)
.then(shortId => {
res.status(200).json(shortId);
@ -226,7 +225,7 @@ module.exports = (app) => {
});
});
// route to get a short channel id from long channel Id
app.get('/api/shortChannelId/:longId/:name', ({ ip, originalUrl, params }, res) => {
app.get('/api/short-channel-id/:longId/:name', ({ ip, originalUrl, params }, res) => {
db.Certificate.getShortChannelIdFromLongChannelId(params.longId, params.name)
.then(shortId => {
logger.debug('sending back short channel id', shortId);