mirror of
https://codeberg.org/Ewen/rudibridge.git
synced 2024-12-21 18:52:32 +00:00
Compare commits
6 commits
bd5ae3cbc3
...
b1db8a51a4
Author | SHA1 | Date | |
---|---|---|---|
Ewen | b1db8a51a4 | ||
Ewen | 91881fa177 | ||
Ewen | 6b1d9924be | ||
Ewen | 9dcb3079b1 | ||
Ewen | a7d95c1461 | ||
Ewen | 032faae19c |
10
.env.example
Normal file
10
.env.example
Normal file
|
@ -0,0 +1,10 @@
|
|||
# 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
|
|
@ -36,9 +36,12 @@ 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`.
|
||||
To use the backend directly, go to the page [http://localhost:8080/api/feed/](http://localhost:8080/api/feed/) and start adding parameters!
|
||||
|
||||
### For production
|
||||
### Using Docker, 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
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ def parse_page():
|
|||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
else:
|
||||
rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now())
|
||||
rss_xml = render_template("rss.xml", feed=feed, build_date=datetime.now().astimezone())
|
||||
response = make_response(rss_xml)
|
||||
response.headers["Content-Type"] = "application/rss+xml"
|
||||
return response
|
||||
|
|
|
@ -12,7 +12,7 @@ class FeedItem:
|
|||
self.link = link
|
||||
self.author = author
|
||||
if item_datetime:
|
||||
self.item_datetime = item_datetime.isoformat()
|
||||
self.item_datetime = item_datetime.strftime("%a, %d %b %Y %H:%M:%S %z")
|
||||
else:
|
||||
self.item_datetime = None
|
||||
|
||||
|
@ -74,7 +74,7 @@ def scrape(request, args):
|
|||
title_class = {"class": args.get("titleClass")}
|
||||
title = article.find(args.get("title"), title_class)
|
||||
if title:
|
||||
title = title.get_text()
|
||||
title = title.get_text().strip()
|
||||
|
||||
content_tag = "p"
|
||||
content_class = {}
|
||||
|
@ -121,7 +121,7 @@ def scrape(request, args):
|
|||
author=author
|
||||
)
|
||||
|
||||
if item.title is not None:
|
||||
if item.title is not None and item.title != "":
|
||||
feed.items.append(item)
|
||||
|
||||
# Sort by datetime if any
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<atom:link href="{{ request.url }}" rel="self" type="application/rss+xml"/>
|
||||
<link>{{ request.url }}</link>
|
||||
<description>A feed generated from {{ feed.url }} with Rudibridge</description>
|
||||
<lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %T") }} +0000</lastBuildDate>
|
||||
<lastBuildDate>{{ build_date.strftime("%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
|
||||
{% for item in feed.items %}
|
||||
<item>
|
||||
{% if item.title %}
|
||||
|
|
|
@ -19,4 +19,6 @@ services:
|
|||
dockerfile: Dockerfile
|
||||
target: frontend-dev
|
||||
ports:
|
||||
- 5173:5173
|
||||
- 5173:5173
|
||||
volumes:
|
||||
- ./frontend:/app
|
|
@ -6,6 +6,8 @@ services:
|
|||
context: ./api
|
||||
dockerfile: Dockerfile
|
||||
target: final
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
frontend:
|
||||
env_file:
|
||||
|
@ -16,7 +18,22 @@ services:
|
|||
target: final
|
||||
args:
|
||||
- VITE_API_ENDPOINT=${VITE_API_ENDPOINT}
|
||||
ports:
|
||||
- 5173:5173
|
||||
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
|
|
@ -13,7 +13,7 @@ CMD ["pnpm", "run", "dev", "--host", "0.0.0.0"]
|
|||
FROM frontend-requirements as build
|
||||
|
||||
ARG VITE_API_ENDPOINT
|
||||
ENV VITE_API_ENDPOINT=${VITE_API_ENDPOINT}}
|
||||
ENV VITE_API_ENDPOINT=${VITE_API_ENDPOINT}
|
||||
WORKDIR /app
|
||||
COPY . ./
|
||||
RUN pnpm run build
|
||||
|
|
Loading…
Reference in a new issue