song uploading is now properly disableable
This commit is contained in:
parent
94c8cdf463
commit
c029f7a0d2
|
@ -22,8 +22,8 @@
|
|||
<%- end -%>
|
||||
|
||||
<form action="/tools/reupload" method="post">
|
||||
ID: <input type="text" id="level_id" name="level_id" disabled="<%= disabled ? "1" : "" %>" />
|
||||
<input type="submit" value="Submit" disabled="<%= disabled ? "1" : "" %>" />
|
||||
ID: <input type="text" id="level_id" name="level_id" <%= disabled ? "disabled" : "" %> />
|
||||
<input type="submit" value="Submit" <%= disabled ? "disabled" : "" %> />
|
||||
</form>
|
||||
<br>
|
||||
<i>Currently only vanilla servers are supported</i>
|
||||
|
|
|
@ -15,10 +15,14 @@
|
|||
<%- elsif song_id -%>
|
||||
<div>Uploaded successfully! Song ID: <b><%= song_id %></b></div><br />
|
||||
<%- end -%>
|
||||
|
||||
|
||||
<%- if disabled -%>
|
||||
<b>Custom songs have been disabled</b><br><br>
|
||||
<%- end -%>
|
||||
|
||||
<form action="/tools/song_upload" method="post">
|
||||
URL: <input type="text" id="url" name="url" />
|
||||
<input type="submit" value="Submit" />
|
||||
URL: <input type="text" id="url" name="url" <%= disabled ? "disabled" : "" %> />
|
||||
<input type="submit" value="Submit" <%= disabled ? "disabled" : "" %> />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -20,10 +20,12 @@ end
|
|||
CrystalGauntlet.template_endpoints["/tools/song_upload"] = ->(context : HTTP::Server::Context) {
|
||||
context.response.content_type = "text/html"
|
||||
|
||||
disabled = !(config_get("songs.allow_custom_songs").as?(Bool))
|
||||
|
||||
error = nil
|
||||
song_id = nil
|
||||
body = context.request.body
|
||||
if body
|
||||
if body && !disabled
|
||||
begin
|
||||
params = URI::Params.parse(body.gets_to_end)
|
||||
song_id = get_next_song_id()
|
||||
|
|
Loading…
Reference in New Issue