aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2020-05-14 19:49:54 -0700
committerAdam Soltys <[email protected]>2020-05-14 19:49:54 -0700
commit8a5496b3cd2e898e204367b8ca7c6e8f4d7b6055 (patch)
treeb7434f5f69dc913ccdee278719adc78b1a9ccd5d /lib
parent25e8391aed541627e2aa2e3540c065f90b96c982 (diff)
downloadcoinos-server-8a5496b3cd2e898e204367b8ca7c6e8f4d7b6055.tar.gz
coinos-server-8a5496b3cd2e898e204367b8ca7c6e8f4d7b6055.zip
drop recaptcha
Diffstat (limited to 'lib')
-rw-r--r--lib/fixed.js22
-rw-r--r--lib/utils.js2
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/fixed.js b/lib/fixed.js
new file mode 100644
index 00000000..bd0710b9
--- /dev/null
+++ b/lib/fixed.js
@@ -0,0 +1,22 @@
+module.exports = function(n, p) {
+ if (!parseInt(p)) return parseInt(n).toFixed(0);
+ else {
+ let x = n / 10 ** p;
+ if (Math.abs(x) < 1.0) {
+ var e = parseInt(x.toString().split('e-')[1]);
+ if (e) {
+ x *= Math.pow(10, e - 1);
+ x = x.toFixed(9 - e);
+ x = '0.' + new Array(e).join('0') + x.toString().substring(2);
+ }
+ } else {
+ var e = parseInt(x.toString().split('+')[1]);
+ if (e > 20) {
+ e -= 20;
+ x /= Math.pow(10, e);
+ x += new Array(e + 1).join('0');
+ }
+ }
+ return x;
+ }
+}
diff --git a/lib/utils.js b/lib/utils.js
index 5674f2fc..a9f42c81 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -1,6 +1,8 @@
const sequelize = require("sequelize");
const { Op } = sequelize;
+fixed = require('./fixed');
+
getUser = async (username, transaction) => {
let params = {
include: [