diff --git a/check_process b/check_process index 525d22a..aa34d78 100755 --- a/check_process +++ b/check_process @@ -3,9 +3,9 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" - language="en" is_public=1 + language="en" + admin="john" password="azerty1234" wiki="My Wiki" color="328cc1" @@ -17,9 +17,13 @@ setup_private=1 setup_public=1 upgrade=1 + # 3.2.11b~ynh5 upgrade=1 from_commit=69db9a386081d9241f5548e09052fd58dee45463 + # 3.2.12~ynh1 + upgrade=1 from_commit=a59e01aec10bd3a749ce062d2931906151d8f8be backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= diff --git a/conf/nginx.conf b/conf/nginx.conf index ec10d44..b7c8793 100755 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index.php; diff --git a/doc/.gitkeep b/doc/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..6dffdd8 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +LionWiki-t2t is a minimalist Wiki engine programmed in PHP. It is extensible, templatable, file based (it doesn't need database like MySQL) and requires just one file to function (30 kb). It is suitable for small websites, personal notebooks or journals. This version is using the lightweight markup language TXT2TAGS. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..42b56d6 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Lionwiki-t2t est un système de type wiki minimaliste, programmé en PHP. Il est extensible et n'utilise que des fichiers plats pour sa base de données. Il est adapté pour la création de petits sites web, de notes personnelles ou de journaux. Cette version utilise le langage de balisage léger TXT2TAGS. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..7fb11e6 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,51 @@ +## Configuration + +In the root folder of this app, there are two files: `config.php` and `config.t2t` + +- `config.php` is for changing password, the template used, default page. You can also define an administrator password which has some more rights (it's possible to lock some pages and modify them only with the administrator password, add some IP address to a blacklist) + +- `config.t2t` is for tweaking your wiki syntax. You can define more tags (using the txt2tags rules) for specific behaviors. + +The `pheditor.php` tool at the root of the site allows you to edit all the necessary configuration files. You can remove or rename it from its interface. The password is the same as the one defined during installation. + +#### Multi-users support + +This is only a single password for editing the wiki (it's not multi-user), and one other password for administration. Both are set to the same one defined in the lionwiki-t2t during the installation by YunoHost. + +You can set the wiki to private (only readable when you are connected to YunoHost SSO) or public (readable by the whole internet). + +You can install multiple instance of this app. + +## Additional information + +You must define a base color during the installation (in hexadecimal format). You can choose it using this online tool for example: https://www.w3schools.com/colors/colors_picker.asp + +It will modify the `templates/minimaxing/minimaxing.less` file and compile it using the lessc command (from the node-less package). + +After the installation, you can edit the base color found in `/var/www/lionwikit2t/templates/minimaxing/minimaxing.less` file. + +Search for: + +``` +/* For YunoHost config */ +@MainColor: #D17732; +``` + +Go inside your installation folder (adapt it to your case, if it's the second instance you've installed, it will be named /var/www/lionwikit2t__2/): + +``` +cd /var/www/lionwikit2t +``` + +Then compile it with: + +``` +lessc templates/minimaxing/minimaxing.less > templates/minimaxing/minimaxing.css +``` + +If something goes wrong, you can go back to the original default file: + +``` +cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css +``` + diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..0824d12 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,49 @@ +## Configuration + +Dans le dossier racine de l'application il y a 2 fichiers, `config.php` et `config.t2t` + +- config.php permet de modifier le mot de passe, le choix du template utilisé et la page par défaut. Vous pouvez également définir ici un mot de passe administrateur (pour bloquer certaines pages en édition) + +- `config.t2t` est pour customiser votre syntaxe wiki. Vous pouvez définir là de nouvelles balises (utilisant les règles txt2tags) pour des comportements spécifiques. + +- L'outil `pheditor.php` à la racine du site permet d'éditer tous les fichiers de configuration nécessaires. Vous pouvez le retirer ou le renommer depuis son interface. Le mot de passe est le même que celui définit lors de l'installation. + +#### Support multi-utilisateurs + +Il y a un seul mot de passe pour éditer ce wiki (dans le fichier config.php), et un autre pour l'administration. C'est le même qui a a été créé lors de l'installation par YunoHost. + +Vous pouvez passer le wiki en mode privé ou public, selon vos usages. + +## Informations additionnelles + +Vous devez définir une couleur de base durant l'installation, au format hexadécimal. Vous pouvez la choisir en utilisant cet outil en ligne : https://www.w3schools.com/colors/colors_picker.asp + +La couleur choisie va modifier le fichier `templates/minimaxing/minimaxing.less` et le compiler en utilisant la commande lessc (du paquet node-less). + +Après l'installation, vous pouvez éditer la couleur de base dans le fichier `/var/www/lionwikit2t/templates/minimaxing/minimaxing.less` + +Recherchez pour : + +``` +/* For YunoHost config */ +@MainColor: #D17732; +``` + +Allez dans le dossier d'installation (à adapter à votre cas, si c'est la seconde instance installée, cela sera nommé `/var/www/lionwikit2t__2/`) : + +``` +cd /var/www/lionwikit2t +``` + +Ensuite compilez le fichier avec : + +``` +lessc templates/minimaxing/minimaxing.less > templates/minimaxing/minimaxing.css +``` + +Si quelque chose se passe mal, vous pouvez revenir au fichier original : + +``` +cp templates/minimaxing/minimaxing_org.css templates/minimaxing/minimaxing.css +``` + diff --git a/doc/screenshots/.gitkeep b/doc/screenshots/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/screenshot_lionwikit2t.png b/doc/screenshots/screenshot_lionwikit2t.png old mode 100755 new mode 100644 similarity index 100% rename from screenshot_lionwikit2t.png rename to doc/screenshots/screenshot_lionwikit2t.png diff --git a/manifest.json b/manifest.json index b465d15..641e14d 100755 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,15 @@ "en": "Lightweight wiki-style CMS using the txt2tags syntax", "fr": "CMS léger, géré sous forme de wiki utilisant la syntaxe txt2tags" }, - "version": "3.2.12~ynh1", + "version": "3.2.12~ynh2", "url": "https://lionwiki-t2t.sourceforge.io/", + "upstream": { + "license": "MIT", + "website": "https://lionwiki-t2t.sourceforge.io/", + "admindoc": "https://lionwiki-t2t.sourceforge.io/", + "userdoc": "https://github.com/farvardin/whatistxt2tags", + "code": "https://sourceforge.net/projects/lionwiki-t2t" + }, "license": "MIT", "maintainer": { "name": "Eric Forgeot" @@ -21,7 +28,7 @@ "php7.3-fpm" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -32,10 +39,6 @@ "example": "/lionwiki", "default": "/lionwiki" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -55,6 +58,10 @@ "choices": ["fr", "en"], "default": "en" }, + { + "name": "admin", + "type": "user" + }, { "name": "password", "type": "password", diff --git a/scripts/backup b/scripts/backup index 2d90ed5..75ce3e0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= diff --git a/scripts/change_url b/scripts/change_url index ea89a34..ba919a3 100755 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,7 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=4 @@ -40,7 +40,7 @@ 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 + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -62,6 +62,8 @@ then change_path=1 fi +#================================================= +# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= @@ -91,6 +93,8 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi +#================================================= +# GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/install b/scripts/install index dcd4254..efb404d 100755 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -26,9 +25,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +admin=$YNH_APP_ARG_ADMIN password=$YNH_APP_ARG_PASSWORD wiki=$YNH_APP_ARG_WIKI color=$YNH_APP_ARG_COLOR @@ -53,20 +52,11 @@ 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=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find an available port -port=$(ynh_find_port --port=8095) -ynh_app_setting_set --app=$app --key=port --value=$port - #================================================= # INSTALL DEPENDENCIES #================================================= @@ -74,6 +64,14 @@ ynh_script_progression --message="Installing dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=1 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -83,22 +81,6 @@ 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" -#================================================= -# NGINX CONFIGURATION -#================================================= -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=1 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -108,10 +90,20 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC SETUP #================================================= -# customise Lionwiki-t2t +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." ### Copy Yunohost specific configuration # This File cannot be modified directly by wiki, only by hand or by Yunohost @@ -167,16 +159,10 @@ lessc $final_path/templates/ggp/ggp.less > $final_path/templates/ggp/ggp.css #ynh_replace_string --match_string="__YNH_COLOR__" --replace_string="$color" --target_file="$final_path/templates/minimaxing/minimaxing.css" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - ynh_store_file_checksum --file="$final_path/config.php" ynh_store_file_checksum --file="$final_path/config.t2t" ynh_store_file_checksum --file="$final_path/menu.php" -#================================================= -# GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= @@ -187,14 +173,18 @@ chmod -R o-rwx $final_path find $final_path -type d -exec chmod g=rx {} + find $final_path -type f -exec chmod g=r {} + +#================================================= +# GENERIC FINALIZATION #================================================= # SETUP SSOWAT #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -# Make app public if necessary or protect it +# Make app public if necessary if [ $is_public -eq 1 ] then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index 0fb22ef..cca754d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,6 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -30,14 +29,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=2 # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=2 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -54,6 +45,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1 # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=2 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 5ce6cce..a1d649c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - #### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -38,23 +37,11 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -d $final_path || ynh_die --message="There is already a directory: $final_path " +test ! -d $final_path \ + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=2 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -64,8 +51,11 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei ynh_system_user_create --username=$app #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=2 + +ynh_restore_file --origin_path="$final_path" # Restore permissions on app files chown -R $app:www-data $final_path @@ -73,13 +63,6 @@ chmod -R o-rwx $final_path find $final_path -type d -exec chmod g=rx {} + find $final_path -type f -exec chmod g=r {} + -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=3 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - #================================================= # SPECIFIC RESTORATION #================================================= @@ -90,6 +73,20 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=4 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=3 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1fd32ac..6e77b71 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,14 +18,15 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) +language=$(ynh_app_setting_get --app=$app --key=language) admin=$(ynh_app_setting_get --app=$app --key=admin) 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) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -37,7 +38,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -61,6 +62,14 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -73,14 +82,6 @@ then ynh_setup_source --dest_dir="$final_path" fi -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 - -# Create a dedicated nginx config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -88,14 +89,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=3 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -104,6 +97,14 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= @@ -131,6 +132,8 @@ chmod -R o-rwx $final_path find $final_path -type d -exec chmod g=rx {} + find $final_path -type f -exec chmod g=r {} + +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #=================================================