Update 'index.js'
This commit is contained in:
parent
e9b5dca6ec
commit
0ccf0d4b0f
1 changed files with 7 additions and 2 deletions
9
index.js
9
index.js
|
@ -3,6 +3,11 @@ const fs = require('fs');
|
|||
const path = require('path')
|
||||
var LdapAuth = require('ldapauth-fork');
|
||||
|
||||
var prankPath = "prankdata.txt";
|
||||
if (!fs.existsSync(prankPath)) {
|
||||
fs.writeFileSync(prankPath, "{}");
|
||||
}
|
||||
|
||||
let PrankData = JSON.parse(fs.readFileSync("prankdata.txt"));
|
||||
let AdminUsersUid = ["asyncnomi", "johan", "enthalpine", "fas", "arina", "billy", "remi", "pierre", "", "", "", ""];
|
||||
let UsersToken = {};
|
||||
|
@ -241,7 +246,7 @@ fastify.post('/getPrank', async (request, reply) => {
|
|||
|
||||
|
||||
function saveData() {
|
||||
fs.writeFileSync('prankdata.txt', JSON.stringify(PrankData));
|
||||
fs.writeFileSync(prankPath, JSON.stringify(PrankData));
|
||||
}
|
||||
|
||||
function authenticate(user, pwd) {
|
||||
|
@ -342,7 +347,7 @@ function makeid(length) {
|
|||
|
||||
const start = async () => {
|
||||
try {
|
||||
await fastify.listen({ port: 3000 })
|
||||
await fastify.listen({ port: 80 })
|
||||
} catch (err) {
|
||||
fastify.log.error(err)
|
||||
LDAP.close(function(err) {
|
||||
|
|
Loading…
Reference in a new issue