mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
commit
8b27d4acab
9 changed files with 35 additions and 51 deletions
|
@ -1,7 +1,7 @@
|
|||
# Weblate for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg)
|
||||
[![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=weblate)
|
||||
[![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate)
|
||||
|
||||
> *This package allows you to install Weblate quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
@ -10,7 +10,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Weblate is a libre web-based translation tool with tight version control integration. It provides two user interfaces, propagation of translations across components, quality checks and automatic linking to source files.
|
||||
|
||||
**Shipped version:** 4.3.1
|
||||
**Shipped version:** 4.4
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
@ -20,10 +20,6 @@ Weblate is a libre web-based translation tool with tight version control integra
|
|||
|
||||
* [YunoHost project uses Weblate for translations](https://translate.yunohost.org)
|
||||
|
||||
## Admin account
|
||||
|
||||
An admin user is created at installation, the login is what you provided at installation, the password is **weblate**.
|
||||
|
||||
## GitHub
|
||||
|
||||
You'll need to give Weblate a GitHub user and a token. Please read [GitHub's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
domain="domain.tld" (DOMAIN)
|
||||
path="/path" (PATH)
|
||||
admin="john" (USER)
|
||||
password="randompass"
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
github_account="myaccount"
|
||||
github_token="myoauthtoken"
|
||||
|
@ -24,13 +25,10 @@
|
|||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=all
|
||||
;;; Upgrade options
|
||||
; commit=cef22ac5634565cecd2d8545229efe3fe79d85bc
|
||||
name=Upgrade from 3.11.3
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake
|
||||
|
|
|
@ -301,12 +301,10 @@ SOCIAL_AUTH_STRATEGY = "weblate.accounts.strategy.WeblateStrategy"
|
|||
SOCIAL_AUTH_RAISE_EXCEPTIONS = True
|
||||
|
||||
SOCIAL_AUTH_EMAIL_VALIDATION_FUNCTION = "weblate.accounts.pipeline.send_validation"
|
||||
SOCIAL_AUTH_EMAIL_VALIDATION_URL = "{0}/accounts/email-sent/".format(URL_PREFIX)
|
||||
SOCIAL_AUTH_LOGIN_ERROR_URL = "{0}/accounts/login/".format(URL_PREFIX)
|
||||
SOCIAL_AUTH_EMAIL_FORM_URL = "{0}/accounts/email/".format(URL_PREFIX)
|
||||
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = "{0}/accounts/profile/#account".format(
|
||||
URL_PREFIX
|
||||
)
|
||||
SOCIAL_AUTH_EMAIL_VALIDATION_URL = f"{URL_PREFIX}/accounts/email-sent/"
|
||||
SOCIAL_AUTH_LOGIN_ERROR_URL = f"{URL_PREFIX}/accounts/login/"
|
||||
SOCIAL_AUTH_EMAIL_FORM_URL = f"{URL_PREFIX}/accounts/email/"
|
||||
SOCIAL_AUTH_NEW_ASSOCIATION_REDIRECT_URL = f"{URL_PREFIX}/accounts/profile/#account"
|
||||
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ("email",)
|
||||
SOCIAL_AUTH_SLUGIFY_USERNAMES = True
|
||||
SOCIAL_AUTH_SLUGIFY_FUNCTION = "weblate.accounts.pipeline.slugify_username"
|
||||
|
@ -346,7 +344,6 @@ MIDDLEWARE = [
|
|||
"weblate.middleware.ProxyMiddleware",
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"weblate.accounts.middleware.AuthenticationMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
|
@ -375,6 +372,7 @@ INSTALLED_APPS = [
|
|||
"weblate.screenshots",
|
||||
"weblate.fonts",
|
||||
"weblate.accounts",
|
||||
"weblate.configuration",
|
||||
"weblate.utils",
|
||||
"weblate.vcs",
|
||||
"weblate.wladmin",
|
||||
|
@ -416,7 +414,7 @@ if platform.system() != "Windows":
|
|||
handler = SysLogHandler(address="/dev/log", facility=SysLogHandler.LOG_LOCAL2)
|
||||
handler.close()
|
||||
HAVE_SYSLOG = True
|
||||
except IOError:
|
||||
except OSError:
|
||||
HAVE_SYSLOG = False
|
||||
|
||||
if DEBUG or not HAVE_SYSLOG:
|
||||
|
@ -436,7 +434,7 @@ LOGGING = {
|
|||
"filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}},
|
||||
"formatters": {
|
||||
"syslog": {"format": "weblate[%(process)d]: %(levelname)s %(message)s"},
|
||||
"simple": {"format": "%(levelname)s %(message)s"},
|
||||
"simple": {"format": "[%(asctime)s: %(levelname)s/%(process)s] %(message)s"},
|
||||
"logfile": {"format": "%(asctime)s %(levelname)s %(message)s"},
|
||||
"django.server": {
|
||||
"()": "django.utils.log.ServerFormatter",
|
||||
|
@ -500,6 +498,8 @@ LOGGING = {
|
|||
"social": {"handlers": [DEFAULT_LOG], "level": DEFAULT_LOGLEVEL},
|
||||
# Django Authentication Using LDAP
|
||||
"django_auth_ldap": {"handlers": [DEFAULT_LOG], "level": DEFAULT_LOGLEVEL},
|
||||
# SAML IdP
|
||||
"djangosaml2idp": {"handlers": [DEFAULT_LOG], "level": DEFAULT_LOGLEVEL},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -640,13 +640,13 @@ SECURE_HSTS_INCLUDE_SUBDOMAINS = ENABLE_HTTPS
|
|||
SECURE_PROXY_SSL_HEADER = None
|
||||
|
||||
# URL of login
|
||||
LOGIN_URL = "{0}/accounts/login/".format(URL_PREFIX)
|
||||
LOGIN_URL = f"{URL_PREFIX}/accounts/login/"
|
||||
|
||||
# URL of logout
|
||||
LOGOUT_URL = "{0}/accounts/logout/".format(URL_PREFIX)
|
||||
LOGOUT_URL = f"{URL_PREFIX}/accounts/logout/"
|
||||
|
||||
# Default location for login
|
||||
LOGIN_REDIRECT_URL = "{0}/".format(URL_PREFIX)
|
||||
LOGIN_REDIRECT_URL = f"{URL_PREFIX}/"
|
||||
|
||||
# Anonymous user name
|
||||
ANONYMOUS_USER_NAME = "anonymous"
|
||||
|
@ -660,7 +660,7 @@ IP_PROXY_OFFSET = 0
|
|||
EMAIL_SEND_HTML = True
|
||||
|
||||
# Subject of emails includes site title
|
||||
EMAIL_SUBJECT_PREFIX = "[{0}] ".format(SITE_TITLE)
|
||||
EMAIL_SUBJECT_PREFIX = f"[{SITE_TITLE}] "
|
||||
|
||||
# Enable remote hooks
|
||||
ENABLE_HOOKS = True
|
||||
|
@ -776,7 +776,7 @@ SERVER_EMAIL = "noreply@__DOMAIN__"
|
|||
|
||||
# Default email address to use for various automated correspondence from
|
||||
# the site managers. Used for registration emails.
|
||||
DEFAULT_FROM_EMAIL = "__ADMINMAIL__"
|
||||
DEFAULT_FROM_EMAIL = "__APP__@__DOMAIN__"
|
||||
|
||||
# List of URLs your site is supposed to serve
|
||||
ALLOWED_HOSTS = ["__DOMAIN__"]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "A translation platform using Git and Python",
|
||||
"fr": "Une plateforme de traduction utilisant Git et Python"
|
||||
},
|
||||
"version": "4.3.1~ynh1",
|
||||
"version": "4.4~ynh1",
|
||||
"url": "https://weblate.org",
|
||||
"license": "AGPL-3.0",
|
||||
"maintainer": {
|
||||
|
@ -67,6 +67,15 @@
|
|||
},
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Set the administrator password",
|
||||
"fr": "Définissez le mot de passe administrateur"
|
||||
},
|
||||
"example": "Choose a password"
|
||||
},
|
||||
{
|
||||
"name": "github_account",
|
||||
"type": "string",
|
||||
|
|
|
@ -12,7 +12,7 @@ pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev
|
|||
libpq-dev libglib2.0-dev mailutils python-celery-common hub"
|
||||
|
||||
# Weblate's version for PIP and settings file
|
||||
weblate_version="4.3.1"
|
||||
weblate_version="4.4"
|
||||
|
||||
|
||||
debian_maj_version=$(sed 's/\..*//' /etc/debian_version)
|
||||
|
|
|
@ -22,14 +22,6 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
|||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_print_info --message="Stopping systemd services..."
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="stop"
|
||||
ynh_systemd_action --service_name="$app-celery" --action="stop"
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -74,13 +66,6 @@ ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
|
|||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-celery.service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start"
|
||||
ynh_systemd_action --service_name="$app-celery" --action="start"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -23,6 +23,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
github_account=$YNH_APP_ARG_GITHUB_ACCOUNT
|
||||
github_token=$YNH_APP_ARG_GITHUB_TOKEN
|
||||
|
@ -160,6 +161,7 @@ ynh_replace_string --match_string="__GITHUBUSER__" --replace_string="$github_acc
|
|||
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||
|
||||
# remove last "/" of $path_url
|
||||
ynh_replace_string --match_string="__PATHURL__" --replace_string="${path_url%/}" --target_file="$settings"
|
||||
|
@ -185,7 +187,7 @@ ynh_script_progression --message="Filling up the database..." --weight=10
|
|||
# generate static files
|
||||
sudo -u $app $final_path/venv/bin/weblate collectstatic --noinput
|
||||
sudo -u $app $final_path/venv/bin/weblate createadmin --no-color \
|
||||
--password "weblate" \
|
||||
--password "$password" \
|
||||
--username "$admin" \
|
||||
--email "$admin_mail"
|
||||
|
||||
|
|
|
@ -100,9 +100,9 @@ ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./d
|
|||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service
|
||||
systemctl enable $app.service --quiet
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-celery.service"
|
||||
systemctl enable "$app-celery"
|
||||
systemctl enable "$app-celery" --quiet
|
||||
|
||||
#=================================================
|
||||
# RESTORE UWSGI
|
||||
|
|
|
@ -71,13 +71,6 @@ then
|
|||
ynh_secure_remove --file="/var/log/$app-celery"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
||||
# Normalize the URL path syntax
|
||||
path_url=$(ynh_normalize_url_path --path_url=$path_url)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -215,6 +208,7 @@ upgrade() {
|
|||
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$settings"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
|
||||
|
||||
# remove last "/" of $path_url
|
||||
ynh_replace_string --match_string="__PATHURL__" --replace_string="${path_url%/}" --target_file="$settings"
|
||||
|
|
Loading…
Reference in a new issue