Initial commit
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
**/**.pyc
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#+title: Readme
|
||||||
|
|
||||||
|
* Tasques
|
||||||
|
** TODO Refactor organitzatiu
|
||||||
|
* Idees
|
||||||
|
** Jams
|
||||||
|
*** Properes jams
|
||||||
|
**** Data i lloc de les properes jams
|
||||||
|
**** Info dels temes que es tocaràn (a la slow jam)
|
||||||
|
*** Live jam
|
||||||
|
**** Quin tema està sonant ara
|
||||||
|
*** Historial de jams
|
||||||
|
**** Veure a cada jam passada quins temes s'han tocat
|
||||||
|
** Temes
|
||||||
|
*** Navegació
|
||||||
|
**** Cerca de temes
|
||||||
|
***** Per nom, tonalitat, compàs, tipus, (shazam!?!?!)
|
||||||
|
***** Per tocats recentment
|
||||||
|
**** Informació
|
||||||
|
***** Nom
|
||||||
|
***** Tonalitat i compàs
|
||||||
|
***** Vegades que s'ha tocat
|
||||||
|
* Referències
|
||||||
|
Fonts d'inspiració i altres materials de referència per fer la web de folkugat
|
||||||
|
** Simple Site
|
||||||
|
https://github.com/tataraba/simplesite
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
rec {
|
||||||
|
# Custom python package
|
||||||
|
jinja2-fragments = pkgs.python311Packages.buildPythonPackage rec {
|
||||||
|
pname = "jinja2_fragments";
|
||||||
|
version = "1.2.1";
|
||||||
|
|
||||||
|
format = "wheel";
|
||||||
|
src = pkgs.python311Packages.fetchPypi rec {
|
||||||
|
inherit pname version format;
|
||||||
|
sha256 = "c9255e5aadd2cb4e3fbd27530370af0b728a522f139455008febc5145d819f84";
|
||||||
|
dist = python;
|
||||||
|
python = "py3";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
pytailwindcss = pkgs.python311Packages.buildPythonPackage rec {
|
||||||
|
pname = "pytailwindcss";
|
||||||
|
version = "0.2.0";
|
||||||
|
|
||||||
|
format = "wheel";
|
||||||
|
src = pkgs.python311Packages.fetchPypi rec {
|
||||||
|
inherit pname version format;
|
||||||
|
sha256 = "30e7bd3b78de19a39a7e66329db02d393ee540f010924397b4d780e85041fae4";
|
||||||
|
dist = python;
|
||||||
|
python = "py3";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
description = "Development flake for the HTMX folkugat web";
|
||||||
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
|
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
|
python = pkgs.python311;
|
||||||
|
pythonPackages = pkgs.python311Packages;
|
||||||
|
|
||||||
|
# custom-python = import ./custom-python.nix { inherit pkgs; };
|
||||||
|
|
||||||
|
projectDependencies = with pythonPackages; [
|
||||||
|
# API
|
||||||
|
fastapi
|
||||||
|
jinja2
|
||||||
|
uvicorn
|
||||||
|
# Auth
|
||||||
|
pyjwt
|
||||||
|
# Search
|
||||||
|
levenshtein
|
||||||
|
# Test
|
||||||
|
pytest
|
||||||
|
];
|
||||||
|
|
||||||
|
in {
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
nativeBuildInputs = [ pkgs.bashInteractive ];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Core python dependencies
|
||||||
|
python
|
||||||
|
pythonPackages.pip
|
||||||
|
pythonPackages.virtualenv
|
||||||
|
# Other dependencies
|
||||||
|
nodePackages_latest.tailwindcss
|
||||||
|
# IDE tools
|
||||||
|
pythonPackages.pylsp-mypy
|
||||||
|
pythonPackages.isort
|
||||||
|
pythonPackages.autopep8
|
||||||
|
nodePackages.pyright
|
||||||
|
# Development tools
|
||||||
|
black
|
||||||
|
pythonPackages.ipython
|
||||||
|
pythonPackages.pytest
|
||||||
|
pythonPackages.setuptools
|
||||||
|
] ++ projectDependencies;
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from ._router import router
|
||||||
|
from .auth import *
|
||||||
|
from .index import *
|
||||||
|
from .sessions import *
|
||||||
|
from .tema import *
|
||||||
|
from .temes import *
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
from fastapi.responses import HTMLResponse
|
||||||
|
|
||||||
|
router = APIRouter(default_response_class=HTMLResponse)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
from typing import Annotated, Optional
|
||||||
|
|
||||||
|
from fastapi import Cookie, Form, Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.config import auth as config
|
||||||
|
from folkugat_web.fragments import nota
|
||||||
|
from folkugat_web.services import auth as service
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/nota")
|
||||||
|
def nota_input(request: Request, value: Optional[str] = None):
|
||||||
|
return nota.input(request, value)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/api/nota")
|
||||||
|
def login(request: Request, value: Annotated[Optional[str], Form()] = None,
|
||||||
|
nota_folkugat: Annotated[Optional[str], Cookie()] = None):
|
||||||
|
logged_in = service.logged_in(nota_folkugat)
|
||||||
|
new_login = service.login(value)
|
||||||
|
if new_login and not logged_in:
|
||||||
|
response = nota.nota(request)
|
||||||
|
response.set_cookie(key=config.COOKIE_NAME,
|
||||||
|
value=service.build_token(),
|
||||||
|
max_age=config.COOKIE_MAX_AGE)
|
||||||
|
else:
|
||||||
|
response = nota.footer(request, value, logged_in)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/api/logout")
|
||||||
|
def logout(request: Request):
|
||||||
|
response = nota.nota(request)
|
||||||
|
response.delete_cookie(key=config.COOKIE_NAME)
|
||||||
|
return response
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/")
|
||||||
|
def index(request: Request, logged_in: auth.LoggedIn):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"index.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"page_title": "Folkugat",
|
||||||
|
"content": "/api/content/sessions",
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"animate": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from . import editor, index, sessio
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import datetime
|
||||||
|
from typing import Annotated, Optional
|
||||||
|
|
||||||
|
from fastapi import Form, Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.fragments import sessions
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/api/sessions/editor/")
|
||||||
|
def insert_row(request: Request, _: auth.RequireLogin):
|
||||||
|
return sessions.sessions_editor_insert_row(request)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/sessions/editor/{session_id}/")
|
||||||
|
def editor_row(request: Request, session_id: int, _: auth.RequireLogin):
|
||||||
|
return sessions.sessions_editor_row(request, session_id=session_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/api/sessions/editor/{session_id}/")
|
||||||
|
def modify_session(
|
||||||
|
request: Request, session_id: int,
|
||||||
|
_: auth.RequireLogin,
|
||||||
|
date: Annotated[datetime.date, Form()],
|
||||||
|
start_time: Annotated[datetime.time, Form()],
|
||||||
|
end_time: Annotated[datetime.time, Form()],
|
||||||
|
venue_name: Annotated[Optional[str], Form()] = None,
|
||||||
|
venue_url: Annotated[Optional[str], Form()] = None,
|
||||||
|
):
|
||||||
|
session_date = sessions.model.Session(id=session_id, date=date, start_time=start_time, end_time=end_time,
|
||||||
|
venue=sessions.model.SessionVenue(name=venue_name, url=venue_url))
|
||||||
|
return sessions.sessions_editor_post_row(request, session_date)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/api/sessions/editor/{session_id}/")
|
||||||
|
def delete_date(session_id: int, _: auth.RequireLogin):
|
||||||
|
return sessions.sessions_editor_delete_row(session_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/sessions/editor/{session_id}/edita")
|
||||||
|
def editor_row_editing(request: Request, session_id: int, _: auth.RequireLogin):
|
||||||
|
return sessions.sessions_editor_row_editing(request, session_id)
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.config import calendari as calendari_conf
|
||||||
|
from folkugat_web.fragments import live, sessions
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/sessions")
|
||||||
|
def page(request: Request, logged_in: auth.LoggedIn):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"index.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"page_title": "Folkugat",
|
||||||
|
"content": "/api/content/sessions",
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"animate": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/content/sessions")
|
||||||
|
def content(request: Request, logged_in: auth.LoggedIn):
|
||||||
|
return sessions.sessions_pagina(request, logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/sessions/upcoming")
|
||||||
|
def calendari(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.LoggedIn,
|
||||||
|
limit: int = calendari_conf.CALENDARI_PAGING_CONFIG.initial_items,
|
||||||
|
):
|
||||||
|
return sessions.sessions_calendari(request=request, limit=limit, logged_in=logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/sessions/history")
|
||||||
|
def history(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.LoggedIn,
|
||||||
|
limit: int = calendari_conf.HISTORY_PAGING_CONFIG.initial_items,
|
||||||
|
):
|
||||||
|
return sessions.sessions_historial(request=request, limit=limit, logged_in=logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/sessions/live")
|
||||||
|
def get_live(request: Request):
|
||||||
|
return live.sessio_en_directe(request)
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.fragments import live, sessions
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/sessio/{session_id}")
|
||||||
|
def page(
|
||||||
|
request: Request,
|
||||||
|
session_id: int,
|
||||||
|
logged_in: auth.LoggedIn,
|
||||||
|
):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"index.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"page_title": "Folkugat",
|
||||||
|
"content": f"/api/content/sessio/{session_id}",
|
||||||
|
"logged_in": logged_in,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/content/sessio/{session_id}")
|
||||||
|
def contingut(
|
||||||
|
request: Request,
|
||||||
|
session_id: int,
|
||||||
|
logged_in: auth.LoggedIn,
|
||||||
|
):
|
||||||
|
return sessions.sessio(request, session_id, logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/api/sessio/{session_id}/live")
|
||||||
|
def set_live(request: Request, session_id: int, _: auth.RequireLogin):
|
||||||
|
return live.start_live_session(request=request, session_id=session_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/api/sessio/{session_id}/live")
|
||||||
|
def stop_live(request: Request, session_id: int, _: auth.RequireLogin):
|
||||||
|
return live.stop_live_session(request=request, session_id=session_id)
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from . import editor, index
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.fragments import tema
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/tema/{tema_id}/editor/title")
|
||||||
|
def title_editor(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.RequireLogin,
|
||||||
|
tema_id: int,
|
||||||
|
):
|
||||||
|
return tema.title_editor(request=request, logged_in=logged_in, tema_id=tema_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/tema/{tema_id}/editor/lyric/{lyric_idx}")
|
||||||
|
def lyric_editor(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.RequireLogin,
|
||||||
|
tema_id: int,
|
||||||
|
lyric_idx: int,
|
||||||
|
):
|
||||||
|
return tema.lyric_editor(request=request, logged_in=logged_in, tema_id=tema_id, lyric_idx=lyric_idx)
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import Request
|
||||||
|
from fastapi.params import Form
|
||||||
|
from fastapi.responses import HTMLResponse
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.fragments import tema, temes
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
from folkugat_web.services.temes import write as temes_w
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/tema/{tema_id}")
|
||||||
|
def page(request: Request, logged_in: auth.LoggedIn, tema_id: int):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"index.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"page_title": "Folkugat",
|
||||||
|
"content": f"/api/tema/{tema_id}",
|
||||||
|
"logged_in": logged_in,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/tema/{tema_id}")
|
||||||
|
def contingut(request: Request, logged_in: auth.LoggedIn, tema_id: int):
|
||||||
|
return temes.tema(request, tema_id, logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/tema/{tema_id}/title")
|
||||||
|
def title(request: Request, logged_in: auth.LoggedIn, tema_id: int):
|
||||||
|
return tema.title(request=request, tema_id=tema_id, logged_in=logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/api/tema/{tema_id}/title")
|
||||||
|
def set_title(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.RequireLogin,
|
||||||
|
tema_id: int,
|
||||||
|
title: Annotated[str, Form()],
|
||||||
|
):
|
||||||
|
new_tema = temes_w.update_title(tema_id=tema_id, title=title)
|
||||||
|
return tema.title(request=request, tema=new_tema, logged_in=logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/tema/{tema_id}/lyric/{lyric_idx}")
|
||||||
|
def lyric(request: Request, logged_in: auth.LoggedIn, tema_id: int, lyric_idx: int):
|
||||||
|
return tema.lyric(request=request, logged_in=logged_in, tema_id=tema_id, lyric_idx=lyric_idx)
|
||||||
|
|
||||||
|
|
||||||
|
@router.put("/api/tema/{tema_id}/lyric/{lyric_idx}")
|
||||||
|
def set_lyric(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.RequireLogin,
|
||||||
|
tema_id: int,
|
||||||
|
lyric_idx: int,
|
||||||
|
title: Annotated[str, Form()],
|
||||||
|
lyric: Annotated[str, Form()],
|
||||||
|
):
|
||||||
|
new_lyric = model.Lyrics(title=title, content=lyric.strip())
|
||||||
|
temes_w.update_lyric(tema_id=tema_id, lyric_idx=lyric_idx, lyric=new_lyric)
|
||||||
|
return tema.lyric(request=request, logged_in=logged_in, tema_id=tema_id, lyric_idx=lyric_idx)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/api/tema/{tema_id}/lyric")
|
||||||
|
def add_lyric(
|
||||||
|
request: Request,
|
||||||
|
logged_in: auth.RequireLogin,
|
||||||
|
tema_id: int,
|
||||||
|
):
|
||||||
|
new_tema = temes_w.add_lyric(tema_id=tema_id)
|
||||||
|
lyric_idx = len(new_tema.lyrics) - 1
|
||||||
|
return tema.lyric_editor(request=request, logged_in=logged_in, tema_id=tema_id, lyric_idx=lyric_idx)
|
||||||
|
|
||||||
|
|
||||||
|
@router.delete("/api/tema/{tema_id}/lyric/{lyric_idx}")
|
||||||
|
def delete_lyric(
|
||||||
|
tema_id: int,
|
||||||
|
lyric_idx: int,
|
||||||
|
):
|
||||||
|
temes_w.delete_lyric(tema_id=tema_id, lyric_idx=lyric_idx)
|
||||||
|
return HTMLResponse()
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from . import index
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.api import router
|
||||||
|
from folkugat_web.fragments import temes
|
||||||
|
from folkugat_web.services import auth
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/temes")
|
||||||
|
def page(request: Request, logged_in: auth.LoggedIn):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"index.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"page_title": "Folkugat",
|
||||||
|
"content": "/api/content/temes",
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"animate": False,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/content/temes")
|
||||||
|
def content(request: Request, logged_in: auth.LoggedIn):
|
||||||
|
return temes.temes_pagina(request, logged_in)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/api/temes/busca")
|
||||||
|
def busca(request: Request, query: str, logged_in: auth.LoggedIn):
|
||||||
|
return temes.temes_busca(request, query, logged_in)
|
||||||
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 127 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 768 B |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 105 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="177.53542mm"
|
||||||
|
height="177.5347mm"
|
||||||
|
viewBox="0 0 177.53542 177.5347"
|
||||||
|
version="1.1"
|
||||||
|
id="svg5"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:docname="logo.svg"
|
||||||
|
inkscape:export-filename="logo.svg"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||||
|
id="namedview7"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
showgrid="false" /><defs
|
||||||
|
id="defs2" /><g
|
||||||
|
inkscape:label="Capa 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-16.357134,-11.673413)"><g
|
||||||
|
id="g1750"
|
||||||
|
transform="translate(4.2160449,-42.578505)"><path
|
||||||
|
style="fill:#b27c09;fill-opacity:1;stroke-width:0.264583"
|
||||||
|
d="m 109.80613,229.62572 c -0.63997,-1.02476 -1.08638,-2.99196 -1.08926,-4.80004 -0.003,-2.05482 -0.0805,-2.06137 -1.60247,-0.13597 -0.57542,0.72797 -1.04623,1.2587 -1.04623,1.17941 0,-0.55297 1.83156,-3.79277 2.75726,-4.87725 0.62321,-0.73012 1.27508,-1.84884 1.45802,-2.50221 0.29488,-1.05324 0.27395,-1.29358 -0.19252,-2.21061 -0.75461,-1.48347 -2.0795,-5.55852 -2.44961,-7.5344 -0.17479,-0.93312 -0.32773,-2.91698 -0.33988,-4.40857 -0.0121,-1.49158 -0.0652,-2.71197 -0.11799,-2.71197 -0.0528,0 -0.68568,0.64529 -1.4065,1.43399 -0.72083,0.78869 -1.94987,1.79477 -2.73122,2.23574 -1.42359,0.80343 -2.30151,1.75896 -2.6515,2.88591 -0.2605,0.83878 0.61508,2.54011 2.17707,4.23028 l 1.27686,1.38164 -0.59607,2.31674 -0.59608,2.31674 -0.0137,-2.1701 -0.0137,-2.17011 -1.15038,-0.79148 c -0.63271,-0.43532 -1.36672,-1.12166 -1.631131,-1.5252 l -0.480748,-0.73371 -0.739098,2.37756 c -0.754494,2.42709 -2.210985,4.8751 -3.339894,5.61357 -0.594307,0.38877 -0.594302,0.38868 0.05509,-0.77322 0.898139,-1.60694 2.660933,-7.00031 3.253602,-9.95457 l 0.492379,-2.45435 2.1099,-1.66838 c 3.15273,-2.49298 4.73416,-4.19483 5.67624,-6.10848 l 0.84726,-1.72102 -2.40205,-3.56073 c -2.69587,-3.99627 -3.92476,-6.30398 -4.8034,-9.0202 -0.32951,-1.01865 -0.68341,-1.94517 -0.786446,-2.05894 -0.313325,-0.34596 -1.636718,1.1777 -2.36283,2.7204 -0.72535,1.54107 -0.776055,2.33606 -0.548452,8.59896 0.09238,2.5421 0.133125,2.41554 -1.945349,6.04279 -0.596321,1.04068 -0.466074,3.05252 0.300318,4.63877 0.290285,0.60082 0.428807,1.0924 0.307832,1.0924 -0.442902,0 -2.036993,-2.14165 -2.335374,-3.13755 -0.477483,-1.59369 -0.386519,-2.16777 0.808556,-5.10278 1.079238,-2.65052 1.114629,-2.83049 1.085173,-5.51801 -0.02953,-2.69398 -0.644546,-6.75167 -1.09101,-7.19813 -0.325665,-0.32567 -3.96304,0.94076 -5.808456,2.02233 -2.583069,1.51389 -3.216135,2.92351 -4.175789,9.29801 -0.374523,2.48776 -0.875485,4.78572 -1.20637,5.53374 -0.93145,2.1057 -0.464672,4.05505 1.860198,7.76853 1.253701,2.00252 1.531204,3.45342 1.07325,5.61139 -0.317841,1.49774 -0.253426,4.26799 0.125728,5.40684 0.09689,0.29104 -0.03185,0.17198 -0.286105,-0.26458 -0.320715,-0.55069 -0.55707,-1.90629 -0.771827,-4.42681 -0.271454,-3.18592 -0.411871,-3.8409 -1.140925,-5.32182 -0.958011,-1.946 -2.829555,-4.40658 -3.351686,-4.40658 -0.529085,0 -1.377932,1.32869 -1.722134,2.69564 -0.244922,0.97267 -0.218932,1.65116 0.13575,3.54398 0.366948,1.95828 0.387271,2.61338 0.124293,4.0071 -0.35696,1.89182 -0.782378,2.43116 -0.782378,0.99189 0,-0.5299 -0.359434,-1.78239 -0.798742,-2.78332 -0.899346,-2.04908 -1.487038,-5.4865 -1.199796,-7.01764 0.151659,-0.80842 0.590412,-1.389 2.154465,-2.85091 2.403761,-2.24678 3.436059,-4.16245 3.800877,-7.05341 0.34602,-2.74198 -0.294322,-8.87356 -0.924943,-8.85679 -0.139555,0.004 -1.357977,0.10217 -2.707606,0.2188 l -2.45387,0.21206 -0.826741,1.63328 c -1.589969,3.14108 -1.913491,5.75534 -1.103461,8.91664 0.278771,1.08795 0.368967,2.01815 0.243724,2.51354 l -0.198824,0.78643 -0.346662,-0.92604 c -0.190664,-0.50932 -0.610426,-1.58089 -0.932805,-2.38125 -0.507521,-1.26001 -0.566161,-1.77463 -0.437168,-3.83646 0.127884,-2.0441 0.685675,-4.60892 1.366599,-6.28385 0.142367,-0.3502 0.05813,-0.46302 -0.34572,-0.46302 -0.83525,0 -1.846744,1.44583 -2.464896,3.52333 -1.229434,4.13191 -3.559405,7.38249 -5.828432,8.13134 -1.886913,0.62274 -2.748463,1.58222 -3.256923,3.62713 -0.243948,0.9811 -0.561393,2.23713 -0.705432,2.79117 -0.230394,0.88621 -2.217714,3.3124 -2.490102,3.04001 -0.05378,-0.0538 0.191129,-0.68878 0.54424,-1.41111 0.419785,-0.85873 0.741846,-2.18339 0.93042,-3.82687 0.175168,-1.52662 0.515538,-2.98104 0.866873,-3.70417 0.498041,-1.02509 0.840825,-1.31938 2.46548,-2.11667 2.98785,-1.46627 3.134667,-1.66548 4.212204,-5.71523 1.047853,-3.93819 1.624944,-4.77965 4.219533,-6.15249 1.205968,-0.63811 1.603592,-0.70245 4.497917,-0.72781 1.74625,-0.0153 3.426616,-0.0451 3.734149,-0.0661 0.30753,-0.0211 1.379093,-0.64514 2.38125,-1.38681 2.255075,-1.66892 3.223006,-2.17056 5.830485,-3.02173 2.643759,-0.86301 3.922792,-1.62615 5.435024,-3.24285 1.246264,-1.33236 2.542561,-3.49944 2.09328,-3.49944 -0.136414,0 -0.780235,0.22813 -1.430716,0.50696 -1.907231,0.81754 -4.805069,1.54401 -9.047639,2.26821 -7.382473,1.26016 -10.470682,2.41564 -12.547222,4.69462 -2.545223,2.79336 -3.501991,3.65504 -4.774179,4.29971 -0.722773,0.36625 -1.380209,0.66592 -1.460973,0.66592 -0.08076,0 0.503666,-0.65051 1.298728,-1.44557 1.187908,-1.1879 1.54014,-1.7608 1.976149,-3.21413 0.345829,-1.15273 0.828575,-2.07601 1.386369,-2.65151 0.470686,-0.48562 0.784538,-0.9542 0.69745,-1.04129 -0.219811,-0.21981 -3.824515,0.79627 -5.535483,1.56032 -1.983658,0.88582 -4.059724,2.5273 -5.295757,4.18717 -0.579276,0.77791 -1.571501,1.91649 -2.204948,2.53018 -1.382257,1.33913 -2.508562,2.95722 -3.182964,4.57275 -0.418878,1.00342 -0.50188,1.93943 -0.527894,5.95312 -0.0322,4.96818 -0.12147,5.47157 -1.422611,8.02202 -0.306235,0.60026 -0.913638,1.49782 -1.349788,1.99457 -0.974966,1.11043 -1.585003,2.51902 -1.585003,Line truncated
|
||||||
|
id="path1760" /><path
|
||||||
|
style="fill:#cbba6d;stroke-width:0.264583"
|
||||||
|
d="m 53.732253,199.37515 c 0.0054,-0.43657 0.06469,-0.58313 0.131773,-0.3257 0.06708,0.25743 0.06267,0.61462 -0.0098,0.79375 -0.07248,0.17913 -0.127363,-0.0315 -0.121971,-0.46805 z"
|
||||||
|
id="path1758" /><path
|
||||||
|
style="fill:#998760;stroke-width:0.264583"
|
||||||
|
d="m 39.500325,131.97254 -0.504028,-0.59531 0.595312,0.50403 c 0.559446,0.47366 0.715762,0.68659 0.504029,0.68659 -0.05021,0 -0.318098,-0.26789 -0.595313,-0.59531 z"
|
||||||
|
id="path1754" /><path
|
||||||
|
style="fill:#361d2e;fill-opacity:1;stroke-width:0.264583"
|
||||||
|
d="m 110.05781,228.19268 c 0.0127,-0.30822 0.0754,-0.37092 0.15985,-0.15985 0.0764,0.19099 0.067,0.4192 -0.0209,0.50712 -0.0879,0.0879 -0.15046,-0.0684 -0.13897,-0.34727 z m -50.424013,-75.6241 c -0.436562,-0.19332 -1.559872,-1.17092 -2.496246,-2.17246 -0.936373,-1.00154 -2.907048,-3.07113 -4.379275,-4.5991 -1.472229,-1.52797 -4.866362,-5.09984 -7.542517,-7.9375 -2.676157,-2.83766 -6.304891,-6.64766 -8.063853,-8.46667 -13.966818,-14.44362 -14.301382,-14.85877 -14.285925,-17.72708 0.0064,-1.19171 0.16891,-2.01603 0.529167,-2.68455 0.285944,-0.53062 3.407659,-4.23639 6.937145,-8.23505 3.529485,-3.998659 6.904498,-7.882253 7.500027,-8.630206 1.615639,-2.029156 2.70273,-2.549403 10.027519,-4.798843 1.527968,-0.469239 3.739255,-1.195409 4.913971,-1.613715 2.572967,-0.916207 4.960369,-1.01088 6.608908,-0.26208 0.58951,0.267769 1.661073,1.114673 2.38125,1.882013 0.720178,0.767336 1.4355,1.527905 1.589604,1.69015 0.154106,0.162243 2.287757,2.497646 4.741444,5.189781 2.453688,2.692136 5.066038,5.544606 5.805223,6.33882 2.803748,3.01248 4.618694,4.99437 7.03683,7.6841 1.373687,1.52797 3.163474,3.4925 3.977304,4.36562 1.804442,1.93591 4.784878,5.16132 5.146508,5.56953 0.145521,0.16426 1.395677,1.51854 2.778125,3.0095 1.382448,1.49096 2.744798,3.07558 3.027445,3.52137 0.690578,1.0892 0.646141,2.75595 -0.141613,5.31156 -0.831006,2.69592 -2.057689,4.3205 -3.981284,5.27268 -1.2847,0.63593 -1.879118,0.74737 -4.621215,0.86635 -6.588437,0.28587 -8.256582,0.39203 -8.606589,0.54774 -0.198615,0.0884 -1.667343,1.63264 -3.263839,3.43172 -1.596499,1.79909 -3.267213,3.66307 -3.712702,4.14219 -0.44549,0.47911 -2.214653,2.41893 -3.931471,4.3107 -1.716817,1.89177 -3.497056,3.64794 -3.956087,3.9026 -0.982503,0.54508 -2.89442,0.5883 -4.017854,0.0908 z m 3.34595,-4.58875 c 0.504577,-0.5457 2.226921,-2.48047 3.827434,-4.29948 1.600509,-1.81901 3.230864,-3.6521 3.623005,-4.07353 0.863071,-0.92753 0.903158,-1.64306 0.1377,-2.45785 -0.702847,-0.74814 -1.133872,-0.77358 -1.60919,-0.095 -0.199319,0.28457 -1.457188,1.70192 -2.795262,3.14967 -1.675424,1.81275 -2.57636,2.59791 -2.893751,2.52187 -0.253487,-0.0607 -0.580081,-0.0195 -0.72576,0.0915 -0.586015,0.44664 -3.571584,3.99495 -3.571584,4.24478 0,0.4813 1.855316,1.91022 2.480246,1.91022 0.365117,0 0.977821,-0.39807 1.527162,-0.99219 z m -4.139052,-3.30729 c 0.412269,-0.47294 1.205855,-1.36325 1.763528,-1.97846 0.558728,-0.61638 1.013949,-1.39236 1.013949,-1.7284 0,-0.39711 0.969084,-1.71354 2.778125,-3.77391 1.527969,-1.74024 2.778125,-3.29319 2.778125,-3.451 0,-0.15781 -0.304599,-0.57308 -0.676883,-0.92282 l -0.676886,-0.63591 -0.97676,1.08325 c -4.478864,4.96712 -4.915009,5.38801 -5.584743,5.38938 -0.516959,10e-4 -1.086956,0.46388 -2.337332,1.89783 -0.909505,1.04303 -1.653646,2.06569 -1.653646,2.27258 0,0.45473 2.098702,2.70736 2.522363,2.70736 0.165322,0 0.637895,-0.38696 1.05016,-0.8599 z m -3.070603,-5.19479 c 0.960879,-1.08382 1.614747,-2.06297 1.614747,-2.41805 0,-0.57874 1.253371,-2.14739 4.37778,-5.47899 0.787307,-0.83952 1.434076,-1.68317 1.437262,-1.87478 0.01016,-0.61038 -1.375067,-2.19552 -1.845625,-2.112 -0.245237,0.0435 -2.213256,2.04366 -4.373375,4.44476 -2.160122,2.40109 -4.322136,4.77887 -4.804476,5.28395 -0.482341,0.50508 -0.876983,1.09588 -0.876983,1.3129 0,0.47122 2.091777,2.66356 2.541381,2.66356 0.172998,0 1.041175,-0.8196 1.929289,-1.82135 z m -3.22322,-4.99167 c 4.356804,-4.74639 7.4838,-8.28279 7.4838,-8.46363 0,-0.0985 -0.440883,-0.63066 -0.979739,-1.1825 -0.93418,-0.95669 -1.784662,-1.28415 -1.974776,-0.76035 -0.04851,0.13364 -1.143389,1.44333 -2.433071,2.91041 -1.702496,1.93669 -2.512669,2.66743 -2.957359,2.66743 -0.353587,0 -0.853424,0.30755 -1.182497,0.7276 -0.313507,0.40018 -1.014667,1.20386 -1.558131,1.78594 -0.543465,0.58208 -1.198843,1.38054 -1.456399,1.77435 l -0.468281,0.71601 1.147315,1.20116 c 0.631021,0.66063 1.341687,1.20163 1.579253,1.20222 0.237567,5.2e-4 1.497516,-1.15981 2.799885,-2.57864 z m -4.421939,-3.77088 c 1.597199,-1.77174 1.881711,-2.22458 1.743535,-2.77511 -0.141486,-0.56373 0.233127,-1.0892 2.617293,-3.67135 1.530326,-1.65741 2.782411,-3.20383 2.782411,-3.43649 0,-0.23267 -0.306853,-0.62409 -0.681897,-0.86983 -0.670677,-0.43944 -0.695712,-0.43134 -1.521354,0.49228 -3.924684,4.39043 -4.784628,5.23399 -5.335641,5.23399 -0.650647,0 -4.171839,3.6803 -4.316495,4.51155 -0.08435,0.48474 1.94313,2.61339 2.500792,2.62558 0.166484,0.004 1.161595,-0.94614 2.211356,-2.11062 z m 42.181632,1.70146 c 0.228677,-0.22867 0.415774,-0.57862 0.415774,-0.77765 0,-0.35153 -1.335473,-2.0205 -3.012421,-3.76469 -0.976059,-1.0152 -2.104337,-1.15475 -2.553325,-0.31581 -0.372528,0.69608 0.03697,1.34898 2.263003,3.60811 1.710817,1.73626 2.192282,1.94473 2.886969,1.25004 z m 2.479525,-2.81214 c 0.174625,-0.17462 0.314679,-0.56158 0.311232,-0.8599 -0.0074,-0.64064 -3.998545,-4.90802 -4.590312,-4.90802 -0.418092,0 -1.224254,0.96495 -1.224254,1.46539 0,0.15912 0.924674,1.26372 2.054831,2.45467 2.033167,2.14253 2.76284,2.53352 3.448503,1.84786 z m -48.828856,-2.Line truncated
|
||||||
|
id="path1752" /></g></g></svg>
|
||||||
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1 @@
|
|||||||
|
(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var z={onLoad:t,process:mt,on:D,off:X,trigger:ee,ajax:or,find:C,findAll:R,closest:A,values:function(e,t){var r=Bt(e,t||"post");return r.values},remove:O,addClass:q,removeClass:T,toggleClass:L,takeClass:H,defineExtension:dr,removeExtension:vr,logAll:E,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=z.config.wsBinaryType;return t},version:"1.8.6"};var r={addTriggerHandler:ft,bodyContains:re,canAccessLocalStorage:S,filterValues:Wt,hasAttribute:o,getAttributeValue:J,getClosestMatch:h,getExpressionVars:rr,getHeaders:_t,getInputValues:Bt,getInternalData:K,getSwapSpecification:Gt,getTriggerSpecs:Xe,getTarget:se,makeFragment:f,mergeObjects:ne,makeSettleInfo:Zt,oobSwap:V,selectAndSwap:Oe,settleImmediately:At,shouldCancel:Ve,triggerEvent:ee,triggerErrorEvent:Q,withExtensions:wt};var n=["get","post","put","delete","patch"];var i=n.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function G(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function J(e,t){return G(e,t)||G(e,"data-"+t)}function u(e){return e.parentElement}function $(){return document}function h(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function a(e,t,r){var n=J(t,r);var i=J(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function Z(t,r){var n=null;h(t,function(e){return n=a(t,e,r)});if(n!=="unset"){return n}}function d(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function s(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function l(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=$().createDocumentFragment()}return i}function f(e){if(z.config.useTemplateFragments){var t=l("<body><template>"+e+"</template></body>",0);return t.querySelector("template").content}else{var r=s(e);switch(r){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return l("<table>"+e+"</table>",1);case"col":return l("<table><colgroup>"+e+"</colgroup></table>",2);case"tr":return l("<table><tbody>"+e+"</tbody></table>",2);case"td":case"th":return l("<table><tbody><tr>"+e+"</tr></tbody></table>",3);case"script":return l("<div>"+e+"</div>",1);default:return l(e,0)}}}function te(e){if(e){e()}}function g(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function p(e){return g(e,"Function")}function m(e){return g(e,"Object")}function K(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function x(e){var t=[];if(e){for(var r=0;r<e.length;r++){t.push(e[r])}}return t}function Y(e,t){if(e){for(var r=0;r<e.length;r++){t(e[r])}}}function y(e){var t=e.getBoundingClientRect();var r=t.top;var n=t.bottom;return r<window.innerHeight&&n>=0}function re(e){if(e.getRootNode&&e.getRootNode()instanceof ShadowRoot){return $().body.contains(e.getRootNode().host)}else{return $().body.contains(e)}}function b(e){return e.trim().split(/\s+/)}function ne(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function w(e){try{return JSON.parse(e)}catch(e){St(e);return null}}function S(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function e(e){return Qt($().body,function(){return eval(e)})}function t(t){var e=z.on("htmx:load",function(e){t(e.detail.elt)});return e}function E(){z.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function C(e,t){if(t){return e.querySelector(t)}else{return C($(),e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,IAAIC,qBAAJ,CAA0BxB,UAA1B,CAAP;MAEF,KAAKvB,mBAAA,CAAegD,MAApB;QACE,OAAO,IAAIC,uBAAJ,CAA4B1B,UAA5B,CAAP;MAEF,KAAKvB,mBAAA,CAAekD,MAApB;QACE,OAAO,IAAIC,uBAAJ,CAA4B5B,UAA5B,CAAP;MAEF,KAAKvB,mBAAA,CAAeoD,QAApB;QACE,OAAO,IAAIC,yBAAJ,CAA8B9B,UAA9B,CAAP;MAEF,KAAKvB,mBAAA,CAAesD,KAApB;QACE,OAAO,IAAIC,sBAAJ,CAA2BhC,UAA3B,CAAP;MAEF,KAAKvB,mBAAA,CAAewD,GAApB;QACE,OAAO,IAAIC,oBAAJ,CAAyBlC,UAAzB,CAAP;MAEF,KAAKvB,mBAAA,CAAe0D,OAApB;QACE,OAAO,IAAIC,wBAAJ,CAA6BpC,UAA7B,CAAP;MAEF,KAAKvB,mBAAA,CAAe4D,SAApB;QACE,OAAO,IAAIC,0BAAJ,CAA+BtC,UAA/B,CAAP;MAEF,KAAKvB,mBAAA,CAAe8D,SAApB;QACE,OAAO,IAAIC,0BAAJ,CAA+BxC,UAA/B,CAAP;MAEF,KAAKvB,mBAAA,CAAegE,QAApB;QACE,OAAO,IAAIC,yBAAJ,CAA8B1C,UAA9B,CAAP;MAEF,KAAKvB,mBAAA,CAAekE,SAApB;QACE,OAAO,IAAIC,0BAAJ,CAA+B5C,UAA/B,CAAP;MAEF,KAAKvB,mBAAA,CAAeoE,KAApB;QACE,OAAO,IAAIC,sBAAJ,CAA2B9C,UAA3B,CAAP;MAEF,KAAKvB,mBAAA,CAAesE,cAApB;QACE,OAAO,IAAIC,+BLine truncated
|
||||||
@@ -0,0 +1,241 @@
|
|||||||
|
/**
|
||||||
|
* @licstart The following is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*
|
||||||
|
* Copyright 2023 Mozilla Foundation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* @licend The above is the entire license notice for the
|
||||||
|
* JavaScript code in this page
|
||||||
|
*/
|
||||||
|
|
||||||
|
/******/ // The require scope
|
||||||
|
/******/ var __webpack_require__ = {};
|
||||||
|
/******/
|
||||||
|
/************************************************************************/
|
||||||
|
/******/ /* webpack/runtime/define property getters */
|
||||||
|
/******/ (() => {
|
||||||
|
/******/ // define getter functions for harmony exports
|
||||||
|
/******/ __webpack_require__.d = (exports, definition) => {
|
||||||
|
/******/ for(var key in definition) {
|
||||||
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
||||||
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
||||||
|
/******/ }
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/ })();
|
||||||
|
/******/
|
||||||
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
||||||
|
/******/ (() => {
|
||||||
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||||
|
/******/ })();
|
||||||
|
/******/
|
||||||
|
/************************************************************************/
|
||||||
|
var __webpack_exports__ = globalThis.pdfjsSandbox = {};
|
||||||
|
|
||||||
|
// EXPORTS
|
||||||
|
__webpack_require__.d(__webpack_exports__, {
|
||||||
|
QuickJSSandbox: () => (/* binding */ QuickJSSandbox)
|
||||||
|
});
|
||||||
|
|
||||||
|
;// CONCATENATED MODULE: ./external/quickjs/quickjs-eval.js
|
||||||
|
var Module=(()=>{var _scriptDir=typeof document!=='undefined'&&document.currentScript?document.currentScript.src:undefined;return function(Module){Module=Module||{};var c;c||(c=typeof Module!=='undefined'?Module:{});var h,n;c.ready=new Promise(function(a,b){h=a;n=b;});var r=Object.assign({},c),t="";"undefined"!=typeof document&&document.currentScript&&(t=document.currentScript.src);_scriptDir&&(t=_scriptDir);0!==t.indexOf("blob:")?t=t.substr(0,t.replace(/[?#].*/,"").lastIndexOf("/")+1):t="";var aa=c.print||console.log.bind(console),u=c.printErr||console.warn.bind(console);Object.assign(c,r);r=null;var v;c.wasmBinary&&(v=c.wasmBinary);var noExitRuntime=c.noExitRuntime||!0;"object"!=typeof WebAssembly&&w("no native wasm support detected");var x,y=!1;function z(a,b,d,e){var f={string:function(l){var p=0;if(null!==l&&void 0!==l&&0!==l){var S=(l.length<<2)+1;p=A(S);B(l,C,p,S);}return p;},array:function(l){var p=A(l.length);D.set(l,p);return p;}};a=c["_"+a];var g=[],k=0;if(e)for(var m=0;m<e.length;m++){var q=f[d[m]];q?(0===k&&(k=E()),g[m]=q(e[m])):g[m]=e[m];}d=a.apply(null,g);return d=function(l){0!==k&&F(k);return"string"===b?G(l):"boolean"===b?!!l:l;}(d);}var H="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(a,b){for(var d=b+NaN,e=b;a[e]&&!(e>=d);)++e;if(16<e-b&&a.buffer&&H)return H.decode(a.subarray(b,e));for(d="";b<e;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var k=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|k:(f&7)<<18|g<<12|k<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023));}}else d+=String.fromCharCode(f);}return d;}function G(a){return a?I(C,a):"";}function B(a,b,d,e){if(0<e){e=d+e-1;for(var f=0;f<a.length;++f){var g=a.charCodeAt(f);if(55296<=g&&57343>=g){var k=a.charCodeAt(++f);g=65536+((g&1023)<<10)|k&1023;}if(127>=g){if(d>=e)break;b[d++]=g;}else{if(2047>=g){if(d+1>=e)break;b[d++]=192|g>>6;}else{if(65535>=g){if(d+2>=e)break;b[d++]=224|g>>12;}else{if(d+3>=e)break;b[d++]=240|g>>18;b[d++]=128|g>>12&63;}b[d++]=128|g>>6&63;}b[d++]=128|g&63;}}b[d]=0;}}function J(a){for(var b=0,d=0;d<a.length;++d){var e=a.charCodeAt(d);55296<=e&&57343>=e&&(e=65536+((e&1023)<<10)|a.charCodeAt(++d)&1023);127>=e?++b:b=2047>=e?b+2:65535>=e?b+3:b+4;}return b;}function K(a){var b=J(a)+1,d=L(b);d&&B(a,D,d,b);return d;}var M,D,C,N;function ba(){var a=x.buffer;M=a;c.HEAP8=D=new Int8Array(a);c.HEAP16=new Int16Array(a);c.HEAP32=N=new Int32Array(a);c.HEAPU8=C=new Uint8Array(a);c.HEAPU16=new Uint16Array(a);c.HEAPU32=new Uint32Array(a);c.HEAPF32=new Float32Array(a);c.HEAPF64=new Float64Array(a);}var O,ca=[],da=[],ea=[];function fa(){var a=c.preRun.shift();ca.unshift(a);}var P=0,Q=null,R=null;function w(a){if(c.onAbort)c.onAbort(a);a="Aborted("+a+")";u(a);y=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");n(a);throw a;}function T(a){return a.startsWith("data:application/octet-stream;base64,");}var U;U="data:application/octet-stream;base64,AGFzbQEAAAAByQZtYAR/fn9/AX5gA39/fwF/YAJ/fwF/YAJ/fwBgAX8Bf2AFf35/f38BfmADf39/AGABfwBgAXwBfGACf34BfmAEf39/fwF/YAJ/fgBgAn9/AX5gAn9+AX9gA39/fgF/YAN/fn8BfmABfgF/YAN/fn8AYAZ/fn9/f38BfmADf35/AX9gBX9/f39/AX9gBn9+fn9/fwF+YAN/fn4BfmAEf39/fwBgBH9/fn8Bf2ADf39/AX5gBH9/f38BfmAGf39/f39/AX9gBX9+fn5+AGABfwF+Y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ccJgEHDAEjARMPBBwCARRKBAoDBBAYBgEBAiwtAg0QOhQdCwQCBw0EBBMNGhAhCRYNLQwGDS4EAQdLCgMnLw4EABMCEAEKTAYBAjwEBk0CBA0PDg4ODgYHAjAGAgIxTk8UEz0bBwQUARYCDhMyLAEnA1ABAjABAgc+ASE9AgcHAgQWAwQPEAQNAwQJARlRBAYzAgYDUgIEFChTBQ0/Aw4DAQ4eAjkhDQkBLAIBAwcEJgMEKwEICAQEGwIHBiUJFgYUAQQCBgEEDgUyAzRUAgIEDFVWBAVXARYXB1gnGA8DFAYGAgECARkKCEAfBAQCAgoBBAIEAgYNADAEGRoKAQIKBgoBBAMEAQQBAgM0QQ4gAFkXDwQDWgQMBwMWAyINDBkbD1sGAQEGIgUPAw0DCgICXAECAgwrEDgKFwMBBxcCCC0IBAIBAQYKBAEEPAIGAwkUAQMAAgMBCgIuAQcBAgICFA0BCgIKCgIXIBBdNwMTAxAEEwQCBBYOBxcUAwIGEQNeXy8ZEBsIYAlhYgBCGgIdHQ0WAQINKTEKDhUADj8KAwQCAQRjGAkNEAQZCQMGDxgCAgMCAxwGFGQHAgEECAdlLine truncated
|
||||||
|
;// CONCATENATED MODULE: ./src/pdf.sandbox.external.js
|
||||||
|
class SandboxSupportBase {
|
||||||
|
constructor(win) {
|
||||||
|
this.win = win;
|
||||||
|
this.timeoutIds = new Map();
|
||||||
|
this.commFun = null;
|
||||||
|
}
|
||||||
|
destroy() {
|
||||||
|
this.commFun = null;
|
||||||
|
for (const id of this.timeoutIds.values()) {
|
||||||
|
this.win.clearTimeout(id);
|
||||||
|
}
|
||||||
|
this.timeoutIds = null;
|
||||||
|
}
|
||||||
|
exportValueToSandbox(val) {
|
||||||
|
throw new Error("Not implemented");
|
||||||
|
}
|
||||||
|
importValueFromSandbox(val) {
|
||||||
|
throw new Error("Not implemented");
|
||||||
|
}
|
||||||
|
createErrorForSandbox(errorMessage) {
|
||||||
|
throw new Error("Not implemented");
|
||||||
|
}
|
||||||
|
callSandboxFunction(name, args) {
|
||||||
|
try {
|
||||||
|
args = this.exportValueToSandbox(args);
|
||||||
|
this.commFun(name, args);
|
||||||
|
} catch (e) {
|
||||||
|
this.win.console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createSandboxExternals() {
|
||||||
|
const externals = {
|
||||||
|
setTimeout: (callbackId, nMilliseconds) => {
|
||||||
|
if (typeof callbackId !== "number" || typeof nMilliseconds !== "number") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (callbackId === 0) {
|
||||||
|
this.win.clearTimeout(this.timeoutIds.get(callbackId));
|
||||||
|
}
|
||||||
|
const id = this.win.setTimeout(() => {
|
||||||
|
this.timeoutIds.delete(callbackId);
|
||||||
|
this.callSandboxFunction("timeoutCb", {
|
||||||
|
callbackId,
|
||||||
|
interval: false
|
||||||
|
});
|
||||||
|
}, nMilliseconds);
|
||||||
|
this.timeoutIds.set(callbackId, id);
|
||||||
|
},
|
||||||
|
clearTimeout: callbackId => {
|
||||||
|
this.win.clearTimeout(this.timeoutIds.get(callbackId));
|
||||||
|
this.timeoutIds.delete(callbackId);
|
||||||
|
},
|
||||||
|
setInterval: (callbackId, nMilliseconds) => {
|
||||||
|
if (typeof callbackId !== "number" || typeof nMilliseconds !== "number") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const id = this.win.setInterval(() => {
|
||||||
|
this.callSandboxFunction("timeoutCb", {
|
||||||
|
callbackId,
|
||||||
|
interval: true
|
||||||
|
});
|
||||||
|
}, nMilliseconds);
|
||||||
|
this.timeoutIds.set(callbackId, id);
|
||||||
|
},
|
||||||
|
clearInterval: callbackId => {
|
||||||
|
this.win.clearInterval(this.timeoutIds.get(callbackId));
|
||||||
|
this.timeoutIds.delete(callbackId);
|
||||||
|
},
|
||||||
|
alert: cMsg => {
|
||||||
|
if (typeof cMsg !== "string") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.win.alert(cMsg);
|
||||||
|
},
|
||||||
|
confirm: cMsg => {
|
||||||
|
if (typeof cMsg !== "string") {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.win.confirm(cMsg);
|
||||||
|
},
|
||||||
|
prompt: (cQuestion, cDefault) => {
|
||||||
|
if (typeof cQuestion !== "string" || typeof cDefault !== "string") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.win.prompt(cQuestion, cDefault);
|
||||||
|
},
|
||||||
|
parseURL: cUrl => {
|
||||||
|
const url = new this.win.URL(cUrl);
|
||||||
|
const props = ["hash", "host", "hostname", "href", "origin", "password", "pathname", "port", "protocol", "search", "searchParams", "username"];
|
||||||
|
return Object.fromEntries(props.map(name => [name, url[name].toString()]));
|
||||||
|
},
|
||||||
|
send: data => {
|
||||||
|
if (!data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const event = new this.win.CustomEvent("updatefromsandbox", {
|
||||||
|
detail: this.importValueFromSandbox(data)
|
||||||
|
});
|
||||||
|
this.win.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Object.setPrototypeOf(externals, null);
|
||||||
|
return (name, args) => {
|
||||||
|
try {
|
||||||
|
const result = externals[name](...args);
|
||||||
|
return this.exportValueToSandbox(result);
|
||||||
|
} catch (error) {
|
||||||
|
throw this.createErrorForSandbox(error?.toString() ?? "");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;// CONCATENATED MODULE: ./src/pdf.sandbox.js
|
||||||
|
|
||||||
|
|
||||||
|
const pdfjsVersion = '4.0.189';
|
||||||
|
const pdfjsBuild = '50f52b43a';
|
||||||
|
class SandboxSupport extends SandboxSupportBase {
|
||||||
|
exportValueToSandbox(val) {
|
||||||
|
return JSON.stringify(val);
|
||||||
|
}
|
||||||
|
importValueFromSandbox(val) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
createErrorForSandbox(errorMessage) {
|
||||||
|
return new Error(errorMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Sandbox {
|
||||||
|
constructor(win, module) {
|
||||||
|
this.support = new SandboxSupport(win, this);
|
||||||
|
module.externalCall = this.support.createSandboxExternals();
|
||||||
|
this._module = module;
|
||||||
|
this._alertOnError = 0;
|
||||||
|
}
|
||||||
|
create(data) {
|
||||||
|
const code = ['var __webpack_exports__ = globalThis.pdfjsSandbox = {};\n\n;// CONCATENATED MODULE: ./src/scripting_api/constants.js\nconst Border = Object.freeze({\n s: "solid",\n d: "dashed",\n b: "beveled",\n i: "inset",\n u: "underline"\n});\nconst Cursor = Object.freeze({\n visible: 0,\n hidden: 1,\n delay: 2\n});\nconst Display = Object.freeze({\n visible: 0,\n hidden: 1,\n noPrint: 2,\n noView: 3\n});\nconst Font = Object.freeze({\n Times: "Times-Roman",\n TimesB: "Times-Bold",\n TimesI: "Times-Italic",\n TimesBI: "Times-BoldItalic",\n Helv: "Helvetica",\n HelvB: "Helvetica-Bold",\n HelvI: "Helvetica-Oblique",\n HelvBI: "Helvetica-BoldOblique",\n Cour: "Courier",\n CourB: "Courier-Bold",\n CourI: "Courier-Oblique",\n CourBI: "Courier-BoldOblique",\n Symbol: "Symbol",\n ZapfD: "ZapfDingbats",\n KaGo: "HeiseiKakuGo-W5-UniJIS-UCS2-H",\n KaMi: "HeiseiMin-W3-UniJIS-UCS2-H"\n});\nconst Highlight = Object.freeze({\n n: "none",\n i: "invert",\n p: "push",\n o: "outline"\n});\nconst Position = Object.freeze({\n textOnly: 0,\n iconOnly: 1,\n iconTextV: 2,\n textIconV: 3,\n iconTextH: 4,\n textIconH: 5,\n overlay: 6\n});\nconst ScaleHow = Object.freeze({\n proportional: 0,\n anamorphic: 1\n});\nconst ScaleWhen = Object.freeze({\n always: 0,\n never: 1,\n tooBig: 2,\n tooSmall: 3\n});\nconst Style = Object.freeze({\n ch: "check",\n cr: "cross",\n di: "diamond",\n ci: "circle",\n st: "star",\n sq: "square"\n});\nconst Trans = Object.freeze({\n blindsH: "BlindsHorizontal",\n blindsV: "BlindsVertical",\n boxI: "BoxIn",\n boxO: "BoxOut",\n dissolve: "Dissolve",\n glitterD: "GlitterDown",\n glitterR: "GlitterRight",\n glitterRD: "GlitterRightDown",\n random: "Random",\n replace: "Replace",\n splitHI: "SplitHorizontalIn",\n splitHO: "SplitHorizontalOut",\n splitVI: "SplitVerticalIn",\n splitVO: "SplitVerticalOut",\n wipeD: "WipeDown",\n wipeL: "WipeLeft",\n wipeR: "WipeRight",\n wipeU: "WipeUp"\n});\nconst ZoomType = Object.freeze({\n none: "NoVary",\n fitP: "FitPage",\n fitW: "FitWidth",\n fitH: "FitHeight",\n fitV: "FitVisibleWidth",\n pref: "Preferred",\n refW: "ReflowWidth"\n});\nconst GlobalConstants = Object.freeze({\n IDS_GREATER_THAN: "Invalid value: must be greater than or equal to % s.",\n IDS_GT_AND_LT: "Invalid value: must be greater than or equal to % s " + "and less than or equal to % s.",\n IDS_LESS_THAN: "Invalid value: must be less than or equal to % s.",\n IDS_INVALID_MONTH: "** Invalid **",\n IDS_INVALID_DATE: "Invalid date / time: please ensure that the date / time exists.Field",\n IDS_INVALID_DATE2: " should match format ",\n IDS_INVALID_VALUE: "The value entered does not match the format of the field",\n IDS_AM: "am",\n IDS_PM: "pm",\n IDS_MONTH_INFO: "January[1] February[2] March[3] April[4] May[5] " + "June[6] July[7] August[8] September[9] October[10] " + "November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] " + "Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] Dec[12]",\n IDS_STARTUP_CONSOLE_MSG: "** ^ _ ^ **",\n RE_NUMBER_ENTRY_DOT_SEP: ["[+-]?\\\\d*\\\\.?\\\\d*"],\n RE_NUMBER_COMMIT_DOT_SEP: ["[+-]?\\\\d+(\\\\.\\\\d+)?", "[+-]?\\\\.\\\\d+", "[+-]?\\\\d+\\\\."],\n RE_NUMBER_ENTRY_COMMA_SEP: ["[+-]?\\\\d*,?\\\\d*"],\n RE_NUMBER_COMMIT_COMMA_SEP: ["[+-]?\\\\d+([.,]\\\\d+)?", "[+-]?[.,]\\\\d+", "[+-]?\\\\d+[.,]"],\n RE_ZIP_ENTRY: ["\\\\d{0,5}"],\n RE_ZIP_COMMIT: ["\\\\d{5}"],\n RE_ZIP4_ENTRY: ["\\\\d{0,5}(\\\\.|[- ])?\\\\d{0,4}"],\n RE_ZIP4_COMMIT: ["\\\\d{5}(\\\\.|[- ])?\\\\d{4}"],\n RE_PHONE_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}", "\\\\(\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\(\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "\\\\d{0,3}\\\\)(\\\\.|[- ])?\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,4}", "011(\\\\.|[- \\\\d])*"],\n RE_PHONE_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\d{3}(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "\\\\(\\\\d{3}\\\\)(\\\\.|[- ])?\\\\d{3}(\\\\.|[- ])?\\\\d{4}", "011(\\\\.|[- \\\\d])*"],\n RE_SSN_ENTRY: ["\\\\d{0,3}(\\\\.|[- ])?\\\\d{0,2}(\\\\.|[- ])?\\\\d{0,4}"],\n RE_SSN_COMMIT: ["\\\\d{3}(\\\\.|[- ])?\\\\d{2}(\\\\.|[- ])?\\\\d{4}"]\n});\n\n;// CONCATENATED MODULE: ./src/scripting_api/common.js\nconst FieldType = {\n none: 0,\n number: 1,\n percent: 2,\n date: 3,\n time: 4\n};\nfunction createActionsMap(actions) {\n const actionsMap = new Map();\n if (actions) {\n for (const [eventType, actionsForEvent] of Object.entries(actions)) {\n actionsMap.set(eventType, actionsForEvent);\n }\n }\n return actionsMap;\n}\nfunction getFieldType(actions) {\n let format = actions.get("Format");\n if (!format) {\n return FieldType.none;\n }\n format = format[0];\n format = format.trim();\n if (format.startsWith("AFNumber_")) {\n return FieldType.number;\n }\n if (format.startsWith("AFPercent_")) {\n return FieldType.percent;\n }\n if (format.startsWith("AFDat
Line truncated
|
||||||
|
code.push("delete dump;");
|
||||||
|
let success = false;
|
||||||
|
let buf = 0;
|
||||||
|
try {
|
||||||
|
const sandboxData = JSON.stringify(data);
|
||||||
|
code.push(`pdfjsScripting.initSandbox({ data: ${sandboxData} })`);
|
||||||
|
buf = this._module.stringToNewUTF8(code.join("\n"));
|
||||||
|
success = !!this._module.ccall("init", "number", ["number", "number"], [buf, this._alertOnError]);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
} finally {
|
||||||
|
if (buf) {
|
||||||
|
this._module.ccall("free", "number", ["number"], [buf]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (success) {
|
||||||
|
this.support.commFun = this._module.cwrap("commFun", null, ["string", "string"]);
|
||||||
|
} else {
|
||||||
|
this.nukeSandbox();
|
||||||
|
throw new Error("Cannot start sandbox");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispatchEvent(event) {
|
||||||
|
this.support?.callSandboxFunction("dispatchEvent", event);
|
||||||
|
}
|
||||||
|
dumpMemoryUse() {
|
||||||
|
this._module?.ccall("dumpMemoryUse", null, []);
|
||||||
|
}
|
||||||
|
nukeSandbox() {
|
||||||
|
if (this._module !== null) {
|
||||||
|
this.support.destroy();
|
||||||
|
this.support = null;
|
||||||
|
this._module.ccall("nukeSandbox", null, []);
|
||||||
|
this._module = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
evalForTesting(code, key) {
|
||||||
|
throw new Error("Not implemented: evalForTesting");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function QuickJSSandbox() {
|
||||||
|
return quickjs_eval().then(module => {
|
||||||
|
return new Sandbox(window, module);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var __webpack_exports__QuickJSSandbox = __webpack_exports__.QuickJSSandbox;
|
||||||
|
export { __webpack_exports__QuickJSSandbox as QuickJSSandbox };
|
||||||
|
|
||||||
|
//# sourceMappingURL=pdf.sandbox.mjs.map
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"pdf.sandbox.mjs","mappings":";;;;;;;;;;;;;;;;;;;;;;SAAA;SACA;;;;;UCDA;UACA;UACA;UACA;UACA,yCAAyC,wCAAwC;UACjF;UACA;UACA;;;;;UCPA;;;;;;;;;;;;ACCA,GAAI,CAAAA,MAAA,CAAU,KAAM,CAClB,GAAI,CAAAC,UAAA,CAAa,MAAO,CAAAC,QAAP,GAAoB,WAApB,EAAmCA,QAAA,CAASC,aAA5C,CAA4DD,QAAA,CAASC,aAAT,CAAuBC,GAAnF,CAAyFC,SAA1G,CAEA,MACF,UAASL,MAAT,CAAiB,CACfA,MAAA,CAASA,MAAA,EAAU,EAAnB,CAGF,GAAI,CAAAM,CAAJ,CAAMA,CAAA,GAAIA,CAAA,CAAE,MAAO,CAAAN,MAAP,GAAkB,WAAlB,CAAgCA,MAAhC,CAAyC,EAA3C,CAAJ,CAAmD,GAAI,CAAAO,CAAJ,CAAMC,CAAN,CAAQF,CAAA,CAAEG,KAAF,CAAQ,GAAI,CAAAC,OAAJ,CAAY,SAASC,CAAT,CAAWC,CAAX,CAAa,CAACL,CAAA,CAAEI,CAAF,CAAIH,CAAA,CAAEI,CAAF,CAAL,CAAzB,CAAR,CAA4C,GAAI,CAAAC,CAAA,CAAEC,MAAA,CAAOC,MAAP,CAAc,EAAd,CAAiBT,CAAjB,CAAN,CAA0BU,CAAA,CAAE,EAA5B,CAA+B,aAAa,MAAO,CAAAd,QAApB,EAA8BA,QAAA,CAASC,aAAvC,GAAuDa,CAAA,CAAEd,QAAA,CAASC,aAAT,CAAuBC,GAAzB,CAAvD,CAAqFH,UAAA,GAAae,CAAA,CAAEf,UAAF,CAAb,CAA2B,IAAIe,CAAA,CAAEC,OAAF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AA,EAAQ,CADa;EAErBC,QAAA,EAAU,CAFW;EAGrBC,KAAA,EAAO;AAHc,CAAvB;AAMA,MAAMC,mBAAA,GAAsB;EAC1B3H,IAAA,EAAM,CADoB;EAE1B4H,MAAA,EAAQ;AAFkB,CAA5B;AAMA,MAAMC,GAAA,GAAM;EAKVC,UAAA,EAAY,CALF;EAMVC,YAAA,EAAc,CANJ;EAOVC,UAAA,EAAY,CAPF;EAQVC,WAAA,EAAa,CARH;EASVC,aAAA,EAAe,CATL;EAUVC,OAAA,EAAS,CAVC;EAWVC,kBAAA,EAAoB,CAXV;EAYVC,WAAA,EAAa,CAZH;EAaVC,SAAA,EAAW,CAbD;EAcVC,IAAA,EAAM,EAdI;EAeVC,OAAA,EAAS,EAfC;EAgBVC,SAAA,EAAW,EAhBD;EAiBVC,MAAA,EAAQ,EAjBE;EAkBVC,MAAA,EAAQ,EAlBE;EAmBVC,OAAA,EAAS,EAnBC;EAoBVC,QAAA,EAAU,EApBA;EAqBVC,QAAA,EAAU,EArBA;EAsBVC,SAAA,EAAW,EAtBD;EAuBVC,SAAA,EAAW,EAvBD;EAwBVC,MAAA,EAAQ,EAxBE;EAyBVC,WAAA,EAAa,EAzBH;EA0BVC,IAAA,EAAM,EA1BI;EA2BVC,MAAA,EAAQ,EA3BE;EA4BVC,UAAA,EAAY,EA5BF;EA6BVC,YAAA,EAAc,EA7BJ;EA8BVC,eAAA,EAAiB,EA9BP;EA+BVC,iBAAA,EAAmB,EA/BT;EAgCVC,OAAA,EAAS,EAhCC;EAiCVC,IAAA,EAAM,EAjCI;EAkCVC,MAAA,EAAQ,EAlCLine truncated
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
const pdfjsLib = await import('./pdf/pdf.mjs');
|
||||||
|
const pdfjsWorker = await import('./pdf/pdf.worker.mjs');
|
||||||
|
|
||||||
|
// The workerSrc property shall be specified.
|
||||||
|
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker;
|
||||||
|
|
||||||
|
|
||||||
|
export function displayPdf(options) {
|
||||||
|
var pdfDoc = null,
|
||||||
|
pageNum = 1,
|
||||||
|
pageRendering = false,
|
||||||
|
pageNumPending = null,
|
||||||
|
ctx = options.canvas.getContext('2d');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get page info from document, resize canvas accordingly, and render page.
|
||||||
|
* @param num Page number.
|
||||||
|
*/
|
||||||
|
function renderPage(num) {
|
||||||
|
pageRendering = true;
|
||||||
|
// Using promise to fetch the page
|
||||||
|
pdfDoc.getPage(num).then(function(page) {
|
||||||
|
var canvasWidth = options.canvas.getBoundingClientRect().width,
|
||||||
|
pageWidth = page.getViewport({scale: 1.0}).width,
|
||||||
|
scale = canvasWidth/pageWidth,
|
||||||
|
viewport = page.getViewport({scale: scale});
|
||||||
|
options.canvas.height = viewport.height;
|
||||||
|
options.canvas.width = viewport.width;
|
||||||
|
|
||||||
|
// Render PDF page into canvas context
|
||||||
|
var renderContext = {
|
||||||
|
canvasContext: ctx,
|
||||||
|
viewport: viewport
|
||||||
|
};
|
||||||
|
var renderTask = page.render(renderContext);
|
||||||
|
|
||||||
|
// Wait for rendering to finish
|
||||||
|
renderTask.promise.then(function() {
|
||||||
|
pageRendering = false;
|
||||||
|
if (pageNumPending !== null) {
|
||||||
|
// New page rendering is pending
|
||||||
|
renderPage(pageNumPending);
|
||||||
|
pageNumPending = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update page counters
|
||||||
|
options.pageNum.textContent = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If another page rendering in progress, waits until the rendering is
|
||||||
|
* finised. Otherwise, executes rendering immediately.
|
||||||
|
*/
|
||||||
|
function queueRenderPage(num) {
|
||||||
|
if (pageRendering) {
|
||||||
|
pageNumPending = num;
|
||||||
|
} else {
|
||||||
|
renderPage(num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-render page (e.g. on resize)
|
||||||
|
*/
|
||||||
|
function reRender() {
|
||||||
|
queueRenderPage(pageNum);
|
||||||
|
}
|
||||||
|
document.defaultView.addEventListener('resize', reRender)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays previous page.
|
||||||
|
*/
|
||||||
|
function onPrevPage() {
|
||||||
|
if (pageNum <= 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pageNum--;
|
||||||
|
queueRenderPage(pageNum);
|
||||||
|
}
|
||||||
|
options.prevPage.addEventListener('click', onPrevPage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays next page.
|
||||||
|
*/
|
||||||
|
function onNextPage() {
|
||||||
|
if (pageNum >= pdfDoc.numPages) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pageNum++;
|
||||||
|
queueRenderPage(pageNum);
|
||||||
|
}
|
||||||
|
options.nextPage.addEventListener('click', onNextPage);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asynchronously downloads PDF.
|
||||||
|
*/
|
||||||
|
pdfjsLib.getDocument(options.url).promise.then(function(pdfDoc_) {
|
||||||
|
pdfDoc = pdfDoc_;
|
||||||
|
options.pageCount.textContent = pdfDoc.numPages;
|
||||||
|
|
||||||
|
// Initial/first page rendering
|
||||||
|
renderPage(pageNum);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<div id="content">
|
||||||
|
<div hx-get="{{ content }}"
|
||||||
|
hx-trigger="load"
|
||||||
|
hx-target="#content"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<div id="footer">
|
||||||
|
<hr class="h-px my-3 bg-beige border-0 ">
|
||||||
|
<div id="nota" class="flex items-center justify-center">
|
||||||
|
<div hx-post="/api/nota"
|
||||||
|
hx-trigger="load"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div class="h-4/5 min-h-[400px] flex flex-col items-center justify-center">
|
||||||
|
<img src = "{{ url_for('static', path='img/folkugat.svg') }}" class="{% if animate %} opacity-0 animate-fade-in-one {% endif %} m-3" width="100" alt="Folkugat"/>
|
||||||
|
<h1 class="text-3xl sm:text-8xl text-beige m-3 {% if animate %} opacity-0 animate-fade-in-one {% endif %}">{{ page_title }}</h1>
|
||||||
|
<h2 class="text-center sm:text-3xl m-6 {% if animate %} opacity-0 animate-fade-in-two {% endif %}">Sessions de folk a Sant Cugat</h2>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{% if session %}
|
||||||
|
<div class="bg-beige text-white mt-2 py-2 text-xl overflow-hidden">
|
||||||
|
<a href="/sessio/{{ session.id }}">
|
||||||
|
<div class="animate-marquee whitespace-nowrap">
|
||||||
|
{% for _ in (1, 2, 3) %}
|
||||||
|
<span class="inline-block mx-4">
|
||||||
|
Sessió en directe
|
||||||
|
</span>
|
||||||
|
<span class="inline-block mx-4">
|
||||||
|
♫
|
||||||
|
</span>
|
||||||
|
<span class="inline-block mx-4">
|
||||||
|
Està sonant <i>Pasdoble de Muntanya</i>
|
||||||
|
</span>
|
||||||
|
<span class="inline-block mx-4">
|
||||||
|
♫
|
||||||
|
</span>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<hr class="h-px bg-beige border-0">
|
||||||
|
<ul class="flex flex-col min-[450px]:flex-row items-center justify-center">
|
||||||
|
|
||||||
|
{% if menu_selected_id == Pages.Sessions %}
|
||||||
|
<li class="p-2 text-beige">
|
||||||
|
<button>
|
||||||
|
{% else %}
|
||||||
|
<li class="p-2">
|
||||||
|
<button hx-get="/api/content/sessions"
|
||||||
|
hx-replace-url="/sessions"
|
||||||
|
hx-target="#content">
|
||||||
|
{% endif %}
|
||||||
|
Sessions
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
{% if menu_selected_id == Pages.Temes %}
|
||||||
|
<li class="p-2 text-beige">
|
||||||
|
<button>
|
||||||
|
{% else %}
|
||||||
|
<li class="p-2">
|
||||||
|
<button hx-get="/api/content/temes"
|
||||||
|
hx-replace-url="/temes"
|
||||||
|
hx-target="#content">
|
||||||
|
{% endif %}
|
||||||
|
Temes
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<hr class="h-px bg-beige border-0">
|
||||||
|
<div hx-get="/api/sessions/live"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-trigger="load, every 20s, reload-marquee from:body">
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{% if logged_in %}
|
||||||
|
|
||||||
|
<button class="p-12"
|
||||||
|
hx-post="/api/logout"
|
||||||
|
hx-target="#nota">
|
||||||
|
😎
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<button class="p-12"
|
||||||
|
hx-get="/api/nota?value={{value or ''}}"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-include="#nota-input">
|
||||||
|
♫
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{% if value %}
|
||||||
|
<div class="p-12">
|
||||||
|
{{ value }}
|
||||||
|
</div>
|
||||||
|
<button class="p-12"
|
||||||
|
hx-get="/api/nota?value={{value or ''}}"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-include="#nota-input">
|
||||||
|
♫
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<button class="p-12"
|
||||||
|
hx-post="/api/nota"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-include="#nota-input"
|
||||||
|
hx-trigger="clicked, keyup[keyCode==13] from:#nota-input">
|
||||||
|
♫
|
||||||
|
</button>
|
||||||
|
<input id="nota-input" type="text" name="value" value="{{value or ''}}"
|
||||||
|
class="rounded border border-yellow-50 focus:outline-none
|
||||||
|
text-yellow-50 text-center
|
||||||
|
animate-grow max-w-xs
|
||||||
|
bg-brown p-1 m-1">
|
||||||
|
<button class="p-12"
|
||||||
|
hx-post="/api/nota"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-include="#nota-input">
|
||||||
|
♫
|
||||||
|
</button>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<div hx-post="/api/nota"
|
||||||
|
hx-trigger="load"
|
||||||
|
hx-target="#nota"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
<!-- PDF Viewer -->
|
||||||
|
<script type="module">
|
||||||
|
const pdfViewer = await import("{{ url_for('static', path='js/pdf_viewer.js') }}");
|
||||||
|
const options = {
|
||||||
|
url: '{{ pdf_url }}',
|
||||||
|
// PDF Canvas (where the pdf will be displayed)
|
||||||
|
canvas: document.getElementById('the-canvas'),
|
||||||
|
// Navigation elements
|
||||||
|
prevPage: document.getElementById('prev'),
|
||||||
|
nextPage: document.getElementById('next'),
|
||||||
|
// Page elements
|
||||||
|
pageCount: document.getElementById('page_count'),
|
||||||
|
pageNum: document.getElementById('page_num'),
|
||||||
|
}
|
||||||
|
pdfViewer.displayPdf(options);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col items-center justify-center">
|
||||||
|
<!-- <div class="text-beige"> -->
|
||||||
|
<!-- <a href="{{ pdf_url }}" -->
|
||||||
|
<!-- target="_blank"> -->
|
||||||
|
<!-- <i class="fa fa-file-pdf" aria-hidden="true"></i> -->
|
||||||
|
<!-- obrir -->
|
||||||
|
<!-- </a> -->
|
||||||
|
<!-- </div> -->
|
||||||
|
<div class="flex flex-row flex-nowrap items-center justify-center w-full">
|
||||||
|
<button id="prev" class="flex-none text-xl text-beige mx-3">
|
||||||
|
<i class="fa fa-chevron-left" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<canvas class="flex-auto m-2 w-1/2 max-w-3xl"
|
||||||
|
id="the-canvas">
|
||||||
|
</canvas>
|
||||||
|
<button id="next" class="flex-none text-xl text-beige mx-3">
|
||||||
|
<i class="fa fa-chevron-right" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span><span id="page_num">?</span> / <span id="page_count">?</span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<button title="Inicia una sessió"
|
||||||
|
class="text-beige mx-1"
|
||||||
|
hx-put="/api/sessio/{{ session.id }}/live"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-play" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<button title="Atura una sessió"
|
||||||
|
class="text-beige mx-1"
|
||||||
|
hx-delete="/api/sessio/{{ session.id }}/live"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-stop" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{% include "fragments/menu.html" %}
|
||||||
|
<div class="p-12 text-center">
|
||||||
|
<h3 class="text-3xl text-beige p-4">Calendari</h3>
|
||||||
|
{% if logged_in %}
|
||||||
|
<button title="Afegeix una sessió"
|
||||||
|
class="text-beige m-2"
|
||||||
|
hx-post="/api/sessions/editor/"
|
||||||
|
hx-target="#{{ calendar_list_id }}"
|
||||||
|
hx-swap="beforeend transition:true">
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
Afegeix una sessió
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
<div hx-get="/api/sessions/upcoming"
|
||||||
|
hx-trigger="load"
|
||||||
|
hx-target="this"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
|
<h3 class="text-3xl text-beige p-4">Historial</h3>
|
||||||
|
<div hx-get="/api/sessions/history"
|
||||||
|
hx-trigger="load"
|
||||||
|
hx-target="this"
|
||||||
|
hx-swap="innerHTML">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{% include "fragments/menu.html" %}
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<div class="m-12 grow max-w-4xl text-center">
|
||||||
|
<h3 class="text-3xl p-4">
|
||||||
|
{% set dn = date_names(session.date) %}
|
||||||
|
{{ dn.day_name }} {{ dn.day }} {{ dn.month_name }} de {{ dn.year }}
|
||||||
|
</h3>
|
||||||
|
{% if logged_in %}
|
||||||
|
{% if session.is_live %}
|
||||||
|
{% include "fragments/sessions/live/stop.html" %}
|
||||||
|
{% else %}
|
||||||
|
{% include "fragments/sessions/live/start.html" %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
<div class="text-left">
|
||||||
|
<h4 class="text-xl text-beige">Horari i lloc</h4>
|
||||||
|
De {{ session.start_time.strftime("%H:%M") }}
|
||||||
|
a {{ session.end_time.strftime("%H:%M") }}
|
||||||
|
{% if session.venue.name %}
|
||||||
|
a
|
||||||
|
{% if session.venue.url %}
|
||||||
|
<a href="{{ session.venue.url }}"
|
||||||
|
class="text-beige"
|
||||||
|
target="_blank">
|
||||||
|
{{ session.venue.name }}
|
||||||
|
</a>
|
||||||
|
{% else %}
|
||||||
|
{{ session.venue.name }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<p>
|
||||||
|
{% if session == None %}
|
||||||
|
<a> L'últim Dimecres de cada mes </a>
|
||||||
|
{% else %}
|
||||||
|
<a>
|
||||||
|
{% set dn = date_names(session.date) %}
|
||||||
|
{{ dn.day_name }} {{ dn.day }} {{ dn.month_name }}
|
||||||
|
</a>
|
||||||
|
de {{ session.start_time.strftime("%H:%M") }}
|
||||||
|
a {{ session.end_time.strftime("%H:%M") }}
|
||||||
|
{% if session.venue.name %}
|
||||||
|
a {{ session.venue.name }}
|
||||||
|
<!-- {% if session.venue.url %} -->
|
||||||
|
<!-- <a href="{{ session.venue.url }}" -->
|
||||||
|
<!-- class="text-beige" -->
|
||||||
|
<!-- target="_blank"> -->
|
||||||
|
<!-- {{ session.venue.name }} -->
|
||||||
|
<!-- </a> -->
|
||||||
|
<!-- {% else %} -->
|
||||||
|
<!-- {{ session.venue.name }} -->
|
||||||
|
<!-- {% endif %} -->
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<ol id="{{ session_list_id }}"
|
||||||
|
class="flex flex-col items-center justify-center">
|
||||||
|
{% for session in sessions %}
|
||||||
|
{% include "fragments/sessions/session_row.html" %}
|
||||||
|
{% endfor %}
|
||||||
|
{% if more_sessions or less_sessions %}
|
||||||
|
<li>
|
||||||
|
{% if more_sessions %}
|
||||||
|
<button title="Mostra més sessions"
|
||||||
|
class="text-beige mx-2"
|
||||||
|
hx-get="{{ get_sessions_url }}?limit={{ more_sessions }}"
|
||||||
|
hx-target="#{{ session_list_id }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
{% if less_sessions %}
|
||||||
|
<button title="Mostra menys sessions"
|
||||||
|
class="text-beige mx-2"
|
||||||
|
hx-get="{{ get_sessions_url }}?limit={{ less_sessions }}"
|
||||||
|
hx-target="#{{ session_list_id }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-caret-up" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ol>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<li class="border rounded border-beige
|
||||||
|
flex flex-row grow
|
||||||
|
p-2 m-2 w-full max-w-xl
|
||||||
|
relative"
|
||||||
|
id="session-row-{{session.id}}">
|
||||||
|
<a href="/session/{{session.id}}">
|
||||||
|
<div class="flex flex-row grow justify-center pl-10">
|
||||||
|
<div class="flex-1">
|
||||||
|
{% include "fragments/sessions/session_date.html" %}
|
||||||
|
</div>
|
||||||
|
<div class="ml-auto">
|
||||||
|
<a title="Més informació"
|
||||||
|
class="text-beige mx-1"
|
||||||
|
href="/sessio/{{session.id}}/">
|
||||||
|
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
|
{% if logged_in %}
|
||||||
|
<button title="Edita la sessió"
|
||||||
|
class="text-beige mx-1"
|
||||||
|
hx-get="/api/sessions/editor/{{session.id}}/edita"
|
||||||
|
hx-target="#session-row-{{session.id}}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button title="Esborra la sessió"
|
||||||
|
class="text-beige mx-1"
|
||||||
|
hx-delete="/api/sessions/editor/{{session.id}}/"
|
||||||
|
hx-target="#session-row-{{session.id}}"
|
||||||
|
hx-swap="outerHTML swap:0.5s">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% if session.id == next_session_id %}
|
||||||
|
<div class="absolute -top-5 -left-6
|
||||||
|
bg-beige text-xs font-bold
|
||||||
|
px-2 py-1
|
||||||
|
transition-opacity duration-200
|
||||||
|
rounded">
|
||||||
|
Propera<br>sessió
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</li>
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
<li id="session-editor-row-{{session.id}}"
|
||||||
|
class="border rounded border-beige
|
||||||
|
flex flex-col grow
|
||||||
|
py-2 px-10 m-2 w-full max-w-xl">
|
||||||
|
<form>
|
||||||
|
<div class="flex flex-row justify-end items-center">
|
||||||
|
<button title="Aplica els canvis"
|
||||||
|
class="text-beige mx-2"
|
||||||
|
hx-put="/api/sessions/editor/{{session.id}}/"
|
||||||
|
hx-target="#session-editor-row-{{session.id}}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-check" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button title="Descarta els canvis"
|
||||||
|
class="text-beige mx-2"
|
||||||
|
hx-get="/api/sessions/editor/{{session.id}}/"
|
||||||
|
hx-target="#session-editor-row-{{session.id}}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col items-start pl-5">
|
||||||
|
<div>
|
||||||
|
<label for="session-editor-row-{{session.id}}-date">
|
||||||
|
Data:
|
||||||
|
</label>
|
||||||
|
<input type="date" name="date"
|
||||||
|
value="{{ session.date.strftime('%Y-%m-%d') }}"
|
||||||
|
min="2022-01-01"
|
||||||
|
max="2050-12-31"
|
||||||
|
class="border-none focus:outline-none
|
||||||
|
text-yellow-50 text-center
|
||||||
|
bg-brown p-0 m-0
|
||||||
|
session-editor-{{session.id}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="session-editor-row-{{session.id}}-start-time">
|
||||||
|
Hora d'inici:
|
||||||
|
</label>
|
||||||
|
<input type="time" name="start_time"
|
||||||
|
value="{{ session.start_time.strftime('%H:%M') }}"
|
||||||
|
step="60"
|
||||||
|
class="border-none focus:outline-none
|
||||||
|
text-yellow-50 text-center
|
||||||
|
bg-brown p-0 m-0
|
||||||
|
session-editor-{{session.id}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="session-editor-row-{{session.id}}-end-time">
|
||||||
|
Hora final:
|
||||||
|
</label>
|
||||||
|
<input type="time" name="end_time"
|
||||||
|
value="{{ session.end_time.strftime('%H:%M') }}"
|
||||||
|
step="60"
|
||||||
|
class="border-none focus:outline-none
|
||||||
|
text-yellow-50 text-center
|
||||||
|
bg-brown p-0 m-0
|
||||||
|
session-editor-{{session.id}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="session-editor-row-{{session.id}}-venue-name">
|
||||||
|
Lloc:
|
||||||
|
</label>
|
||||||
|
<input list="llocs" name="venue_name"
|
||||||
|
placeholder="nom del lloc"
|
||||||
|
value="{{ session.venue.name or "" }}"
|
||||||
|
class="border border-yellow-50 focus:outline-none
|
||||||
|
rounded
|
||||||
|
text-yellow-50 text-center
|
||||||
|
bg-brown p-0 m-0
|
||||||
|
session-editor-{{session.id}}"
|
||||||
|
/>
|
||||||
|
<datalist id="llocs">
|
||||||
|
<option value="la FEM">
|
||||||
|
<option value="Cal Temerari">
|
||||||
|
</datalist>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="session-editor-row-{{session.id}}-venue-url">
|
||||||
|
Link:
|
||||||
|
</label>
|
||||||
|
<input placeholder="URL del lloc" name="venue_url"
|
||||||
|
value="{{ session.venue.url or "" }}"
|
||||||
|
class="border border-yellow-50 focus:outline-none
|
||||||
|
rounded
|
||||||
|
text-yellow-30 text-center
|
||||||
|
bg-brown p-0 m-0 my-1
|
||||||
|
session-editor-{{session.id}}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<form id="tema-lyric-{{ lyric_idx }}">
|
||||||
|
<h5 class="text-sm text-beige text-right">
|
||||||
|
<input name="title"
|
||||||
|
placeholder="Nom de la lletra"
|
||||||
|
value="{{ lyric.title }}"
|
||||||
|
class="border border-beige focus:outline-none
|
||||||
|
rounded
|
||||||
|
bg-brown px-2 "
|
||||||
|
/>
|
||||||
|
<button title="Desa els canvis"
|
||||||
|
class="mx-1"
|
||||||
|
hx-put="/api/tema/{{ tema.id }}/lyric/{{ lyric_idx }}"
|
||||||
|
hx-target="#tema-lyric-{{ lyric_idx }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-check" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button title="Descarta els canvis"
|
||||||
|
class="mx-1"
|
||||||
|
hx-get="/api/tema/{{ tema.id }}/lyric/{{ lyric_idx }}"
|
||||||
|
hx-target="#tema-lyric-{{ lyric_idx }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</h5>
|
||||||
|
<hr class="h-px mt-1 mb-3 bg-beige border-0">
|
||||||
|
<textarea name="lyric"
|
||||||
|
placeholder="Lletra"
|
||||||
|
rows="{{ lyric.content.count('\n') + 1 }}"
|
||||||
|
class="border border-beige focus:outline-none
|
||||||
|
w-full text-center
|
||||||
|
rounded
|
||||||
|
bg-brown p-2 m-0">
|
||||||
|
{{ lyric.content }}
|
||||||
|
</textarea>
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<div class="flex flex-row flex-wrap justify-center"
|
||||||
|
id="tema-title">
|
||||||
|
<form>
|
||||||
|
<input name="title"
|
||||||
|
placeholder="Nom del tema"
|
||||||
|
value="{{ tema.title }}"
|
||||||
|
class="border border-beige focus:outline-none
|
||||||
|
rounded text-3xl
|
||||||
|
bg-brown p-2 m-0"
|
||||||
|
/>
|
||||||
|
<button title="Desa"
|
||||||
|
class="text-beige text-3xl mx-1"
|
||||||
|
hx-put="/api/tema/{{ tema.id }}/title"
|
||||||
|
hx-target="#tema-title"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-check" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button title="Descarta"
|
||||||
|
class="text-beige text-3xl mx-1"
|
||||||
|
hx-get="/api/tema/{{ tema.id }}/title"
|
||||||
|
hx-target="#tema-title"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<li class="flex flex-row items-start">
|
||||||
|
<div class="p-2 m-2 text-beige border border-beige rounded-md">
|
||||||
|
<a href="{{ link.url }}" target="_blank">
|
||||||
|
{% if link.subtype == LinkSubtype.SPOTIFY %}
|
||||||
|
{% include "icons/spotify.svg" %}
|
||||||
|
{% elif link.subtype == LinkSubtype.YOUTUBE %}
|
||||||
|
{% include "icons/youtube.svg" %}
|
||||||
|
{% elif link.subtype == LinkSubtype.PDF %}
|
||||||
|
{% include "icons/pdf.svg" %}
|
||||||
|
{% elif link.type == LinkType.AUDIO %}
|
||||||
|
{% include "icons/notes.svg" %}
|
||||||
|
{% else %}
|
||||||
|
{% include "icons/link.svg" %}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="my-2">
|
||||||
|
<p class="text-sm text-beige">Partitura</p>
|
||||||
|
<p>Hola</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{% if logged_in or tema.links %}
|
||||||
|
<h4 class="text-xl text-beige">Enllaços</h4>
|
||||||
|
<hr class="h-px mt-1 mb-3 bg-beige border-0">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if tema.links %}
|
||||||
|
{% for link in tema.links %}
|
||||||
|
<ul class="flex flex-col justify-center"
|
||||||
|
id="new-link-target">
|
||||||
|
{% set link_idx = loop.index0 %}
|
||||||
|
{% include "fragments/tema/link.html" %}
|
||||||
|
</ul>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if logged_in %}
|
||||||
|
<div class="flex flex-row my-2 justify-end">
|
||||||
|
<button title="Afegeix una lletra"
|
||||||
|
class="text-sm text-beige text-right"
|
||||||
|
hx-post="/api/tema/{{ tema.id }}/link"
|
||||||
|
hx-target="#new-link-target"
|
||||||
|
hx-swap="beforebegin">
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
Afegeix un enllaç
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<div id="tema-lyric-{{ lyric_idx }}">
|
||||||
|
<h5 class="text-sm text-beige text-right">
|
||||||
|
{{ lyric.title }}
|
||||||
|
{% if logged_in %}
|
||||||
|
<button title="Modifica la lletra"
|
||||||
|
class="mx-1"
|
||||||
|
hx-get="/api/tema/{{ tema.id }}/editor/lyric/{{ lyric_idx }}"
|
||||||
|
hx-target="#tema-lyric-{{ lyric_idx }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
<button title="Esborra la lletra"
|
||||||
|
class="mx-1"
|
||||||
|
hx-delete="/api/tema/{{ tema.id }}/lyric/{{ lyric_idx }}"
|
||||||
|
hx-target="#tema-lyric-{{ lyric_idx }}"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-times" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</h5>
|
||||||
|
<hr class="h-px mt-1 mb-3 bg-beige border-0">
|
||||||
|
<div class="text-center">
|
||||||
|
{{ lyric.content.replace('\n', '<br>') | safe }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{% if logged_in or tema.lyrics %}
|
||||||
|
<h4 class="text-xl text-beige">Lletra</h4>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if tema.lyrics %}
|
||||||
|
{% for lyric in tema.lyrics %}
|
||||||
|
{% set lyric_idx = loop.index0 %}
|
||||||
|
{% include "fragments/tema/lyric.html" %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if logged_in %}
|
||||||
|
<div id="new-lyric-target"></div>
|
||||||
|
<div class="flex flex-row my-2 justify-end">
|
||||||
|
<button title="Afegeix una lletra"
|
||||||
|
class="text-sm text-beige text-right"
|
||||||
|
hx-post="/api/tema/{{ tema.id }}/lyric"
|
||||||
|
hx-target="#new-lyric-target"
|
||||||
|
hx-swap="beforebegin">
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
Afegeix una lletra
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{% include "fragments/menu.html" %}
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<div class="m-12 grow max-w-4xl text-center">
|
||||||
|
{% include "fragments/tema/title.html" %}
|
||||||
|
<div class="text-left">
|
||||||
|
|
||||||
|
<!-- {% if tema.scores() %} -->
|
||||||
|
<!-- temes -->
|
||||||
|
<!-- <h4 class="text-xl text-beige">Tema</h4> -->
|
||||||
|
<!-- <hr class="h-px mt-1 mb-3 bg-beige border-0"> -->
|
||||||
|
<!-- {% for file in tema.files %} -->
|
||||||
|
<!-- {% if file.type == FileType.PDF %} -->
|
||||||
|
<!-- {% set pdf_url = file.path %} -->
|
||||||
|
<!-- {% include "fragments/pdf_viewer.html" %} -->
|
||||||
|
<!-- {% endif %} -->
|
||||||
|
<!-- {% endfor %} -->
|
||||||
|
<!-- {% endif %} -->
|
||||||
|
|
||||||
|
{% include "fragments/tema/lyrics.html" %}
|
||||||
|
{% include "fragments/tema/links.html" %}
|
||||||
|
|
||||||
|
<!-- PROPERTIES -->
|
||||||
|
{% if tema.properties %}
|
||||||
|
<h4 class="text-xl mt-3 text-beige">Informació</h4>
|
||||||
|
<hr class="h-px mt-1 mb-3 bg-beige border-0">
|
||||||
|
{% for property in tema.properties %}
|
||||||
|
<p>
|
||||||
|
<i>{{ property.field.value.capitalize() }}</i>: {{ property.value }}
|
||||||
|
</p>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<div class="flex flex-row flex-wrap justify-center"
|
||||||
|
id="tema-title">
|
||||||
|
<h3 class="text-3xl p-4">{{ tema.title }}</h3>
|
||||||
|
{% if logged_in %}
|
||||||
|
<button title="Canvia el títol"
|
||||||
|
class="text-beige text-2xl"
|
||||||
|
hx-get="/api/tema/{{ tema.id }}/editor/title"
|
||||||
|
hx-target="#tema-title"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
<i class="fa fa-pencil" aria-hidden="true"></i>
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{% include "fragments/menu.html" %}
|
||||||
|
<div class="p-12 text-center flex flex-col items-center justify-center">
|
||||||
|
<h3 class="text-3xl text-beige p-4">Temes</h3>
|
||||||
|
<button title="Afegeix un tema"
|
||||||
|
class="text-beige m-2">
|
||||||
|
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||||
|
Afegeix un tema
|
||||||
|
</button>
|
||||||
|
<input type="text" name="query" value=""
|
||||||
|
placeholder="Busca una tema..."
|
||||||
|
class="rounded
|
||||||
|
text-yellow-50 bg-brown
|
||||||
|
border border-yellow-50
|
||||||
|
p-2 m-2"
|
||||||
|
hx-get="/api/temes/busca"
|
||||||
|
hx-trigger="revealed, keyup delay:500ms changed"
|
||||||
|
hx-target="#search-results">
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<div id="search-results"
|
||||||
|
class="m-4 max-w-5xl
|
||||||
|
flex flex-wrap items-center justify-center">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<div class="flex-none px-4 py-2 w-80 h-80 m-2 border-solid border rounded-md bg-yellow-50 text-brown">
|
||||||
|
<div class="flex flex-col h-full">
|
||||||
|
<div class="text-xl text-beige">
|
||||||
|
<a href="/tema/{{ tema.id }}">
|
||||||
|
{{ tema.title }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="grow"></div>
|
||||||
|
<div class="flex flex-row">
|
||||||
|
</div>
|
||||||
|
<ul class="flex flex-row items-center justify-center">
|
||||||
|
{% if tema.links %}
|
||||||
|
{% for link in tema.links %}
|
||||||
|
<li class="p-2 m-2 text-beige border border-beige rounded-md">
|
||||||
|
<a href="{{ link.url }}" target="_blank">
|
||||||
|
{% if link.type == LinkType.AUDIO %}
|
||||||
|
{% if link.subtype == LinkSubtype.SPOTIFY %}
|
||||||
|
{% include "icons/spotify.svg" %}
|
||||||
|
{% elif link.subtype == LinkSubtype.YOUTUBE %}
|
||||||
|
{% include "icons/youtube.svg" %}
|
||||||
|
{% else %}
|
||||||
|
{% include "icons/notes.svg" %}
|
||||||
|
{% endif %}
|
||||||
|
{% elif link.type == LinkType.SCORE %}
|
||||||
|
{% if link.subtype == LinkSubtype.PDF %}
|
||||||
|
{% include "icons/pdf.svg" %}
|
||||||
|
{% else %}
|
||||||
|
{% include "icons/link.svg" %}
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
{% include "icons/link.svg" %}
|
||||||
|
{% endif %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
<!-- {% if logged_in %} -->
|
||||||
|
<!-- <div> -->
|
||||||
|
<!-- Edita -->
|
||||||
|
<!-- </div> -->
|
||||||
|
<!-- {% endif %} -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-link-45deg" viewBox="0 0 16 16">
|
||||||
|
<path d="M4.715 6.542 3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.002 1.002 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>
|
||||||
|
<path d="M6.586 4.672A3 3 0 0 0 7.414 9.5l.775-.776a2 2 0 0 1-.896-3.346L9.12 3.55a2 2 0 1 1 2.83 2.83l-.793.792c.112.42.155.855.128 1.287l1.372-1.372a3 3 0 1 0-4.243-4.243z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 531 B |
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-music-note-beamed" viewBox="0 0 16 16">
|
||||||
|
<path d="M6 13c0 1.105-1.12 2-2.5 2S1 14.105 1 13c0-1.104 1.12-2 2.5-2s2.5.896 2.5 2m9-2c0 1.105-1.12 2-2.5 2s-2.5-.895-2.5-2 1.12-2 2.5-2 2.5.895 2.5 2"/>
|
||||||
|
<path fill-rule="evenodd" d="M14 11V2h1v9zM6 3v10H5V3z"/>
|
||||||
|
<path d="M5 2.905a1 1 0 0 1 .9-.995l8-.8a1 1 0 0 1 1.1.995V3L5 4z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 426 B |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-file-earmark-pdf-fill" viewBox="0 0 16 16">
|
||||||
|
<path d="M5.523 12.424c.14-.082.293-.162.459-.238a7.878 7.878 0 0 1-.45.606c-.28.337-.498.516-.635.572a.266.266 0 0 1-.035.012.282.282 0 0 1-.026-.044c-.056-.11-.054-.216.04-.36.106-.165.319-.354.647-.548m2.455-1.647c-.119.025-.237.05-.356.078a21.148 21.148 0 0 0 .5-1.05 12.045 12.045 0 0 0 .51.858c-.217.032-.436.07-.654.114m2.525.939a3.881 3.881 0 0 1-.435-.41c.228.005.434.022.612.054.317.057.466.147.518.209a.095.095 0 0 1 .026.064.436.436 0 0 1-.06.2.307.307 0 0 1-.094.124.107.107 0 0 1-.069.015c-.09-.003-.258-.066-.498-.256M8.278 6.97c-.04.244-.108.524-.2.829a4.86 4.86 0 0 1-.089-.346c-.076-.353-.087-.63-.046-.822.038-.177.11-.248.196-.283a.517.517 0 0 1 .145-.04c.013.03.028.092.032.198.005.122-.007.277-.038.465z"/>
|
||||||
|
<path fill-rule="evenodd" d="M4 0h5.293A1 1 0 0 1 10 .293L13.707 4a1 1 0 0 1 .293.707V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2m5.5 1.5v2a1 1 0 0 0 1 1h2zM4.165 13.668c.09.18.23.343.438.419.207.075.412.04.58-.03.318-.13.635-.436.926-.786.333-.401.683-.927 1.021-1.51a11.651 11.651 0 0 1 1.997-.406c.3.383.61.713.91.95.28.22.603.403.934.417a.856.856 0 0 0 .51-.138c.155-.101.27-.247.354-.416.09-.181.145-.37.138-.563a.844.844 0 0 0-.2-.518c-.226-.27-.596-.4-.96-.465a5.76 5.76 0 0 0-1.335-.05 10.954 10.954 0 0 1-.98-1.686c.25-.66.437-1.284.52-1.794.036-.218.055-.426.048-.614a1.238 1.238 0 0 0-.127-.538.7.7 0 0 0-.477-.365c-.202-.043-.41 0-.601.077-.377.15-.576.47-.651.823-.073.34-.04.736.046 1.136.088.406.238.848.43 1.295a19.697 19.697 0 0 1-1.062 2.227 7.662 7.662 0 0 0-1.482.645c-.37.22-.699.48-.897.787-.21.326-.275.714-.08 1.103z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-spotify" viewBox="0 0 16 16">
|
||||||
|
<path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.669 11.538a.498.498 0 0 1-.686.165c-1.879-1.147-4.243-1.407-7.028-.77a.499.499 0 0 1-.222-.973c3.048-.696 5.662-.397 7.77.892a.5.5 0 0 1 .166.686zm.979-2.178a.624.624 0 0 1-.858.205c-2.15-1.321-5.428-1.704-7.972-.932a.625.625 0 0 1-.362-1.194c2.905-.881 6.517-.454 8.986 1.063a.624.624 0 0 1 .206.858m.084-2.268C10.154 5.56 5.9 5.419 3.438 6.166a.748.748 0 1 1-.434-1.432c2.825-.857 7.523-.692 10.492 1.07a.747.747 0 1 1-.764 1.288z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 614 B |
@@ -0,0 +1,3 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" class="bi bi-youtube" viewBox="0 0 16 16">
|
||||||
|
<path d="M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 0 1 1.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 0 1-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 0 1-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 0 1 0 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 0 1 1.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 0 1 7.858 2h.193zM6.4 5.209v4.818l4.157-2.408z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 913 B |
@@ -0,0 +1,38 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover"/>
|
||||||
|
|
||||||
|
<title>{{ page_title }}</title>
|
||||||
|
<meta name="description" content="{{ page_description }}"/>
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
|
||||||
|
integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
|
||||||
|
crossorigin="anonymous"
|
||||||
|
referrerpolicy="no-referrer" />
|
||||||
|
|
||||||
|
<!-- Taiwind CSS -->
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', path='css/main.css') }}" type="text/css" />
|
||||||
|
|
||||||
|
<!-- HTMX -->
|
||||||
|
<script src="{{ url_for('static', path='js/htmx.min.js') }}"></script>
|
||||||
|
|
||||||
|
<!-- Favicon! -->
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', path='favicon/apple-touch-icon.png') }}">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for('static', path='favicon/favicon-32x32.png') }}">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for('static', path='favicon/favicon-16x16.png') }}">
|
||||||
|
<link rel="manifest" href="/site.webmanifest">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="bg-brown text-yellow-50">
|
||||||
|
<div id="header">
|
||||||
|
{% include "fragments/header.html" %}
|
||||||
|
</div>
|
||||||
|
<div class="{% if animate %} animate-fade-in-three opacity-0 {% endif %}">
|
||||||
|
{% include "fragments/content.html" %}
|
||||||
|
{% include "fragments/footer.html" %}
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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)))
|
||||||
@@ -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
|
||||||
|
)
|
||||||
@@ -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",
|
||||||
|
}
|
||||||
@@ -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}")
|
||||||
@@ -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}")
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
LOGGED_IN_FOOTER = "😎"
|
||||||
@@ -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
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
from ._connection import get_connection, Connection
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import sqlite3
|
||||||
|
from contextlib import contextmanager
|
||||||
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
|
from folkugat_web.config.db import DB_FILE
|
||||||
|
|
||||||
|
Connection = sqlite3.Connection
|
||||||
|
|
||||||
|
|
||||||
|
@contextmanager
|
||||||
|
def get_connection(con: Optional[Connection] = None) -> Iterator[Connection]:
|
||||||
|
if con:
|
||||||
|
yield con
|
||||||
|
else:
|
||||||
|
con = sqlite3.connect(DB_FILE)
|
||||||
|
try:
|
||||||
|
yield con
|
||||||
|
con.commit()
|
||||||
|
except Exception:
|
||||||
|
con.rollback()
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
|
con.close()
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
from folkugat_web.dal.sql import get_connection, sessions
|
||||||
|
from folkugat_web.dal.sql.temes import ddl as temes_ddl
|
||||||
|
|
||||||
|
|
||||||
|
def create_db():
|
||||||
|
with get_connection() as con:
|
||||||
|
sessions.create_db(con)
|
||||||
|
temes_ddl.create_db(con)
|
||||||
@@ -0,0 +1,194 @@
|
|||||||
|
import datetime
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from folkugat_web.dal.sql import Connection, get_connection
|
||||||
|
from folkugat_web.model import sessions as model
|
||||||
|
from folkugat_web.model.sql import OrderCol, Range
|
||||||
|
from folkugat_web.typing import OptionalListOrValue as OLV
|
||||||
|
|
||||||
|
|
||||||
|
def create_db(con: Optional[Connection] = None):
|
||||||
|
with get_connection(con) as con:
|
||||||
|
create_sessions_table(con)
|
||||||
|
|
||||||
|
|
||||||
|
def drop_sessions_table(con: Connection):
|
||||||
|
query = "DROP TABLE IF EXISTS sessions"
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
|
||||||
|
def create_sessions_table(con: Connection):
|
||||||
|
query = """
|
||||||
|
CREATE TABLE IF NOT EXISTS sessions (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
date TEXT NOT NULL,
|
||||||
|
start_time TEXT NOT NULL,
|
||||||
|
end_time TEXT NOT NULL,
|
||||||
|
venue_name TEXT,
|
||||||
|
venue_url TEXT,
|
||||||
|
is_live BOOLEAN DEFAULT false
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
|
||||||
|
def _session_to_row(sessio: model.Session) -> dict:
|
||||||
|
return {
|
||||||
|
'id': sessio.id,
|
||||||
|
'date': sessio.date,
|
||||||
|
'start_time': sessio.start_time.isoformat(),
|
||||||
|
'end_time': sessio.end_time.isoformat(),
|
||||||
|
'venue_name': sessio.venue.name,
|
||||||
|
'venue_url': sessio.venue.url,
|
||||||
|
'is_live': sessio.is_live,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _row_to_session(row: tuple) -> model.Session:
|
||||||
|
return model.Session(
|
||||||
|
id=row[0],
|
||||||
|
date=datetime.date.fromisoformat(row[1]),
|
||||||
|
start_time=datetime.time.fromisoformat(row[2]),
|
||||||
|
end_time=datetime.time.fromisoformat(row[3]),
|
||||||
|
venue=model.SessionVenue(
|
||||||
|
name=row[4],
|
||||||
|
url=row[5],
|
||||||
|
),
|
||||||
|
is_live=row[6],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def insert_session(session: model.Session, con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
INSERT INTO sessions
|
||||||
|
(id, date, start_time, end_time, venue_name, venue_url, is_live)
|
||||||
|
VALUES
|
||||||
|
(:id, :date, :start_time, :end_time, :venue_name, :venue_url, :is_live)
|
||||||
|
RETURNING *
|
||||||
|
"""
|
||||||
|
data = _session_to_row(session)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
row = cur.fetchone()
|
||||||
|
return _row_to_session(row)
|
||||||
|
|
||||||
|
|
||||||
|
def update_session(session: model.Session, con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
UPDATE sessions SET
|
||||||
|
date = :date, start_time = :start_time, end_time = :end_time,
|
||||||
|
venue_name = :venue_name, venue_url = :venue_url, is_live = :is_live
|
||||||
|
WHERE id = :id
|
||||||
|
"""
|
||||||
|
data = _session_to_row(session)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
|
||||||
|
|
||||||
|
def _filter_clause(session_id: Optional[int] = None,
|
||||||
|
date_range: Optional[Range[datetime.date]] = None,
|
||||||
|
is_live: Optional[bool] = None) -> tuple[str, dict]:
|
||||||
|
filter_clauses = []
|
||||||
|
filter_data = {}
|
||||||
|
|
||||||
|
if session_id is not None:
|
||||||
|
filter_clauses.append(f"id = :session_id")
|
||||||
|
filter_data["session_id"] = session_id
|
||||||
|
|
||||||
|
if date_range:
|
||||||
|
if ub := date_range.upper_bound():
|
||||||
|
operator = "<=" if ub[1] else "<"
|
||||||
|
filter_clauses.append(f"date {operator} :date_ub")
|
||||||
|
filter_data["date_ub"] = ub[0]
|
||||||
|
if lb := date_range.lower_bound():
|
||||||
|
operator = ">=" if lb[1] else ">"
|
||||||
|
filter_clauses.append(f"date {operator} :date_lb")
|
||||||
|
filter_data["date_lb"] = lb[0]
|
||||||
|
|
||||||
|
if is_live is not None:
|
||||||
|
filter_clauses.append(f"is_live = :is_live")
|
||||||
|
filter_data["is_live"] = is_live
|
||||||
|
|
||||||
|
if filter_clauses:
|
||||||
|
filter_clause_str = " AND ".join(filter_clauses)
|
||||||
|
filter_clause = f"WHERE {filter_clause_str}"
|
||||||
|
return filter_clause, filter_data
|
||||||
|
else:
|
||||||
|
return "", {}
|
||||||
|
|
||||||
|
|
||||||
|
def _order_clause(order_by: OLV[OrderCol[model.SessionCols]]) -> str:
|
||||||
|
if not order_by:
|
||||||
|
return ""
|
||||||
|
if not isinstance(order_by, list):
|
||||||
|
order_by = [order_by]
|
||||||
|
|
||||||
|
order_clauses = [f"{ocol.column.value} {ocol.order.value}" for ocol in order_by]
|
||||||
|
order_clauses_str = " ".join(order_clauses)
|
||||||
|
return f"ORDER BY {order_clauses_str}"
|
||||||
|
|
||||||
|
|
||||||
|
def get_sessions(session_id: Optional[int] = None,
|
||||||
|
date_range: Optional[Range[datetime.date]] = None,
|
||||||
|
is_live: Optional[bool] = None,
|
||||||
|
order_by: OLV[OrderCol[model.SessionCols]] = None,
|
||||||
|
limit: Optional[int] = None, offset: Optional[int] = None,
|
||||||
|
con: Optional[Connection] = None) -> list[model.Session]:
|
||||||
|
clauses = []
|
||||||
|
filter_clause, data = _filter_clause(session_id=session_id, date_range=date_range, is_live=is_live)
|
||||||
|
if filter_clause:
|
||||||
|
clauses.append(filter_clause)
|
||||||
|
if order_clause := _order_clause(order_by=order_by):
|
||||||
|
clauses.append(order_clause)
|
||||||
|
if limit is not None:
|
||||||
|
clauses.append("LIMIT :limit")
|
||||||
|
data["limit"] = limit
|
||||||
|
if offset is not None:
|
||||||
|
clauses.append("OFFSET :offset")
|
||||||
|
data["offset"] = offset
|
||||||
|
|
||||||
|
clauses_str = " ".join(clauses)
|
||||||
|
query = f"""
|
||||||
|
SELECT id, date, start_time, end_time, venue_name, venue_url, is_live
|
||||||
|
FROM sessions
|
||||||
|
{clauses_str}
|
||||||
|
"""
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
return list(map(_row_to_session, cur.fetchall()))
|
||||||
|
|
||||||
|
|
||||||
|
def delete_session_by_id(session_id: int, con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
DELETE FROM sessions
|
||||||
|
WHERE id = :id
|
||||||
|
"""
|
||||||
|
data = dict(id=session_id)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
|
||||||
|
|
||||||
|
def stop_live_sessions(con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
UPDATE sessions SET is_live = false WHERE is_live = true
|
||||||
|
"""
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
|
||||||
|
def set_live_session(session_id: int, con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
UPDATE sessions SET is_live = true WHERE id = :id
|
||||||
|
"""
|
||||||
|
data = dict(id=session_id)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
stop_live_sessions(con=con)
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import datetime
|
||||||
|
import json
|
||||||
|
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
|
||||||
|
|
||||||
|
def tema_to_row(tema: model.Tema) -> dict:
|
||||||
|
return {
|
||||||
|
'id': tema.id,
|
||||||
|
'title': tema.title,
|
||||||
|
'properties': json.dumps(list(map(lambda p: p.to_dict(), tema.properties))),
|
||||||
|
'links': json.dumps(list(map(lambda l: l.to_dict(), tema.links))),
|
||||||
|
'lyrics': json.dumps(list(map(lambda l: l.to_dict(), tema.lyrics))),
|
||||||
|
'alternatives': json.dumps(tema.alternatives),
|
||||||
|
'ngrams': json.dumps(tema.ngrams),
|
||||||
|
'modification_date': tema.modification_date.isoformat(),
|
||||||
|
'creation_date': tema.creation_date.isoformat(),
|
||||||
|
'hidden': 1 if tema.hidden else 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def cell_to_ngrams(cell: str) -> model.NGrams:
|
||||||
|
return {int(n): ngrams_ for n, ngrams_ in json.loads(cell).items()}
|
||||||
|
|
||||||
|
|
||||||
|
def row_to_tema(row: tuple) -> model.Tema:
|
||||||
|
return model.Tema(
|
||||||
|
id=row[0],
|
||||||
|
title=row[1],
|
||||||
|
properties=list(map(model.Property.from_dict, json.loads(row[2]))),
|
||||||
|
links=list(map(model.Link.from_dict, json.loads(row[3]))),
|
||||||
|
lyrics=list(map(model.Lyrics.from_dict, json.loads(row[4]))),
|
||||||
|
alternatives=json.loads(row[5]),
|
||||||
|
ngrams=cell_to_ngrams(row[6]),
|
||||||
|
modification_date=datetime.datetime.fromisoformat(row[7]),
|
||||||
|
creation_date=datetime.datetime.fromisoformat(row[8]),
|
||||||
|
hidden=bool(row[9]),
|
||||||
|
)
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from folkugat_web import data
|
||||||
|
from folkugat_web.dal.sql import Connection, get_connection
|
||||||
|
|
||||||
|
from .write import insert_tema
|
||||||
|
|
||||||
|
|
||||||
|
def create_db(con: Optional[Connection] = None):
|
||||||
|
with get_connection(con) as con:
|
||||||
|
drop_temes_table(con)
|
||||||
|
create_temes_table(con)
|
||||||
|
|
||||||
|
for tema in data.TEMES:
|
||||||
|
insert_tema(tema, con)
|
||||||
|
|
||||||
|
|
||||||
|
def drop_temes_table(con: Connection):
|
||||||
|
query = "DROP TABLE IF EXISTS temes"
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
|
|
||||||
|
|
||||||
|
def create_temes_table(con: Connection):
|
||||||
|
query = """
|
||||||
|
CREATE TABLE IF NOT EXISTS temes (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
properties TEXT,
|
||||||
|
links TEXT,
|
||||||
|
lyrics TEXT,
|
||||||
|
alternatives TEXT,
|
||||||
|
ngrams TEXT,
|
||||||
|
creation_date TEXT NOT NULL,
|
||||||
|
modification_date TEXT NOT NULL,
|
||||||
|
hidden INTEGER NOT NULL
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from folkugat_web.dal.sql import Connection, get_connection
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
|
||||||
|
from ._conversion import cell_to_ngrams, row_to_tema
|
||||||
|
|
||||||
|
TEMA_ID_TO_NGRAMS_CACHE = None
|
||||||
|
|
||||||
|
|
||||||
|
def get_tema_by_id(tema_id: int, con: Optional[Connection] = None) -> Optional[model.Tema]:
|
||||||
|
query = """
|
||||||
|
SELECT
|
||||||
|
id, title, properties, links, lyrics, alternatives, ngrams,
|
||||||
|
creation_date, modification_date, hidden
|
||||||
|
FROM temes
|
||||||
|
WHERE id = :id
|
||||||
|
"""
|
||||||
|
data = dict(id=tema_id)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
row = cur.fetchone()
|
||||||
|
return row_to_tema(row) if row else None
|
||||||
|
|
||||||
|
|
||||||
|
def evict_tema_id_to_ngrams_cache():
|
||||||
|
global TEMA_ID_TO_NGRAMS_CACHE
|
||||||
|
TEMA_ID_TO_NGRAMS_CACHE = None
|
||||||
|
|
||||||
|
|
||||||
|
def get_tema_id_to_ngrams(con: Optional[Connection] = None) -> dict[int, model.NGrams]:
|
||||||
|
global TEMA_ID_TO_NGRAMS_CACHE
|
||||||
|
if TEMA_ID_TO_NGRAMS_CACHE is None:
|
||||||
|
TEMA_ID_TO_NGRAMS_CACHE = _get_tema_id_to_ngrams(con)
|
||||||
|
return TEMA_ID_TO_NGRAMS_CACHE
|
||||||
|
|
||||||
|
|
||||||
|
def _get_tema_id_to_ngrams(con: Optional[Connection] = None) -> dict[int, model.NGrams]:
|
||||||
|
query = """
|
||||||
|
SELECT id, ngrams
|
||||||
|
FROM temes
|
||||||
|
WHERE hidden = 0
|
||||||
|
"""
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query)
|
||||||
|
rows = cur.fetchall()
|
||||||
|
return {id_: cell_to_ngrams(ng) for id_, ng in rows}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from folkugat_web.dal.sql import Connection, get_connection
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
|
||||||
|
from ._conversion import row_to_tema, tema_to_row
|
||||||
|
from .query import evict_tema_id_to_ngrams_cache
|
||||||
|
|
||||||
|
|
||||||
|
def insert_tema(tema: model.Tema, con: Optional[Connection] = None) -> model.Tema:
|
||||||
|
query = """
|
||||||
|
INSERT INTO temes
|
||||||
|
(id, title, properties, links, lyrics, alternatives, ngrams,
|
||||||
|
creation_date, modification_date, hidden)
|
||||||
|
VALUES
|
||||||
|
(:id, :title, :properties, :links, :lyrics, :alternatives, :ngrams,
|
||||||
|
:creation_date, :modification_date, :hidden)
|
||||||
|
RETURNING *
|
||||||
|
"""
|
||||||
|
data = tema_to_row(tema)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
row = cur.fetchone()
|
||||||
|
evict_tema_id_to_ngrams_cache()
|
||||||
|
return row_to_tema(row)
|
||||||
|
|
||||||
|
|
||||||
|
def update_tema(tema: model.Tema, con: Optional[Connection] = None):
|
||||||
|
query = """
|
||||||
|
UPDATE temes
|
||||||
|
SET
|
||||||
|
title = :title, properties = :properties, links = :links, lyrics = :lyrics,
|
||||||
|
alternatives = :alternatives, ngrams = :ngrams, creation_date = :creation_date,
|
||||||
|
modification_date = :modification_date, hidden = :hidden
|
||||||
|
WHERE
|
||||||
|
id = :id
|
||||||
|
"""
|
||||||
|
data = tema_to_row(tema)
|
||||||
|
with get_connection(con) as con:
|
||||||
|
cur = con.cursor()
|
||||||
|
cur.execute(query, data)
|
||||||
|
evict_tema_id_to_ngrams_cache()
|
||||||
|
return
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
from folkugat_web.model import temes as model
|
||||||
|
|
||||||
|
TEMES = [
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="El Joan Petit",
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Pasdoble de Muntanya (Cançó amb el nom molt llarg)",
|
||||||
|
links=[
|
||||||
|
model.Link(
|
||||||
|
type=model.LinkType.AUDIO,
|
||||||
|
subtype=model.LinkSubtype.SPOTIFY,
|
||||||
|
url="https://open.spotify.com/track/4j9Krf19c5USmMvVUCoeWa?si=3023d1d83f814886",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Astrid Waltz",
|
||||||
|
alternatives=["vals"],
|
||||||
|
links=[
|
||||||
|
model.Link(
|
||||||
|
type=model.LinkType.OTHER,
|
||||||
|
subtype=None,
|
||||||
|
url="https://marc.sastre.cat/folkugat",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Ook Pik Waltz",
|
||||||
|
alternatives=["vals"],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Pasdoble Patumaire",
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="El Gitano",
|
||||||
|
links=[
|
||||||
|
model.Link(
|
||||||
|
type=model.LinkType.SCORE,
|
||||||
|
subtype=model.LinkSubtype.PDF,
|
||||||
|
url="/db/temes/1/tema.pdf",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Pasdoble de Gitanes",
|
||||||
|
alternatives=["entrada"],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Jota Comunera",
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
# ---
|
||||||
|
model.Tema(
|
||||||
|
title="Malaguenya de Barxeta",
|
||||||
|
lyrics=[
|
||||||
|
model.Lyrics(
|
||||||
|
title="Malaguenya de Barxeta",
|
||||||
|
content="""
|
||||||
|
Mira si he corregut terres
|
||||||
|
que he estat en Alfarrasí,
|
||||||
|
en Adzaneta i Albaida,
|
||||||
|
en el Palomar i ací.
|
||||||
|
|
||||||
|
Omplim el sarró de pa,
|
||||||
|
si vols que et guarde les cabres,
|
||||||
|
que les figues ja s'acaben
|
||||||
|
i raïm ja no hi ha.
|
||||||
|
|
||||||
|
L'altre dia jo somiava
|
||||||
|
que ja era realitat
|
||||||
|
un món sense violència
|
||||||
|
ple de pau i llibertat.
|
||||||
|
|
||||||
|
Vinc del cor de la Costera,
|
||||||
|
el poble dels socarrats,
|
||||||
|
d'allà on renaix de les cendres
|
||||||
|
el meu País Valencià.
|
||||||
|
""".strip(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
properties=[
|
||||||
|
model.Property(
|
||||||
|
model.PropertyField.AUTOR,
|
||||||
|
"Pep Jimeno 'Botifarra'"
|
||||||
|
)
|
||||||
|
],
|
||||||
|
hidden=False,
|
||||||
|
).with_ngrams(),
|
||||||
|
]
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.model import sessions as model
|
||||||
|
from folkugat_web.services import sessions as service
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
def sessio_en_directe(request: Request):
|
||||||
|
session = service.get_live_session()
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/marquee.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"session": session,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def start_live_session(request: Request, session_id: int):
|
||||||
|
service.set_live_session(session_id=session_id)
|
||||||
|
session = model.Session(id=session_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/live/stop.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"session": session,
|
||||||
|
},
|
||||||
|
headers={
|
||||||
|
"HX-Trigger": "reload-marquee"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def stop_live_session(request: Request, session_id: int):
|
||||||
|
service.stop_live_sessions()
|
||||||
|
session = model.Session(id=session_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/live/start.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"session": session,
|
||||||
|
},
|
||||||
|
headers={
|
||||||
|
"HX-Trigger": "reload-marquee"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
from folkugat_web.config import nota as config
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
def input(request, value=None):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/nota/input.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"value": value,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def footer(request, value, logged_in):
|
||||||
|
response = templates.TemplateResponse(
|
||||||
|
"fragments/nota/footer.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"value": config.LOGGED_IN_FOOTER if logged_in else value,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def nota(request):
|
||||||
|
response = templates.TemplateResponse(
|
||||||
|
"fragments/nota/nota.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
response.headers["HX-Refresh"] = "true"
|
||||||
|
return response
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from fastapi import Request
|
||||||
|
from fastapi.responses import HTMLResponse
|
||||||
|
from folkugat_web.config import calendari as config
|
||||||
|
from folkugat_web.model import sessions as model
|
||||||
|
from folkugat_web.model.pagines import Pages
|
||||||
|
from folkugat_web.services import sessions as service
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_pagina(request, logged_in):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/pagina.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"Pages": Pages,
|
||||||
|
"menu_selected_id": Pages.Sessions,
|
||||||
|
"calendar_list_id": config.CALENDAR_LIST_ID,
|
||||||
|
"history_list_id": config.HISTORY_LIST_ID,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_calendari(request: Request, limit: int, logged_in: bool):
|
||||||
|
sessions = service.get_next_sessions(limit=limit+1)
|
||||||
|
has_more_sessions = len(sessions) > limit
|
||||||
|
sessions = sessions[:limit]
|
||||||
|
next_session_id = sessions[0].id if sessions else None
|
||||||
|
return _sessions_list(
|
||||||
|
request=request,
|
||||||
|
sessions=sessions,
|
||||||
|
has_more_sessions=has_more_sessions,
|
||||||
|
paging_config=config.CALENDARI_PAGING_CONFIG,
|
||||||
|
list_id=config.CALENDAR_LIST_ID,
|
||||||
|
next_session_id=next_session_id,
|
||||||
|
get_sessions_url="/api/sessions/upcoming",
|
||||||
|
limit=limit,
|
||||||
|
logged_in=logged_in
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_historial(request: Request, limit: int, logged_in: bool):
|
||||||
|
sessions = service.get_sessions_history(limit=limit+1)
|
||||||
|
has_more_sessions = len(sessions) > limit
|
||||||
|
sessions = sessions[:limit]
|
||||||
|
return _sessions_list(
|
||||||
|
request=request,
|
||||||
|
sessions=sessions,
|
||||||
|
has_more_sessions=has_more_sessions,
|
||||||
|
paging_config=config.HISTORY_PAGING_CONFIG,
|
||||||
|
list_id=config.HISTORY_LIST_ID,
|
||||||
|
get_sessions_url="/api/sessions/history",
|
||||||
|
limit=limit,
|
||||||
|
logged_in=logged_in
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _sessions_list(request: Request, sessions: list[model.Session], has_more_sessions: bool,
|
||||||
|
paging_config: config.PagingConfig, list_id: str, get_sessions_url: str,
|
||||||
|
limit: int, logged_in: bool, next_session_id: Optional[int] = None):
|
||||||
|
if has_more_sessions:
|
||||||
|
more_sessions = limit + paging_config.step
|
||||||
|
else:
|
||||||
|
more_sessions = None
|
||||||
|
|
||||||
|
if len(sessions) > paging_config.initial_items:
|
||||||
|
less_sessions = max(paging_config.initial_items, len(sessions) - paging_config.step)
|
||||||
|
else:
|
||||||
|
less_sessions = None
|
||||||
|
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/session_list.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"get_sessions_url": get_sessions_url,
|
||||||
|
"sessions": sessions,
|
||||||
|
"session_list_id": list_id,
|
||||||
|
"next_session_id": next_session_id,
|
||||||
|
"more_sessions": more_sessions,
|
||||||
|
"less_sessions": less_sessions,
|
||||||
|
"limit": limit,
|
||||||
|
"date_names": service.get_date_names,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessio(request: Request, session_id: int, logged_in: bool):
|
||||||
|
session = service.get_session(session_id=session_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/sessio.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"Pages": Pages,
|
||||||
|
"session": session,
|
||||||
|
"date_names": service.get_date_names,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_editor_row(request: Request, session_date: Optional[model.Session] = None, session_id: Optional[int] = None):
|
||||||
|
if session_date is None:
|
||||||
|
if session_id is None:
|
||||||
|
raise ValueError("Must either give session or session_id")
|
||||||
|
session_date = service.get_session(session_id=session_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/session_row.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"session": session_date,
|
||||||
|
"date_names": service.get_date_names,
|
||||||
|
"logged_in": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_editor_row_editing(request, session_id: int):
|
||||||
|
session = service.get_session(session_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/sessions/session_row_editing.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"session": session,
|
||||||
|
"date_names": service.get_date_names,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_editor_insert_row(request, session_date: Optional[model.Session] = None):
|
||||||
|
session_date = service.insert_session(session_date or service.new_session())
|
||||||
|
return sessions_editor_row(request, session_date=session_date)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_editor_post_row(request, session_date: model.Session):
|
||||||
|
service.set_session(session_date)
|
||||||
|
return sessions_editor_row(request, session_date=session_date)
|
||||||
|
|
||||||
|
|
||||||
|
def sessions_editor_delete_row(session_id: int):
|
||||||
|
service.delete_session(session_id)
|
||||||
|
return HTMLResponse()
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
from folkugat_web.services.temes import query as temes_q
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
def title(request: Request, logged_in: bool, tema: Optional[model.Tema] = None, tema_id: Optional[int] = None):
|
||||||
|
if tema is None:
|
||||||
|
if tema_id is None:
|
||||||
|
raise ValueError("Either 'tema' or 'tema_id' must be given!")
|
||||||
|
tema = temes_q.get_tema_by_id(tema_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/tema/title.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"tema": tema,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def title_editor(request: Request, logged_in: bool, tema_id: int):
|
||||||
|
tema = temes_q.get_tema_by_id(tema_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/tema/editor/title.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"tema": tema,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def lyric(request: Request, logged_in: bool, tema_id: int, lyric_idx: int):
|
||||||
|
tema = temes_q.get_tema_by_id(tema_id)
|
||||||
|
if tema is None:
|
||||||
|
raise ValueError(f"No tune exists for tema_id: {tema_id}")
|
||||||
|
if len(tema.lyrics) < lyric_idx:
|
||||||
|
raise ValueError(f'Lyric index out of bounds')
|
||||||
|
lyric = tema.lyrics[lyric_idx]
|
||||||
|
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/tema/lyric.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"tema": tema,
|
||||||
|
"lyric_idx": lyric_idx,
|
||||||
|
"lyric": lyric,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def lyric_editor(request: Request, logged_in: bool, tema_id: int, lyric_idx: int):
|
||||||
|
tema = temes_q.get_tema_by_id(tema_id)
|
||||||
|
if tema is None:
|
||||||
|
raise ValueError(f"No tune exists for tema_id: {tema_id}")
|
||||||
|
if len(tema.lyrics) < lyric_idx:
|
||||||
|
raise ValueError(f'Lyric index out of bounds')
|
||||||
|
lyric = tema.lyrics[lyric_idx]
|
||||||
|
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/tema/editor/lyric.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"tema": tema,
|
||||||
|
"lyric_idx": lyric_idx,
|
||||||
|
"lyric": lyric,
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
from fastapi import Request
|
||||||
|
from folkugat_web.model import temes as model
|
||||||
|
from folkugat_web.model.pagines import Pages
|
||||||
|
from folkugat_web.services.temes import query as temes_q
|
||||||
|
from folkugat_web.services.temes import search as temes_s
|
||||||
|
from folkugat_web.templates import templates
|
||||||
|
|
||||||
|
|
||||||
|
def temes_pagina(request: Request, logged_in: bool):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/temes/pagina.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"Pages": Pages,
|
||||||
|
"menu_selected_id": Pages.Temes,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def temes_busca_result(request: Request, tema: model.Tema, logged_in: bool):
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/temes/result.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"tema": tema,
|
||||||
|
"LinkSubtype": model.LinkSubtype,
|
||||||
|
"LinkType": model.LinkType,
|
||||||
|
}
|
||||||
|
).body.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
|
def temes_busca(request: Request, query: str, logged_in: bool):
|
||||||
|
temes = temes_s.busca_temes(query)
|
||||||
|
return '\n'.join(
|
||||||
|
[temes_busca_result(request, tema, logged_in)
|
||||||
|
for tema in temes]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def tema(request: Request, tema_id: int, logged_in: bool):
|
||||||
|
tema = temes_q.get_tema_by_id(tema_id)
|
||||||
|
return templates.TemplateResponse(
|
||||||
|
"fragments/tema/pagina.html",
|
||||||
|
{
|
||||||
|
"request": request,
|
||||||
|
"logged_in": logged_in,
|
||||||
|
"Pages": Pages,
|
||||||
|
"LinkSubtype": model.LinkSubtype,
|
||||||
|
"LinkType": model.LinkType,
|
||||||
|
"tema": tema,
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.NOTSET)
|
||||||
|
|
||||||
|
logger = logging.getLogger('folkugat-web')
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import subprocess
|
||||||
|
from contextlib import asynccontextmanager
|
||||||
|
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
|
from folkugat_web import log
|
||||||
|
from folkugat_web.config import directories, db
|
||||||
|
from folkugat_web.dal.sql.ddl import create_db
|
||||||
|
from folkugat_web.api import router
|
||||||
|
|
||||||
|
|
||||||
|
@asynccontextmanager
|
||||||
|
async def lifespan(_: FastAPI):
|
||||||
|
"""
|
||||||
|
Context manager for FastAPI app. It will run all code before `yield`
|
||||||
|
on app startup, and will run code after `yeld` on app shutdown.
|
||||||
|
"""
|
||||||
|
|
||||||
|
log.logger.info("Running Tailwind CSS...")
|
||||||
|
try:
|
||||||
|
subprocess.run([
|
||||||
|
"tailwindcss",
|
||||||
|
"-i",
|
||||||
|
directories.STATIC_DIR / "src" / "tw.css",
|
||||||
|
"-o",
|
||||||
|
directories.STATIC_DIR / "css" / "main.css",
|
||||||
|
# "--minify"
|
||||||
|
])
|
||||||
|
except Exception as e:
|
||||||
|
log.logger.error(f"Error running tailwindcss: {e}")
|
||||||
|
log.logger.info("Tailwind CSS done")
|
||||||
|
|
||||||
|
log.logger.info("Creating DB...")
|
||||||
|
create_db()
|
||||||
|
log.logger.info("DB created")
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
def get_app() -> FastAPI:
|
||||||
|
app = FastAPI(lifespan=lifespan)
|
||||||
|
app.include_router(router)
|
||||||
|
|
||||||
|
app.mount("/static", StaticFiles(directory=directories.STATIC_DIR), name="static")
|
||||||
|
app.mount("/db/temes", StaticFiles(directory=db.DB_TEMES_DIR), name="temes")
|
||||||
|
|
||||||
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
app = get_app()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import uvicorn
|
||||||
|
|
||||||
|
uvicorn.run(app, host="127.0.0.1", port=8000)
|
||||||