Skip to content

Commit

Permalink
sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
KTachibanaM committed Jul 31, 2024
1 parent 2123a63 commit f57e6ff
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy

on:
push:
branches:
- main
- master
jobs:
deploy:
name: Deploy app
Expand Down
8 changes: 8 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import os
import sentry_sdk
from flask import Flask, g
from yurikamome.mastodon_meta_blueprint import meta_blueprint
from yurikamome.mastodon_timelines_blueprint import timelines_blueprint
from yurikamome.pages_blueprint import pages_blueprint
from yurikamome.helpers import get_db


if os.getenv('SENTRY_DSN'):
sentry_sdk.init(
dsn=os.getenv('SENTRY_DSN'),
)


app = Flask(__name__, template_folder='templates', static_folder='static')
app.register_blueprint(pages_blueprint, url_prefix='/')
app.register_blueprint(meta_blueprint, url_prefix='/')
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ flask[async]==3.0.2
pytz==2024.1
python-dotenv==1.0.1
twikit==2.1.0
sentry-sdk[flask]==1.43.0
2 changes: 1 addition & 1 deletion yurikamome/mastodon_meta_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def create_app_route():

@meta_blueprint.route('/oauth/authorize')
@session_authenticated
@catches_exceptions
# @catches_exceptions
def oauth_authorize():
if not g.session_row:
return redirect(f'/login?from={quote(request.full_path)}')
Expand Down
6 changes: 3 additions & 3 deletions yurikamome/pages_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

@pages_blueprint.route('/')
@session_authenticated
@catches_exceptions
# @catches_exceptions
def index():
username = None
if g.session_row:
Expand All @@ -20,7 +20,7 @@ def index():

@pages_blueprint.route('/login')
@session_authenticated
@catches_exceptions
# @catches_exceptions
def login():
if g.session_row:
return redirect('/')
Expand All @@ -30,7 +30,7 @@ def login():

@pages_blueprint.route('/logout')
@session_authenticated
@catches_exceptions
# @catches_exceptions
def logout():
if g.session_row:
delete_session(g.session_row['session_id'])
Expand Down

0 comments on commit f57e6ff

Please sign in to comment.