moved constants back to individual modules
This commit is contained in:
parent
7a81d53c35
commit
f0435be0b2
3 changed files with 11 additions and 11 deletions
|
@ -3,7 +3,10 @@ const db = require('../models');
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const { resolveAgainstClaimTable, serveFile, showFile, showFileLite, getShortClaimIdFromLongClaimId, getClaimIdByLongChannelId, getAllChannelClaims, getLongChannelId, getShortChannelIdFromLongChannelId, getLongClaimId } = require('../helpers/serveHelpers.js');
|
const { resolveAgainstClaimTable, serveFile, showFile, showFileLite, getShortClaimIdFromLongClaimId, getClaimIdByLongChannelId, getAllChannelClaims, getLongChannelId, getShortChannelIdFromLongChannelId, getLongClaimId } = require('../helpers/serveHelpers.js');
|
||||||
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
|
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
|
||||||
const { SERVE, SHOW, SHOWLITE } = require('../helpers/constants.js');
|
|
||||||
|
const SERVE = 'SERVE';
|
||||||
|
const SHOW = 'SHOW';
|
||||||
|
const SHOWLITE = 'SHOWLITE';
|
||||||
|
|
||||||
function checkForLocalAssetByClaimId (claimId, name) {
|
function checkForLocalAssetByClaimId (claimId, name) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
SERVE : 'SERVE',
|
|
||||||
SHOW : 'SHOW',
|
|
||||||
SHOWLITE : 'SHOWLITE',
|
|
||||||
CHANNEL : 'CHANNEL',
|
|
||||||
CLAIM : 'CLAIM',
|
|
||||||
CHANNELID_INDICATOR: ':',
|
|
||||||
};
|
|
|
@ -1,7 +1,13 @@
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const { getAssetByClaim, getChannelContents, getAssetByChannel, serveOrShowAsset } = require('../controllers/serveController.js');
|
const { getAssetByClaim, getChannelContents, getAssetByChannel, serveOrShowAsset } = require('../controllers/serveController.js');
|
||||||
const { handleRequestError } = require('../helpers/errorHandlers.js');
|
const { handleRequestError } = require('../helpers/errorHandlers.js');
|
||||||
const { SERVE, SHOW, SHOWLITE, CHANNEL, CLAIM, CHANNELID_INDICATOR } = require('../helpers/constants.js');
|
|
||||||
|
const SERVE = 'SERVE';
|
||||||
|
const SHOW = 'SHOW';
|
||||||
|
const SHOWLITE = 'SHOWLITE';
|
||||||
|
const CHANNEL = 'CHANNEL';
|
||||||
|
const CLAIM = 'CLAIM';
|
||||||
|
const CHANNELID_INDICATOR = ':';
|
||||||
|
|
||||||
function isValidClaimId (claimId) {
|
function isValidClaimId (claimId) {
|
||||||
return ((claimId.length === 40) && !/[^A-Za-z0-9]/g.test(claimId));
|
return ((claimId.length === 40) && !/[^A-Za-z0-9]/g.test(claimId));
|
||||||
|
@ -84,7 +90,6 @@ module.exports = (app) => {
|
||||||
getAsset(claimType, channelName, channelId, name, claimId)
|
getAsset(claimType, channelName, channelId, name, claimId)
|
||||||
// 2. serve or show
|
// 2. serve or show
|
||||||
.then(fileInfo => {
|
.then(fileInfo => {
|
||||||
logger.debug('fileInfo', fileInfo);
|
|
||||||
if (!fileInfo) {
|
if (!fileInfo) {
|
||||||
res.status(200).render('noClaims');
|
res.status(200).render('noClaims');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue