Compare commits

...

73 Commits

Author SHA1 Message Date
Michel Roux fa629143e7 Merge pull request 'Update dependency black to v23' (#99) from renovate/black-23.x into master
continuous-integration/drone/push Build is passing Details
4 days ago
Michel Roux b8bc180c6f Update dependency black to v23
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
4 days ago
Michel Roux 914ed744a0 Small fixes and add py.typed
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
3 weeks ago
Michel Roux 4027fd0063 Merge pull request 'Update dependency sentry-sdk to v1.13.0' (#98) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
3 weeks ago
Michel Roux 9a1aa6fc20 Update dependency sentry-sdk to v1.13.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
3 weeks ago
Michel Roux b23c972ffc Merge pull request 'Update dependency djlint to v1.19.11' (#97) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
1 month ago
Michel Roux 385d40b726 Update dependency djlint to v1.19.11
continuous-integration/drone/push Build is passing Details
1 month ago
Michel Roux 0e961faaa0 Merge pull request 'Update dependency djlint to v1.19.10' (#96) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
1 month ago
Michel Roux e176a51f7a Update dependency djlint to v1.19.10
continuous-integration/drone/push Build is passing Details
1 month ago
Michel Roux cef34a852f Update lock
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux f6a01c96a4 Merge pull request 'Update dependency flake8-black to v0.3.6' (#95) from renovate/flake8-black-0.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux da02181758 Update dependency flake8-black to v0.3.6
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 795c32fb46 Merge pull request 'Update dependency sentry-sdk to v1.12.1' (#94) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 2ebc39857b Update dependency sentry-sdk to v1.12.1
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 3b05b2ef95 Merge pull request 'Update dependency djlint to v1.19.9' (#93) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 005c4bdb65 Update dependency djlint to v1.19.9
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 85b6440e96 Merge pull request 'Update dependency sentry-sdk to v1.12.0' (#92) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux bf1aa03e8e Update dependency sentry-sdk to v1.12.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2 months ago
Michel Roux fc83203b70 Merge pull request 'Update dependency djlint to v1.19.8' (#91) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 00461f0e63 Update dependency djlint to v1.19.8
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 9b85d636b0 Merge pull request 'Update dependency black to v22.12.0' (#90) from renovate/black-22.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 1f310b9e32 Update dependency black to v22.12.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2 months ago
Michel Roux 33ed6d2b9b Merge pull request 'Update python Docker tag to v3.11.1' (#89) from renovate/python-3.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux c9bcfc8c91 Update python Docker tag to v3.11.1
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux b274e499c4 Update lock
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2 months ago
Michel Roux 7770e4e828 Merge pull request 'Update dependency flake8 to v6' (#86) from renovate/flake8-6.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux bdab7b5c9a Update dependency flake8 to v6
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 55903c12f6 Merge pull request 'Update dependency types-oauthlib to v3.2.0.1' (#88) from renovate/types-oauthlib-3.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux ba46852b05 Update dependency types-oauthlib to v3.2.0.1
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 6658109f0f Merge pull request 'Update dependency flake8-alphabetize to v0.0.19' (#87) from renovate/flake8-alphabetize-0.x into master
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 484c865d26 Update dependency flake8-alphabetize to v0.0.19
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux bad8cbd3a5 Fix TokenExpiredError #DIVENT-3
continuous-integration/drone/push Build is passing Details
2 months ago
Michel Roux 5fe486b03d Merge pull request 'Update dependency sentry-sdk to v1.11.1' (#85) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 4a013b7ad2 Update dependency sentry-sdk to v1.11.1
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 2e085abed7 Merge pull request 'Update dependency flake8-black to v0.3.5' (#84) from renovate/flake8-black-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 94cc28225b Update dependency flake8-black to v0.3.5
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 052c3468c8 Merge pull request 'Update dependency uvicorn to v0.20.0' (#83) from renovate/uvicorn-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux c9c5e3917b Update dependency uvicorn to v0.20.0
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 6f122a1f03 Merge pull request 'Update dependency flake8-black to v0.3.4' (#82) from renovate/flake8-black-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux d68e48e002 Update dependency flake8-black to v0.3.4
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux cb2cc1b042 Merge pull request 'Update dependency mypy to v0.991' (#80) from renovate/mypy-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 8b2281c153 Update dependency mypy to v0.991
continuous-integration/drone/push Build is failing Details
3 months ago
Michel Roux 187c364fa5 Merge pull request 'Update dependency sentry-sdk to v1.11.0' (#81) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux e21df47492 Update dependency sentry-sdk to v1.11.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
3 months ago
Michel Roux 051a2a4920 Merge pull request 'Update dependency djlint to v1.19.7' (#78) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux e3a60c1ad6 Update dependency djlint to v1.19.7
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 8a21afc11f Merge pull request 'Update dependency mypy to v0.990' (#79) from renovate/mypy-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 91732ec3d7 Update dependency mypy to v0.990
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 261c1b2b7f Fix Google and Outlook link
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 8f32dd9bb6 Merge pull request 'Update dependency djlint to v1.19.4' (#77) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 8780341bcb Update dependency djlint to v1.19.4
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux e63062cadf Merge pull request 'Update dependency disnake to v2.7.0' (#76) from renovate/disnake-2.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 1408a00ac9 Update dependency disnake to v2.7.0
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
3 months ago
Michel Roux bd29a2bd96 Merge pull request 'Update dependency flake8-alphabetize to v0.0.18' (#75) from renovate/flake8-alphabetize-0.x into master
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 29a168ffdc Update dependency flake8-alphabetize to v0.0.18
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 8fd4e8f243 Do not use slim image anymore
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux 459dbd5243 Update lock
continuous-integration/drone/push Build is failing Details
3 months ago
Michel Roux c81546b834 Merge pull request 'Update dependency djlint to v1.19.3' (#74) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is failing Details
3 months ago
Michel Roux ae00ebf0ae Update dependency djlint to v1.19.3
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux a5795bbda2 Merge pull request 'Update python Docker tag to v3.11.0' (#73) from renovate/python-3-x into master
continuous-integration/drone/push Build is failing Details
3 months ago
Michel Roux 64a8042dd5 Update python Docker tag to v3.11.0
continuous-integration/drone/push Build is passing Details
3 months ago
Michel Roux fc505d82ab Merge pull request 'Update dependency sentry-sdk to v1.10.1' (#72) from renovate/sentry-sdk-1.x into master
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 988dc05b3d Update dependency sentry-sdk to v1.10.1
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux e2beda32e5 Merge pull request 'Update dependency djlint to v1.19.2' (#71) from renovate/djlint-1.x into master
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 211580afbf Update dependency djlint to v1.19.2
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux f1073205a1 FIx sentry error
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 3f2bf09bf6 Merge pull request 'Update dependency disnake to v2.6.1' (#70) from renovate/disnake-2.x into master
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 2629afceda Update dependency disnake to v2.6.1
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux a35aeb629a Readd Sentry
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 4533920245 Revert "Remove Sentry"
4 months ago
Michel Roux 58f5e772b7 Merge pull request 'Update dependency uvicorn to v0.19.0' (#69) from renovate/uvicorn-0.x into master
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux 94ecdce208 Update dependency uvicorn to v0.19.0
continuous-integration/drone/push Build is passing Details
4 months ago
Michel Roux eccd531d45 Update version
continuous-integration/drone/push Build is passing Details
4 months ago

@ -4,7 +4,7 @@ type: docker
steps:
- name: lint
image: python:3.8-slim
image: python:3.8
commands:
- pip install poetry
- poetry install
@ -23,7 +23,7 @@ steps:
from_secret: docker_password
- name: publish
image: python:3.8-slim
image: python:3.8
commands:
- pip install poetry
- poetry publish --build

@ -1,2 +1,2 @@
[flake8]
max-line-length = 100
max-line-length = 88

@ -1,10 +1,10 @@
FROM python:3.10.8-slim as build
FROM python:3.11.1 as build
WORKDIR /app
COPY . .
RUN pip install poetry && poetry build
FROM python:3.10.8-slim
FROM python:3.11.1
COPY --from=build /app/dist /tmp/dist
RUN pip install /tmp/dist/*.whl && rm -rf /tmp/dist

@ -2,23 +2,26 @@ import json
import logging
from datetime import datetime, timedelta
from functools import wraps
from os import environ, path
from os import getenv, path
from typing import Dict, Optional
from disnake import Client, Guild
from dotenv import load_dotenv
from ics import Calendar, ContentLine, Event
from ics.alarm import DisplayAlarm
from oauthlib.oauth2 import TokenExpiredError
from quart import Quart, redirect, render_template, request, session, url_for
from requests_oauthlib import OAuth2Session # type: ignore
import sentry_sdk
from sentry_sdk.integrations.quart import QuartIntegration
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware # type: ignore
load_dotenv()
DISCORD_TOKEN = environ.get("DISCORD_TOKEN")
OAUTH2_CLIENT_ID = environ.get("OAUTH2_CLIENT_ID")
OAUTH2_CLIENT_SECRET = environ.get("OAUTH2_CLIENT_SECRET")
DISCORD_TOKEN = getenv("DISCORD_TOKEN")
OAUTH2_CLIENT_ID = getenv("OAUTH2_CLIENT_ID")
OAUTH2_CLIENT_SECRET = getenv("OAUTH2_CLIENT_SECRET")
if not DISCORD_TOKEN:
raise Exception("Missing DISCORD_TOKEN")
if not OAUTH2_CLIENT_ID:
@ -26,11 +29,15 @@ if not OAUTH2_CLIENT_ID:
if not OAUTH2_CLIENT_SECRET:
raise Exception("Missing OAUTH2_CLIENT_SECRET")
QUART_DEBUG = environ.get("QUART_DEBUG", False)
QUART_DEBUG = getenv("QUART_DEBUG", False)
if QUART_DEBUG:
logging.basicConfig(level=logging.DEBUG)
API_BASE_URL = environ.get("API_BASE_URL", "https://discordapp.com/api")
SENTRY_DSN = getenv("SENTRY_DSN")
if SENTRY_DSN:
sentry_sdk.init(SENTRY_DSN, integrations=[QuartIntegration()])
API_BASE_URL = getenv("API_BASE_URL", "https://discordapp.com/api")
AUTHORIZATION_BASE_URL = f"{API_BASE_URL}/oauth2/authorize"
TOKEN_URL = f"{API_BASE_URL}/oauth2/token"
@ -180,9 +187,12 @@ async def guilds():
url_for(".subscribe", guild_id=guild.vanity_url_code or guild.id)
)
discord = make_session(token=session.get("oauth2_token"))
user = discord.get(f"{API_BASE_URL}/users/@me").json()
user_guilds = discord.get(f"{API_BASE_URL}/users/@me/guilds").json()
try:
discord = make_session(token=session.get("oauth2_token"))
user = discord.get(f"{API_BASE_URL}/users/@me").json()
user_guilds = discord.get(f"{API_BASE_URL}/users/@me/guilds").json()
except TokenExpiredError:
return redirect(url_for(".login"))
common_guilds = []
for bot_guild in client.guilds:
@ -202,8 +212,11 @@ async def subscribe(guild_id: str):
if guild is None:
return redirect(url_for(".login"))
discord = make_session(token=session.get("oauth2_token"))
user_guilds = discord.get(f"{API_BASE_URL}/users/@me/guilds").json()
try:
discord = make_session(token=session.get("oauth2_token"))
user_guilds = discord.get(f"{API_BASE_URL}/users/@me/guilds").json()
except TokenExpiredError:
return redirect(url_for(".login"))
if not any(str(guild.id) == user_guild["id"] for user_guild in user_guilds):
return redirect(url_for(".login"))
@ -253,6 +266,7 @@ async def ical(guild_id: str):
return calendar.serialize()
quart_task = client.loop.create_task(app.run_task("0.0.0.0"))
quart_task.add_done_callback(lambda f: client.loop.stop())
client.run(DISCORD_TOKEN)
def __main__():
quart_task = client.loop.create_task(app.run_task("0.0.0.0"))
quart_task.add_done_callback(lambda f: client.loop.stop())
client.run(DISCORD_TOKEN)

@ -21,7 +21,7 @@
<li>
<a class="button"
target="_blank"
href="https://calendar.google.com/calendar/u/0/r?cid={{ request.host_url }}{{ guild.vanity_url_code|default(guild.id, True) }}.ics">
href="https://calendar.google.com/calendar/u/0/r?cid=webcal://{{ request.host }}/{{ guild.vanity_url_code|default(guild.id, True) }}.ics">
<i class="fa fa-google"></i>
{{ _("Subscribe to") }} Google
</a>
@ -29,7 +29,7 @@
<li>
<a class="button"
target="_blank"
href="https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&url={{ request.host_url }}{{ guild.vanity_url_code|default(guild.id, True) }}.ics">
href="https://outlook.live.com/owa?path=/calendar/action/compose&rru=addsubscription&url=webcal://{{ request.host }}/{{ guild.vanity_url_code|default(guild.id, True) }}.ics">
<i class="fa fa-windows"></i>
{{ _("Subscribe to") }} Outlook
</a>

1863
poetry.lock generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
[tool.poetry]
name = "divent"
version = "2.0.2"
version = "3.1.0"
description = "The discord scheduled event calendar generator"
authors = ["Xéfir Destiny"]
license = "WTFPL"
@ -12,21 +12,23 @@ repository = "https://git.crystalyx.net/Xefir/Divent"
divent = 'divent.bot:__main__'
[tool.poetry.dependencies]
python = "^3.8"
disnake = "2.6.0"
python = "^3.8.1"
disnake = "^2.7.0"
ics = "0.8.0.dev0"
python-dotenv = "0.21.0"
quart = "0.18.3"
requests-oauthlib = "1.3.1"
uvicorn = "0.18.3"
python-dotenv = "^0.21.0"
quart = "^0.18.3"
requests-oauthlib = "^1.3.1"
sentry-sdk = "^1.13.0"
uvicorn = "^0.20.0"
[tool.poetry.dev-dependencies]
black = "22.10.0"
djlint = "1.19.1"
flake8 = "5.0.4"
flake8-alphabetize = "0.0.17"
flake8-black = "0.3.3"
mypy = "0.982"
black = "^23.0.0"
djlint = "^1.19.11"
flake8 = "^6.0.0"
flake8-alphabetize = "^0.0.19"
flake8-black = "^0.3.6"
mypy = "^0.991"
types-oauthlib = "^3.2.0.1"
[build-system]
requires = ["poetry-core>=1.0.0"]

Loading…
Cancel
Save