diff --git a/README.md b/README.md index ffe20b8..db42954 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,14 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl - Simple and clean command line interface. - Basic bookmarks management i.e. add, edit and delete. -- Search bookmarks by their title, tags, url and page content. +- Search bookmarks by their title, tags, URL and page content. - Import and export bookmarks from and to Netscape Bookmark file. -- Portable, thanks to its single binary format and sqlite3 database - Simple web interface for those who don't want to use a command line app. - Where possible, by default shiori will download a static copy of the webpage in simple text and HTML format, which later can be used as an offline archive for that page. +### Shiori Web Extension +[Shiori Web Extension](https://github.com/go-shiori/shiori-web-ext) is a simple extension for managing bookmarks using Shiori. This extension is intended to integrate Shiori with your favorite web browser. This way, you can save and remove bookmarks in Shiori without switching from your current page. **Shipped version:** 1.5.0~ynh1 @@ -39,6 +40,8 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl ## Disclaimers / important information +The default account is `shiori` with password `gopher`. It is removed once another 'owner' account is created. + - username: `shiori` - password: `gopher` diff --git a/README_fr.md b/README_fr.md index 54ab50d..58c40b5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,13 +17,14 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl - Simple and clean command line interface. - Basic bookmarks management i.e. add, edit and delete. -- Search bookmarks by their title, tags, url and page content. +- Search bookmarks by their title, tags, URL and page content. - Import and export bookmarks from and to Netscape Bookmark file. -- Portable, thanks to its single binary format and sqlite3 database - Simple web interface for those who don't want to use a command line app. - Where possible, by default shiori will download a static copy of the webpage in simple text and HTML format, which later can be used as an offline archive for that page. +### Shiori Web Extension +[Shiori Web Extension](https://github.com/go-shiori/shiori-web-ext) is a simple extension for managing bookmarks using Shiori. This extension is intended to integrate Shiori with your favorite web browser. This way, you can save and remove bookmarks in Shiori without switching from your current page. **Version incluse :** 1.5.0~ynh1 @@ -35,6 +36,8 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl ## Avertissements / informations importantes +The default account is `shiori` with password `gopher`. It is removed once another 'owner' account is created. + - username: `shiori` - password: `gopher` diff --git a/check_process b/check_process index 12a8c93..b50e3a6 100644 --- a/check_process +++ b/check_process @@ -13,7 +13,7 @@ upgrade=1 #upgrade=1 from_commit=CommitHash backup_restore=1 - multi_instance=0 + multi_instance=1 change_url=1 ;;; Options Email= diff --git a/conf/.env b/conf/.env deleted file mode 100644 index 96cc833..0000000 --- a/conf/.env +++ /dev/null @@ -1,3 +0,0 @@ -SHIORI_DBTYPE=mysql -SHIORI_DSN=__DB_USER__:__DB_PWD__@(localhost)/__DB_NAME__?charset=utf8&parseTime=True&loc=Local -SHIORI_DIR=__DATADIR__ \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 96ccc0c..d601a3a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -7,9 +7,10 @@ location / { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; - proxy_set_header Connection ''; + proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/conf/systemd.service b/conf/systemd.service index d4ac2b4..eeb2d71 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,9 +8,9 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/__APP__ serve --port __PORT__ -StandardOutput=append:/var/log/__APP__/__APP__.log -StandardError=inherit +ExecStart=__FINALPATH__/shiori serve --port __PORT__ +Restart=always +Environment="SHIORI_DIR=__DATADIR__" [Install] WantedBy=multi-user.target diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index d25d09e..62eda83 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -4,9 +4,11 @@ Shiori is a simple bookmarks manager written in Go language. Intended as a simpl - Simple and clean command line interface. - Basic bookmarks management i.e. add, edit and delete. -- Search bookmarks by their title, tags, url and page content. +- Search bookmarks by their title, tags, URL and page content. - Import and export bookmarks from and to Netscape Bookmark file. -- Portable, thanks to its single binary format and sqlite3 database - Simple web interface for those who don't want to use a command line app. - Where possible, by default shiori will download a static copy of the webpage in simple text and HTML format, which later can be used as an offline archive for that page. +### Shiori Web Extension + +[Shiori Web Extension](https://github.com/go-shiori/shiori-web-ext) is a simple extension for managing bookmarks using Shiori. This extension is intended to integrate Shiori with your favorite web browser. This way, you can save and remove bookmarks in Shiori without switching from your current page. \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 19bf0c0..11a57fd 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,2 +1,4 @@ +The default account is `shiori` with password `gopher`. It is removed once another 'owner' account is created. + - username: `shiori` - password: `gopher` diff --git a/manifest.json b/manifest.json index dbeda44..91caae0 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "shiori", "packaging_format": 1, "description": { - "en": "Simple bookmark manager built with Go", - "fr": "Simple bookmark manager built with Go" + "en": "Simple bookmark manager", + "fr": "Gestionnaire de liens simple" }, "version": "1.5.0~ynh1", "url": "https://github.com/go-shiori/shiori", @@ -18,13 +18,13 @@ }, "license": "MIT", "maintainer": { - "name": "John doe", - "email": "john.doe@example.com" + "name": "eric_G", + "email": "" }, "requirements": { "yunohost": ">= 4.3.0" }, - "multi_instance": false, + "multi_instance": true, "services": [ "nginx" ], diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..6a48f17 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,9 @@ # COMMON VARIABLES #================================================= +# dependencies used by the app +pkg_dependencies="sqlite3" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index cd58e10..bf59418 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,7 +26,6 @@ app=$YNH_APP_INSTANCE_NAME 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) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= @@ -40,12 +39,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# BACKUP THE DATA DIR -#================================================= - -ynh_backup --src_path="$datadir" --is_big - #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -66,13 +59,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP THE MYSQL DATABASE -#================================================= -ynh_print_info --message="Backing up the MySQL database..." - -ynh_mysql_dump_db --database="$db_name" > db.sql - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index df1547b..e2a9cb6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +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) @@ -32,7 +32,7 @@ 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)..." --time --weight=1 +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 @@ -67,14 +67,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf diff --git a/scripts/install b/scripts/install index 838626a..4b42d76 100755 --- a/scripts/install +++ b/scripts/install @@ -64,16 +64,6 @@ ynh_script_progression --message="Configuring system user..." --weight=1 # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=2 - -db_name=$(ynh_sanitize_dbid --db_name=$app) -db_user=$db_name -ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -110,16 +100,6 @@ chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/.env" --destination="$final_path/.env" - -chmod 400 "$final_path/.env" -chown $app:$app "$final_path/.env" - #================================================= # SETUP SYSTEMD #================================================= @@ -169,8 +149,6 @@ then ynh_permission_update --permission="main" --add="visitors" fi -ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/remove b/scripts/remove index b5d9612..6a8e2fd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -17,9 +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) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) @@ -49,17 +46,11 @@ ynh_remove_systemd_config #================================================= ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_secure_remove --file="/var/log/$app" + # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=1 - -# Remove a database if it exists, along with the associated user -ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -69,12 +60,15 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 ynh_secure_remove --file="$final_path" #================================================= -# REMOVE APP MAIN DIR +# REMOVE DATA DIR #================================================= -ynh_script_progression --message="Removing dir directory..." --weight=1 -# Remove the app directory securely -ynh_secure_remove --file="$datadir" +# Remove the data directory if --purge option is used +if [ "${YNH_APP_PURGE:-0}" -eq 1 ] +then + ynh_script_progression --message="Removing app data directory..." --weight=1 + ynh_secure_remove --file="$datadir" +fi #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index bb2c6b0..61c4223 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -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 ynh_abort_if_errors @@ -31,8 +27,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) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user=$db_name datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= @@ -40,7 +34,7 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= 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 @@ -85,13 +79,14 @@ chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" #================================================= -# RESTORE THE MYSQL DATABASE +# SPECIFIC RESTORATION #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 -db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index d2cf23c..f07e442 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -db_name=$(ynh_app_setting_get --app=$app --key=db_name) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION @@ -49,7 +49,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # CREATE DEDICATED USER