17 Commits

Author SHA1 Message Date
0f5a9868b8 Add renovate.json
All checks were successful
PR tests / build-image (pull_request) Successful in 1m22s
PR tests / smoke-tests (pull_request) Successful in 27s
2025-11-28 01:05:25 +00:00
Gitea CI
2ee5715b7a Bump version: 0.1.4 → 0.2.0 2025-11-26 13:28:09 +00:00
Gitea CI
e3cc82568a Bump version: 0.1.3 → 0.1.4 2025-11-25 13:34:37 +00:00
4ad04cdf49 Merge pull request 'feat: add redis caching' (#9) from dev into main
Reviewed-on: #9
2025-11-25 13:33:52 +00:00
Gitea CI
d0dafec4cb Bump version: 0.1.2 → 0.1.3 2025-11-25 10:06:03 +00:00
075041f371 Update pyproject.toml 2025-11-25 10:00:51 +00:00
981d5211b6 Merge pull request 'Add new env variable to use prefixes in url [release-patch]' (#8) from dev into main
Reviewed-on: #8
2025-11-25 09:57:16 +00:00
d5cf0a8636 Merge pull request 'dev' (#7) from dev into main
Reviewed-on: #7
2025-11-25 09:51:05 +00:00
5a1c19ccbe Merge pull request 'dev [release-patch]' (#6) from dev into main
Reviewed-on: #6
2025-11-25 09:05:53 +00:00
59c90ca471 Merge pull request 'chore: replace apk with apt [release-patch]' (#5) from dev into main
Reviewed-on: #5
2025-11-25 08:00:20 +00:00
1e7d45ec49 Merge pull request 'test: inspired by other Dockerfile [release-patch]' (#4) from dev into main
Reviewed-on: #4
2025-11-25 07:51:22 +00:00
69e463c9a4 Merge pull request 'test: add path, switch to uv [release-patch]' (#3) from dev into main
Reviewed-on: #3
2025-11-25 07:39:30 +00:00
b1cdeffb4c Update pyproject.toml 2025-11-25 07:39:24 +00:00
e2cd6d7ba3 Update pyproject.toml 2025-11-25 07:38:30 +00:00
Gitea CI
70a867e4a1 Bump version: 0.1.0 → 0.1.1 2025-11-25 04:13:49 +00:00
16b1c131a4 Merge pull request 'change dockerfile' (#2) from dev into main
Reviewed-on: #2
2025-11-25 04:13:20 +00:00
809ce9bdd9 Merge pull request 'add versioning' (#1) from dev into main
Reviewed-on: #1
2025-11-25 03:52:15 +00:00
6 changed files with 11 additions and 26 deletions

View File

@@ -58,7 +58,7 @@ jobs:
fetch-tags: true # Fetch all tags (refs/tags) fetch-tags: true # Fetch all tags (refs/tags)
- name: Install uv - name: Install uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v5
- name: Set up Python - name: Set up Python
run: uv python install run: uv python install
with: with:

View File

@@ -16,7 +16,7 @@ jobs:
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
- name: Install uv - name: Install uv
uses: astral-sh/setup-uv@v7 uses: astral-sh/setup-uv@v5
- name: (optional) Prepare dependencies - name: (optional) Prepare dependencies
run: | run: |

13
.vscode/settings.json vendored
View File

@@ -1,13 +0,0 @@
{
"cSpell.words": [
"buildx",
"Buildx",
"elif",
"gitea",
"Gitea",
"github",
"linux",
"pyproject",
"semapform"
]
}

View File

@@ -4,19 +4,17 @@ This can run independently to support the PHP application.
""" """
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from contextlib import asynccontextmanager
import json import json
import logging import logging
import os import os
import re import re
import time import time
import urllib.parse from typing import Any, TYPE_CHECKING
from contextlib import asynccontextmanager
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING: if TYPE_CHECKING:
from collections.abc import AsyncIterator, Awaitable, Callable from collections.abc import AsyncIterator, Callable, Awaitable
# Avoid importing heavy modules at top-level to keep `import api_service` lightweight # Avoid importing heavy modules at top-level to keep `import api_service` lightweight
from fastapi import FastAPI, Query, Request, Response from fastapi import FastAPI, Query, Request, Response
@@ -31,7 +29,7 @@ redis_client = None
@asynccontextmanager @asynccontextmanager
async def _lifespan(_app: FastAPI) -> AsyncIterator[None]: async def _lifespan(_app: FastAPI) -> AsyncIterator[None]:
"""Lifespan handler: connect to Redis on startup and close on shutdown.""" """Lifespan handler: connect to Redis on startup and close on shutdown."""
global redis_client # type: ignore[PLW0603] global redis_client
if REDIS_URL: if REDIS_URL:
try: try:
import redis.asyncio as aioredis import redis.asyncio as aioredis
@@ -161,10 +159,6 @@ async def _cache_set(key: str, value: CacheValue, ttl: int = CACHE_TTL_SECONDS)
async def validate_signature(signature: str = Query(...)) -> JSONResponse: async def validate_signature(signature: str = Query(...)) -> JSONResponse:
"""Validate a book signature and return total pages.""" """Validate a book signature and return total pages."""
# check cache first # check cache first
# ensure signature is stripped of leading/trailing whitespace
signature = signature.strip()
# enforce url quotes
signature = urllib.parse.quote(signature)
cache_key = f"signature:{signature}" cache_key = f"signature:{signature}"
cached = await _cache_get(cache_key) cached = await _cache_get(cache_key)
if cached is not None: if cached is not None:

View File

@@ -7,6 +7,7 @@ requires-python = ">=3.13"
dependencies = [ dependencies = [
"bibapi[catalogue]>=0.0.6", "bibapi[catalogue]>=0.0.6",
"fastapi>=0.122.0", "fastapi>=0.122.0",
"pip>=25.3",
"uvicorn>=0.38.0", "uvicorn>=0.38.0",
"redis>=4.6.0", "redis>=4.6.0",
] ]
@@ -15,7 +16,7 @@ name = "gitea"
url = "https://git.theprivateserver.de/api/packages/PHB/pypi/simple/" url = "https://git.theprivateserver.de/api/packages/PHB/pypi/simple/"
[tool.bumpversion] [tool.bumpversion]
current_version = "0.1.3" current_version = "0.2.0"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"] serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}" search = "{current_version}"

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}