Stash
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2022-09-07 21:11:11 +00:00
parent bf2918795f
commit 89889e40f4
6 changed files with 123 additions and 24 deletions

View File

@ -74,7 +74,7 @@ def i18n(str: str) -> str:
return str return str
def days_before_failure(): def days_before_failure() -> int:
nextYear = datetime.today().year + 5 - ((datetime.today().year + 5) % 5) nextYear = datetime.today().year + 5 - ((datetime.today().year + 5) % 5)
nextDate = datetime(year=nextYear, month=6, day=3) nextDate = datetime(year=nextYear, month=6, day=3)
nextDelta = nextDate - datetime.now() nextDelta = nextDate - datetime.now()
@ -93,11 +93,18 @@ async def index():
guild = get_guild_by_id(guild_id) guild = get_guild_by_id(guild_id)
if guild: if guild:
return False return redirect(url_for(".subscribe", guild_id=guild_id))
return await render_template("index.html.j2") return await render_template("index.html.j2")
@app.route("/subscribe/<guild_id>")
async def subscribe(guild_id: str):
guild = get_guild_by_id(guild_id)
return await render_template("subscribe.html.j2", guild=guild)
@app.route("/<guild_id>.ics") @app.route("/<guild_id>.ics")
async def ical(guild_id: str): async def ical(guild_id: str):
guild = get_guild_by_id(guild_id) guild = get_guild_by_id(guild_id)

View File

@ -34,10 +34,15 @@ body {
width: 130px; width: 130px;
} }
#avatars, footer, h1, h2 { footer, h1, h2 {
text-align: center; text-align: center;
} }
#avatars {
display: flex;
justify-content: center;
}
#avatars img { #avatars img {
border-radius: 50%; border-radius: 50%;
} }
@ -55,9 +60,27 @@ body {
padding: 32px 16px 24px; padding: 32px 16px 24px;
} }
#scopes { #dots {
list-style-type: none; font-size: xx-large;
padding: 0; opacity: 0.2;
align-self: center;
margin: 0 24px;
}
.hr-sect {
display: flex;
align-items: center;
color: rgba(79, 84, 92);
margin: 8px 0;
}
.hr-sect:before,
.hr-sect:after {
content: "";
flex-grow: 1;
background: rgba(79, 84, 92);
height: 1px;
margin: 0 8px;
} }
#scopes li { #scopes li {
@ -65,12 +88,34 @@ body {
font-size: 14px; font-size: 14px;
} }
footer ul { #select_guid {
width: 100%;
background-color: #202225;
border: 0;
border-radius: 3px;
color: white;
font-size: 15px;
padding: 10px;
}
#permissions {
font-size: 12px; font-size: 12px;
margin-top: 8px;
}
ul {
list-style-type: none; list-style-type: none;
padding: 0; padding: 0;
} }
ul li a {
color: #a3a6aa;
}
footer ul {
font-size: 12px;
}
footer ul li { footer ul li {
display: inline-block; display: inline-block;
} }
@ -79,10 +124,6 @@ footer ul li:last-child {
display: block; display: block;
} }
footer ul li a {
color: #a3a6aa;
}
footer ul li i { footer ul li i {
margin: 8px; margin: 8px;
} }
@ -131,21 +172,25 @@ hr {
padding: 16px; padding: 16px;
text-align: right; text-align: right;
border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px;
display: flex;
justify-content: flex-end;
} }
#buttons a { .button {
background-color: #5865f2; background-color: #5865f2;
line-height: 38px; line-height: 38px;
font-size: 14px; font-size: 14px;
padding: 0 16px; padding: 0 16px;
border-radius: 3px; border-radius: 3px;
color: white; color: white;
display: inline-block; border: 0;
display: block;
text-align: center;
} }
@media only screen and (max-width : 320px) { @media only screen and (max-width : 320px) {
#logo { #logo {
text-align: center; align-self: center;
top: inherit; top: inherit;
left: inherit; left: inherit;
} }

View File

@ -8,7 +8,7 @@
width="173"/> width="173"/>
</div> </div>
<hr /> <hr />
<span id="details">{{ error }}</span> <span>{{ error }}</span>
</div> </div>
<div id="buttons"> <div id="buttons">
<a href="{{ url_for('index') }}"> <a href="{{ url_for('index') }}">

View File

@ -24,8 +24,9 @@
</ul> </ul>
<hr /> <hr />
<h3>{{ _('Choose a server:') }}</h3> <h3>{{ _('Choose a server:') }}</h3>
<select name="guild"> <select name="guild" id="select_guid">
<option> <option>
&nbsp;
</option> </option>
{% for guild in client.guilds %} {% for guild in client.guilds %}
<option value="{{ guild.id }}"> <option value="{{ guild.id }}">
@ -33,9 +34,29 @@
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
<div class="hr-sect">{{ _("OR") }}</div>
<a class="button"
target="_blank"
href="https://discord.com/api/oauth2/authorize?client_id={{ client.user.id }}&permissions=536870912&scope=bot">
{{ _("Add the bot on your server") }}
</a>
<ul id="permissions">
<li>
{{ _("You must have") }}
<strong>{{ _("Manage Server") }}</strong>
{{ _("permission on this server to perform this action") }}
</li>
<li>
{{ _("After adding the bot,") }}
<a href="">
<i class="fa fa-refresh"></i>
<strong>{{ _("reload the page") }}</strong>
</a>
</li>
</ul>
</div> </div>
<div id="buttons"> <div id="buttons">
<a href="{{ url_for('index') }}">{{ _("Let's go!") }}</a> <input type="submit" class="button" value="{{ _("Let's go!") }}"/>
</div> </div>
</form> </form>
{% endblock content %} {% endblock content %}

View File

@ -1 +1,19 @@
{% extends "base.html.j2" %}
{% block content %}
<div id="box">
<div id="avatars">
<img src="{{ client.user.display_avatar }}"
alt="{{ _('Bot Logo') }}"
width="80"
height="80"/>
<span id="dots">…</span>
<img src="{{ guild.icon.url }}"
alt="{{ _('Guild Logo') }}"
width="80"
height="80"/>
</div>
<h1>{{ client.user.display_name }}</h1>
<h2>{{ _('The discord scheduled event calendar generator') }}</h2>
<hr />
</div>
{% endblock content %}

View File

@ -2,13 +2,21 @@
"Discord Logo": "Logo Discord", "Discord Logo": "Logo Discord",
"Bot Logo": "Logo du robot", "Bot Logo": "Logo du robot",
"The discord scheduled event calendar generator": "Générateur de calendrier pour les évènements Discord", "The discord scheduled event calendar generator": "Générateur de calendrier pour les évènements Discord",
"This will allow you to:": "Ceci vous permettra de :", "This will allow you to:": "Ceci te permettra de :",
"Subscribe to a calendar on Google, Yahoo, Outlook, Apple or any ICS complient software": "S'abonner à un calendrier sur Google, Yahoo, Outlook, Apple ou tout autre logiciel compatible", "Subscribe to a calendar on Google, Yahoo, Outlook, Apple or any ICS complient software": "T'abonner à un calendrier sur Google, Yahoo, Outlook, Apple ou tout autre logiciel compatible",
"Throwing you to a new isekai world": "Vous envoyer dans un monde fantaisiste armée d'une poile à frire", "Throwing you to a new isekai world": "T'envoyer dans un monde fantaisiste armée d'une poile à frire",
"Choose a server:": "Choisi un serveur :",
"You must have": "Tu dois avoir la permission",
"Manage Server": "Gérer le serveur",
"permission on this server to perform this action": "sur ce serveur pour effectuer cette action",
"OR": "OU",
"Add the bot on your server": "Ajoute le bot sur ton serveur",
"After adding the bot,": "Après avoir ajouté le bot sur ton serveur,",
"reload the page": "actualise la page",
"Let's go!": "C'est parti !", "Let's go!": "C'est parti !",
"Add author on Discord": "Ajoute moi sur Discord :)", "Add author on Discord": "Ajoute moi sur Discord ;)",
"Read the licence": "Voir la licence", "Read the licence": "Voir la licence",
"View the source code" : "Regarder le code source", "View the source code" : "Regarde le code source",
"Host it yourself": "Héberger ça vous-même", "Host it yourself": "Héberge ça chez toi",
"Next castastrophic life failure in about %days% days": "Prochaine vie de merde dans environ %days% jours" "Next castastrophic life failure in about %days% days": "Prochaine vie de merde dans environ %days% jours"
} }