Revert "[revert] of course he fixes it right after i push"
This reverts commit af54814620
.
This commit is contained in:
parent
af54814620
commit
6d1bbfa4e0
3 changed files with 43 additions and 17 deletions
27
api/song.js
27
api/song.js
|
@ -2,7 +2,27 @@ const request = require('request')
|
|||
|
||||
module.exports = async (app, req, res) => {
|
||||
|
||||
let info = {error: true, exists: false, artist: { name: "", scouted: false, whitelisted: false }, song: { name: "", externalUse: false, allowed: false } }
|
||||
// temporary solution until song api is re-enabled
|
||||
|
||||
if (req.offline) return res.send('-1')
|
||||
|
||||
let songID = req.params.song
|
||||
req.gdRequest('getGJSongInfo', {songID: songID}, function(err, resp, body) {
|
||||
if (err || !body || body.startsWith("<")) return res.send('-1')
|
||||
else if (body < 0) return res.send(false)
|
||||
request.get('https://www.newgrounds.com/audio/listen/' + songID, function(err2, resp2, song) {
|
||||
console.log(resp2.statusCode)
|
||||
return res.send(resp2.statusCode == 200)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// RobTop disabled his song checking page soo.... //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
/* let info = {error: true, exists: false, artist: { name: "", scouted: false, whitelisted: false }, song: { name: "", externalUse: false, allowed: false } }
|
||||
|
||||
if (req.offline) return res.send(info)
|
||||
|
||||
|
@ -12,7 +32,7 @@ module.exports = async (app, req, res) => {
|
|||
request.post('http://boomlings.com/database/testSong.php?songID=' + songID, req.gdParams(), function(err, resp, body) {
|
||||
if (err || !body || body == '-1' || body.startsWith("<")) return res.send(info)
|
||||
else if (!body.includes("<br>")) testError = true
|
||||
|
||||
|
||||
req.gdRequest('getGJSongInfo', {songID: songID}, function(err2, resp, songAllowed) {
|
||||
if (err2 || !songAllowed || songAllowed < 0 || body.startsWith("<")) return res.send(info)
|
||||
|
||||
|
@ -32,4 +52,5 @@ module.exports = async (app, req, res) => {
|
|||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
} */
|
|
@ -745,7 +745,12 @@
|
|||
</div>
|
||||
|
||||
<br>
|
||||
<p class="reveal" onclick="$('#response-analyze').slideToggle(100)"><b>Response (8)</b></p>
|
||||
<p class="reveal" onclick="$('#response-analyze').slideToggle(100)"><b>Response (1)</b></p>
|
||||
<div class="subdiv" id="response-analyze">
|
||||
<p>literally just returns true or false (or -1 if there's an error)</p>
|
||||
<p>there used to be more but rob disabled his song api sooo</p>
|
||||
</div>
|
||||
<!-- <p class="reveal" onclick="$('#response-analyze').slideToggle(100)"><b>Response (8)</b></p>
|
||||
<div class="subdiv" id="response-analyze">
|
||||
<p>error: Appears if the GD servers rejected the request or not. <code>song.allowed</code> may still work even with an error</p>
|
||||
<p>exists: If the provided song exists on Newgrounds</p>
|
||||
|
@ -755,7 +760,7 @@
|
|||
<p>song.name: The name of the song</p>
|
||||
<p>song.externalUse: If the song is allowed for external use</p>
|
||||
<p>song.allowed: If the song is allowed for use in GD</p>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<br>
|
||||
</div>
|
||||
|
|
|
@ -342,18 +342,18 @@ $('#checkSong').click(function() {
|
|||
$('#songLoading').show()
|
||||
fetch(`../api/song/[[SONGID]]`).then(res => res.json()).then(info => {
|
||||
$('#songLoading').hide()
|
||||
$(info.song.allowed ? '#songAllowed' : '#songNotAllowed').show().addClass('songStatus')
|
||||
if (info.error) return
|
||||
if (!info.artist.scouted) {
|
||||
$('#scout').attr('src', '../assets/x.png')
|
||||
$('#scout').attr('title', $('#scout').attr('title').replace('is ', 'is NOT '))
|
||||
$('#scout').css('filter', 'saturate(0.4)')
|
||||
}
|
||||
if (!info.artist.whitelisted) {
|
||||
$('#whitelist').attr('src', '../assets/x.png')
|
||||
$('#whitelist').attr('title', $('#whitelist').attr('title').replace('is ', 'is NOT '))
|
||||
}
|
||||
$('#scout').show(); $('#whitelist').show()
|
||||
$(info && info != -1 ? '#songAllowed' : '#songNotAllowed').show().addClass('songStatus')
|
||||
// if (info.error) return
|
||||
// if (!info.artist.scouted) {
|
||||
// $('#scout').attr('src', '../assets/x.png')
|
||||
// $('#scout').attr('title', $('#scout').attr('title').replace('is ', 'is NOT '))
|
||||
// $('#scout').css('filter', 'saturate(0.4)')
|
||||
// }
|
||||
// if (!info.artist.whitelisted) {
|
||||
// $('#whitelist').attr('src', '../assets/x.png')
|
||||
// $('#whitelist').attr('title', $('#whitelist').attr('title').replace('is ', 'is NOT '))
|
||||
// }
|
||||
// $('#scout').show(); $('#whitelist').show()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue