1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Add profiles and osu! mini

This commit is contained in:
Steffo 2018-06-04 11:58:27 +02:00
parent 48e047918f
commit 1df05801af
6 changed files with 160 additions and 52 deletions

View file

@ -36,3 +36,96 @@ input[type="text"], input[type="password"] {
grid-column: 2;
}
}
.game-panel {
max-width: 400px;
}
.osu {
display: grid;
position: relative;
font-family: 'Exo 2', 'Helvetica Neue', 'Arial', sans-serif;
font-style: italic;
border: 8px solid #ffffff;
border-radius: 10px;
color: #ffffff;
padding: 10px;
grid-row-gap: 4px;
.background-image {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-image: url("https://osu.ppy.sh/images/layout/nav-backgrounds/triangles-combined.png");
z-index: -2;
}
.background-color {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(187, 17, 119, 0.9);
z-index: -1;
}
.player {
grid-row: 1;
grid-column-start: 1;
grid-column-end: 4;
font-size: large;
a {
text-decoration: none;
}
.player-image {
width: 32px;
height: 32px;
border-radius: 16px;
vertical-align: middle;
}
.player-name {
vertical-align: middle;
color: #ffffff;
}
}
.game-title {
grid-row: 2;
font-size: smaller;
font-style: normal;
}
.game-score {
grid-row: 3;
}
.standard {
grid-column: 1;
}
.taiko {
grid-column: 2;
}
.catch {
grid-column: 3;
}
.mania {
grid-column: 4;
}
.number {
font-size: large;
}
.pp {
font-size: x-small;
}
}

View file

@ -359,11 +359,7 @@ def cmd_eat(bot: Bot, update: Update):
bot.send_message(update.message.chat.id, "⚠️ Non hai specificato cosa mangiare!\n"
"Sintassi corretta: `/food <cibo>`")
return
if food.startswith("Uran") and discord_connection is not None:
bot.send_message(update.message.chat.id, "☢️ Ti senti improvvisamente radioattivo.\n\n"
"__Il sito RYG, https://rygc.steffo.eu/, si è aggiornato!__")
return
elif "tonnuooooooro" in food.lower():
if "tonnuooooooro" in food.lower():
bot.send_message(update.message.chat.id, "👻 Il pesce che hai mangiato era posseduto.\n"
"Spooky!")
return

View file

@ -4,42 +4,14 @@
Royal Games
{% endblock %}
{% block posthead %}
<script>
function send() {
document.querySelector("#send").setAttribute("disabled", "true");
var x = new XMLHttpRequest();
x.open("GET", "{{ easter_egg }}", true);
x.send();
}
</script>
{% endblock %}
{% block body %}
<h1>
Admin Dashboard
Royal Games
</h1>
<p>
<button>Ban</button> <input type="text" value="Sensei"> for <input type="text" value="sending nudes">
Benvenuto al sito web della Royal Games! E' ancora un po' triste e spoglio, ma spero che collaboriate a migliorarlo!
</p>
<p>
<button>Create</button> useless Consiglio
</p>
<p>
<button>Generate</button> random russian insults
</p>
<p>
<button>Delete</button> some random messages from Telegram
</p>
<p>
<button>Trigger</button> either @EvilBalu or @Protoh
</p>
<p>
<button id="send" onclick="send()">Send</button> super secret file
</p>
<p>
<h3>GDPR compliance</h3>
<a href="{{ url_for('static', filename='passwordisryg.kdbx') }}">Download</a> RYG members' passwords
Attualmente, sto sviluppando i <b>profili RYG</b>! Clicca <a href="/profile/{{ session['username'] }}">qui</a> per vedere il tuo.
</p>
{% endblock %}

37
templates/minis/osu.html Normal file
View file

@ -0,0 +1,37 @@
<style>
@import url('https://fonts.googleapis.com/css?family=Exo+2');
</style>
<div class="game-panel osu">
<div class="background-image"></div>
<div class="background-color"></div>
<div class="player">
<a href="https://osu.ppy.sh/users/{{ osu.osu_id }}">
<img src="https://a.ppy.sh/{{ osu.osu_id }}" class="player-image">
<span class="player-name">{{ osu.osu_name }}</span>
</a>
</div>
<div class="game-title standard">
osu!
</div>
<div class="game-score standard">
<span class="number">{{ osu.std_pp | int }}</span><span class="pp">pp</span>
</div>
<div class="game-title taiko">
osu!taiko
</div>
<div class="game-score taiko">
<span class="number">{{ osu.taiko_pp | int }}</span><span class="pp">pp</span>
</div>
<div class="game-title catch">
osu!catch
</div>
<div class="game-score catch">
<span class="number">{{ osu.catch_pp | int }}</span><span class="pp">pp</span>
</div>
<div class="game-title mania">
osu!mania
</div>
<div class="game-score mania">
<span class="number">{{ osu.mania_pp | int }}</span><span class="pp">pp</span>
</div>
</div>

14
templates/profile.html Normal file
View file

@ -0,0 +1,14 @@
{% extends 'base.html' %}
{% block pagetitle %}
Royal Games
{% endblock %}
{% block body %}
<h1>
Profilo di {{ royal.username }}
</h1>
{% if osu %}
{% include "minis/osu.html" %}
{% endif %}
{% endblock %}

View file

@ -24,6 +24,18 @@ def page_main():
return redirect(url_for("page_login"))
@app.route("/profile/<name>")
def page_profile(name: str):
db_session = db.Session()
user = db_session.query(db.Royal).filter_by(username=name).one_or_none()
if user is None:
db_session.close()
abort(404)
return
osu = db_session.query(db.Osu).filter_by(royal=user).one_or_none()
return render_template("profile.html", royal=user, osu=osu)
@app.route("/login")
def page_login():
return render_template("login.html")
@ -73,22 +85,6 @@ def page_password():
return
@app.route(config["Flask"]["easter_egg"])
def page_easter_egg():
username = fl_session.get("username")
if username is None:
abort(403)
return
db_session = db.Session()
user = db_session.query(db.Telegram).join(db.Royal).filter_by(username=username).one()
db_session.close()
requests.get("https://api.telegram.org/bot490383363:AAG-_iipLeU2Vl0CfAG-YbRzy-mAndfANBc/sendDocument", params={
"chat_id": user.telegram_id,
"document": "BQADAgADqgEAAu2JiEjObmr6xD7y7AI",
"caption": "Super-secret file"
})
if __name__ == "__main__":
try:
app.run(host="0.0.0.0", port=1234, debug=__debug__)