|
|
|
@ -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) { |
|
|
|
|