diff --git a/conf/arm64.src b/conf/arm64.src index 6c4b48d..f374176 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -3,4 +3,5 @@ SOURCE_SUM=6f48f8b59bc8d834c6ede1d27ecc1a598b8a0be1dab00622caa6fd047e51eed6 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/conf/config.default.yml b/conf/config.default.yml index c9949db..059f590 100644 --- a/conf/config.default.yml +++ b/conf/config.default.yml @@ -19,20 +19,20 @@ ObfsRequirePreferred: false DisableTrackers: false # DisableTrackers Don't announce to trackers. This only leaves DHT to discover peers. -DisableIPv6: false +DisableIPv6: __DISABLE_IP_V6__ # DisableIPv6 Don't connect to IPv6 peers. -DisableUTP: false +DisableUTP: __DISABLE_UTP__ # Disable UTP in the torrent protocol. # In recent versions, the UTP process cause quite high CPU usage. Set to true can ease the situation. NoDefaultPortForwarding: true # Don't broadcast the UPNP request for gateway port forwarding, which is unnecessary in machines that has public IP (of which this program is mean for?) -DownloadDirectory: /home/yunohost.app/__APP__/downloads +DownloadDirectory: __DOWNLOAD_DIRECTORY__ # DisableEncryption A switch disables [BitTorrent protocol encryption](https://en.wikipedia.org/wiki/BitTorrent_protocol_encryption) -WatchDirectory: /home/yunohost.app/__APP__/torrents +WatchDirectory: __WATCH_DIRECTORY__ # DownloadDirectory The directory where downloaded file saves. EnableUpload: true diff --git a/conf/i386.src b/conf/i386.src index dd17e3a..47e8bd2 100644 --- a/conf/i386.src +++ b/conf/i386.src @@ -3,4 +3,5 @@ SOURCE_SUM=583898eb907c21dbbcb6f33934eae3dc1d6ec2620fdc7689c70a3479049af52b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/conf/x86_64.src b/conf/x86_64.src index 6489df8..f2281a6 100644 --- a/conf/x86_64.src +++ b/conf/x86_64.src @@ -3,4 +3,5 @@ SOURCE_SUM=d2f535e4cd0449b357a563cfce79c1f6afcac9b7b3af94e758defc44faa52ebf SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=gz SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=simple-torrent SOURCE_EXTRACT=false diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..e4e061c --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,44 @@ +version = "1.0" + +[main] +name = "Simple Torrent configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration Options" + + [main.config.download_directory] + ask = "Set download directory" + type = "string" + default = "/home/yunohost.app/__APP__/downloads" + help = "The directory where downloaded file saves." + bind = "DownloadDirectory:__FINALPATH__/config.yml" + + [main.config.watch_directory] + ask = "Set watch directory" + type = "string" + default = "/home/yunohost.app/__APP__/torrents" + help = "The directory where downloaded file saves." + bind = "WatchDirectory:__FINALPATH__/config.yml" + + [main.config.disable_ip_v6] + ask = "Disable IPv6" + type = "boolean" + yes = "true" + no = "false" + help = "Don't connect to IPv6 peers." + bind = "DisableIPv6:__FINALPATH__/config.yml" + + [main.config.disable_utp] + ask = "Disable UTP" + type = "boolean" + yes = "true" + no = "false" + help = "Disable UTP in the torrent protocol. In recent versions, the UTP process cause quite high CPU usage. Set to true can ease the situation." + bind = "DisableUTP:__FINALPATH__/config.yml" + + + + + + diff --git a/scripts/install b/scripts/install index 12beb0c..fedc51c 100644 --- a/scripts/install +++ b/scripts/install @@ -27,6 +27,11 @@ architecture=$(ynh_detect_arch) app=$YNH_APP_INSTANCE_NAME +download_directory="/home/yunohost.app/$app/downloads" +watch_directory="/home/yunohost.app/$app/torrents" +disable_ip_v6="false" +disable_utp="false" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -51,6 +56,10 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 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=download_directory --value=$download_directory +ynh_app_setting_set --app=$app --key=watch_directory --value=$watch_directory +ynh_app_setting_set --app=$app --key=disable_ip_v6 --value=$disable_ip_v6 +ynh_app_setting_set --app=$app --key=disable_utp --value=$disable_utp #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/remove b/scripts/remove index 8ab2c82..5abf796 100644 --- a/scripts/remove +++ b/scripts/remove @@ -55,6 +55,7 @@ ynh_secure_remove --file="$final_path" # REMOVE DATA DIR #================================================= +# Remove the app data directory with the command `yunohost app remove --purge` # Remove the data directory if --purge option is used if [ "${YNH_APP_PURGE:-0}" -eq 1 ] then diff --git a/scripts/upgrade b/scripts/upgrade index b7e46f0..8a3db4d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,11 @@ port=$(ynh_app_setting_get --app=$app --key=port) peer_port=$(ynh_app_setting_get --app=$app --key=peer_port) architecture=$(ynh_detect_arch) +download_directory=$(ynh_app_setting_get --app=$app --key=download_directory) +watch_directory=$(ynh_app_setting_get --app=$app --key=watch_directory) +disable_ip_v6=$(ynh_app_setting_get --app=$app --key=disable_ip_v6) +disable_utp=$(ynh_app_setting_get --app=$app --key=disable_utp) + #================================================= # CHECK VERSION #================================================= @@ -54,6 +59,26 @@ then ynh_die --message="Sorry, this app cannot be installed on a 32-bit ARM machine." fi +if [ -z "$download_directory" ]; then + download_directory="/home/yunohost.app/$app/downloads" + ynh_app_setting_set --app=$app --key=download_directory --value=$download_directory +fi + +if [ -z "$watch_directory" ]; then + watch_directory="/home/yunohost.app/$app/torrents" + ynh_app_setting_set --app=$app --key=watch_directory --value=$watch_directory +fi + +if [ -z "$disable_ip_v6" ]; then + disable_ip_v6="false" + ynh_app_setting_set --app=$app --key=disable_ip_v6 --value=$disable_ip_v6 +fi + +if [ -z "$disable_utp" ]; then + disable_utp="false" + ynh_app_setting_set --app=$app --key=disable_utp --value=$disable_utp +fi + # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -87,7 +112,7 @@ then ynh_script_progression --message="Upgrading source files..." --weight=5 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$final_path --source_id="$architecture" --keep="$final_path/config.yml" + ynh_setup_source --dest_dir=$final_path --source_id="$architecture" #--keep="$final_path/config.yml" pushd "$final_path" gzip --decompress $(ynh_detect_arch).gz @@ -111,9 +136,9 @@ ynh_add_nginx_config #================================================= # MODIFY A CONFIG FILE #================================================= -# ynh_script_progression --message="Modifying a config file..." --weight=1 +ynh_script_progression --message="Modifying a config file..." --weight=1 -# ynh_add_config --template="../conf/config.default.yml" --destination="$final_path/config.yml" +ynh_add_config --template="../conf/config.default.yml" --destination="$final_path/config.yml" #================================================= # CREATE DIRECTORIES