diff --git a/README.md b/README.md index 37d2d05..e28deeb 100644 --- a/README.md +++ b/README.md @@ -215,7 +215,7 @@ dragscroll.js - Used on several pages for drag scrolling -level.json - An array of the official GD tracks, and also difficulty face stuff for level searching +music.json - An array of the official GD tracks (name, artist) diff --git a/api/download.js b/api/download.js index 6bde11b..dd6a3b2 100644 --- a/api/download.js +++ b/api/download.js @@ -1,6 +1,7 @@ const request = require('request') const fs = require('fs') const Level = require('../classes/Level.js') + module.exports = async (app, req, res, api, ID, analyze) => { if (req.offline) { @@ -55,24 +56,7 @@ module.exports = async (app, req, res, api, ID, analyze) => { req.gdRequest('getGJSongInfo', { songID: level.customSong }, function (err, resp, songRes) { - if (!err && songRes != '-1') { - let songData = app.parseResponse(songRes, '~|~') - level.songName = songData[2] || "Unknown" - level.songAuthor = songData[4] || "Unknown" - level.songSize = (songData[5] || "0") + "MB" - level.songID = songData[1] || String(level.customSong) - if (songData[10]) level.songLink = decodeURIComponent(songData[10]) - if (!songData[2]) level.invalidSong = true - } - - else { - let foundSong = require('../misc/level.json').music[parseInt(levelInfo[12]) + 1] || { "null": true } - level.songName = foundSong[0] || "Unknown" - level.songAuthor = foundSong[1] || "Unknown" - level.songSize = "0MB" - level.songID = "Level " + [parseInt(levelInfo[12]) + 1] - } - + level = level.getSongInfo(app.parseResponse(songRes, '~|~')) level.extraString = levelInfo[36] level.data = levelInfo[4] if (req.isGDPS) level.gdps = (req.onePointNine ? "1.9/" : "") + req.endpoint diff --git a/api/level.js b/api/level.js index 0faaee3..69bd7a2 100644 --- a/api/level.js +++ b/api/level.js @@ -33,23 +33,7 @@ module.exports = async (app, req, res, api, analyze) => { song = app.parseResponse(song, '~|~') let levelInfo = app.parseResponse(preRes[0]) - let level = new Level(levelInfo, req.server, false, author) - - if (level.customSong) { - level.songName = song[2] || "Unknown" - level.songAuthor = song[4] || "Unknown" - level.songSize = (song[5] || "0") + "MB" - level.songID = song[1] || String(level.customSong) - if (song[10]) level.songLink = decodeURIComponent(song[10]) - } - - else { - let foundSong = require('../misc/level.json').music[parseInt(levelInfo[12]) + 1] || { "null": true } - level.songName = foundSong[0] || "Unknown" - level.songAuthor = foundSong[1] || "Unknown" - level.songSize = "0MB" - level.songID = "Level " + [parseInt(levelInfo[12]) + 1] - } + let level = new Level(levelInfo, req.server, false, author).getSongInfo(song) if (req.isGDPS) level.gdps = (req.onePointNine ? "1.9/" : "") + req.endpoint if (level.author != "-") app.userCache(req.id, level.accountID, level.playerID, level.author) diff --git a/api/search.js b/api/search.js index 854a3ca..751b155 100644 --- a/api/search.js +++ b/api/search.js @@ -1,5 +1,5 @@ const request = require('request') -const levels = require('../misc/level.json').music +const music = require('../misc/music.json') const Level = require('../classes/Level.js') let demonList = {} // list: [], lastUpdated: 0 @@ -55,10 +55,6 @@ module.exports = async (app, req, res) => { count: amount } - if (req.query.songID && filters.customSong == 0 && levels.find(x => req.query.songID.toLowerCase() == x[0].toLowerCase())) { - filters.song = levels.findIndex(x => req.query.songID.toLowerCase() == x[0].toLowerCase()) - } - if (req.query.type) { let filterCheck = req.query.type.toLowerCase() switch(filterCheck) { @@ -94,7 +90,6 @@ module.exports = async (app, req, res) => { } if (filters.str == "*") delete filters.str - req.gdRequest('getGJLevels21', req.gdParams(filters), function(err, resp, body) { if (err || !body || body == '-1' || body.startsWith("<")) return res.send("-1") @@ -116,27 +111,12 @@ module.exports = async (app, req, res) => { levelArray.forEach((x, y) => { - let level = new Level(x, req.server) let songSearch = songs.find(y => y['~1'] == x[35]) || [] + let level = new Level(x, req.server).getSongInfo(songSearch) level.author = authorList[x[6]] ? authorList[x[6]][0] : "-"; level.accountID = authorList[x[6]] ? authorList[x[6]][1] : "0"; - if (level.customSong) { - level.songName = app.clean(songSearch[2] || "Unknown") - level.songAuthor = songSearch[4] || "Unknown" - level.songSize = (songSearch[5] || "0") + "MB" - level.songID = songSearch[1] || level.customSong - if (songSearch[10]) level.songLink = decodeURIComponent(songSearch[10]) - } - else { - let foundSong = require('../misc/level.json').music[parseInt(x[12]) + 1] || {"null": true} - level.songName = foundSong[0] || "Unknown" - level.songAuthor = foundSong[1] || "Unknown" - level.songSize = "0MB" - level.songID = "Level " + [parseInt(x[12]) + 1] - } - if (demonMode) { if (!y) level.demonList = req.server.demonList level.demonPosition = demonList[req.id].list.indexOf(level.id) + 1 diff --git a/assets/css/browser.css b/assets/css/browser.css index a48066b..b8261ed 100644 --- a/assets/css/browser.css +++ b/assets/css/browser.css @@ -1213,6 +1213,10 @@ input::-webkit-inner-spin-button { color: #ffaaaa; } +.gray { + filter: grayscale(100%); +} + .grayscale { filter: grayscale(100%) brightness(0.7); } diff --git a/assets/gdps/zombiedash_icon.png b/assets/gdps/zombiedash_icon.png new file mode 100644 index 0000000..ea48f17 Binary files /dev/null and b/assets/gdps/zombiedash_icon.png differ diff --git a/assets/gdps/zombiedash_logo.png b/assets/gdps/zombiedash_logo.png new file mode 100644 index 0000000..ae705b3 Binary files /dev/null and b/assets/gdps/zombiedash_logo.png differ diff --git a/assets/song-custom.png b/assets/song-custom.png new file mode 100644 index 0000000..3e55291 Binary files /dev/null and b/assets/song-custom.png differ diff --git a/assets/song-normal.png b/assets/song-normal.png new file mode 100644 index 0000000..79d88e7 Binary files /dev/null and b/assets/song-normal.png differ diff --git a/classes/Level.js b/classes/Level.js index 1556e0e..c8c0ade 100644 --- a/classes/Level.js +++ b/classes/Level.js @@ -1,4 +1,5 @@ const XOR = require(__dirname + "/../classes/XOR"); +const music = require(__dirname + "/../misc/music.json"); let orbs = [0, 0, 50, 75, 125, 175, 225, 275, 350, 425, 500] let length = ['Tiny', 'Short', 'Medium', 'Long', 'XL'] @@ -32,7 +33,7 @@ class Level { this.version = +levelInfo[5]; this.copiedID = levelInfo[30] this.twoPlayer = levelInfo[31] > 0 - this.officialSong = levelInfo[12] != 0 ? parseInt(levelInfo[12]) + 1 : 0 + this.officialSong = +levelInfo[35] ? 0 : parseInt(levelInfo[12]) + 1 this.customSong = +levelInfo[35] this.coins = +levelInfo[37] this.verifiedCoins = levelInfo[38] > 0 @@ -66,6 +67,25 @@ class Level { if (this.editorTime == 1 && this.totalEditorTime == 2) { this.editorTime = 0; this.totalEditorTime = 0 } // remove GDPS default values } + + getSongInfo(songInfo) { + if (this.customSong) { + this.songName = songInfo[2] || "Unknown" + this.songAuthor = songInfo[4] || "Unknown" + this.songSize = (songInfo[5] || "0") + "MB" + this.songID = songInfo[1] || this.customSong + if (songInfo[10]) this.songLink = decodeURIComponent(songInfo[10]) + } + else { + let foundSong = music[this.officialSong] || {"null": true} + this.songName = foundSong[0] || "Unknown" + this.songAuthor = foundSong[1] || "Unknown" + this.songSize = "0MB" + this.songID = "Level " + this.officialSong + } + + return this + } } module.exports = Level; \ No newline at end of file diff --git a/html/filters.html b/html/filters.html index 394d622..981e825 100644 --- a/html/filters.html +++ b/html/filters.html @@ -23,9 +23,17 @@

No Star

Original

2-Player

-

Coins

+

Coins

Song

- + + +
+ + @@ -139,10 +147,14 @@ \ No newline at end of file diff --git a/html/messages.html b/html/messages.html index 6980502..2f802fa 100644 --- a/html/messages.html +++ b/html/messages.html @@ -84,7 +84,7 @@

Are you sure you want to delete this message?

- + diff --git a/index.js b/index.js index 6d93a9f..79e33cc 100644 --- a/index.js +++ b/index.js @@ -38,6 +38,7 @@ let achievements = require('./misc/achievements.json') let achievementTypes = require('./misc/achievementTypes.json') let shopIcons = require('./misc/shops.json') let colorList = require('./icons/colors.json') +let music = require('./misc/music.json') let gdIcons = fs.readdirSync('./assets/previewicons') let assetPage = fs.readFileSync('./html/assets.html', 'utf8') @@ -74,6 +75,7 @@ app.use(async function(req, res, next) { req.isGDPS = req.server.endpoint != "http://boomlings.com/database/" if (req.isGDPS) res.set("gdps", (req.onePointNine ? "1.9/" : "") + req.id) + if (req.query.online > 0) req.offline = false req.gdParams = function(obj={}, substitute=true) { Object.keys(app.config.params).forEach(x => { if (!obj[x]) obj[x] = app.config.params[x] }) @@ -213,7 +215,7 @@ let downloadDisabled = ['daily', 'weekly'] let gdpsHide = ['achievements', 'messages'] app.get("/", function(req, res) { - if (req.offline && !req.query.hasOwnProperty("home")) res.sendFile(__dirname + "/html/offline.html") + if (req.query.hasOwnProperty("offline") || (req.offline && !req.query.hasOwnProperty("home"))) res.sendFile(__dirname + "/html/offline.html") else { fs.readFile('./html/home.html', 'utf8', function (err, data) { let html = data; @@ -294,6 +296,7 @@ app.get("/icon/:text", function(req, res) { app.run.icon(app, req, res) }) app.get("/api/userCache", function(req, res) { res.send(app.accountCache) }) app.get("/api/gdps", function(req, res) { res.send(req.query.hasOwnProperty("current") ? req.server : app.servers) }) app.get("/api/achievements", function(req, res) { res.send({achievements, types: achievementTypes, shopIcons, colors: colorList }) }) +app.get("/api/music", function(req, res) { res.send(music) }) app.get('/api/icons', function(req, res) { let sample = [JSON.stringify(sampleIcons[Math.floor(Math.random() * sampleIcons.length)].slice(1))] let iconserver = req.isGDPS ? req.server.name : undefined diff --git a/misc/level.json b/misc/level.json deleted file mode 100644 index ececfed..0000000 --- a/misc/level.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - - "music": [ - ["Stay Inside Me", "OcularNebula"], - ["Stereo Madness", "ForeverBound"], - ["Back on Track", "DJVI"], - ["Polargeist", "Step"], - ["Dry Out", "DJVI"], - ["Base After Base", "DJVI"], - ["Can't Let Go", "DJVI"], - ["Jumper", "Waterflame"], - ["Time Machine", "Waterflame"], - ["Cycles", "DJVI"], - ["xStep", "DJVI"], - ["Clutterfunk", "Waterflame"], - ["Theory of Everything", "DJ-Nate"], - ["Electroman Adventures", "Waterflame"], - ["Clubstep", "DJ-Nate"], - ["Electrodynamix", "DJ-Nate"], - ["Hexagon Force", "Waterflame"], - ["Blast Processing", "Waterflame"], - ["Theory of Everything 2", "DJ-Nate"], - ["Geometrical Dominator", "Waterflame"], - ["Deadlocked", "F-777"], - ["Fingerdash", "MDK"], - ["The Seven Seas", "F-777"], - ["Viking Arena", "F-777"], - ["Airborne Robots", "F-777"], - ["The Challenge", "RobTop"], - ["Payload", "Dex Arson"], - ["Beast Mode", "Dex Arson"], - ["Machina", "Dex Arson"], - ["Years", "Dex Arson"], - ["Frontlines", "Dex Arson"], - ["Space Pirates", "Waterflame"], - ["Striker", "Waterflame"], - ["Embers", "Dex Arson"], - ["Round 1", "Dex Arson"], - ["Monster Dance Off", "F-777"], - ["Press Start", "MDK"], - ["Nock Em", "Bossfight"], - ["Power Trip", "Boom Kitty"] - ], - - "difficulties": { - "easy": "1", - "normal": "2", - "hard": "3", - "harder": "4", - "insane": "5", - "demon": "-2", - "easydemon": "-2&demonFilter=1", - "mediumdemon": "-2&demonFilter=2", - "harddemon": "-2&demonFilter=3", - "insanedemon": "-2&demonFilter=4", - "extremedemon": "-2&demonFilter=5", - "auto": "-3", - "unrated": "-1", - "na": "-1", - "n/a": "-1" - } - -} \ No newline at end of file diff --git a/misc/music.json b/misc/music.json new file mode 100644 index 0000000..6e6d457 --- /dev/null +++ b/misc/music.json @@ -0,0 +1,41 @@ +[ + ["Stay Inside Me", "OcularNebula"], + ["Stereo Madness", "ForeverBound"], + ["Back on Track", "DJVI"], + ["Polargeist", "Step"], + ["Dry Out", "DJVI"], + ["Base After Base", "DJVI"], + ["Can't Let Go", "DJVI"], + ["Jumper", "Waterflame"], + ["Time Machine", "Waterflame"], + ["Cycles", "DJVI"], + ["xStep", "DJVI"], + ["Clutterfunk", "Waterflame"], + ["Theory of Everything", "DJ-Nate"], + ["Electroman Adventures", "Waterflame"], + ["Clubstep", "DJ-Nate"], + ["Electrodynamix", "DJ-Nate"], + ["Hexagon Force", "Waterflame"], + ["Blast Processing", "Waterflame"], + ["Theory of Everything 2", "DJ-Nate"], + ["Geometrical Dominator", "Waterflame"], + ["Deadlocked", "F-777"], + ["Fingerdash", "MDK"], + ["The Seven Seas", "F-777"], + ["Viking Arena", "F-777"], + ["Airborne Robots", "F-777"], + ["The Challenge", "RobTop"], + ["Payload", "Dex Arson"], + ["Beast Mode", "Dex Arson"], + ["Machina", "Dex Arson"], + ["Years", "Dex Arson"], + ["Frontlines", "Dex Arson"], + ["Space Pirates", "Waterflame"], + ["Striker", "Waterflame"], + ["Embers", "Dex Arson"], + ["Round 1", "Dex Arson"], + ["Monster Dance Off", "F-777"], + ["Press Start", "MDK"], + ["Nock Em", "Bossfight"], + ["Power Trip", "Boom Kitty"] +] \ No newline at end of file diff --git a/servers.json b/servers.json index 5c4a25b..353bb91 100644 --- a/servers.json +++ b/servers.json @@ -89,6 +89,15 @@ "endpoint": "http://cnekgdps.7m.pl/cnekgdpsdtb/" }, + { + "name": "Zombie Dash", + "link": "http://zombiedashoficial.ddns.net/", + "author": "Ghost Power 13", + "authorLink": "https://www.youtube.com/channel/UCC_S4bHTIGVJiCfZsKU15Gw", + "id": "zombiedash", + "endpoint": "http://zombiedashoficial.ddns.net/" + }, + { "name": "Geometry Dash Gravity", "link": "https://discord.gg/qpUJgBC",