diff --git a/api/search.js b/api/search.js index a9920c2..cb3610a 100644 --- a/api/search.js +++ b/api/search.js @@ -108,7 +108,7 @@ module.exports = async (app, req, res) => { let arr = x.split(':') authorList[arr[0]] = [arr[1], arr[2]]}) - let levelArray = preRes.map(x => app.parseResponse(x)).filter(x => x[1]) + let levelArray = preRes.map(x => app.parseResponse(x)).filter(x => x[2]) let parsedLevels = [] levelArray.forEach((x, y) => { @@ -128,7 +128,7 @@ module.exports = async (app, req, res) => { if (level.author != "-" && app.config.cacheAccountIDs) app.userCache(req.id, level.accountID, level.playerID, level.author) //this is broken if you're not on page 0, blame robtop - if (filters.page == 0 && y == 0) { + if (filters.page == 0 && y == 0 && splitBody[3]) { let pages = splitBody[3].split(":"); if (filters.gauntlet) { // gauntlet page stuff diff --git a/assets/gdps/robtopgames_icon.png b/assets/gdps/robtopgames_icon.png new file mode 100644 index 0000000..439f94b Binary files /dev/null and b/assets/gdps/robtopgames_icon.png differ diff --git a/assets/gdps/robtopgames_logo.png b/assets/gdps/robtopgames_logo.png new file mode 100644 index 0000000..218243d Binary files /dev/null and b/assets/gdps/robtopgames_logo.png differ diff --git a/classes/Level.js b/classes/Level.js index c8c0ade..b2597f1 100644 --- a/classes/Level.js +++ b/classes/Level.js @@ -11,16 +11,16 @@ class Level { if (!levelInfo[2]) return; this.name = levelInfo[2]; this.id = levelInfo[1]; - this.description = Buffer.from(levelInfo[3], "base64").toString() || "(No description provided)"; + this.description = Buffer.from((levelInfo[3] || ""), "base64").toString() || "(No description provided)"; this.author = author[1] || "-" this.playerID = levelInfo[6] this.accountID = author[2] || 0 - this.difficulty = difficulty[levelInfo[9]] - this.downloads = +levelInfo[10] - this.likes = +levelInfo[14] + this.difficulty = difficulty[levelInfo[9]] || "Unrated" + this.downloads = +levelInfo[10] || 0 + this.likes = +levelInfo[14] || 0 this.disliked = levelInfo[14] < 0 this.length = length[levelInfo[15]] || "XL" - this.stars = +levelInfo[18] + this.stars = +levelInfo[18] || 0 this.orbs = orbs[levelInfo[18]] || 0 this.diamonds = levelInfo[18] < 2 ? 0 : parseInt(levelInfo[18]) + 2 this.featured = levelInfo[19] > 0 @@ -31,10 +31,10 @@ class Level { if (download) { this.editorTime = +levelInfo[46] || 0; this.totalEditorTime = +levelInfo[47] || 0 } if (levelInfo[27]) this.password = levelInfo[27]; this.version = +levelInfo[5]; - this.copiedID = levelInfo[30] + this.copiedID = levelInfo[30] || "0" this.twoPlayer = levelInfo[31] > 0 this.officialSong = +levelInfo[35] ? 0 : parseInt(levelInfo[12]) + 1 - this.customSong = +levelInfo[35] + this.customSong = +levelInfo[35] || 0 this.coins = +levelInfo[37] this.verifiedCoins = levelInfo[38] > 0 this.starsRequested = +levelInfo[39] diff --git a/html/search.html b/html/search.html index 70779b1..66ee8bf 100644 --- a/html/search.html +++ b/html/search.html @@ -136,7 +136,7 @@ let superSearch = ['*', '*?type=mostliked', '*?type=mostdownloaded', '*?type=rec let demonListLink = "https://pointercrate.com/" let searchFilters = `../api/search/${type == 'saved' ? JSON.parse(localStorage.getItem('saved') || '[]').reverse().toString() : accID || path}?page=[PAGE]${count ? "" : "&count=10"}${window.location.search.replace(/\?/g, "&").replace("page", "nope")}` -function clean(text) {return text.toString().replace(/&/g, "&").replace(//g, ">").replace(/=/g, "=").replace(/"/g, """).replace(/'/g, "'")} +function clean(text) {return (text || "").toString().replace(/&/g, "&").replace(//g, ">").replace(/=/g, "=").replace(/"/g, """).replace(/'/g, "'")} if (type == "followed") { let followed = localStorage.followed ? JSON.parse(localStorage.followed) : [] @@ -193,7 +193,7 @@ function Append(firstLoad) { let noLink = songColor != "whatIfItWasPurple" $('#searchBox').append(`