Add users

This commit is contained in:
Joakim Hellsén 2024-02-23 06:21:06 +01:00
commit 09ad44f247
13 changed files with 382 additions and 57 deletions

View file

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block content %}
<h2>Change Password</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Change Password</button>
</form>
{% endblock %}

View file

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% block content %}
<p>
You can register <a href='{% url "feeds:register" %}'>here</a>.
</p>
<h2>Login</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
</form>
{% endblock %}

View file

@ -0,0 +1,27 @@
{% extends "base.html" %}
{% block content %}
<h2>{{ user.username }}</h2>
<h3>Feeds</h3>
<ul>
{% for feed in feeds %}
<li>
<a href='{% url "feeds:feed" feed.id %}'>{{ feed.title }}</a>
</li>
{% endfor %}
</ul>
<h3>Subscriptions</h3>
<ul>
{% for subscription in subscriptions %}
<li>
<a href='{% url "feeds:feed" subscription.id %}'>{{ subscription.title }}</a>
</li>
{% endfor %}
</ul>
<h3>Subscribers</h3>
<p>
<form action="{% url 'feeds:logout' %}" method="post">
{% csrf_token %}
<button type="submit">Logout</button>
</form>
</p>
{% endblock %}

View file

@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block content %}
<h2>Register</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Register</button>
</form>
{% endblock %}

5
templates/api.html Normal file
View file

@ -0,0 +1,5 @@
{% extends "base.html" %}
{% block content %}
<h2>API Documentation</h2>
<p>This is the API documentation.</p>
{% endblock %}

View file

@ -82,19 +82,15 @@
{% endif %}
<span class="title">
<h1>
<a href="/">FeedVault</a>
<a href='{% url "feeds: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.
{% else %}
0 feeds.
{% endif %}
~{{ db_size }}.
{% if amount_of_feeds %}{{ amount_of_feeds }} feeds.{% endif %}
{% if db_size %}~{{ db_size }}.{% endif %}
</small>
</div>
<div class="right">
@ -108,12 +104,20 @@
<small>
<div class="leftright">
<div class="left">
<a href="/">Home</a> | <a href="/feeds">Feeds</a> |
<a href="/api">API</a>
<a href='{% url "feeds:index" %}'>Home</a> | <a href='{% url "feeds:feeds" %}'>Feeds</a> |
<a href='{% url "feeds:api" %}'>API</a>
</div>
<div class="right">
<a href="https://github.com/TheLovinator1/FeedVault">GitHub</a> |
<a href="https://github.com/sponsors/TheLovinator1">Donate</a>
<!-- Show login if not logged in -->
{% if not user.is_authenticated %}
| <a href='{% url "feeds:login" %}'>Login</a>
{% endif %}
<!-- Show username if logged in -->
{% if user.is_authenticated %}
| <a href='{% url "feeds:profile" %}'>{{ user.username }}</a>
{% endif %}
</div>
</div>
</small>
@ -127,7 +131,7 @@
<small>
<div class="leftright">
<div class="left">
Made by <a href="">Joakim Hellsén</a>.
Made by <a href="https://github.com/TheLovinator1">Joakim Hellsén</a>.
</div>
<div class="right">No rights reserved.</div>
</div>

View file

@ -1,20 +1,39 @@
{% extends "base.html" %}
{% block content %}
<h2>Feeds to archive</h2>
<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.
</p>
<form action="/add" method="post">
{% csrf_token %}
<textarea id="urls" name="urls" rows="5" cols="50" required></textarea>
<button type="submit">Add feeds</button>
</form>
<br>
<p>You can also upload .opml files containing the feeds you wish to archive:</p>
<form enctype="multipart/form-data" method="post" action="/upload_opml">
<input type="file" name="file" id="file" accept=".opml" required>
<button type="submit">Upload OPML</button>
</form>
{% if user.is_authenticated %}
<h2>Welcome, {{ user.username }}!</h2>
<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.
</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>
<br>
<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. The service will parse the files and add the feeds to the archive.
</p>
<form enctype="multipart/form-data"
method="post"
action="{% url 'feeds:upload' %}">
{% csrf_token %}
<p>
<input type="file" name="file" id="file" required>
</p>
<button type="submit">Upload feeds</button>
</form>
{% else %}
<h2>Welcome to FeedVault!</h2>
<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>
<p>
You need to <a href='{% url "feeds:login" %}'>login</a> or <a href='{% url "feeds:register" %}'>register</a> to add new feeds or upload files.
</p>
{% endif %}
<h2>FAQ</h2>
<details>
<summary>What are web feeds?</summary>
@ -39,13 +58,6 @@
</p>
<hr>
</details>
<details>
<summary>How does it work?</summary>
<p>
FeedVault is written in Go and uses the <a href="https://github.com/mmcdole/gofeed">gofeed</a> library to parse The service periodically checks for new content in the feeds and stores it in a database. Users can access the archived feeds through the website or API.
</p>
<hr>
</details>
<details>
<summary>How can I access the archived feeds?</summary>
<p>