This commit is contained in:
parent
c570daf09f
commit
c3f892637a
@ -1,6 +1,7 @@
|
|||||||
|
import json
|
||||||
from asyncio import new_event_loop
|
from asyncio import new_event_loop
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from os import environ
|
from os import environ, path
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from disnake import Client, Guild
|
from disnake import Client, Guild
|
||||||
@ -69,12 +70,36 @@ def make_oauth_session(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.context_processor
|
CATALOG_CACHE = {}
|
||||||
|
|
||||||
|
|
||||||
|
def i18n(str: str) -> str:
|
||||||
|
lang = request.accept_languages.best_match(["en", "fr"])
|
||||||
|
|
||||||
|
if lang not in CATALOG_CACHE:
|
||||||
|
catalog_file = f"{path.dirname(__file__)}/translations/{lang}.json"
|
||||||
|
if path.exists(catalog_file):
|
||||||
|
with open(catalog_file) as catalog_json:
|
||||||
|
catalog = json.load(catalog_json)
|
||||||
|
CATALOG_CACHE[lang] = catalog
|
||||||
|
|
||||||
|
if lang in CATALOG_CACHE and str in CATALOG_CACHE[lang]:
|
||||||
|
return CATALOG_CACHE[lang][str]
|
||||||
|
|
||||||
|
return str
|
||||||
|
|
||||||
|
|
||||||
def days_before_failure():
|
def days_before_failure():
|
||||||
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()
|
||||||
return dict(days_before_failure=nextDelta.days)
|
|
||||||
|
return nextDelta.days
|
||||||
|
|
||||||
|
|
||||||
|
@app.context_processor
|
||||||
|
def context_processor():
|
||||||
|
return dict(days_before_failure=days_before_failure(), _=i18n, bot=client.user)
|
||||||
|
|
||||||
|
|
||||||
@app.template_filter("guild_icon_ext")
|
@app.template_filter("guild_icon_ext")
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
|
/* https://google-webfonts-helper.herokuapp.com/fonts/open-sans?subsets=latin */
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Open Sans';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: local(''),
|
||||||
|
url('../fonts/open-sans-v29-latin-regular.woff2') format('woff2'),
|
||||||
|
url('../fonts/open-sans-v29-latin-regular.woff') format('woff');
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: #202225;
|
background-color: #202225;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
font-family: Whitney, "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
color: #b9bbbe;
|
||||||
}
|
}
|
||||||
|
|
||||||
#logo {
|
#logo {
|
||||||
@ -9,6 +21,10 @@ body {
|
|||||||
top: 24px;
|
top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#avatars {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@ -20,4 +36,56 @@ body {
|
|||||||
background-color: #18191c;
|
background-color: #18191c;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
|
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
|
||||||
|
padding: 32px 16px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#scopes {
|
||||||
|
list-style-type: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#scopes li {
|
||||||
|
margin: 8px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-custom-circle {
|
||||||
|
border-radius: 20px;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 22px;
|
||||||
|
font-size: 20px;
|
||||||
|
float: left;
|
||||||
|
margin-right: 12px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-check {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fa-times {
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 20px;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
color:rgba(79, 84, 92, 0.48);
|
||||||
|
margin: 24px 0;
|
||||||
}
|
}
|
||||||
|
BIN
divent/static/fonts/open-sans-v29-latin-regular.woff
Normal file
BIN
divent/static/fonts/open-sans-v29-latin-regular.woff
Normal file
Binary file not shown.
BIN
divent/static/fonts/open-sans-v29-latin-regular.woff2
Normal file
BIN
divent/static/fonts/open-sans-v29-latin-regular.woff2
Normal file
Binary file not shown.
@ -20,7 +20,7 @@
|
|||||||
id="logo"
|
id="logo"
|
||||||
height="36"
|
height="36"
|
||||||
width="130"
|
width="130"
|
||||||
alt="Discord Logo"/>
|
alt="{{ _('Discord Logo') }}"/>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -1,16 +1,27 @@
|
|||||||
{% extends "base.html.j2" %}
|
{% extends "base.html.j2" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="box">
|
<div id="box">
|
||||||
<h1>Divent</h1>
|
<div id="avatars">
|
||||||
<h2>The discord scheduled event calendar generator</h2>
|
<img src="{{ bot.display_avatar }}"
|
||||||
|
alt="{{ _('Bot Logo') }}"
|
||||||
|
width="80"
|
||||||
|
height="80"/>
|
||||||
|
</div>
|
||||||
|
<h1>{{ bot.display_name }}</h1>
|
||||||
|
<h2>{{ _('The discord scheduled event calendar generator') }}</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<h3>This will allow you to :</h3>
|
<h3>{{ _('This will allow you to:') }}</h3>
|
||||||
<ul>
|
<ul id="scopes">
|
||||||
<li>Subscribe to a calendar on Google, Yahoo, Outlook, Apple or any ICS complient software</li>
|
<li>
|
||||||
<li>Throwing you to a new isekai world</li>
|
<i class="fa fa-custom-circle fa-check"></i>
|
||||||
|
{{ _('Subscribe to a calendar on Google, Yahoo, Outlook, Apple or any ICS complient software') }}
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<i class="fa fa-custom-circle fa-times"></i>
|
||||||
|
{{ _('Throwing you to a new isekai world') }}
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<hr />
|
<hr />
|
||||||
</div>
|
</div>
|
||||||
<div id="buttons">
|
<div id="buttons"></div>
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
8
divent/translations/fr.json
Normal file
8
divent/translations/fr.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"Discord Logo": "Logo Discord",
|
||||||
|
"Bot Logo": "Logo du robot",
|
||||||
|
"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 :",
|
||||||
|
"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",
|
||||||
|
"Throwing you to a new isekai world": "Vous envoyer dans un monde fantaisiste armée d'une poile à frire"
|
||||||
|
}
|
2
poetry.lock
generated
2
poetry.lock
generated
@ -709,7 +709,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "1.1"
|
lock-version = "1.1"
|
||||||
python-versions = "^3.8"
|
python-versions = "^3.8"
|
||||||
content-hash = "2566e2b3365ca858319fc998523d32ffba94ee8df19bcc9b07257d2a19c8f7c6"
|
content-hash = "aad6f01abb7b6a536c0e82001edc4ffd2150ee3d6828467e661b4d25d042436c"
|
||||||
|
|
||||||
[metadata.files]
|
[metadata.files]
|
||||||
aiofiles = [
|
aiofiles = [
|
||||||
|
@ -11,6 +11,7 @@ disnake = "2.5.1"
|
|||||||
ics = "0.7"
|
ics = "0.7"
|
||||||
python-dotenv = "0.20.0"
|
python-dotenv = "0.20.0"
|
||||||
quart = "0.17.0"
|
quart = "0.17.0"
|
||||||
|
requests = "2.28.0"
|
||||||
requests-oauthlib = "1.3.1"
|
requests-oauthlib = "1.3.1"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
|
Loading…
Reference in New Issue
Block a user