Initial commit

This commit is contained in:
marc
2025-03-09 20:00:54 +01:00
commit efd26ce19d
118 changed files with 78086 additions and 0 deletions

View File

View File

@@ -0,0 +1,11 @@
import os
import random
import string
from datetime import timedelta
SESSION_DURATION = timedelta(minutes=30)
COOKIE_NAME = "nota_folkugat"
COOKIE_MAX_AGE = int(SESSION_DURATION.total_seconds())
ADMIN_PASSWORD = os.getenv("ADMIN_PASSWORD", "hola")
JWT_SECRET = os.getenv("JWT_SECRET", "".join(random.choice(string.ascii_letters) for _ in range(32)))

View File

@@ -0,0 +1,21 @@
import dataclasses
CALENDAR_LIST_ID = "calendar-list"
HISTORY_LIST_ID = "history-list"
@dataclasses.dataclass
class PagingConfig:
initial_items: int
step: int
CALENDARI_PAGING_CONFIG = PagingConfig(
initial_items=3,
step=2
)
HISTORY_PAGING_CONFIG = PagingConfig(
initial_items=3,
step=2
)

View File

@@ -0,0 +1,23 @@
DAY_NAMES_CAT = {
0: "Dilluns",
1: "Dimarts",
2: "Dimecres",
3: "Dijous",
4: "Divendres",
5: "Dissabte",
6: "Diumenge",
}
MONTH_NAMES_CAT = {
1: "de Gener",
2: "de Febrer",
3: "de Març",
4: "d'Abril",
5: "de Maig",
6: "de Juny",
7: "de Juliol",
8: "de Agost",
9: "de Setembre",
10: "d'Octubre",
11: "de Novembre",
12: "de Desembre",
}

10
folkugat_web/config/db.py Normal file
View File

@@ -0,0 +1,10 @@
import os
from pathlib import Path
from folkugat_web.log import logger
DB_DIR = Path(os.getenv("DB_DIR", "/home/marc/tmp/folkugat")).resolve()
DB_FILE = DB_DIR / "folkugat.db"
DB_TEMES_DIR = DB_DIR / "temes"
logger.info(f"Using DB_DIR: {DB_DIR}")

View File

@@ -0,0 +1,10 @@
from pathlib import Path
from folkugat_web.log import logger
APP_DIR = Path(__file__).resolve().parent.parent
ASSETS_DIR = APP_DIR / "assets"
STATIC_DIR = ASSETS_DIR / "static"
TEMPLATES_DIR = ASSETS_DIR / "templates"
logger.info(f"Using APP_DIR: {APP_DIR}")

View File

@@ -0,0 +1 @@
LOGGED_IN_FOOTER = "😎"

View File

@@ -0,0 +1,8 @@
# Minimum ngram length to compute, search string shorther than this limit are ignored
MIN_NGRAM_LENGTH = 3
# Maximum number of insertions/deletions to check for when comparing strings
QUERY_NGRAM_RANGE = 2
# Maximum distance to show a match as the result of a search
SEARCH_DISTANCE_THRESHOLD = 0.25