From 01e7041f11061e16c81f14e4d8d0c518819000fb Mon Sep 17 00:00:00 2001 From: 101arrowz Date: Wed, 23 Oct 2019 17:23:59 -0700 Subject: [PATCH] Improved passwords --- api/download.js | 12 ++++-------- html/level.html | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/api/download.js b/api/download.js index 8c33e68..97e2baf 100644 --- a/api/download.js +++ b/api/download.js @@ -1,6 +1,7 @@ const request = require('request') const fs = require('fs') - +const XOR = require('../misc/XOR.js'); +const xor = new XOR(); module.exports = async (app, req, res, api, ID, analyze) => { let orbs = [0, 0, 50, 75, 125, 175, 225, 275, 350, 425, 500] @@ -56,16 +57,11 @@ module.exports = async (app, req, res, api, ID, analyze) => { objects: levelInfo[45] == "65535" ? "65000+" : levelInfo[45], large: levelInfo[45] > 40000, } - if (level.password != "0") { - const XOR = require('../misc/XOR.js'); - const xor = new XOR(); let pass = level.password - pass = +xor.decrypt(pass, 26364) - pass = pass.toString() - - if (pass.length > 1) level.password = Number(pass) - 1000000 + pass = xor.decrypt(pass, 26364); + if (pass.length > 1) level.password = pass.slice(1).padStart(6, '0'); else level.password = pass } diff --git a/html/level.html b/html/level.html index d7bb9e9..ecd1eaf 100644 --- a/html/level.html +++ b/html/level.html @@ -160,7 +160,7 @@ $('#levelInfo').html($('#levelInfo').html() if (!'[[UPLOADED]]'.startsWith('[')) { $('#levelInfo').html($('#levelInfo').html() - .replace('[[PASS]]', `
Password: ${[[PASSWORD]] == 0 ? "No copy" : [[PASSWORD]] == 1 ? "Free copy" : [[PASSWORD]]}`) + .replace('[[PASS]]', `
Password: ${'[[PASSWORD]]' == '0' ? "No copy" : '[[PASSWORD]]' == 1 ? "Free copy" : '[[PASSWORD]]'}`) .replace('[[LOWDETAIL]]', `
Low Detail: ${[[LDM]] ? "Yes" : "No"}`) .replace('[[UPLOAD]]', '[[UPLOADED]]' == "0" ? "" : `
Uploaded: [[UPLOADED]]`) .replace('[[UPDATE]]', '[[UPDATED]]' == "0" ? "" : `
Updated: [[UPDATED]]`))}