Allow configuring a mastodon instance for contact

This commit is contained in:
Roland Geider
2023-11-19 13:23:14 +01:00
parent c53b4aaa8e
commit b4bd6fa1c0
5 changed files with 50 additions and 56 deletions

View File

@@ -1,4 +1,5 @@
# wger
<img src="https://raw.githubusercontent.com/wger-project/wger/master/wger/core/static/images/logos/logo.png" width="100" height="100" />
wger (ˈɡɐ) Workout Manager is a free, open source web application that helps
@@ -10,15 +11,14 @@ For a live system, refer to the project's site: <https://wger.de/>
![Workout plan](https://raw.githubusercontent.com/wger-project/wger/master/wger/software/static/images/workout.png)
## Mobile app
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
alt="Get it on Google Play"
height="80">](https://play.google.com/store/apps/details?id=de.wger.flutter)
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/de.wger.flutter/)
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
alt="Get it on Google Play"
height="80">](https://play.google.com/store/apps/details?id=de.wger.flutter)
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/de.wger.flutter/)
## Installation
@@ -30,7 +30,6 @@ as an administration guide available at <https://wger.readthedocs.io> or in the
Please consult the commands' help for further information and available
parameters.
### Production
If you want to host your own instance, take a look at the provided docker
@@ -67,7 +66,7 @@ docker run -ti \
Then just open <http://localhost:8000> and log in as: **admin**, password **adminadmin**
For more info, check the [README in wger/extras/developemt](
./extras/docker/development/README.md
./extras/docker/development/README.md
).
Alternatively you can use the production compose file for development as well,
@@ -79,7 +78,6 @@ file for details). You will also probably want to set `DJANGO_DEBUG to false
If you prefer a local installation, consult the
[development documentation](https://wger.readthedocs.io/en/latest/development.html)
## Contact
Feel free to contact us if you found this useful or if there was something that
@@ -87,10 +85,9 @@ didn't behave as you expected. We can't fix what we don't know about, so please
report liberally. If you're not sure if something is a bug or not, feel free to
file a bug anyway.
* **discord:** <https://discord.gg/rPWFv6W>
* **issue tracker:** <https://github.com/wger-project/wger/issues>
* **twitter:** <https://twitter.com/wger_project>
* **Discord:** <https://discord.gg/rPWFv6W>
* **Issue tracker:** <https://github.com/wger-project/wger/issues>
* **Mastodon:** <https://fosstodon.org/@wger>
## Sources
@@ -98,13 +95,12 @@ All the code and the content is available on github:
<https://github.com/wger-project/wger>
## Translation
Translate the app to your language on [Weblate](https://hosted.weblate.org/engage/wger/).
[![translation status](https://hosted.weblate.org/widgets/wger/-/multi-blue.svg)](https://hosted.weblate.org/engage/wger/)
## License
The application is licensed under the Affero GNU General Public License 3 or

View File

@@ -523,8 +523,8 @@ by the US Department of Agriculture. It is extremely complete, with around
"""
if (
not WeightEntry.objects.filter(user=self.user).exists() or (
datetime.date.today() - WeightEntry.objects.filter(user=self.user).latest().date
> datetime.timedelta(days=3)
datetime.date.today() - WeightEntry.objects.filter(user=self.user).latest().date >
datetime.timedelta(days=3)
)
):
entry = WeightEntry()

View File

@@ -24,7 +24,6 @@ from datetime import timedelta
from wger import get_version
from wger.utils.constants import DOWNLOAD_INGREDIENT_WGER
"""
This file contains the global settings that don't usually need to be changed.
For a full list of options, visit:
@@ -172,7 +171,7 @@ TEMPLATES = [
'django.template.loaders.app_directories.Loader',
],
'debug':
False
False
},
},
]
@@ -257,7 +256,7 @@ AVAILABLE_LANGUAGES = (
LANGUAGE_CODE = 'en'
# All translation files are in one place
LOCALE_PATHS = (os.path.join(SITE_ROOT, 'locale'), )
LOCALE_PATHS = (os.path.join(SITE_ROOT, 'locale'),)
# Primary keys are AutoFields
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
@@ -498,7 +497,7 @@ CORS_URLS_REGEX = r'^/api/.*$'
#
# Ignore these URLs if they cause 404
#
IGNORABLE_404_URLS = (re.compile(r'^/favicon\.ico$'), )
IGNORABLE_404_URLS = (re.compile(r'^/favicon\.ico$'),)
#
# Password rules
@@ -537,6 +536,7 @@ WGER_SETTINGS = {
'SYNC_EXERCISE_IMAGES_CELERY': False,
'SYNC_EXERCISE_VIDEOS_CELERY': False,
'TWITTER': False,
'MASTODON': 'https://fosstodon.org/@wger',
'USE_CELERY': False,
'USE_RECAPTCHA': False,
'WGER_INSTANCE': 'https://wger.de',

View File

@@ -519,10 +519,19 @@
rel="noopener noreferrer">
<i class="fab fa-discord px-2"></i>
</a>
<a href="https://twitter.com/wger_project" target="_blank"
rel="noopener noreferrer">
<i class="fab fa-twitter px-2" aria-hidden="true"></i>
</a>
{% if twitter %}
<a href="https://twitter.com/{{ twitter }}" target="_blank"
rel="noopener noreferrer">
<i class="fab fa-twitter px-2" aria-hidden="true"></i>
</a>
{% endif %}
{% if mastodon %}
<a href="{{ mastodon }}" target="_blank"
rel="noopener noreferrer">
<i class="fab fa-mastodon px-2" aria-hidden="true"></i>
</a>
{% endif %}
</h1>
</li>
<li class="list-group-item bg-transparent border-0">

View File

@@ -35,59 +35,48 @@ def processor(request):
for lang in settings.AVAILABLE_LANGUAGES:
i18n_path[lang[0]] = '/{0}/{1}'.format(lang[0], '/'.join(full_path.split('/')[2:]))
# yapf: disable
context = {
# Twitter handle for this instance
'twitter':
settings.WGER_SETTINGS['TWITTER'],
'mastodon': settings.WGER_SETTINGS['MASTODON'],
'twitter': settings.WGER_SETTINGS['TWITTER'],
# Languages
'i18n_language':
get_language_data(
(get_language(), languages_dict.get(get_language(), ENGLISH_SHORT_NAME)),
),
'languages':
settings.AVAILABLE_LANGUAGES,
get_language_data(
(get_language(), languages_dict.get(get_language(), ENGLISH_SHORT_NAME)),
),
'languages': settings.AVAILABLE_LANGUAGES,
# The current path
'request_full_path':
full_path,
'request_full_path': full_path,
# The current full path with host
'request_absolute_path':
request.build_absolute_uri(),
'image_absolute_path':
request.build_absolute_uri(static_path),
'request_absolute_path': request.build_absolute_uri(),
'image_absolute_path': request.build_absolute_uri(static_path),
# Translation links
'i18n_path':
i18n_path,
'is_api_path':
'/api/' in request.build_absolute_uri(),
'i18n_path': i18n_path,
'is_api_path': '/api/' in request.build_absolute_uri(),
# Flag for guest users
'has_demo_data':
request.session.get('has_demo_data', False),
'has_demo_data': request.session.get('has_demo_data', False),
# Don't show messages on AJAX requests (they are deleted if shown)
'no_messages':
request.META.get('HTTP_X_WGER_NO_MESSAGES', False),
'no_messages': request.META.get('HTTP_X_WGER_NO_MESSAGES', False),
# Default cache time for template fragment caching
'cache_timeout':
settings.CACHES['default']['TIMEOUT'],
'cache_timeout': settings.CACHES['default']['TIMEOUT'],
# Used for logged in trainers
'trainer_identity':
request.session.get('trainer.identity'),
'trainer_identity': request.session.get('trainer.identity'),
# current gym, if available
'custom_header':
get_custom_header(request),
'custom_header': get_custom_header(request),
# Template to extend in forms, kinda ugly but will be removed in the future
'extend_template':
'base_empty.html' if is_ajax else 'base.html'
'extend_template': 'base_empty.html' if is_ajax else 'base.html',
}
# yapf: enable
# Pseudo-intelligent navigation here
if '/software/' in request.get_full_path() \