mirror of
https://codeberg.org/Freedium-cfd/web.git
synced 2026-03-11 09:04:37 +00:00
chore: minor fixes
This commit is contained in:
parent
26d52f2a54
commit
213d41df01
9 changed files with 137 additions and 62 deletions
73
CaddyfileDev
73
CaddyfileDev
|
|
@ -5,170 +5,207 @@
|
|||
|
||||
|
||||
handle_path /android-chrome-192x192.png {
|
||||
root * ./static/android-chrome-192x192.png
|
||||
root * /static/android-chrome-192x192.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /android-chrome-512x512.png {
|
||||
root * ./static/android-chrome-512x512.png
|
||||
root * /static/android-chrome-512x512.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon.png {
|
||||
root * ./static/apple-touch-icon.png
|
||||
root * /static/apple-touch-icon.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /browserconfig.xml {
|
||||
root * ./static/browserconfig.xml
|
||||
root * /static/browserconfig.xml
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon-16x16.png {
|
||||
root * ./static/favicon-16x16.png
|
||||
root * /static/favicon-16x16.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon-32x32.png {
|
||||
root * ./static/favicon-32x32.png
|
||||
root * /static/favicon-32x32.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon.ico {
|
||||
root * ./static/favicon.ico
|
||||
root * /static/favicon.ico
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /humans.txt {
|
||||
root * ./static/humans.txt
|
||||
root * /static/humans.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-144x144.png {
|
||||
root * ./static/mstile-144x144.png
|
||||
root * /static/mstile-144x144.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-150x150.png {
|
||||
root * ./static/mstile-150x150.png
|
||||
root * /static/mstile-150x150.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-310x150.png {
|
||||
root * ./static/mstile-310x150.png
|
||||
root * /static/mstile-310x150.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-310x310.png {
|
||||
root * ./static/mstile-310x310.png
|
||||
root * /static/mstile-310x310.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-70x70.png {
|
||||
root * ./static/mstile-70x70.png
|
||||
root * /static/mstile-70x70.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /robots.txt {
|
||||
root * ./static/robots.txt
|
||||
root * /static/robots.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /safari-pinned-tab.svg {
|
||||
root * ./static/safari-pinned-tab.svg
|
||||
root * /static/safari-pinned-tab.svg
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /security.txt {
|
||||
root * ./static/security.txt
|
||||
root * /static/security.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /site.webmanifest {
|
||||
root * ./static/site.webmanifest
|
||||
root * /static/site.webmanifest
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /sitemap.xml {
|
||||
root * ./static/sitemap.xml
|
||||
root * /static/sitemap.xml
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /websocket {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /meta.json {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/scripts/jsd/main.js {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/rum {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /graphql/websocket {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /onboarding/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /wp-* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.env {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /api* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /rss.xml {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.git/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-120x120.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-120x120-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-152x152.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-152x152-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.well-known/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1 {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/h/g/orchestrate/chl_page/v1 {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
route /* {
|
||||
reverse_proxy web:7080
|
||||
|
|
|
|||
|
|
@ -6,170 +6,207 @@ freedium.cfd {
|
|||
|
||||
|
||||
handle_path /android-chrome-192x192.png {
|
||||
root * ./static/android-chrome-192x192.png
|
||||
root * /static/android-chrome-192x192.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /android-chrome-512x512.png {
|
||||
root * ./static/android-chrome-512x512.png
|
||||
root * /static/android-chrome-512x512.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon.png {
|
||||
root * ./static/apple-touch-icon.png
|
||||
root * /static/apple-touch-icon.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /browserconfig.xml {
|
||||
root * ./static/browserconfig.xml
|
||||
root * /static/browserconfig.xml
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon-16x16.png {
|
||||
root * ./static/favicon-16x16.png
|
||||
root * /static/favicon-16x16.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon-32x32.png {
|
||||
root * ./static/favicon-32x32.png
|
||||
root * /static/favicon-32x32.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /favicon.ico {
|
||||
root * ./static/favicon.ico
|
||||
root * /static/favicon.ico
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /humans.txt {
|
||||
root * ./static/humans.txt
|
||||
root * /static/humans.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-144x144.png {
|
||||
root * ./static/mstile-144x144.png
|
||||
root * /static/mstile-144x144.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-150x150.png {
|
||||
root * ./static/mstile-150x150.png
|
||||
root * /static/mstile-150x150.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-310x150.png {
|
||||
root * ./static/mstile-310x150.png
|
||||
root * /static/mstile-310x150.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-310x310.png {
|
||||
root * ./static/mstile-310x310.png
|
||||
root * /static/mstile-310x310.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /mstile-70x70.png {
|
||||
root * ./static/mstile-70x70.png
|
||||
root * /static/mstile-70x70.png
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /robots.txt {
|
||||
root * ./static/robots.txt
|
||||
root * /static/robots.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /safari-pinned-tab.svg {
|
||||
root * ./static/safari-pinned-tab.svg
|
||||
root * /static/safari-pinned-tab.svg
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /security.txt {
|
||||
root * ./static/security.txt
|
||||
root * /static/security.txt
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /site.webmanifest {
|
||||
root * ./static/site.webmanifest
|
||||
root * /static/site.webmanifest
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /sitemap.xml {
|
||||
root * ./static/sitemap.xml
|
||||
root * /static/sitemap.xml
|
||||
file_server
|
||||
}
|
||||
|
||||
|
||||
handle_path /websocket {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /meta.json {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/scripts/jsd/main.js {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/rum {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /graphql/websocket {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /onboarding/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /wp-* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.env {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /api* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /rss.xml {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.git/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-120x120.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-120x120-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-152x152.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /apple-touch-icon-152x152-precomposed.png {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /.well-known/* {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1 {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
handle_path /cdn-cgi/challenge-platform/h/g/orchestrate/chl_page/v1 {
|
||||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
|
||||
route /* {
|
||||
reverse_proxy web:7080
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
FROM python:3.12.3
|
||||
|
||||
RUN pip install docker requests[socks] loguru --no-cache-dir
|
||||
|
||||
COPY scripts/ /scripts/
|
||||
|
||||
# RUN chmod +x /scripts/service_up.py
|
||||
|
||||
CMD [ "python3", "/scripts/service_up.py" ]
|
||||
14
README.md
14
README.md
|
|
@ -63,4 +63,18 @@ sudo docker-compose -f docker-compose-dev.yml up
|
|||
And now you can access local instance of Freedium by opening browser and type `http://localhost:6752`.
|
||||
|
||||
## TODO:
|
||||
|
||||
- Integrate library notifiers - https://github.com/liiight/notifiers
|
||||
- Do not use 'shturman/dante' image, because it is does not have updates for a long time. (Probably) Use https://hub.docker.com/r/vimagick/dante/
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Speed up parser logic, port to Cython or rewrite to Golang
|
||||
- [ ] Make parse Medium format directly to Markdown, not HTML, in order to make it more universal. This helps to generate RSS feeds, PDF, HTML.
|
||||
OR we need write separate parser for different formats, like PDF, Markdown, etc.
|
||||
- [ ] Add more services than just a Medium
|
||||
- [ ] Rewrite frontend to Svelte
|
||||
- [ ] Move frontend to Cloudflare Pages
|
||||
- [ ] Integrate Grafana/Prometheus to monitor our services
|
||||
- [ ] Add more metrics to our services to have ability to monitor it
|
||||
- [ ] Make able translate posts to different languages using translatepy library
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@ from typing import Union, Optional
|
|||
from abc import ABC, abstractmethod
|
||||
|
||||
import psycopg2
|
||||
import sqlite_zstd
|
||||
import uuid
|
||||
from loguru import logger
|
||||
from psycopg2.extras import execute_batch
|
||||
|
||||
try:
|
||||
import sqlite_zstd
|
||||
except ImportError:
|
||||
sqlite_zstd = None
|
||||
|
||||
|
||||
class CacheData:
|
||||
__slots__ = ("data",)
|
||||
|
|
@ -94,7 +98,11 @@ class SQLiteCacheBackend(AbstractCacheBackend):
|
|||
self.cursor = self.connection.cursor()
|
||||
|
||||
if self.zstd_enabled:
|
||||
if sqlite_zstd is None:
|
||||
raise ValueError("sqlite_zstd library not found.")
|
||||
|
||||
sqlite_zstd.load(self.connection)
|
||||
self.enable_zstd()
|
||||
|
||||
def ensure_connection(self):
|
||||
if self.connection is None or self.cursor is None:
|
||||
|
|
@ -117,9 +125,6 @@ class SQLiteCacheBackend(AbstractCacheBackend):
|
|||
return [CacheResponse(key, value) for key, value in self.cursor]
|
||||
|
||||
def enable_zstd(self):
|
||||
if not self.zstd_enabled:
|
||||
raise ValueError("Can't use zstd compression. Please install 'sqlite_zstd' package")
|
||||
|
||||
self.ensure_connection()
|
||||
with self.connection:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
loguru==0.6.0
|
||||
psycopg2-binary==2.9.9
|
||||
sqlite-zstd-build
|
||||
# sqlite-zstd-build
|
||||
# git+https://github.com/phiresky/sqlite-zstd.git#egg=sqlite_zstd&subdirectory=python
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
sudo systemctl status redis
|
||||
sudo systemctl stop redis
|
||||
sudo systemctl disable redis
|
||||
|
|
@ -4,6 +4,7 @@ from typing import List, Dict
|
|||
from jinja2 import Template
|
||||
|
||||
# Constants
|
||||
APP_ROOT = "/static"
|
||||
STATIC_DIR = "./static"
|
||||
ACCESS_DENIED_PATHS: List[str] = [
|
||||
"websocket",
|
||||
|
|
@ -41,12 +42,12 @@ def generate_static_file_rules(files: List[str]) -> List[str]:
|
|||
template = Template(
|
||||
"""
|
||||
handle_path /{{ file }} {
|
||||
root * ./static/{{ file }}
|
||||
root * {{ app_root }}/{{ file }}
|
||||
file_server
|
||||
}
|
||||
"""
|
||||
)
|
||||
return [template.render(file=file) for file in files]
|
||||
return [template.render(file=file, app_root=APP_ROOT) for file in files]
|
||||
|
||||
|
||||
def generate_access_denied_rules(paths: List[str]) -> List[str]:
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
arch=$(lscpu | grep Architecture | awk {'print $2'})
|
||||
echo $arch
|
||||
|
||||
redis-cli flushall
|
||||
./bin/$arch/caddy run --config ./CaddyfileMaintance
|
||||
Loading…
Reference in a new issue