Merge remote-tracking branch 'origin/main'

This commit is contained in:
rimu 2024-04-02 12:40:01 +13:00
commit 7f6cd31ccc
7 changed files with 111 additions and 3 deletions

View file

@ -110,12 +110,11 @@ pip install -r requirements.txt
DATABASE_URL=postgresql+psycopg2://username:password@localhost/database_name DATABASE_URL=postgresql+psycopg2://username:password@localhost/database_name
``` ```
* Also change `SECRET_KEY` to some random sequence of numbers and letters. * Also change `SECRET_KEY` to some random sequence of numbers and letters.
* `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY` can be generated at https://www.google.com/recaptcha/admin/create.
### Extra info ### Extra info
* `SERVER_NAME` should be the domain of the site/instance. Use `127.0.0.1:5000` during development unless using ngrok. * `SERVER_NAME` should be the domain of the site/instance. Use `127.0.0.1:5000` during development unless using ngrok.
* `RECAPTCHA_PUBLIC_KEY` and `RECAPTCHA_PRIVATE_KEY` can be generated at https://www.google.com/recaptcha/admin/create (this is optional - omit to allow registration without RECAPCHA).
* `CACHE_TYPE` can be `FileSystemCache` or `RedisCache`. `FileSystemCache` is fine during development (set `CACHE_DIR` to `/tmp/piefed` or `/dev/shm/piefed`) * `CACHE_TYPE` can be `FileSystemCache` or `RedisCache`. `FileSystemCache` is fine during development (set `CACHE_DIR` to `/tmp/piefed` or `/dev/shm/piefed`)
while `RedisCache` **should** be used in production. If using `RedisCache`, set `CACHE_REDIS_URL` to `redis://localhost:6379/1` while `RedisCache` **should** be used in production. If using `RedisCache`, set `CACHE_REDIS_URL` to `redis://localhost:6379/1`

View file

@ -229,6 +229,23 @@ def list_subscribed_communities():
def donate(): def donate():
return render_template('donate.html') return render_template('donate.html')
@bp.route('/about')
def about_page():
users = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
user_amount = len(users)
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
#admins = users.filter()
# Todo, figure out how to filter the user list with the list of user_role user_id == 4
#staff = users.filter()
domains_amount = len(Domain.query.filter_by(banned=False).all())
community_amount = len(Community.query.all())
instance = Instance.query.filter_by(id=1).first()
return render_template('about.html', user_amount=user_amount, domains_amount=domains_amount, community_amount=community_amount, instance=instance)#, admins=admins)
@bp.route('/privacy') @bp.route('/privacy')
def privacy(): def privacy():

24
app/templates/about.html Normal file
View file

@ -0,0 +1,24 @@
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
{% extends 'themes/' + theme() + '/base.html' %}
{% else %}
{% extends "base.html" %}
{% endif %} %}
{% block app_content %}
<div class="row">
<div class="col-12 col-md-8 position-relative main_pane">
<h1>{{ _('About %(site_name)s', site_name=g.site.name) }}</h1>
<p> {{g.site.name}} is a <a href="https://join.piefed.social/">pyfedi</a> instance created on {{instance.created_at}}. It is home to <a href="/people">{{user_amount}} users</a>, <a href="/communities/local"> {{community_amount}} communities</a> who discussed <a href="/domains">{{domains_amount}} domains</a>. This instance is administerred and staffed by $PLACEHOLDER_ADMINS and $PLACEHOLDER_STAFF.</p>
<h2>Contact</h2>
<p>Placeholder Admin email</p>
<h2> About Us </h2>
<p> {{g.site.description | safe}} </p>
<p> {{g.site.sidebar}} </p>
{% if g.site.legal_information %}
<h2> Legal Information </h2>
<p> {{g.site.legal_information}} </p>
<p> <a href="/privacy"> Our Privacy Policy </a> </p>
{% endif %}
</div>
{% endblock %}

View file

@ -157,12 +157,14 @@
<li><a class="dropdown-item{% if active_child == 'list_communities' %} active{% endif %}" href="/topics">{{ _('Browse by topic') }}</a></li> <li><a class="dropdown-item{% if active_child == 'list_communities' %} active{% endif %}" href="/topics">{{ _('Browse by topic') }}</a></li>
<li><a class="dropdown-item{% if active_child == 'list_topics' %} active{% endif %}" href="/communities">{{ _('All communities') }}</a></li> <li><a class="dropdown-item{% if active_child == 'list_topics' %} active{% endif %}" href="/communities">{{ _('All communities') }}</a></li>
{% if moderating_communities %} {% if moderating_communities %}
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">{{ _('Moderating') }}</h6></li> <li><h6 class="dropdown-header">{{ _('Moderating') }}</h6></li>
{% for community_menu_item in moderating_communities %} {% for community_menu_item in moderating_communities %}
<li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li> <li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li>
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if joined_communities %} {% if joined_communities %}
<li><hr class="dropdown-divider"></li>
<li><h6 class="dropdown-header">{{ _('Joined communities') }}</h6></li> <li><h6 class="dropdown-header">{{ _('Joined communities') }}</h6></li>
{% for community_menu_item in joined_communities %} {% for community_menu_item in joined_communities %}
<li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li> <li class="pl-2"><a class="dropdown-item{% if community and community.id == community_menu_item.id%} active{% endif %}" href="/c/{{ community_menu_item.link() }}">{{ community_menu_item.title }}</a></li>

View file

@ -0,0 +1,15 @@
# Adding communities
To add a community to your local
## Notes
This is only for local communities, not for remote communities.
## Instructions
1. Login to your instance as your admin user
2. Click the PieFed logo
3. Click **Explore communities**
4. In the top right hand corner, click the **Create local** button
5. Fill in the details

41
docs/ADDING_USERS.md Normal file
View file

@ -0,0 +1,41 @@
# Adding users
There are two ways of adding users to your instance to get the ball rolling.
## Notes before starting
Please note that both of these involve **local** users, and not **remote** users.
## Instructions
### Allow registration
To allow registration:
1. Login to your instance as your admin user
2. Go to **Admin**
3. Click on **Misc settings**
4. Look for **Registration mode**.
5. Either set the choice to **Open** or **Require Application**
### Registering
After registration is set to open/require application, the common user flow is to
navigate to your instance and click **Register**.
### Disabling ReCAPCHA
If you ensure your `.env` file has empty values for `RECAPTCHA3_PUBLIC_KEY` and
`RECAPTCHA3_PRIVATE_KEY`, then you can bypass the ReCAPCHA step. The only problem is
you will need to ensure the users email address is verified, and this may be a hassle.
## Admin screen
1. Login to your instance as your admin user
2. Go to **Admin**
3. Click **Users**
4. Click the **Add local user** button.
5. Fill in the details
6. Ensure you click **Email address is verified**.
Once you've set all the details and save, the user is now accessible.

10
docs/KEY_TERMS.md Normal file
View file

@ -0,0 +1,10 @@
# Key terms
* `Instance`: A single PieFed server. if you are developing on your local, it will most
likely be http://127.0.0.1:5000. Otherwise, if you have set up your instance, or for
whichever instance you want to apply (assuming you have the privileges for the
actions detailed)
* `Local`: By making changes on a local instance, any actions done will be done
* on that instance.
* `Remote`: By making changes on a local instance, any actions done will be applied
to an external instance.