From 9dfd14a35dc2c4287ddff7c4265094a11964c041 Mon Sep 17 00:00:00 2001 From: tycrek Date: Tue, 6 Apr 2021 15:07:56 -0600 Subject: [PATCH] fixed randomGen --- idgen/random.js | 4 ++-- utils.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/idgen/random.js b/idgen/random.js index 5a30c2e..e47b869 100644 --- a/idgen/random.js +++ b/idgen/random.js @@ -1,2 +1,2 @@ -//const { cryptoRandomString } = require('crypto-random-string'); -//module.exports = (length) => cryptoRandomString({ length, type: 'alphanumeric' }); +const cryptoRandomString = require('crypto-random-string'); +module.exports = (length) => cryptoRandomString({ length, type: 'alphanumeric' }); diff --git a/utils.js b/utils.js index 4fe2a3b..182038d 100755 --- a/utils.js +++ b/utils.js @@ -1,7 +1,7 @@ const fs = require('fs-extra'); const Path = require('path'); const zwsGen = require('./idgen/zws'); -//const randomGen = require('./idgen/random'); +const randomGen = require('./idgen/random'); const idModes = { zws: 'zws', // Zero-width spaces (see: https://zws.im/) @@ -16,6 +16,6 @@ module.exports = { verify: (req, tokens) => req.headers.authorization && tokens.includes(req.headers.authorization), generateId: (mode, lenth, originalName) => (mode == idModes.zws) ? zwsGen(lenth) - : (mode == idModes.r) ? zwsGen(lenth)//randomGen(lenth) + : (mode == idModes.r) ? randomGen(lenth) : originalName } \ No newline at end of file