Use FastAPI instead of Django

This commit is contained in:
Joakim Hellsén 2024-05-21 02:43:53 +02:00
commit b462be40af
No known key found for this signature in database
GPG key ID: D196AE66FEBE1DC9
43 changed files with 1105 additions and 1688 deletions

View file

@ -1,4 +1,3 @@
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -8,8 +7,7 @@
{% if keywords %}<meta name="keywords" content="{{ keywords }}" />{% endif %}
{% if author %}<meta name="author" content="{{ author }}" />{% endif %}
{% if canonical %}<link rel="canonical" href="{{ canonical }}" />{% endif %}
<title>{{ title|default:"FeedVault" }}</title>
<script src="{% static 'htmx.min.js' %}" defer></script>
<title>{{ title | default("FeedVault") }}</title>
<style>
html {
max-width: 88ch;
@ -84,19 +82,18 @@
{% endif %}
<span class="title">
<h1>
<a href="{% url 'feeds:index' %}">FeedVault</a>
<a href='{{ url_for("index") }}'>FeedVault</a>
</h1>
</span>
<div class="leftright">
<div class="left">
<small>Archive of
<a href="https://en.wikipedia.org/wiki/Web_feed">web feeds</a>.
{% if amount_of_feeds %}{{ amount_of_feeds }} feeds.{% endif %}
{% if db_size %}~{{ db_size }}.{% endif %}
{{ stats }}
</small>
</div>
<div class="right">
<form action="{% url 'feeds:search' %}" method="get">
<form action='{{ url_for("search") }}' method="get" class="search">
<input type="text" name="q" placeholder="Search" />
<button type="submit">Search</button>
</form>
@ -106,15 +103,14 @@
<small>
<div class="leftright">
<div class="left">
<a href="{% url 'feeds:index' %}">Home</a> |
<a href="{% url 'feeds:feeds' %}">Feeds</a> |
<a href="{% url 'feeds:upload' %}">Upload</a>
<a href='{{ url_for("index") }}'>Home</a> |
<a href='{{ url_for("feeds") }}'>Feeds</a> |
<a href='{{ url_for("upload_files") }}'>Upload</a> |
<a href='{{ url_for("contact") }}'>Contact</a>
</div>
<div class="right">
<a href="https://github.com/TheLovinator1/FeedVault">GitHub</a> |
<a href="https://github.com/sponsors/TheLovinator1">Donate</a>
{% if not user.is_authenticated %}| <a href="">Login</a>{% endif %}
{% if user.is_authenticated %}| <a href="">{{ user.username }}</a>{% endif %}
</div>
</div>
</small>
@ -127,9 +123,7 @@
<footer>
<small>
<div class="leftright">
<div class="left">
<a href="">Privacy Policy</a> | <a href="">Terms of Service</a>
</div>
<div class="left">Web scraping is not a crime.</div>
<div class="right">No rights reserved.</div>
</div>
<div class="leftright">

34
templates/contact.html Normal file
View file

@ -0,0 +1,34 @@
{% extends "base.html" %}
{% block content %}
<h2>Contact</h2>
<p>
If you have any questions, suggestions, or feedback, feel free to contact me. I am always happy to help.
<br>
You can contact me through the following methods:
</p>
<p>
<ul>
<li>
<a href="https://github.com/TheLovinator1/FeedVault.se/issues">GitHub issues</a>
</li>
<li>
<a href="mailto:tlovinator@gmail.com">tlovinator@gmail.com</a>
</li>
<li>TheLovinator#9276 on Discord</li>
<li>Use the form below to send me a message</li>
</ul>
</p>
<h3>Send a message</h3>
<form method="post" action='{{ url_for("contact") }}'>
<p>
<label for="message">Message</label>
<textarea id="message"
name="message"
rows="4"
cols="50"
required
placeholder="Enter your message"></textarea>
</p>
<button type="submit">Send message</button>
</form>
{% endblock content %}

View file

@ -7,8 +7,8 @@
{% for entry in entries %}
<li>
<a href="{{ entry.link }}">{{ entry.title }}</a>
<p>{{ entry.summary|safe }}</p>
<p>{{ entry.summary | safe }}</p>
</li>
{% endfor %}
</ul>
{% endblock %}
{% endblock content %}

View file

@ -4,9 +4,9 @@
<ul>
{% for feed in feeds %}
<li>
<a href="{% url 'feeds:feed' feed.id %}">{{ feed.url }}</a>
<a href="{{ url_for('feed', feed_url=feed.url) }}">{{ feed.url }}</a>
<p>{{ feed.description }}</p>
</li>
{% endfor %}
</ul>
{% endblock %}
{% endblock content %}

View file

@ -1,42 +1,36 @@
{% extends "base.html" %}
{% block content %}
<h2>Welcome, archivist!</h2>
<h3>Latest Feeds</h3>
<ul>
{% if not feeds %}<p>No feeds found.</p>{% endif %}
{% for feed in feeds %}
<li>
<a href="{{ url_for('feed', feed_url=feed.url) }}">{{ feed.url }}</a>
<p>{{ feed.description }}</p>
</li>
{% endfor %}
</ul>
<h3>FAQ</h3>
<summary>What are web feeds?</summary>
<p>
Input the URLs of the feeds you wish to archive below. You can add as many as needed, and access them through the website or API. Alternatively, include links to .opml files, and the feeds within will be archived.
Web feeds are a way to distribute content on the web. They allow users to access updates from websites without having to visit them directly. Feeds are typically used for news websites, blogs, and other sites that frequently update content.
<br>
You can read more about web feeds on <a href="https://en.wikipedia.org/wiki/Web_feed">Wikipedia</a>.
</p>
<form action="{% url 'feeds:add' %}" method='post'>
{% csrf_token %}
<textarea id="urls" name="urls" rows="5" cols="50" required></textarea>
<button type="submit">Add feeds</button>
</form>
<h2>FAQ</h2>
<details>
<summary>What are web feeds?</summary>
<p>
Web feeds are a way to distribute content on the web. They allow users to access updates from websites without having to visit them directly. Feeds are typically used for news websites, blogs, and other sites that frequently update content.
<br>
You can read more about web feeds on <a href="https://en.wikipedia.org/wiki/Web_feed">Wikipedia</a>.
</p>
<hr>
</details>
<details>
<summary>What is FeedVault?</summary>
<p>
FeedVault is a service that archives web It allows users to access and search for historical content from various websites. The service is designed to preserve the history of the web and provide a reliable source for accessing content that may no longer be available on the original websites.
</p>
<hr>
</details>
<details>
<summary>Why archive feeds?</summary>
<p>
Web feeds are a valuable source of information, and archiving them ensures that the content is preserved for future reference. By archiving feeds, we can ensure that historical content is available for research, analysis, and other purposes. Additionally, archiving feeds can help prevent the loss of valuable information due to website changes, outages, or other issues.
</p>
<hr>
</details>
<details>
<summary>How can I access the archived feeds?</summary>
<p>
You can access the archived feeds through the website or API. The website provides a user interface for searching and browsing the feeds, while the API allows you to access the feeds programmatically. You can also download the feeds in various formats, such as JSON, XML, or RSS.
</p>
</details>
{% endblock %}
<hr>
<summary>What is FeedVault?</summary>
<p>
FeedVault is a service that archives web feeds. It allows users to access and search for historical content from various websites. The service is designed to preserve the history of the web and provide a reliable source for accessing content that may no longer be available on the original websites.
</p>
<hr>
<summary>Why archive feeds?</summary>
<p>
Web feeds are a valuable source of information, and archiving them ensures that the content is preserved for future reference. By archiving feeds, we can ensure that historical content is available for research, analysis, and other purposes. Additionally, archiving feeds can help prevent the loss of valuable information due to website changes, outages, or other issues.
</p>
<hr>
<summary>How can I access the archived feeds?</summary>
<p>
You can access the archived feeds through the website or API. The website provides a user interface for searching and browsing the feeds, while the API allows you to access the feeds programmatically. You can also download the feeds in various formats, such as JSON, XML, or RSS.
</p>
{% endblock content %}

View file

@ -2,14 +2,14 @@
{% block content %}
<h2>
Searched for:
"{{ query|default:"Search" }}"
"{{ query }}"
</h2>
{% if feeds %}
{% for feed in feeds %}
<a href="{% url 'feeds:feed' feed.id %}">{{ feed.url|default:"Unknown Feed" }} →</a>
{% if entries %}
{% for entry in entries %}
<a href="{{ url_for('feed', feed_url=entry.feed_url) }}">{{ entry.feed_url }} →</a>
<br>
{% endfor %}
{% else %}
<p>No results found.</p>
<p>No entries found.</p>
{% endif %}
{% endblock %}
{% endblock content %}

View file

@ -1,27 +1,47 @@
<h2>Upload</h2>
<p>
You can also upload files containing the feeds you wish to archive.
Currently supported file formats: .opml, .xml, .json.
Your file will be parsed in the future if not currently supported.
Feel free to upload databases, backups, or any other files containing feeds.
</p>
<form enctype="multipart/form-data"
method="post"
action="{% url 'feeds:upload' %}">
{% csrf_token %}
{% extends "base.html" %}
{% block content %}
<h2>Upload</h2>
<p>
<label for="file">Choose a file to upload</label>
You can upload files to the archive here.
<br>
Things you can upload include:
<ul>
<li>Lists of URLs</li>
<li>Databases</li>
<li>Backups</li>
<li>Archives</li>
<li>Anything else that is relevant</li>
</ul>
<br>
<input type="file" name="file" id="file" required>
Uploaded files will be manually reviewed and indexed. If you have any questions, feel free to <a href='{{ url_for("contact") }}''>contact me</a>.
<br>
<br>
<label for="description">Description (optional)</label>
<input type="text"
name="description"
id="description"
size="80"
placeholder="Description (optional)">
You can also provide a description for the file you are uploading.
</p>
<button type="submit">Upload file</button>
</form>
<form enctype="multipart/form-data"
method="post"
action='{{ url_for("upload_files") }}'>
<p>
<input type="file" name="files" required multiple>
<br>
<br>
<label for="description">Description (optional)</label>
<textarea id="description"
name="description"
rows="4"
cols="50"
placeholder="Enter a description for the file"></textarea>
</p>
<input type="checkbox" id="public" name="public">
<label for="public">Public</label>
<br>
<br>
<small>
Public files will be listed on FeedVault for everyone to see and download.
<br>
Private files will only be used for indexing feeds.
</small>
<br>
<br>
<button type="submit">Upload file</button>
</form>
{% endblock content %}