diff --git a/conf/config.json b/conf/config.json index c74e8b1..8fb8ddd 100644 --- a/conf/config.json +++ b/conf/config.json @@ -10,7 +10,7 @@ "port": __PORT__, "store_path": "tube.db", "upload_path": "__DATADIR__/uploads", - "max_upload_size": 104857600 + "max_upload_size": __MAX_UPLOAD_SIZE__ }, "thumbnailer": { "timeout": 60 @@ -26,14 +26,14 @@ }, "feed": { "external_url": "https://__DOMAIN__", - "title": "Feed Title", + "title": "__FEED_TITLE__", "link": "http://__DOMAIN__/about", - "description": "Feed Description", + "description": "__FEED_DESCRIPTION__", "author": { - "name": "Author Name", - "email": "author@somewhere.example" + "name": "__AUTHOR_NAME__", + "email": "__AUTHOR_EMAIL__" }, - "copyright": "Copyright Text" + "copyright": "__COPYRIGHT_TEXT__" }, "copyright": { "content": "All Content herein Public Domain and User Contributed." diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..b49711d --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,47 @@ +version = "1.0" + +[main] +name = "Tube configuration" +services = ["__APP__"] + + [main.config] + name = "Configuration Options" + + [main.config.max_upload_size] + ask = "Max Upload Size" + type = "number" + help = "Set max_upload_size to the maximum number of bytes you wish to impose on uploaded and imported videos. Upload(s)/Import(s) that exceed this size will by denied by the server. This is a saftey measure so as to not DoS the Tube server instance. Set it to a sensible value you see fit." + bind = "max_upload_size:/var/www/__APP__/config.json" + + [main.rss] + name = "RSS feed information" + + [main.rss.feed_title] + ask = "Feed Title" + type = "string" + help = "Set the feed title for your RSS feed" + bind = "title:/var/www/__APP__/config.json" + + [main.rss.feed_description] + ask = "Feed Description" + type = "string" + help = "Set the feed description for your RSS feed" + bind = "description:/var/www/__APP__/config.json" + + [main.rss.author_name] + ask = "Author Name" + type = "string" + help = "Set the author name for the RSS feed" + bind = "name:/var/www/__APP__/config.json" + + [main.rss.author_email] + ask = "Author Email" + type = "string" + help = "Set the author email for the RSS feed" + bind = "email:/var/www/__APP__/config.json" + + [main.rss.copyright_text] + ask = "Copyright Text" + type = "string" + help = "Set the copyright text for the RSS feed" + bind = "copyright:/var/www/__APP__/config.json" diff --git a/config_panel.toml.example b/config_panel.toml.example deleted file mode 100644 index 6f7eec5..0000000 --- a/config_panel.toml.example +++ /dev/null @@ -1,15 +0,0 @@ -version = "1.0" - -[main] -name = "Tube configuration" -services = ["__APP__"] - - [main.config] - name = "Configuration Options" - - [main.config.max_upload_size] - ask = "Max upload size" - type = "number" - help = "Set max_upload_size to the maximum number of bytes you wish to impose on uploaded and imported videos. Upload(s)/Import(s) that exceed this size will by denied by the server. This is a saftey measure so as to not DoS the Tube server instance. Set it to a sensible value you see fit." - bind = "max_upload_size:/var/www/__APP__/config.json" - \ No newline at end of file diff --git a/scripts/install b/scripts/install index ddf44e7..823f0d3 100755 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,13 @@ is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME +max_upload_size=1048576000 +feed_title="Feed title" +feed_description="Feed description" +author_name="Author Name" +author_email="author@somewhere.example" +copyright_text="Copyright Text" + #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= @@ -48,6 +55,12 @@ 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=max_upload_size --value=$max_upload_size +ynh_app_setting_set --app=$app --key=feed_title --value=$feed_title +ynh_app_setting_set --app=$app --key=feed_description --value=$feed_description +ynh_app_setting_set --app=$app --key=author_name --value=$author_name +ynh_app_setting_set --app=$app --key=author_email --value=$author_email +ynh_app_setting_set --app=$app --key=copyright_text --value=$copyright_text #================================================= # STANDARD MODIFICATIONS diff --git a/scripts/upgrade b/scripts/upgrade index c88d24d..a53e119 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,6 +20,13 @@ 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) +max_upload_size=$(ynh_app_setting_get --app=$app --key=max_upload_size) +feed_title=$(ynh_app_setting_get --app=$app --key=feed_title) +feed_description=$(ynh_app_setting_get --app=$app --key=feed_description) +author_name=$(ynh_app_setting_get --app=$app --key=author_name) +author_email=$(ynh_app_setting_get --app=$app --key=author_email) +copyright_text=$(ynh_app_setting_get --app=$app --key=copyright_text) + #================================================= # CHECK VERSION #================================================= @@ -49,6 +56,55 @@ 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" +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If max_upload_size doesn't exist, create it +if [ -z "$max_upload_size" ]; then + max_upload_size=100 + ynh_app_setting_set --app=$app --key=max_upload_size --value=$max_upload_size +fi + +# If feed_title doesn't exist, create it +if [ -z "$feed_title" ]; then + feed_title="Feed title" + ynh_app_setting_set --app=$app --key=feed_title --value=$feed_title +fi + +# If feed_description doesn't exist, create it +if [ -z "$feed_description" ]; then + feed_description="Feed description" + ynh_app_setting_set --app=$app --key=feed_description --value=$feed_description +fi + +# If author_name doesn't exist, create it +if [ -z "$author_name" ]; then + author_name="Author Name" + ynh_app_setting_set --app=$app --key=author_name --value=$author_name +fi + +# If author_email doesn't exist, create it +if [ -z "$author_email" ]; then + author_email="author@somewhere.example" + ynh_app_setting_set --app=$app --key=author_email --value=$author_email +fi + +# If copyright_text doesn't exist, create it +if [ -z "$copyright_text" ]; then + copyright_text="Copyright Text" + ynh_app_setting_set --app=$app --key=copyright_text --value=$copyright_text +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 + #================================================= # CREATE DEDICATED USER #=================================================