diff --git a/api.py b/api.py
index e996d84..22e2163 100644
--- a/api.py
+++ b/api.py
@@ -1,5 +1,5 @@
from sanic import response
-from sanic import Blueprint, exceptions
+from sanic import Blueprint
from ext import *
from config import *
import sqlite3
@@ -59,8 +59,8 @@ async def api_leaderboard(request):
async def send_feedback(request):
try:
async with httpx.AsyncClient() as client:
- r = await client.post("https://api.telegram.org/bot5648800229:AAGr5EJdyo4obXB7pftIcQGjYLAlQdpu1Iw/sendMessage",
- json = {'chat_id': -946677603, 'text': str(request.json)}
+ r = await client.post(f"https://api.telegram.org/bot{TG_BOT_API}/sendMessage",
+ json = {'chat_id': TG_CHAT_ID, 'text': str(request.json)}
)
except:
return response.json({'ok': False, 'error': 'There has been an issue sending your feedback.'})
@@ -85,19 +85,6 @@ async def show_events(request):
return r
-@bp.route("/achievements.json")
-async def show_achievements(request):
-
- if request.token:
- user = await request.app.ctx.om.get_order(code=request.token[:5])
- if not user or user.app_token != request.token[5:]:
- return response.json({'ok': False, 'error': 'The token you have provided is not valid.'}, status=401)
-
- with sqlite3.connect('data/boop.db') as db:
- db.row_factory = sqlite3.Row
- events = db.execute('SELECT * FROM achievement ORDER BY points DESC')
- return response.json([{'won_at': '2023-05-05T21:00Z' if request.token and random.random() < 0.2 else None, **dict(x), 'about': 'This is instructions on how to win the field.'} for x in events])
-
@bp.get("/logout")
async def logout(request):
if not request.token:
diff --git a/carpooling.py b/carpooling.py
index 03f5a82..3b89501 100644
--- a/carpooling.py
+++ b/carpooling.py
@@ -1,8 +1,6 @@
-from sanic.response import html, redirect, text
+from sanic.response import html
from sanic import Blueprint, exceptions
-from random import choice
from ext import *
-from config import headers
import json
bp = Blueprint("carpooling", url_prefix="/manage/carpooling")
diff --git a/config.example.py b/config.example.py
index b33b7b4..de039d9 100644
--- a/config.example.py
+++ b/config.example.py
@@ -1,11 +1,41 @@
-headers = {'Host': 'your-pretix-hostname', 'Authorization': 'Token XXXXXXXXXXXXXXXXXXXXXXXX'}
-base_url = "https://your-pretix-hostname/api/v1/organizers/organizer-name/events/your-event/"
+ORGANIZER = 'furizon'
+EVENT_NAME = 'river-side-2023'
+API_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxx'
+HOSTNAME = 'your-pretix-hostname'
+
+headers = {'Host': HOSTNAME, 'Authorization': f'Token {API_TOKEN}'}
+base_url = f"https://{HOSTNAME}/api/v1/organizers/{ORGANIZER}/events/{EVENT_NAME}/"
PROPIC_DEADLINE = 1683575684
FILL_CACHE = True
DEV_MODE = True
+ITEM_IDS = {
+ 'ticket': [90,],
+ 'membership_card': [91,],
+ 'sponsorship': [], # first one = normal, second = super
+ 'early_arrival': [],
+ 'late_departure': [],
+ 'room': 98
+}
+
+# Create a bunch of "room" items which will get added to the order once somebody gets a room.
+ROOM_MAP = {
+ 1: 16,
+ 2: 17,
+ 3: 18,
+ 4: 19,
+ 5: 20
+}
+
+# This is used for feedback sending inside of the app. Feedbacks will be sent to the specified chat using the bot api id.
+TG_BOT_API = '123456789:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
+TG_CHAT_ID = -1234567
+
+# These order codes have additional functions.
+ADMINS = ['XXXXX', 'YYYYY']
+
SMTP_HOST = 'your-smtp-host.com'
SMTP_USER = 'username'
SMTP_PASSWORD = 'password'
diff --git a/export.py b/export.py
index d6064f4..ad22b11 100644
--- a/export.py
+++ b/export.py
@@ -1,14 +1,14 @@
from sanic.response import text
from sanic import Blueprint, exceptions
from ext import *
-from config import headers
+from config import headers, ADMINS, ORGANIZER, EVENT_NAME
bp = Blueprint("export", url_prefix="/manage/export")
@bp.route("/export.csv")
async def export_csv(request, order: Order):
if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
- if order.code not in ['HWUC9','9YKGJ']: raise exceptions.Forbidden("Birichino :)")
+ if order.code not in ADMINS: raise exceptions.Forbidden("Birichino :)")
page = 0
orders = {}
@@ -18,7 +18,7 @@ async def export_csv(request, order: Order):
while 1:
page += 1
- r = httpx.get(f'https://reg.furizon.net/api/v1/organizers/furizon/events/beyond/orders/?page={page}', headers=headers)
+ r = httpx.get(f'https://reg.furizon.net/api/v1/organizers/{ORGANIZER}/events/{EVENT_NAME}/orders/?page={page}', headers=headers)
if r.status_code == 404: break
for r in r.json()['results']:
@@ -64,7 +64,7 @@ async def export_hotel_csv(request, order: Order):
while 1:
page += 1
- r = httpx.get(f'https://reg.furizon.net/api/v1/organizers/furizon/events/beyond/orders/?page={page}', headers=headers)
+ r = httpx.get(f'https://reg.furizon.net/api/v1/organizers/{ORGANIZER}/events/{EVENT_NAME}/orders/?page={page}', headers=headers)
if r.status_code == 404: break
for r in r.json()['results']:
diff --git a/karaoke.py b/karaoke.py
index ecf7627..3b2a15b 100644
--- a/karaoke.py
+++ b/karaoke.py
@@ -1,15 +1,8 @@
from sanic.response import html, redirect, text
from sanic import Blueprint, exceptions, response
-from random import choice
from ext import *
-from config import headers, PROPIC_DEADLINE
-from PIL import Image
-from os.path import isfile
-from os import unlink
-from io import BytesIO
-from hashlib import sha224
-from time import time
from urllib.parse import unquote
+from config import ADMINS
import json
bp = Blueprint("karaoke", url_prefix="/manage/karaoke")
@@ -17,7 +10,7 @@ bp = Blueprint("karaoke", url_prefix="/manage/karaoke")
@bp.get("/admin")
async def show_songs(request, order: Order):
- if order.code not in ['9YKGJ', 'CMPQG']:
+ if order.code not in ADMINS:
raise exceptions.Forbidden("Birichino")
orders = [x for x in request.app.ctx.om.cache.values() if x.karaoke_songs]
@@ -35,7 +28,7 @@ async def show_songs(request, order: Order):
@bp.post("/approve")
async def approve_songs(request, order: Order):
- if order.code not in ['9YKGJ', 'CMPQG']:
+ if order.code not in ADMINS:
raise exceptions.Forbidden("Birichino")
for song in request.form:
@@ -51,7 +44,7 @@ async def sing_song(request, order: Order, songname):
if not order: raise exceptions.Forbidden("You have been logged out. Please access the link in your E-Mail to login again!")
- if order.code not in ['9YKGJ', 'CMPQG']:
+ if order.code not in ADMINS:
raise exceptions.Forbidden("Birichino")
songname = unquote(songname)
diff --git a/propic.py b/propic.py
index 2a536a7..04a5472 100644
--- a/propic.py
+++ b/propic.py
@@ -1,11 +1,8 @@
-from sanic.response import html, redirect, text
+from sanic.response import html, redirect
from sanic import Blueprint, exceptions
-from random import choice
from ext import *
-from config import headers, PROPIC_DEADLINE
+from config import PROPIC_DEADLINE
from PIL import Image
-from os.path import isfile
-from os import unlink
from io import BytesIO
from hashlib import sha224
from time import time
diff --git a/stats.py b/stats.py
index ae37d1f..2025490 100644
--- a/stats.py
+++ b/stats.py
@@ -1,9 +1,6 @@
from sanic.response import html
-from sanic import Blueprint, exceptions
+from sanic import Blueprint
from ext import *
-from config import headers
-from time import time
-import asyncio
bp = Blueprint("stats", url_prefix="/manage")
diff --git a/tpl/base.html b/tpl/base.html
index c4100cd..66da42b 100644
--- a/tpl/base.html
+++ b/tpl/base.html
@@ -88,9 +88,6 @@
Nose Count
{% if order %}
Carpooling
- {% if not order.room_confirmed %}
- Roommate Search
- {% endif %}
Logout
{% endif %}
@@ -109,7 +106,7 @@
});