diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 025b259..479c641 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Halcyon for YunoHost [![Integration level](https://dash.yunohost.org/integration/halcyon.svg)](https://dash.yunohost.org/appci/app/halcyon) ![](https://ci-apps.yunohost.org/ci/badges/halcyon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/halcyon.maintain.svg) @@ -5,36 +10,27 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Halcyon quickly and simply on a YunoHost server. +> *This package allows you to install Halcyon 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.* ## Overview -Halcyon is a webclient for Mastodon and Pleroma which looks like Twitter. -**Shipped version:** 2.4.9 +Webclient for Mastodon and Pleroma. + +**Shipped version:** 2.4.9~ynh1 + + ## Screenshots -![](https://halcyon.cybre.space/login/assets/images/preview0.png) +![](./doc/screenshots/preview0.png) -## Limitations +## Documentation and resources -* Halcyon requires a dedicated domain like `halcyon.domain.tld`. - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/halcyon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/halcyon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/halcyon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/halcyon/) - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/halcyon_ynh/issues - * App website: https://notabug.org/halcyon-suite/halcyon - * Upstream app repository: https://notabug.org/halcyon-suite/halcyon - * Other Halcyon instances: https://www.halcyon.social/instances.php - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://notabug.org/halcyon-suite/halcyon +* Upstream app code repository: https://notabug.org/halcyon-suite/halcyon +* YunoHost documentation for this app: https://yunohost.org/app_halcyon +* Report a bug: https://github.com/YunoHost-Apps/halcyon_ynh/issues ## Developer info @@ -46,3 +42,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/halcyon_ynh/tree/test or sudo yunohost app upgrade halcyon -u https://github.com/YunoHost-Apps/halcyon_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index c5eb759..e577a8d 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,40 +1,32 @@ # Halcyon pour YunoHost [![Niveau d'intégration](https://dash.yunohost.org/integration/halcyon.svg)](https://dash.yunohost.org/appci/app/halcyon) ![](https://ci-apps.yunohost.org/ci/badges/halcyon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/halcyon.maintain.svg) -[![Install Halcyon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=halcyon) +[![Installer Halcyon avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=halcyon) -*[Read this readme in english.](./README.md)* - -> *Ce package vous permet d'installer Halcyon rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* +> *Ce package vous permet d'installer Halcyon rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -Halcyon est un client Web pour Mastodon et Pleroma qui ressemble à Twitter. -**Version incluse :** 2.4.9 +Client web pour Mastodon et Pleroma. + +**Version incluse :** 2.4.9~ynh1 + + ## Captures d'écran -![](https://halcyon.cybre.space/login/assets/images/preview0.png) +![](./doc/screenshots/preview0.png) -## Limitations +## Documentations et ressources -* Halcyon nécessite un domaine dédié comme `halcyon.domain.tld`. - -#### Architectures supportées - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/halcyon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/halcyon/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/halcyon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/halcyon/) - -## Liens - - * Signaler un bug : https://github.com/YunoHost-Apps/halcyon_ynh/issues - * Site de l'application : https://notabug.org/halcyon-suite/halcyon - * Dépôt de l'application principale : https://notabug.org/halcyon-suite/halcyon - * Autres instances Halcyon : https://www.halcyon.social/instances.php - * Site web YunoHost : https://yunohost.org/ ---- +* Site officiel de l'app : https://notabug.org/halcyon-suite/halcyon +* Dépôt de code officiel de l'app : https://notabug.org/halcyon-suite/halcyon +* Documentation YunoHost pour cette app : https://yunohost.org/app_halcyon +* Signaler un bug : https://github.com/YunoHost-Apps/halcyon_ynh/issues ## Informations pour les développeurs @@ -46,3 +38,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/halcyon_ynh/tree/test ou sudo yunohost app upgrade halcyon -u https://github.com/YunoHost-Apps/halcyon_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index fab8d82..5d16523 100644 --- a/check_process +++ b/check_process @@ -1,16 +1,12 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - is_public=1 (PUBLIC|public=1|private=0) + domain="domain.tld" + path="/path" + is_public=1 language="en_US" ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 @@ -18,7 +14,6 @@ upgrade=1 backup_restore=1 multi_instance=1 - port_already_use=0 change_url=0 ;;; Options Email=anmol@datamol.org diff --git a/conf/config.ini.sample b/conf/config.ini.sample new file mode 100644 index 0000000..0bbe1b2 --- /dev/null +++ b/conf/config.ini.sample @@ -0,0 +1,33 @@ +; Register App Settings +; The URL Unshortener automatically parses links to URL Shorteners like bit.ly and displays the long version so that the user knows where a link goes +[App] +api_client_name = YunoHost Halcyon +api_client_website = https://__DOMAIN__/ +who_to_follow_provider = https://vinayaka.tsia.de/cgi-bin/vinayaka-user-match-osa-api.cgi?{{host}}+{{user}} +default_language = __LANGUAGE__ +debug_mode = false +url_unshortener = true + +; Media embed settings +; YouPlay resolves YouTube MP4s on your server and sends this link to the user for privacy-friendly watching +; Vimeo embeds work in the same way as YouPlay embeds here because the official players contain too much spyware +; YouPlay Fallback uses a proprietary API of https://unblockvideos.com and can be used if your own server IP has been blocked by Google +; Invidous is a external service to watch YouTube videos in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here +; Nitter is a external service to view Twitter contents in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here +; Bibliogram is a external service to view Instagram contents in a privacy-friendly way - Halcyon can automatically rewrite links to a instance you can set here +[Media] +youplay = true +vimeo = true +youplay_fallback = true +invidious = invidious.snopyta.org +nitter = nitter.13ad.de +bibliogram = bibliogram.ggc-project.de + +; The proxy can be used optionally to resolve data for privacy-friendly media embeds on the server side - It is not used for Mastodon API requests on login +; Proxy type can be set to none, socks5, socks4, http or https +[Proxy] +type = none +domain = +port = +username = +password = diff --git a/doc/.DS_Store b/doc/.DS_Store new file mode 100644 index 0000000..c90376b Binary files /dev/null and b/doc/.DS_Store differ diff --git a/doc/screenshots/preview0.png b/doc/screenshots/preview0.png new file mode 100644 index 0000000..06e9a6b Binary files /dev/null and b/doc/screenshots/preview0.png differ diff --git a/manifest.json b/manifest.json index 6e03eda..9675b04 100644 --- a/manifest.json +++ b/manifest.json @@ -8,13 +8,18 @@ }, "version": "2.4.9~ynh1", "url": "https://notabug.org/halcyon-suite/halcyon", + "upstream": { + "license": "AGPL-3.0-only", + "website": "https://notabug.org/halcyon-suite/halcyon", + "code": "https://notabug.org/halcyon-suite/halcyon" + }, "license": "AGPL-3.0-only", "maintainer": { "name": "Anmol Sharma", "email": "anmol@datamol.org" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ @@ -26,19 +31,11 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Halcyon", - "fr": "Choisissez un nom de domaine pour Halcyon" - }, "example": "example.com" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "If enabled, Halcyon will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Halcyon sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." diff --git a/scripts/change_url b/scripts/change_url index 161b84f..8c43ce6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -84,10 +101,6 @@ fi ### (It's compatible with sed regular expressions syntax) ynh_replace_string "$old_domain" "$new_domain" "$final_path/config/config.ini" -# Set permissions to app files -chown -R $app: $final_path -chmod -R 755 $final_path/data - ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ynh_backup_if_checksum_is_different "$final_path/config/config.ini" diff --git a/scripts/install b/scripts/install index dca63f3..b6d534e 100755 --- a/scripts/install +++ b/scripts/install @@ -45,9 +45,16 @@ ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # STANDARD MODIFICATIONS #================================================= @@ -59,6 +66,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -67,14 +78,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -90,39 +93,20 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # MODIFY A CONFIG FILE #================================================= -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) -cp $final_path/config/config.ini.sample $final_path/config/config.ini -ynh_replace_string --match_string="Your application name" --replace_string="Yunohost Halcyon" --target_file="$final_path/config/config.ini" -ynh_replace_string --match_string="example.com" --replace_string="$domain" --target_file="$final_path/config/config.ini" -ynh_replace_string --match_string="en_US" --replace_string="$language" --target_file="$final_path/config/config.ini" +ynh_add_config --template="../conf/config.ini.sample" --destination="$final_path/config/config.ini" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$final_path/config/config.ini" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R $app: $final_path -chmod -R 755 $final_path/data +chmod 400 "$final_path/config/config.ini" +chown $app "$final_path/config/config.ini" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=10 +ynh_script_progression --message="Configuring permissions..." --weight=10 # Make app public if necessary or protect it if [ $is_public -eq 1 ] then - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index 01bccc1..95a3bae 100755 --- a/scripts/restore +++ b/scripts/restore @@ -47,6 +47,14 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -54,21 +62,9 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R $app: $final_path -chmod -R 755 $final_path/data +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 5d35b9b..c3583d1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -34,21 +33,19 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=3 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -63,6 +60,14 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -74,9 +79,13 @@ then ynh_script_progression --message="Upgrading source files..." --weight=2 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config/config.ini" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -85,14 +94,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -101,31 +102,6 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --package="$extra_php_dependencies" -#================================================= -# CREATE DEDICATED USER -#================================================= - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -ynh_backup_if_checksum_is_different --file="$final_path/config/config.ini" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/config/config.ini" - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R $app: $final_path -chmod -R 755 $final_path/data - #================================================= # RELOAD NGINX #=================================================