Skip to content

Commit

Permalink
Build 1593530430
Browse files Browse the repository at this point in the history
Merge pull request #47 from RealistikOsu/development
  • Loading branch information
RealistikDash authored Jun 30, 2020
2 parents e8f0963 + 8e75f19 commit 036b164
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 11 deletions.
2 changes: 1 addition & 1 deletion buildinfo.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": 1591992477}
{"version": 1593530430}
23 changes: 23 additions & 0 deletions changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,5 +527,28 @@
"Content" : "Fixed the redirects on gamemode wipes."
}
]
},
{
"Build" : 1593530430,
"Type" : 3,
"Summary" : "Thys build focuses on fixing minor issues with RealistikPanel.",
"Changes" : [
{
"Type" : 5,
"Content" : "Some servers being offline no longer causes the dash to not load."
},
{
"Type" : 5,
"Content" : "Fixed issue with some dark mode elements using a bright colour scheme"
},
{
"Type" : 5,
"Content" : "Fix some available beatmap requests showing up as not found."
},
{
"Type" : 5,
"Content" : "Fix song playback on beatmap rank page."
}
]
}
]
30 changes: 24 additions & 6 deletions functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,10 @@ def UserData(UserID):
Data["DonorExpireStr"] = TimeToTimeAgo(Data["DonorExpire"])

#now for silences and ban times
Data["IsBanned"] = int(Data2[7]) > 0
Data["BanedAgo"] = TimeToTimeAgo(int(Data2[7]))
Data["IsSilenced"] = int(Data2[5]) > round(time.time())
Data["SilenceEndAgo"] = TimeToTimeAgo(int(Data2[5]))
Data["IsBanned"] = CoolerInt(Data2[7]) > 0
Data["BanedAgo"] = TimeToTimeAgo(CoolerInt(Data2[7]))
Data["IsSilenced"] = CoolerInt(Data2[5]) > round(time.time())
Data["SilenceEndAgo"] = TimeToTimeAgo(CoolerInt(Data2[5]))

#removing "None" from user page and admin notes
if Data["Notes"] == None:
Expand Down Expand Up @@ -1229,7 +1229,7 @@ def DeleteAccount(id : int):
mycursor.execute("DELETE FROM users_relationships WHERE user1 = %s OR user2 = %s", (id, id,))
mycursor.execute("DELETE FROM user_badges WHERE user = %s", (id,))
mycursor.execute("DELETE FROM user_clans WHERE user = %s", (id,))
mycursor.execute("DELETE FROM user_stats WHERE id = %s", (id,))
mycursor.execute("DELETE FROM users_stats WHERE id = %s", (id,))
if UserConfig["HasRelax"]:
mycursor.execute("DELETE FROM scores_relax WHERE userid = %s", (id,))
mycursor.execute("DELETE FROM rx_stats WHERE id = %s", (id,))
Expand Down Expand Up @@ -1805,18 +1805,30 @@ def GetRankRequests(Page: int):
"""Gets all the rank requests. This may require some optimisation."""
Page -= 1
Offset = UserConfig["PageSize"] * Page #for the page system to work
mycursor.execute("SELECT * FROM rank_requests LIMIT %s OFFSET %s", (UserConfig['PageSize'], Offset,))
mycursor.execute("SELECT id, userid, bid, type, time, blacklisted FROM rank_requests WHERE blacklisted = 0 LIMIT %s OFFSET %s", (UserConfig['PageSize'], Offset,))
RankRequests = mycursor.fetchall()
#turning what we have so far into
TheRequests = []
UserIDs = [] #used for later fetching the users, so we dont have a repeat of 50 queries
for Request in RankRequests:
#getting song info, like 50 individual queries at peak lmao
TriedSet = False
TriedBeatmap = False
if Request[3] == "s":
mycursor.execute("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmapset_id = %s LIMIT 1", (Request[2],))
TriedSet = True
else:
mycursor.execute("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", (Request[2],))
TriedBeatmap = True
Name = mycursor.fetchall()
#in case it was added incorrectly for some reason?
if len(Name) == 0:
if TriedBeatmap:
mycursor.execute("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmapset_id = %s LIMIT 1", (Request[2],))
if TriedSet:
mycursor.execute("SELECT song_name, beatmapset_id FROM beatmaps WHERE beatmap_id = %s LIMIT 1", (Request[2],))
Name = mycursor.fetchall()

#if the info is bad
if len(Name) == 0:
SongName = "Darude - Sandstorm (Song not found)"
Expand Down Expand Up @@ -2137,3 +2149,9 @@ def CreatePrivilege():
#checking the ID
mycursor.execute("SELECT id FROM privileges_groups ORDER BY id DESC LIMIT 1")
return mycursor.fetchone()[0]

def CoolerInt(ToInt):
"""Makes a number an int butt also works with special cases etc if ToInt is None, it returns a 0! Magic."""
if ToInt == None:
return 0
return int(ToInt)
21 changes: 18 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,28 @@ def PPApi(id):
#api mirrors
@app.route("/js/status/api")
def ApiStatus():
return jsonify(requests.get(UserConfig["ServerURL"] + "api/v1/ping").json())
try:
return jsonify(requests.get(UserConfig["ServerURL"] + "api/v1/ping").json())
except:
return jsonify({
"code" : 503
})
@app.route("/js/status/lets")
def LetsStatus():
return jsonify(requests.get(UserConfig["LetsAPI"] + "v1/status").json()) #this url to provide a predictable result
try:
return jsonify(requests.get(UserConfig["LetsAPI"] + "v1/status").json()) #this url to provide a predictable result
except:
return jsonify({
"server_status" : 0
})
@app.route("/js/status/bancho")
def BanchoStatus():
return jsonify(requests.get(UserConfig["BanchoURL"] + "api/v1/serverStatus").json()) #this url to provide a predictable result
try:
return jsonify(requests.get(UserConfig["BanchoURL"] + "api/v1/serverStatus").json()) #this url to provide a predictable result
except:
return jsonify({
"result" : 0
})

#actions
@app.route("/actions/wipe/<AccountID>")
Expand Down
5 changes: 5 additions & 0 deletions static/css/daskstisla.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,8 @@ body.sidebar-mini .main-sidebar:after {
.selectize-input {
border: 1px solid #797979;
}

.dropdown-item:focus, .dropdown-item:hover {
color: white;
background-color: #353535;
}
2 changes: 1 addition & 1 deletion templates/beatrank.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h4>Quick Actions</h4>
<a onclick="Play()" class="btn btn-primary" style="color: white;">Play</a>
<a onclick="Pause()" class="btn btn-primary" style="color: white;">Pause</a>
<audio id="BeatmapAudio">
<source src="https://b.ppy.sh/preview/{{ beatdata[0]['BeatmapsetId'] }}.mp3" type="audio/mpeg">
<source src="https://b.ppy.sh/preview/{{ beatdata[0][0]['BeatmapsetId'] }}.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
Expand Down

0 comments on commit 036b164

Please sign in to comment.