Compare commits

..

No commits in common. "b1db8a51a42f515369b51ecb1a0c3a3bdad99d58" and "bd5ae3cbc3f0611059aa1521d7da82264b06a9b7" have entirely different histories.

8 changed files with 12 additions and 44 deletions

View file

@ -1,10 +0,0 @@
# Frontend configuration
VITE_API_ENDPOINT=http://yourdomain.tld/api/
# Traefik configuration, if needed
TRAEFIK_HOST=yourdomain.tld
TRAEFIK_CERTRESOLVER=letsencrypt
# Backend configuration
FLASK_SECRET_KEY="changeme!"
FLASK_DEBUG=False

View file

@ -36,12 +36,9 @@ You will need to have Docker and Docker Compose installed.
Clone the repository, go to its root and run `docker-compose -f docker-compose.dev.yml up -d`. Clone the repository, go to its root and run `docker-compose -f docker-compose.dev.yml up -d`.
To use the backend directly, go to the page [http://localhost:8080/api/feed/](http://localhost:8080/api/feed/) and start adding parameters! To use the backend directly, go to the page [http://localhost:8080/api/feed/](http://localhost:8080/api/feed/) and start adding parameters!
### Using Docker, for production ### For production
You will also need Docker and Docker Compose.
Copy `.env.example` to `.env` and edit the latter. Tweak your reverse proxy (in my case, Traefik). Then, run `docker compose up -d`.
*To do*
## Examples ## Examples

View file

@ -59,7 +59,7 @@ def parse_page():
response.headers["Content-Type"] = "application/json" response.headers["Content-Type"] = "application/json"
return response return response
else: else:
rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now().astimezone()) rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now())
response = make_response(rss_xml) response = make_response(rss_xml)
response.headers["Content-Type"] = "application/rss+xml" response.headers["Content-Type"] = "application/rss+xml"
return response return response

View file

@ -12,7 +12,7 @@ class FeedItem:
self.link = link self.link = link
self.author = author self.author = author
if item_datetime: if item_datetime:
self.item_datetime = item_datetime.strftime("%a, %d %b %Y %H:%M:%S %z") self.item_datetime = item_datetime.isoformat()
else: else:
self.item_datetime = None self.item_datetime = None
@ -74,7 +74,7 @@ def scrape(request, args):
title_class = {"class": args.get("titleClass")} title_class = {"class": args.get("titleClass")}
title = article.find(args.get("title"), title_class) title = article.find(args.get("title"), title_class)
if title: if title:
title = title.get_text().strip() title = title.get_text()
content_tag = "p" content_tag = "p"
content_class = {} content_class = {}
@ -121,7 +121,7 @@ def scrape(request, args):
author=author author=author
) )
if item.title is not None and item.title != "": if item.title is not None:
feed.items.append(item) feed.items.append(item)
# Sort by datetime if any # Sort by datetime if any

View file

@ -5,7 +5,7 @@
<atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/> <atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/>
<link>{{ request.url }}</link> <link>{{ request.url }}</link>
<description>A feed generated from {{ feed.url }} with Rudibridge</description> <description>A feed generated from {{ feed.url }} with Rudibridge</description>
<lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate> <lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %T") }} +0000</lastBuildDate>
{% for item in feed.items %} {% for item in feed.items %}
<item> <item>
{% if item.title %} {% if item.title %}

View file

@ -20,5 +20,3 @@ services:
target: frontend-dev target: frontend-dev
ports: ports:
- 5173:5173 - 5173:5173
volumes:
- ./frontend:/app

View file

@ -6,8 +6,6 @@ services:
context: ./api context: ./api
dockerfile: Dockerfile dockerfile: Dockerfile
target: final target: final
ports:
- 8080:8080
frontend: frontend:
env_file: env_file:
@ -18,22 +16,7 @@ services:
target: final target: final
args: args:
- VITE_API_ENDPOINT=${VITE_API_ENDPOINT} - VITE_API_ENDPOINT=${VITE_API_ENDPOINT}
ports:
- 5173:5173
volumes: volumes:
- ./frontend/nginx/nginx.conf:/etc/nginx/nginx.conf - ./frontend/nginx/nginx.conf:/etc/nginx/nginx.conf
networks:
- traefik_net
- default
labels:
- "traefik.enable=true"
- "traefik.http.routers.rudibridge.rule=Host(`${TRAEFIK_HOST}`)"
- "traefik.http.routers.rudibridge.entrypoints=http"
- "traefik.http.routers.rudibridgetls.rule=Host(`${TRAEFIK_HOST}`)"
- "traefik.http.routers.rudibridgetls.entrypoints=https"
- "traefik.http.routers.rudibridgetls.tls=true"
- "traefik.http.routers.rudibridgetls.tls.certresolver=${TRAEFIK_CERTRESOLVER}"
- "traefik.http.routers.rudibridgetls.tls.domains[0].main=${TRAEFIK_HOST}"
- "traefik.docker.network=traefik_net"
networks:
traefik_net:
external: true

View file

@ -13,7 +13,7 @@ CMD ["pnpm", "run", "dev", "--host", "0.0.0.0"]
FROM frontend-requirements as build FROM frontend-requirements as build
ARG VITE_API_ENDPOINT ARG VITE_API_ENDPOINT
ENV VITE_API_ENDPOINT=${VITE_API_ENDPOINT} ENV VITE_API_ENDPOINT=${VITE_API_ENDPOINT}}
WORKDIR /app WORKDIR /app
COPY . ./ COPY . ./
RUN pnpm run build RUN pnpm run build