Compare commits

..

1 Commits

Author SHA1 Message Date
Avril 3e31b30338
server/amusement.js: Pseudo-code on how `#<` **might** be able to work.. Eh. I can"t be bothered with this anymore right now.
3 years ago

@ -316,7 +316,7 @@ function toggle_expansion(img, event) {
if (event.metaKey) if (event.metaKey)
return; return;
event.preventDefault(); event.preventDefault();
var expand = !img.data('thumbSrc'); var expand = !img.data('thumbSrc');
img.closest('article').toggleClass('expanded', expand); img.closest('article').toggleClass('expanded', expand);
var $imgs = img; var $imgs = img;
if (THREAD && (event.altKey || event.shiftKey)) { if (THREAD && (event.altKey || event.shiftKey)) {
@ -332,7 +332,7 @@ function toggle_expansion(img, event) {
with_dom(function () { with_dom(function () {
$imgs.each(function () { $imgs.each(function () {
var $img = $(this); var $img = $(this);
if (expand) if (expand)
expand_image($img); expand_image($img);
else { else {
contract_image($img, event); contract_image($img, event);
@ -344,30 +344,24 @@ function toggle_expansion(img, event) {
function contract_image($img, event) { function contract_image($img, event) {
var thumb = $img.data('thumbSrc'); var thumb = $img.data('thumbSrc');
var audio = $($img).parent().siblings("audio"); if (!thumb)
if (audio.length > 0) { return;
$img.data("thumbSrc", null); // try to keep the thumbnail in-window for large images
audio.remove(); var h = $img.height();
} var th = parseInt($img.data('thumbHeight'), 10);
else { if (event) {
if (!thumb) var y = $img.offset().top, t = $(window).scrollTop();
return; if (y < t && th < h)
// try to keep the thumbnail in-window for large images window.scrollBy(0, Math.max(th - h,
var h = $img.height(); y - t - event.clientY + th/2));
var th = parseInt($img.data('thumbHeight'), 10);
if (event) {
var y = $img.offset().top, t = $(window).scrollTop();
if (y < t && th < h)
window.scrollBy(0, Math.max(th - h,
y - t - event.clientY + th/2));
}
if (fullWidthExpansion)
contract_full_width(parent_post($img));
$img.replaceWith($('<img>')
.width($img.data('thumbWidth')).height(th)
.attr('src', thumb));
} }
if (fullWidthExpansion)
contract_full_width(parent_post($img));
$img.replaceWith($('<img>')
.width($img.data('thumbWidth')).height(th)
.attr('src', thumb));
} }
function expand_image($img) { function expand_image($img) {
if ($img.data('thumbSrc')) if ($img.data('thumbSrc'))
return; return;
@ -378,49 +372,36 @@ function expand_image($img) {
var cap = a.siblings('figcaption').text(); var cap = a.siblings('figcaption').text();
var dims = cap.match(/(\d+)x(\d+)/); var dims = cap.match(/(\d+)x(\d+)/);
var video = /^Video/.test(cap); var video = /^Video/.test(cap);
var audio = /^Audio/.test(cap); if (!dims)
if (dims) { return;
var tw = $img.width(), th = $img.height(); var tw = $img.width(), th = $img.height();
var w = parseInt(dims[1], 10), h = parseInt(dims[2], 10); var w = parseInt(dims[1], 10), h = parseInt(dims[2], 10);
// if this is a high-density screen, reduce image size appropriately // if this is a high-density screen, reduce image size appropriately
var r = window.devicePixelRatio; var r = window.devicePixelRatio;
if (!options.get('nohighres') && !video && r && r > 1) { if (!options.get('nohighres') && !video && r && r > 1) {
var min = 1000; var min = 1000;
if ((w > min || h > min) && w/r > tw && h/r > th) { if ((w > min || h > min) && w/r > tw && h/r > th) {
w /= r; w /= r;
h /= r; h /= r;
}
}
$img.remove();
$img = $(video ? '<video>' : '<img>', {
src: href,
width: w, height: h,
data: {
thumbWidth: tw, thumbHeight: th,
thumbSrc: $img.attr('src'),
},
prop: video ? {autoplay: true, loop: true} : {},
}).appendTo(a);
var fit = options.get('inlinefit');
if (fit != 'none') {
var both = fit == 'both';
fit_to_window($img, w, h, both || fit == 'width',
both || fit == 'height');
} }
} else if (audio) { }
//$fig = this.$el.children('figure');
$aud = $('<audio/>', { $img.remove();
src: href, $img = $(video ? '<video>' : '<img>', {
width: 300, src: href,
height: '3em', width: w, height: h,
autoplay: true, data: {
loop: false, thumbWidth: tw, thumbHeight: th,
controls: true thumbSrc: $img.attr('src'),
}).insertAfter(a); },
$img.data("thumbSrc", $aud); prop: video ? {autoplay: true, loop: true} : {},
//if (vol) }).appendTo(a);
// $fig.find('audio')['0'].volume = vol;
//this.model.set('imageExpanded', true); var fit = options.get('inlinefit');
if (fit != 'none') {
var both = fit == 'both';
fit_to_window($img, w, h, both || fit == 'width',
both || fit == 'height');
} }
} }

@ -407,9 +407,13 @@ OS.karada = function (body) {
return output; return output;
} }
var dice_re = /(#tea|#dame|#tutturu|#muri|#flip|#when|#du|#fun|#fcount|#test|#sleep|#janken|#8ball|#imfey|#\?(?:\[(?:\w,*)+\])?|#\d{0,2}d\d{1,4}(?:[+-]\d{1,4})?)/i; var dice_re = /(#tea|#dame|#tutturu|#muri|#flip|#when|#du|#fun|#fcount|#test|#sleep|#janken|#8ball|#imfey|#<(.*)|#\?(?:\[(?:\w,*)+\])?|#\d{0,2}d\d{1,4}(?:[+-]\d{1,4})?)/i;
exports.dice_re = dice_re; exports.dice_re = dice_re;
//TODO: XXX: Does this need to be exposed to the client? I don't think it does.
const ARBITRARY = config.ARBITRARY || {};
exports.lookup_arbitrary = ARBITRARY;
var WHEN = [ var WHEN = [
'Now', null, null, null, null, 'Now', null, null, null, null,
'Later', null, null, null, null, 'Later', null, null, null, null,
@ -476,18 +480,7 @@ function parse_dice(frag)
{ {
return {n:1, faces:2}; return {n:1, faces:2};
} }
if (/^#\?/.test(frag)) if (frag == '#fun' || frag == '#fcount' || frag == '#du')
{
var l = frag.slice(2).split(/(\[|\]|,)/);
var j =0;
for(var i=0;i<l.length;i++)
{
if(/(\[|\]|,)/.test(l[i])) continue;
if(l[i].length>0) j+=1;
}
return {n:1, faces: j};
}
if (frag == '#fun' || frag == '#fcount' || frag == '#du')
return {n: 1, faces: 2}; return {n: 1, faces: 2};
if (frag == '#tea') if (frag == '#tea')
return {n: 1, faces: 2}; return {n: 1, faces: 2};
@ -505,6 +498,23 @@ function parse_dice(frag)
return {n: 1, faces: 2}; return {n: 1, faces: 2};
if (frag == '#janken') if (frag == '#janken')
return {n: 1, faces: 3}; return {n: 1, faces: 3};
if (/^#\?/.test(frag))
{
var l = frag.slice(2).split(/(\[|\]|,)/);
var j =0;
for(var i=0;i<l.length;i++)
{
if(/(\[|\]|,)/.test(l[i])) continue;
if(l[i].length>0) j+=1;
}
return {n:1, faces: j};
}
if (/^#</.test(frag)) {
const rest = frag.slice(2);
if (rest.length)
return {n: 1, faces: 3};
else return {n: 0, faces: 3};
}
var m = frag.match(/^#(\d*)d(\d+)([+-]\d+)?$/i); var m = frag.match(/^#(\d*)d(\d+)([+-]\d+)?$/i);
if (!m) if (!m)
return false; return false;
@ -797,34 +807,26 @@ OS.gazou = function (info, toppu) {
} }
else { else {
src = encodeURI(this.image_paths().src + info.src); src = encodeURI(this.image_paths().src + info.src);
caption = [ video = info.video || (/\.webm$/i.test(src) && 'webm'); // webm check is legacy
(/\.(mp3|ogg|wav|flac)/.test(info.src)?'Audio': caption = [video ? 'Video ' : 'Image ', new_tab_link(src, info.src)];
(this.sauceToggle?image_sauce_id(info.mid):
(/\.(webm|mp4)/.test(info.src)?'Video':'Image'))), ' ',
new_tab_link(src, (this.thumbStyle == 'hide') ? '[Show]' : info.src, 'imageSrc')
];
} }
var img = this.gazou_img(info, toppu); var img = this.gazou_img(info, toppu);
var dims = info.dims[0] + 'x' + info.dims[1]; var dims = info.dims[0] + 'x' + info.dims[1];
return [safe('<figure data-img="'), return [safe('<figure data-MD5="'), info.MD5,
safe(info.spoiler ? '" data-spoiler="' : ''), info.spoiler || '', safe('" data-size="'), info.size,
safe('"><figcaption>'), video ? [safe('" data-video="'), video] : '',
caption, safe(' <i>('), safe('"><figcaption>'),
(this.spoilToggle && info.spoiler ? 'Spoiler, ' : ''), caption, safe(' <i>('),
info.audio ? (audioIndicator + ', ') : '', info.audio ? (audioIndicator + ', ') : '',
(info.songTitle || info.artist) ? info.duration ? (info.duration + ', ') : '',
[safe('<abbr style="font-weight: bold;" title="'), songTitleText, readable_filesize(info.size), ', ',
safe('">'), soundInformation, safe('</abbr>'), ', '] : '', dims, (info.apng ? ', APNG' : ''),
info.duration ? (info.duration + ', ') : '', this.full ? [', ', chibi(info.imgnm, img.src)] : '',
readable_filesize(info.size), safe(')</i></figcaption>'),
/\.(mp3|ogg|wav|flac)/.test(info.src) ? '' : [', ', dims], this.thumbStyle == 'hide' ? '' : img.html,
(info.apng ? ', APNG' : ''), safe('</figure>\n\t')];
this.full ? [', ', chibi(info.imgnm, img.src)] : '',
safe(')</i></figcaption>'),
this.thumbStyle == 'hide' ? '' : img.html,
safe('</figure>\n\t')];
}; };
exports.thumbStyles = ['small', 'sharp', 'large', 'hide']; exports.thumbStyles = ['small', 'sharp', 'large', 'hide'];

@ -36,7 +36,6 @@ module.exports = {
VIDEO_EXTS: ['.webm', '.mp4'], VIDEO_EXTS: ['.webm', '.mp4'],
// allow audio streams // allow audio streams
AUDIO: false, AUDIO: false,
AUDIO_EXTS: ['.mp3', '.flac', '.ogg', '.wav'],
// uncomment this to have all audio uploads overlaid with // uncomment this to have all audio uploads overlaid with
// the corresponding spoiler image // the corresponding spoiler image
/* /*

@ -177,18 +177,15 @@ IU.process = function () {
if (image.ext == '.mov') if (image.ext == '.mov')
image.ext = '.mp4'; image.ext = '.mp4';
if (IMAGE_EXTS.indexOf(image.ext) < 0 if (IMAGE_EXTS.indexOf(image.ext) < 0
&& (!config.VIDEO || config.VIDEO_EXTS.indexOf(image.ext) < 0) && (!config.VIDEO || config.VIDEO_EXTS.indexOf(image.ext) < 0))
&& (!config.VIDEO || config.AUDIO_EXTS.indexOf(image.ext) < 0))
return this.failure(Muggle('Invalid image format.')); return this.failure(Muggle('Invalid image format.'));
image.imgnm = filename.substr(0, 256); image.imgnm = filename.substr(0, 256);
this.status('Verifying...'); this.status('Verifying...');
if (config.VIDEO_EXTS.indexOf(image.ext) >= 0) if (config.VIDEO_EXTS.indexOf(image.ext) >= 0)
video_still(image.path, image.ext, this.verify_video.bind(this)); video_still(image.path, image.ext, this.verify_video.bind(this));
else if (config.AUDIO_EXTS.indexOf(image.ext) >= 0)
audio_still(image.path, this.verify_audio.bind(this));
else if (image.ext == '.jpg' && jpegtranBin && jheadBin) else if (image.ext == '.jpg' && jpegtranBin && jheadBin)
jobs.schedule(new AutoRotateJob(image.path), this.verify_image.bind(this)); jobs.schedule(new AutoRotateJob(image.path), this.verify_image.bind(this));
else else
this.verify_image(); this.verify_image();
}; };
@ -213,166 +210,6 @@ AutoRotateJob.prototype.perform_job = function () {
}); });
}; };
function AudioStillJob(src) {
jobs.Job.call(this);
this.src = src;
}
util.inherits(AudioStillJob, jobs.Job);
AudioStillJob.prototype.describe_job = function () {
return "FFmpeg audio still of " + this.src;
};
AudioStillJob.prototype.perform_job = function () {
var self = this;
self.get_info();
}
AudioStillJob.prototype.get_info = function () {
var self = this;
var audioData = {};
child_process.execFile(ffprobeBin, [this.src],
function(err, stdout, stderr){
var type = stderr.match(/Input #0, (.*),/);
if (type)
audioData.type = type[1];
var title = stderr.match(/title\s+: (.*)/i);
if (title)
audioData.title = title[1];
var artist = stderr.match(/artist\s+: (.*)/i);
if (artist)
audioData.artist = artist[1];
var l = stderr.match(/Duration: (\d{2}):(\d{2}):(\d{2})\.(\d{2})/);
if (l){
var h = (l[1] != '00' ? l[1] + 'h' : '');
var m = (l[2] != '00' ? l[2] + 'm' : '');
var s = (l[3] != '00' ? l[3] + 's' : '');
audioData.total = parseFloat(parseFloat(l[1])*3600 +
parseFloat(l[2])*60 + parseFloat(l[3]) + '.' + parseFloat(l[4]));
audioData.length = h + m + s;
}
self.short_test(audioData);
});
}
AudioStillJob.prototype.short_test = function (audioData) {
var self = this;
var dest = index.media_path('tmp', 'still_'+etc.random_id());
if (audioData.total <= 10) {
if (!config.AUDIOFILE_IMAGE) {
var msg = "Failure serverside.";
var prob = "Missing AUDIOFILE_IMAGE.";
winston.warn(prob);
fs.unlink(dest, function (err) {
self.finish_job(Muggle(msg, prob));
});
return;
}
fs.readFile(config.AUDIOFILE_IMAGE, function (errRead, img) {
if (errRead) {
var msg = "Failure serverside.";
var prob = "Error reading AUDIOFILE_IMAGE";
winston.warn(prob);
fs.unlink(dest, function (err) {
self.finish_job(Muggle(msg, prob));
});
return;
}
fs.writeFile(dest, img, function (errWrite) {
if (errWrite) {
var msg = "Failure serverside.";
var prob = "Error copying AUDIOFILE_IMAGE";
winston.warn(prob);
fs.unlink(dest, function (err) {
self.finish_job(Muggle(msg, prob));
});
return;
}
self.finish_job(null, {
still_path: dest,
duration: audioData.length,
audiotype: audioData.type,
title: audioData.title,
artist: audioData.artist,
});
});
});
} else {
self.encode_thumb(audioData, dest);
}
}
AudioStillJob.prototype.encode_thumb = function (audioData, dest) {
var self = this;
var args = ['-hide_banner', '-loglevel', 'info',
'-f', 'lavfi', '-ss', (Math.floor(audioData.total/2) <= 10 ?
Math.floor(audioData.total - audioData.total/10) : Math.floor(audioData.total/2)),
'-i', 'amovie=' + this.src + ', asplit [a][out1];[a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]',
'-f', 'image2', '-vframes', '1', '-vcodec', 'png',
'-y', dest];
var opts = {env: {AV_LOG_FORCE_NOCOLOR: '1'}};
child_process.execFile(ffmpegBin, args, opts,
function (err, stdout, stderr) {
var lines = stderr ? stderr.split('\n') : [];
var first = lines[0];
if (err) {
var msg;
if (/no such file or directory/i.test(first))
msg = "Audio went missing.";
else if (/invalid data found when/i.test(first))
msg = "Invalid audio file.";
else if (/^ffmpeg version/i.test(first))
msg = "Server's ffmpeg is too old.";
else {
msg = "Unknown audio reading error.";
winston.warn("Unknown ffmpeg output: "+first);
}
fs.unlink(dest, function (err) {
self.finish_job(Muggle(msg, stderr));
});
return;
}
self.finish_job(null, {
still_path: dest,
duration: audioData.length,
audiotype: audioData.type,
title: audioData.title,
artist: audioData.artist,
});
});
};
function audio_still(src, cb) {
jobs.schedule(new AudioStillJob(src), cb);
}
IU.verify_audio = function (err, info) {
if (err)
return this.failure(err);
var self = this;
this.db.track_temporary(info.still_path, function (err) {
if (err)
winston.warn("Tracking error: " + err);
// pretend it's a PNG for the next steps
var image = self.image;
image.video_path = image.path;
image.path = info.still_path;
image.ext = '.png';
if (info.duration)
image.duration = info.duration;
if (info.audiotype)
image.audiofile = info.audiotype;
if (info.title)
image.title = info.title;
if (info.artist)
image.artist = info.artist;
self.verify_image();
});
};
function StillJob(src, ext) { function StillJob(src, ext) {
jobs.Job.call(this); jobs.Job.call(this);
this.src = src; this.src = src;
@ -468,10 +305,6 @@ function video_still(src, ext, cb) {
jobs.schedule(new StillJob(src, ext), cb); jobs.schedule(new StillJob(src, ext), cb);
} }
function audio_thumb(src, ext, cb) {
jobs.schedule(new AudioJob(src, ext), cb);
}
IU.verify_video = function (err, info) { IU.verify_video = function (err, info) {
if (err) if (err)
return this.failure(err); return this.failure(err);
@ -641,8 +474,8 @@ IU.got_nails = function () {
var image = this.image; var image = this.image;
if (image.video_path) { if (image.video_path) {
// stop pretending this is just a still image // stop pretending this is just a still image
image.path = image.video_path; image.path = image.video_path;
image.ext = image.audiofile ? '.'+image.audiofile : '.'+image.video; image.ext = '.' + image.video;
delete image.video_path; delete image.video_path;
} }
@ -699,10 +532,9 @@ var identifyBin, convertBin;
which('identify', function (err, bin) { if (err) throw err; identifyBin = bin; }); which('identify', function (err, bin) { if (err) throw err; identifyBin = bin; });
which('convert', function (err, bin) { if (err) throw err; convertBin = bin; }); which('convert', function (err, bin) { if (err) throw err; convertBin = bin; });
var ffmpegBin, ffprobeBin; var ffmpegBin;
if (config.VIDEO) { if (config.VIDEO) {
which('ffmpeg', function (err, bin) { if (err) throw err; ffmpegBin = bin; }); which('ffmpeg', function (err, bin) { if (err) throw err; ffmpegBin = bin; });
which('ffprobe', function (err, bin) { if (err) throw err; ffprobeBin = bin; });
} }
/* optional JPEG auto-rotation */ /* optional JPEG auto-rotation */

@ -12,7 +12,7 @@ exports.Onegai = db.Onegai;
exports.config = config; exports.config = config;
var image_attrs = ('src thumb dims size MD5 hash imgnm spoiler realthumb vint' var image_attrs = ('src thumb dims size MD5 hash imgnm spoiler realthumb vint'
+ ' apng mid audio video duration audiofile').split(' '); + ' apng mid audio video duration').split(' ');
exports.image_attrs = image_attrs; exports.image_attrs = image_attrs;
exports.send_dead_image = function (kind, filename, resp) { exports.send_dead_image = function (kind, filename, resp) {

@ -22,8 +22,9 @@
"chart.js": "^2.7.2", "chart.js": "^2.7.2",
"diskspace": "^2.0.0", "diskspace": "^2.0.0",
"formidable": "1.0.17", "formidable": "1.0.17",
"hashloli": "git+ssh://git@git.flanchan.moe:flanchan/hashloli.git", "hashloli": "git+ssh://public@flanchan.moe:hashloli.git",
"jsoncompress": "^0.1.3", "jsoncompress": "^0.1.3",
"kana-hash": "file:../../home/avril/software/libkhash/node",
"minimist": "1.2.0", "minimist": "1.2.0",
"nan": "^2.14.0", "nan": "^2.14.0",
"recaptcha2": "^1.3.2", "recaptcha2": "^1.3.2",

@ -119,6 +119,39 @@ exports.roll_dice = function (frag, post, extra) {
else if(ms[i] == '#fcount') { else if(ms[i] == '#fcount') {
dice.push([pyu]); dice.push([pyu]);
} }
else if(ms[i].startsWith('#<'))
{
//TODO: Stupid hack on how to make this work with `async () =>` results... (pseudo-code, maybe come back to this when I can be bothered to write the needed utils, figure out how node capture groups works, and all the other bs needed...)
/* XXX: [[psuedo-code]]
const frag = ms[i].slice(2);
const lookup_result = match_regexes_in_object_keys(config.ARBITRARY, frag); // { lookup: <value>, key: <regex>, matches: <regex match groups> };
const lookup = lookup_result.lookup;
// XXX: Sets the extra.new_dice, and appends post.dice one value: `result`.
const set_dice = (result) => {
const dice = result ? [result] : [];
extra.new_dice = dice;
dice = post.dice ? post.dice.concat(dice) : dice;
post.dice = dice;
return dice;
};
if(!lookup) ;// XXX: no match
else if(is_function(lookup))
{ let string = lookup(frag, lookup_result.matches || {}, lookup_result.key);
dice.push([string]); }
else if(is_string(lookup)) dice.push([string]);
else if(is_promise(lookup) {
// We need to insert this via `attachToPost`. So we'll set `extra.new_dice` to be sure it's hit.
//set_dice("..."); //XXX: TODO: Won't this just mean the next result is *appeneded*, and treated as a result for the next command? So, we won't set an intermidiate, we'll just wait on `lookup().then(...)`
// When async lambda completes, we'll set `extra.new_dice()` and append `post.dice()` again.
lookup(frag, lookup_result.matches || {}, lookup_result.key).then(set_dice).catch((err) => {
set_dice("Error: " + (err || "(unbound)"));
});
return; // XXX: Important to return here so we don't hit the below `if(dice.length)`
} else ; //XXX no match
*/
}
else { else {
var info = common.parse_dice(ms[i]); var info = common.parse_dice(ms[i]);
if (!info) if (!info)
@ -142,6 +175,7 @@ exports.roll_dice = function (frag, post, extra) {
if (dice.length + exist > rollLimit) if (dice.length + exist > rollLimit)
dice = dice.slice(0, Math.max(0, rollLimit - exist)); dice = dice.slice(0, Math.max(0, rollLimit - exist));
if (dice.length) { if (dice.length) {
// TODO: for `#<` to work: The key to hitting `attachToPost` at all is in `extra.new_dice` vs `post.dice`
extra.new_dice = dice; extra.new_dice = dice;
dice = post.dice ? post.dice.concat(dice) : dice; dice = post.dice ? post.dice.concat(dice) : dice;
post.dice = dice; post.dice = dice;

@ -2,7 +2,7 @@ var opts = require('./opts');
if (require.main == module) opts.parse_args(); if (require.main == module) opts.parse_args();
opts.load_defaults(); opts.load_defaults();
//const khash = require("kana-hash"); const khash = require("kana-hash");
var _ = require('../lib/underscore'), var _ = require('../lib/underscore'),
amusement = require('./amusement'), amusement = require('./amusement'),
@ -23,7 +23,7 @@ var _ = require('../lib/underscore'),
render = require('./render'), render = require('./render'),
request = require('request'), request = require('request'),
STATE = require('./state'), STATE = require('./state'),
//tripcode = require('../tripcode').make(),//{hash:function(a,b){return new khash.Kana(0, this.salt).once(a);}, setSalt:function(a){if(a) this.salt = new khash.Salt(a); else this.salt = khash.Salt.Default; return this.salt;}}, //require('./../tripcode/tripcode'), tripcode = require('../tripcode').make(),//{hash:function(a,b){return new khash.Kana(0, this.salt).once(a);}, setSalt:function(a){if(a) this.salt = new khash.Salt(a); else this.salt = khash.Salt.Default; return this.salt;}}, //require('./../tripcode/tripcode'),
urlParse = require('url').parse, urlParse = require('url').parse,
web = require('./web'), web = require('./web'),
winston = require('winston'); winston = require('winston');
@ -845,12 +845,12 @@ function allocate_post(msg, client, callback) {
post.name = parsed[0]; post.name = parsed[0];
var spec = STATE.hot.SPECIAL_TRIPCODES; var spec = STATE.hot.SPECIAL_TRIPCODES;
if (spec && parsed[1] && parsed[1] in spec) { if (spec && parsed[1] && parsed[1] in spec) {
post.trip = spec[parsed[1]]; post.trip = spec[parsed[1]];
} }
else if (parsed[1] || parsed[2]) { else if (parsed[1] || parsed[2]) {
var trip = "Can this just be a string?"; //tripcode.hash(parsed[1], parsed[2]); var trip = tripcode.hash(parsed[1], parsed[2]);
if (trip) if (trip)
post.trip = trip; post.trip = trip;
} }
} }
if (msg.email) { if (msg.email) {
@ -1245,8 +1245,8 @@ function non_daemon_pid_setup() {
if (require.main == module) { if (require.main == module) {
if (!process.getuid()) if (!process.getuid())
throw new Error("Refusing to run as root."); throw new Error("Refusing to run as root.");
// if (!tripcode.setSalt(config.SECURE_SALT)) if (!tripcode.setSalt(config.SECURE_SALT))
// throw "Bad SECURE_SALT"; throw "Bad SECURE_SALT";
async.series([ async.series([
imager.make_media_dirs, imager.make_media_dirs,
setup_imager_relay, setup_imager_relay,

Loading…
Cancel
Save