Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!aScript) {
aNext();
return;
}
// HTTP/1.1 Caching
aRes.set('Cache-Control', 'public, max-age=' + maxAge +
', no-cache, no-transform, must-revalidate');
script = modelParser.parseScript(aScript);
meta = script.meta; // NOTE: Watchpoint
if (/\.json$/.test(aReq.params.scriptname)) {
// Create a based representation of the hex sha512sum
eTag = '"' + Base62.encode(parseInt('0x' + aScript.hash, 16)) + ' .meta.json"';
// If already client-side... HTTP/1.1 Caching
if (aReq.get('if-none-match') === eTag) {
aRes.status(304).send(); // Not Modified
return;
}
// Okay to send .meta.json...
aRes.set('Content-Type', 'application/json; charset=UTF-8');
// HTTP/1.0 Caching
aRes.set('Expires', moment(moment() + maxAge * 1000).utc()
.format('ddd, DD MMM YYYY HH:mm:ss') + ' GMT');
// HTTP/1.1 Caching
aRes.set('Etag', eTag);
function getOrCreateMessageId(message) {
if (message in messages) {
return messages[message].id;
}
const id = base62ascii.encode(nextMessageId++); // [0-9a-zA-Z]
messages[message] = {id, message};
return id;
}
exports.id2url = function(id){
return base62.encode(id.toString());
}