Browse Source

Fixes

master
Sven Slootweg 7 years ago
parent
commit
5f441d5cac
  1. 11
      app.coffee
  2. 11
      bin/www.coffee
  3. 3
      public/css/style.css
  4. 1
      public/css/style.scss
  5. 596
      public/js/bundle.js
  6. 3
      setup-root.sh

11
app.coffee

@ -142,11 +142,14 @@ runWrapper ->
app.use logger (config.accessLog.format ? "combined"), stream: accessLogStream
app.use (req, res, next) ->
if req.secure
res.set "Strict-Transport-Security", "max-age=63072000; includeSubDomains; preload"
next()
if config.ssl?.key?
if req.secure
res.set "Strict-Transport-Security", "max-age=63072000; includeSubDomains; preload"
next()
else
res.redirect "https://pdf.yt/"
else
res.redirect "https://pdf.yt/"
next()
# Using /static/ paths to maintain backwards compatibility.
app.use("/static/thumbs", express.static(path.join(__dirname, 'thumbnails')))

11
bin/www.coffee

@ -58,10 +58,11 @@ httpServer.listen(port)
httpServer.on('error', onError)
httpServer.on('listening', onListening)
credentials = {key: fs.readFileSync(config.ssl.key), cert: fs.readFileSync(config.ssl.cert), ciphers: "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"}
if config.ssl?.key?
credentials = {key: fs.readFileSync(config.ssl.key), cert: fs.readFileSync(config.ssl.cert), ciphers: "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA"}
httpsServer = https.createServer(credentials, app)
httpsServer = https.createServer(credentials, app)
httpsServer.listen(443)
httpsServer.on('error', onError)
httpsServer.on('listening', onListening)
httpsServer.listen(443)
httpsServer.on('error', onError)
httpsServer.on('listening', onListening)

3
public/css/style.css

@ -652,7 +652,8 @@ body {
margin-bottom: 32px;
border-radius: 4px; }
.notice a {
color: white; }
color: white;
text-decoration: underline; }
.notice p {
margin: 8px 0px; }

1
public/css/style.scss

@ -1172,6 +1172,7 @@ body
a
{
color: white;
text-decoration: underline;
}
p

596
public/js/bundle.js

@ -56,9 +56,9 @@
$ = __webpack_require__(6);
autosize = __webpack_require__(8);
autosize = __webpack_require__(7);
marked = __webpack_require__(7);
marked = __webpack_require__(8);
scrollFloat = __webpack_require__(5);
@ -9702,6 +9702,188 @@
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Autosize 3.0.0
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
global.autosize = mod.exports;
}
})(this, function (exports, module) {
'use strict';
function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || ta.hasAttribute('data-autosize-on')) {
return;
}var maxHeight;
var heightOffset;
function init() {
var style = window.getComputedStyle(ta, null);
if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
ta.style.resize = 'horizontal';
}
// Chrome/Safari-specific fix:
// When the textarea y-over is hidden, Chrome/Safari doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround will cause the text to reflow.
var width = ta.style.width;
ta.style.width = '0px';
// Force reflow:
/* jshint ignore:start */
ta.offsetWidth;
/* jshint ignore:end */
ta.style.width = width;
maxHeight = style.maxHeight !== 'none' ? parseFloat(style.maxHeight) : false;
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
update();
}
function update() {
var startHeight = ta.style.height;
var htmlTop = document.documentElement.scrollTop;
var bodyTop = document.body.scrollTop;
ta.style.height = 'auto';
var endHeight = ta.scrollHeight + heightOffset;
if (maxHeight !== false && maxHeight < endHeight) {
endHeight = maxHeight;
if (ta.style.overflowY !== 'scroll') {
ta.style.overflowY = 'scroll';
}
} else if (ta.style.overflowY !== 'hidden') {
ta.style.overflowY = 'hidden';
}
ta.style.height = endHeight + 'px';
// prevents scroll-position jumping
document.documentElement.scrollTop = htmlTop;
document.body.scrollTop = bodyTop;
if (startHeight !== ta.style.height) {
var evt = document.createEvent('Event');
evt.initEvent('autosize:resized', true, false);
ta.dispatchEvent(evt);
}
}
ta.addEventListener('autosize:destroy', (function (style) {
window.removeEventListener('resize', update);
ta.removeEventListener('input', update);
ta.removeEventListener('keyup', update);
ta.removeAttribute('data-autosize-on');
ta.removeEventListener('autosize:destroy');
Object.keys(style).forEach(function (key) {
ta.style[key] = style[key];
});
}).bind(ta, {
height: ta.style.height,
overflowY: ta.style.overflowY,
resize: ta.style.resize
}));
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ('onpropertychange' in ta && 'oninput' in ta) {
ta.addEventListener('keyup', update);
}
window.addEventListener('resize', update);
ta.addEventListener('input', update);
ta.addEventListener('autosize:update', update);
ta.setAttribute('data-autosize-on', true);
ta.style.overflowY = 'hidden';
init();
}
function destroy(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA') {
return;
}var evt = document.createEvent('Event');
evt.initEvent('autosize:destroy', true, false);
ta.dispatchEvent(evt);
}
function update(ta) {
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) {
return;
}var evt = document.createEvent('Event');
evt.initEvent('autosize:update', true, false);
ta.dispatchEvent(evt);
}
var autosize;
// Do nothing in IE8 or lower
if (typeof window.getComputedStyle !== 'function') {
autosize = function (el) {
return el;
};
autosize.destroy = function (el) {
return el;
};
autosize.update = function (el) {
return el;
};
} else {
autosize = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, assign);
} else if (el && el.nodeName) {
assign(el);
}
return el;
};
autosize.destroy = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, destroy);
} else if (el && el.nodeName) {
destroy(el);
}
return el;
};
autosize.update = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, update);
} else if (el && el.nodeName) {
update(el);
}
return el;
};
}
module.exports = autosize;
});
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/**
@ -10961,211 +11143,29 @@
marked.lexer = Lexer.lex;
marked.InlineLexer = InlineLexer;
marked.inlineLexer = InlineLexer.output;
marked.parse = marked;
if (true) {
module.exports = marked;
} else if (typeof define === 'function' && define.amd) {
define(function() { return marked; });
} else {
this.marked = marked;
}
}).call(function() {
return this || (typeof window !== 'undefined' ? window : global);
}());
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Autosize 3.0.0
license: MIT
http://www.jacklmoore.com/autosize
*/
(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module);
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod);
global.autosize = mod.exports;
}
})(this, function (exports, module) {
'use strict';
function assign(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || ta.hasAttribute('data-autosize-on')) {
return;
}var maxHeight;
var heightOffset;
function init() {
var style = window.getComputedStyle(ta, null);
if (style.resize === 'vertical') {
ta.style.resize = 'none';
} else if (style.resize === 'both') {
ta.style.resize = 'horizontal';
}
// Chrome/Safari-specific fix:
// When the textarea y-over is hidden, Chrome/Safari doesn't reflow the text to account for the space
// made available by removing the scrollbar. This workaround will cause the text to reflow.
var width = ta.style.width;
ta.style.width = '0px';
// Force reflow:
/* jshint ignore:start */
ta.offsetWidth;
/* jshint ignore:end */
ta.style.width = width;
maxHeight = style.maxHeight !== 'none' ? parseFloat(style.maxHeight) : false;
if (style.boxSizing === 'content-box') {
heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
} else {
heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
}
update();
}
function update() {
var startHeight = ta.style.height;
var htmlTop = document.documentElement.scrollTop;
var bodyTop = document.body.scrollTop;
ta.style.height = 'auto';
var endHeight = ta.scrollHeight + heightOffset;
if (maxHeight !== false && maxHeight < endHeight) {
endHeight = maxHeight;
if (ta.style.overflowY !== 'scroll') {
ta.style.overflowY = 'scroll';
}
} else if (ta.style.overflowY !== 'hidden') {
ta.style.overflowY = 'hidden';
}
ta.style.height = endHeight + 'px';
// prevents scroll-position jumping
document.documentElement.scrollTop = htmlTop;
document.body.scrollTop = bodyTop;
if (startHeight !== ta.style.height) {
var evt = document.createEvent('Event');
evt.initEvent('autosize:resized', true, false);
ta.dispatchEvent(evt);
}
}
ta.addEventListener('autosize:destroy', (function (style) {
window.removeEventListener('resize', update);
ta.removeEventListener('input', update);
ta.removeEventListener('keyup', update);
ta.removeAttribute('data-autosize-on');
ta.removeEventListener('autosize:destroy');
Object.keys(style).forEach(function (key) {
ta.style[key] = style[key];
});
}).bind(ta, {
height: ta.style.height,
overflowY: ta.style.overflowY,
resize: ta.style.resize
}));
// IE9 does not fire onpropertychange or oninput for deletions,
// so binding to onkeyup to catch most of those events.
// There is no way that I know of to detect something like 'cut' in IE9.
if ('onpropertychange' in ta && 'oninput' in ta) {
ta.addEventListener('keyup', update);
}
window.addEventListener('resize', update);
ta.addEventListener('input', update);
ta.addEventListener('autosize:update', update);
ta.setAttribute('data-autosize-on', true);
ta.style.overflowY = 'hidden';
init();
}
function destroy(ta) {
if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA') {
return;
}var evt = document.createEvent('Event');
evt.initEvent('autosize:destroy', true, false);
ta.dispatchEvent(evt);
}
marked.inlineLexer = InlineLexer.output;
function update(ta) {
if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) {
return;
}var evt = document.createEvent('Event');
evt.initEvent('autosize:update', true, false);
ta.dispatchEvent(evt);
}
marked.parse = marked;
var autosize;
if (true) {
module.exports = marked;
} else if (typeof define === 'function' && define.amd) {
define(function() { return marked; });
} else {
this.marked = marked;
}
// Do nothing in IE8 or lower
if (typeof window.getComputedStyle !== 'function') {
autosize = function (el) {
return el;
};
autosize.destroy = function (el) {
return el;
};
autosize.update = function (el) {
return el;
};
} else {
autosize = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, assign);
} else if (el && el.nodeName) {
assign(el);
}
return el;
};
autosize.destroy = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, destroy);
} else if (el && el.nodeName) {
destroy(el);
}
return el;
};
autosize.update = function (el) {
if (el && el.length) {
Array.prototype.forEach.call(el, update);
} else if (el && el.nodeName) {
update(el);
}
return el;
};
}
}).call(function() {
return this || (typeof window !== 'undefined' ? window : global);
}());
module.exports = autosize;
});
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
var prefixes = __webpack_require__(12);
var prefixes = __webpack_require__(13);
/**
* Pretty format a number with SI prefixes.
@ -11236,7 +11236,7 @@
// Node/CommonJS:
factory(
__webpack_require__(6),
__webpack_require__(14)
__webpack_require__(12)
);
} else {
// Browser globals:
@ -12748,105 +12748,6 @@
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(13);
/**
* SI Prefix Dictionary
*/
var prefixes = [
{pow10: Math.pow(10, -24), prefix: 'yocto', symbol: 'y'},
{pow10: Math.pow(10, -21), prefix: 'zepto', symbol: 'z'},
{pow10: Math.pow(10, -18), prefix: 'atto', symbol: 'a'},
{pow10: Math.pow(10, -15), prefix: 'femto', symbol: 'f'},
{pow10: Math.pow(10, -12), prefix: 'pico', symbol: 'p'},
{pow10: Math.pow(10, -9), prefix: 'nano', symbol: 'n'},
{pow10: Math.pow(10, -6), prefix: 'micro', symbol: 'μ'},
{pow10: Math.pow(10, -3), prefix: 'milli', symbol: 'm'},
{pow10: Math.pow(10, 0), prefix: '', symbol: ''},
{pow10: Math.pow(10, 3), prefix: 'kilo', symbol: 'k'},
{pow10: Math.pow(10, 6), prefix: 'mega', symbol: 'M'},
{pow10: Math.pow(10, 9), prefix: 'giga', symbol: 'G'},
{pow10: Math.pow(10, 12), prefix: 'tera', symbol: 'T'},
{pow10: Math.pow(10, 15), prefix: 'peta', symbol: 'P'},
{pow10: Math.pow(10, 18), prefix: 'exa', symbol: 'E'},
{pow10: Math.pow(10, 21), prefix: 'zetta', symbol: 'Z'},
{pow10: Math.pow(10, 24), prefix: 'yotta', symbol: 'Y'}
];
module.exports = prefixes;
/**
* Adjust the magnitude of a number to that indicated by the prefix at prefixIndex.
*/
function adjustNumber(number, prefixIndex) {
return util.round(number / prefixes[prefixIndex].pow10, 2);
}
module.exports.adjustNumber = adjustNumber;
/**
* Get the most "best match" prefix index for a given number/
*/
function getPrefixIndex(number) {
// use absolute value for comparisons
var abs = Math.abs(number);
// attempt to match extremities
if (abs <= prefixes[0].pow10) return 0;
else if (abs >= prefixes[prefixes.length - 1].pow10) return prefixes.length - 1;
// find best match
for (var i = getInitialPrefixIterPos(); i < prefixes.length; i++) {
if (abs < prefixes[i].pow10) return i - 1;
}
return 8;
}
module.exports.getPrefixIndex = getPrefixIndex;
/**
* A crude optimization so that we can get a good iterator start position.
*
* Assumes absNumb is an the absolute value of a number.
*/
function getInitialPrefixIterPos(absNum) {
return absNum >= prefixes[8].pow10 ? 8 : 0;
}
module.exports.getInitialPrefixIterPos = getInitialPrefixIterPos;
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
/**
* All credit here goes to Jérémie Astori!
*
* See http://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places-in-javascript
*/
function round(value, exp) {
if (typeof exp === 'undefined' || +exp === 0)
return Math.round(value);
value = +value;
exp = +exp;
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0))
return NaN;
// Shift
value = value.toString().split('e');
value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)));
// Shift back
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp));
}
module.exports.round = round;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! jQuery UI - v1.11.1+CommonJS - 2014-09-17
@ -13414,5 +13315,104 @@
}));
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(14);
/**
* SI Prefix Dictionary
*/
var prefixes = [
{pow10: Math.pow(10, -24), prefix: 'yocto', symbol: 'y'},
{pow10: Math.pow(10, -21), prefix: 'zepto', symbol: 'z'},
{pow10: Math.pow(10, -18), prefix: 'atto', symbol: 'a'},
{pow10: Math.pow(10, -15), prefix: 'femto', symbol: 'f'},
{pow10: Math.pow(10, -12), prefix: 'pico', symbol: 'p'},
{pow10: Math.pow(10, -9), prefix: 'nano', symbol: 'n'},
{pow10: Math.pow(10, -6), prefix: 'micro', symbol: 'μ'},
{pow10: Math.pow(10, -3), prefix: 'milli', symbol: 'm'},
{pow10: Math.pow(10, 0), prefix: '', symbol: ''},
{pow10: Math.pow(10, 3), prefix: 'kilo', symbol: 'k'},
{pow10: Math.pow(10, 6), prefix: 'mega', symbol: 'M'},
{pow10: Math.pow(10, 9), prefix: 'giga', symbol: 'G'},
{pow10: Math.pow(10, 12), prefix: 'tera', symbol: 'T'},
{pow10: Math.pow(10, 15), prefix: 'peta', symbol: 'P'},
{pow10: Math.pow(10, 18), prefix: 'exa', symbol: 'E'},
{pow10: Math.pow(10, 21), prefix: 'zetta', symbol: 'Z'},
{pow10: Math.pow(10, 24), prefix: 'yotta', symbol: 'Y'}
];
module.exports = prefixes;
/**
* Adjust the magnitude of a number to that indicated by the prefix at prefixIndex.
*/
function adjustNumber(number, prefixIndex) {
return util.round(number / prefixes[prefixIndex].pow10, 2);
}
module.exports.adjustNumber = adjustNumber;
/**
* Get the most "best match" prefix index for a given number/
*/
function getPrefixIndex(number) {
// use absolute value for comparisons
var abs = Math.abs(number);
// attempt to match extremities
if (abs <= prefixes[0].pow10) return 0;
else if (abs >= prefixes[prefixes.length - 1].pow10) return prefixes.length - 1;
// find best match
for (var i = getInitialPrefixIterPos(); i < prefixes.length; i++) {
if (abs < prefixes[i].pow10) return i - 1;
}
return 8;
}
module.exports.getPrefixIndex = getPrefixIndex;
/**
* A crude optimization so that we can get a good iterator start position.
*
* Assumes absNumb is an the absolute value of a number.
*/
function getInitialPrefixIterPos(absNum) {
return absNum >= prefixes[8].pow10 ? 8 : 0;
}
module.exports.getInitialPrefixIterPos = getInitialPrefixIterPos;
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
/**
* All credit here goes to Jérémie Astori!
*
* See http://stackoverflow.com/questions/11832914/round-to-at-most-2-decimal-places-in-javascript
*/
function round(value, exp) {
if (typeof exp === 'undefined' || +exp === 0)
return Math.round(value);
value = +value;
exp = +exp;
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0))
return NaN;
// Shift
value = value.toString().split('e');
value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)));
// Shift back
value = value.toString().split('e');
return +(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp));
}
module.exports.round = round;
/***/ }
/******/ ]);

3
setup-root.sh

@ -8,6 +8,9 @@ npm install -g coffee-script forever
touch /etc/authbind/byport/80
chown pdfy /etc/authbind/byport/80
chmod 755 /etc/authbind/byport/80
touch /etc/authbind/byport/443
chown pdfy /etc/authbind/byport/443
chmod 755 /etc/authbind/byport/443
chown -R pdfy:pdfy .

Loading…
Cancel
Save