From 1108bcd6505c3cf3f6372a06f6e3d12a86ce27b6 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 11:19:57 +0200 Subject: [PATCH 01/49] Change version notation --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 82177db..be49296 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Code editor awesomeness ...in your browser", "fr": "Un éditeur de code impressionnant ...dans votre navigateur" }, - "version": "1.2~ynh1", + "version": "2.0.0~ynh1", "url": "https://icecoder.net/", "license": "AGPL-3.0-only", "maintainer": { From d99e72bd843ae566af7d1c73c63a3129afa7782d Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 11:22:33 +0200 Subject: [PATCH 02/49] Update manifest.json --- manifest.json | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index be49296..72c1b6c 100644 --- a/manifest.json +++ b/manifest.json @@ -32,12 +32,14 @@ { "name": "path", "type": "path", - "help": { - "en": "Choose the internal path for this app (We recommand to set it to the internal path of a Custom Webapp).", - "fr": "Choisissez le chemin interne de cette application (nous vous recommandons de le définir sur le chemin interne d'une Custom Webapp)." - }, - "example": "/var/www/my_webapp/www/icecoder", - "default": "/var/www/my_webapp/www/icecoder" + "example": "/example", + "default": "/example" + }, + { + "name": "internal_path", + "type": "path", + "example": "/var/www/my_webapp/www", + "default": "/var/www/my_webapp/www" } ] } From 11fdf6ce24b16ea8b03dab60b6c96a77a5729a0b Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 11:29:12 +0200 Subject: [PATCH 03/49] Update install --- scripts/install | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 660484e..be2c56d 100755 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH +internal_path=`echo $YNH_APP_ARG_INTERNAL_PATH "/icecoder"` ### If it's a multi-instance app, meaning it can be installed several times independently @@ -77,7 +78,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1 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" +ynh_setup_source --dest_dir="$internal_path" #================================================= # GENERIC FINALIZATION @@ -110,11 +111,11 @@ ynh_use_logrotate #================================================= ynh_script_progression --message="Configuring permissions..." --weight=1 -if [[ $path_url =~ my_webapp ]] +if [[ $internal_path =~ my_webapp ]] then - chown -R my_webapp $final_path + chown -R my_webapp $internal_path else - chown -R www-data.www-data $final_path + chown -R www-data.www-data $internal_path fi #================================================= From 32aa7e7b2aa96f47c4eb2d22cf653c9877c73435 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 18:24:55 +0200 Subject: [PATCH 04/49] Create software.conf --- software.conf | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 software.conf diff --git a/software.conf b/software.conf new file mode 100644 index 0000000..28fdf3b --- /dev/null +++ b/software.conf @@ -0,0 +1,14 @@ + Date: Mon, 29 Mar 2021 18:57:36 +0200 Subject: [PATCH 05/49] Update install --- scripts/install | 58 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/scripts/install b/scripts/install index be2c56d..ca819e0 100755 --- a/scripts/install +++ b/scripts/install @@ -21,9 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH -internal_path=`echo $YNH_APP_ARG_INTERNAL_PATH "/icecoder"` - +path_url=`echo "/" `ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path` "/icecoder"` ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -52,13 +50,12 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" -final_path=$path_url +final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= @@ -78,7 +75,16 @@ ynh_script_progression --message="Setting up source files..." --weight=1 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="$internal_path" +ynh_setup_source --dest_dir="$final_path" + +#================================================= +# SPECIFIC SETUP +#================================================= + +# Change config (ban editor's folder) +php -f "../conf/config.php" + +#================================================= #================================================= # GENERIC FINALIZATION @@ -90,6 +96,9 @@ ynh_setup_source --dest_dir="$internal_path" ### Then, if write authorization is needed, any access should be given only to directories ### that really need such authorization. +# Set permissions to app files +chown -R $YNH_APP_ARG_APP_ID $final_path + #================================================= # SETUP LOGROTATE #================================================= @@ -107,16 +116,37 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 ynh_use_logrotate #================================================= -# SETUP PERMISSIONS +# INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +### `yunohost service add` integrates a service in YunoHost. It then gets +### displayed in the admin interface and through the others `yunohost service` commands. +### (N.B.: this line only makes sense if the app adds a service to the system!) +### If you're not using these lines: +### - You can remove these files in conf/. +### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script +### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script +### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script + +yunohost service add $app --description="ICEcoder logs" --log="/var/log/$app/$app.log" + +### Additional options starting with 3.8: +### +### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed +### which will then be checked by YunoHost's diagnosis system +### (N.B. DO NOT USE THIS is the port is only internal!!!) +### +### --test_status "some command" a custom command to check the status of the service +### (only relevant if 'systemctl status' doesn't do a good job) +### +### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service +### +### Re-calling 'yunohost service add' during the upgrade script is the right way +### to proceed if you later realize that you need to enable some flags that +### weren't enabled on old installs (be careful it'll override the existing +### service though so you should re-provide all relevant flags when doing so) -if [[ $internal_path =~ my_webapp ]] -then - chown -R my_webapp $internal_path -else - chown -R www-data.www-data $internal_path -fi #================================================= # END OF SCRIPT From 371c9b47baa59cba5fa01768298b0435b60fc869 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:00:07 +0200 Subject: [PATCH 06/49] Update restore --- scripts/restore | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/restore b/scripts/restore index da00f18..2b7f8a3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,7 +27,7 @@ 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) -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +app_id=$(ynh_app_setting_get --app=$app --key=app_id) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -58,12 +58,7 @@ ynh_restore_file --origin_path="$final_path" # RESTORE USER RIGHTS #================================================= -if [[ $path_url =~ my_webapp ]] -then - chown -R my_webapp $final_path -else - chown -R www-data.www-data $final_path -fi +chown -R $app_id $final_path #================================================= # RESTORE THE LOGROTATE CONFIGURATION From 4ed6d29d07ac42d9d32eae9ed56e5752bd6b85cf Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:02:14 +0200 Subject: [PATCH 07/49] Update install --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index ca819e0..bc79ab0 100755 --- a/scripts/install +++ b/scripts/install @@ -22,6 +22,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=`echo "/" `ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path` "/icecoder"` +app_id=$YNH_APP_ARG_APP_ID ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -63,6 +64,7 @@ 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=app_id --value=$app_id #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From 749d49080cc9313ec29376c8ae8e71a2fc630b97 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:02:30 +0200 Subject: [PATCH 08/49] Delete software.conf --- software.conf | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 software.conf diff --git a/software.conf b/software.conf deleted file mode 100644 index 28fdf3b..0000000 --- a/software.conf +++ /dev/null @@ -1,14 +0,0 @@ - Date: Mon, 29 Mar 2021 19:08:48 +0200 Subject: [PATCH 09/49] Update manifest.json --- manifest.json | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/manifest.json b/manifest.json index 72c1b6c..31b2e3d 100644 --- a/manifest.json +++ b/manifest.json @@ -30,16 +30,12 @@ "example": "example.com" }, { - "name": "path", - "type": "path", - "example": "/example", - "default": "/example" - }, - { - "name": "internal_path", - "type": "path", - "example": "/var/www/my_webapp/www", - "default": "/var/www/my_webapp/www" + "name": "app_id", + "type": "app", + "ask": { + "en": "Choose a webapp", + "fr": "Choisissez une webapp" + } } ] } From 34f593ef09f20a7725a5d5b6d36184f58f1955b7 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:15:38 +0200 Subject: [PATCH 10/49] Create icecoder_settings.php --- conf/icecoder_settings.php | 231 +++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 conf/icecoder_settings.php diff --git a/conf/icecoder_settings.php b/conf/icecoder_settings.php new file mode 100644 index 0000000..d7f08e7 --- /dev/null +++ b/conf/icecoder_settings.php @@ -0,0 +1,231 @@ +versionNo = "8.0"; + $this->docRoot = $_SERVER['DOCUMENT_ROOT']; + } + + + // ======== + // DATA DIR + // ======== + + public function getDataDirDetails() + { + clearstatcache(); + + // Return details about the data dir + $fullPath = dirname(__FILE__) . "/../data/"; + $exists = file_exists($fullPath); + $readable = is_readable($fullPath); + $writable = is_writable($fullPath); + return [ + "fullPath" => $fullPath, + "exists" => $exists, + "readable" => $readable, + "writable" => $writable, + ]; + } + + // ============= + // GLOBAL CONFIG + // ============= + + public function getConfigGlobalTemplate() + { + // Return the serialized global config template + $fileName = 'template-config-global.php'; + $fullPath = dirname(__FILE__) . "/../lib/" . $fileName; + if (function_exists('opcache_invalidate')) { + opcache_invalidate($fullPath, true); + } + $settings = file_get_contents($fullPath); + return $settings; + } + + public function getConfigGlobalFileDetails() + { + clearstatcache(); + + // Return details about the global config file + $fileName = 'config-global.php'; + $fullPath = dirname(__FILE__) . "/../data/" . $fileName; + $exists = file_exists($fullPath); + $readable = is_readable($fullPath); + $writable = is_writable($fullPath); + $filemtime = filemtime($fullPath); + return [ + "fileName" => $fileName, + "fullPath" => $fullPath, + "exists" => $exists, + "readable" => $readable, + "writable" => $writable, + "filemtime" => $filemtime + ]; + } + + public function getConfigGlobalSettings() + { + // Start an array with version number and document root + $settings = []; + $settings['versionNo'] = $this->versionNo; + $settings['docRoot'] = $this->docRoot; + // Get global config file details + $fullPath = $this->getConfigGlobalFileDetails()['fullPath']; + $settingsFromFile = $this->serializedFileData("get", $fullPath); + // Merge that with the array we started with and return + $settings = array_merge($settings, $settingsFromFile); + return $settings; + } + + public function setConfigGlobalSettings($settings): bool + { + // Get the global config file details + $fullPath = $this->getConfigGlobalFileDetails()['fullPath']; + if ($fConfigSettings = fopen($fullPath, 'w')) { + // If the settings we've received aren't in serialized format yet, do that now + // As $settings could be a serialized string or array + if (is_array($settings)) { + unset($settings['versionNo']); + unset($settings['docRoot']); + } + return $this->serializedFileData("set", $fullPath, $settings); + } else { + return false; + } + } + + public function updateConfigGlobalSettings($array): bool + { + // Update global config settings file + $settingsFromFile = $this->getConfigGlobalSettings(); + $settings = array_merge($settingsFromFile, $array); + return $this->setConfigGlobalSettings($settings); + } + + // ============ + // USERS CONFIG + // ============ + + public function getConfigUsersTemplate() + { + // Return the serialized users config template + $fileName = 'template-config-users.php'; + $fullPath = dirname(__FILE__) . "/../lib/" . $fileName; + if (function_exists('opcache_invalidate')) { + opcache_invalidate($fullPath, true); + } + $settings = file_get_contents($fullPath); + return $settings; + } + + public function getConfigUsersFileDetails($fileName) + { + // Return details about the users config file + $fullPath = dirname(__FILE__) . "/../data/" . $fileName; + $exists = file_exists($fullPath); + $readable = is_readable($fullPath); + $writable = is_writable($fullPath); + $filemtime = filemtime($fullPath); + return [ + "fileName" => $fileName, + "fullPath" => $fullPath, + "exists" => $exists, + "readable" => $readable, + "writable" => $writable, + "filemtime" => $filemtime, + ]; + } + + public function getConfigUsersSettings($fileName) + { + // Get users config file details + $fullPath = $this->getConfigUsersFileDetails($fileName)['fullPath']; + $settingsFromFile = $this->serializedFileData("get", $fullPath); + // Now return + return $settingsFromFile; + } + + public function setConfigUsersSettings($fileName, $settings): bool + { + // Get the users config file details + $fullPath = $this->getConfigUsersFileDetails($fileName)['fullPath']; + if ($fConfigSettings = fopen($fullPath, 'w')) { + return $this->serializedFileData("set", $fullPath, $settings); + } else { + return false; + } + } + + public function updateConfigUsersSettings($fileName, $array): bool + { + // Update users config settings file + $settingsFromFile = $this->getConfigUsersSettings($fileName); + $settings = array_merge($settingsFromFile, $array); + return $this->setConfigUsersSettings($fileName, $settings); + } + + public function updateConfigUsersCreateDate($fileName) + { + global $ICEcoderUserSettings; + + // Get users config file details + $filemtime = $this->getConfigUsersFileDetails($fileName)['filemtime']; + // Make it a number (avoids null, undefined etc) + $filemtime = intval($filemtime); + // Set it to the epoch time now if we don't have a real value + if (0 === $filemtime) { + $filemtime = time(); + } + // Update users config settings file + $ICEcoderSettingsFromFile = $this->getConfigUsersSettings($fileName); + $ICEcoderSettingsFromFile['configCreateDate'] = $filemtime; + $this->setConfigUsersSettings($fileName, $ICEcoderSettingsFromFile); + // Set the new value in array + $ICEcoderUserSettings['configCreateDate'] = $filemtime; + } + + public function createIPSettingsFileIfNotExist() + { + global $username, $settingsFile, $settingsFileAddr; + + // Create a duplicate version for the IP address of the domain if it doesn't exist yet + $serverAddr = $_SERVER['SERVER_ADDR'] ?? "1"; + if ($serverAddr == "1" || $serverAddr == "::1") { + $serverAddr = "127.0.0.1"; + } + $settingsFileAddr = 'config-' . $username . str_replace(".", "_", $serverAddr) . '.php'; + if (false === file_exists(dirname(__FILE__) . "/../data/" . $settingsFileAddr)) { + if (false === copy(dirname(__FILE__) . "/../data/" . $settingsFile, dirname(__FILE__) . "/../data/" . $settingsFileAddr)) { + $reqsFailures = ["phpCreateSettingsFileAddr"]; + include dirname(__FILE__) . "/../lib/requirements.php"; + } + } + } + + public function serializedFileData($do, $fullPath, $output=null) + { + if ("get" === $do) { + if (function_exists('opcache_invalidate')) { + opcache_invalidate($fullPath, true); + } + $data = file_get_contents($fullPath); + $data = str_replace("<"."?php\n/*\n\n", "", $data); + $data = str_replace("\n\n*/\n?".">", "", $data); + $data = unserialize($data); + return $data; + } + if ("set" === $do) { + if (true === is_array($output)) { + $output = serialize($output); + } + return false !== file_put_contents($fullPath, "<"."?php\n/*\n\n" . $output . "\n\n*/\n?" . ">"); + } + } +} From ee227b8d486b9d465d03d3c30b61c276c1d08956 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:20:02 +0200 Subject: [PATCH 11/49] Create config.php --- conf/config.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 conf/config.php diff --git a/conf/config.php b/conf/config.php new file mode 100644 index 0000000..909039c --- /dev/null +++ b/conf/config.php @@ -0,0 +1,15 @@ +getConfigGlobalSettings(); + +print_r(getConfigUsersTemplate()); + +// Update the loginRequired setting to false +//$icSettings->updateConfigGlobalSettings( +// ["loginRequired" => false] +//); +?> From d1aa75d81d00ff54c6f79f7846d4fac971e27bce Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:31:46 +0200 Subject: [PATCH 12/49] Update manifest.json --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 31b2e3d..e7a8288 100644 --- a/manifest.json +++ b/manifest.json @@ -33,8 +33,8 @@ "name": "app_id", "type": "app", "ask": { - "en": "Choose a webapp", - "fr": "Choisissez une webapp" + "en": "Indicate a Custom Webapp ID", + "fr": "Indiquez une ID de Custom Webapp" } } ] From 68cbe982eb8be5844d335a0c7fcaaee94b8075e0 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:32:46 +0200 Subject: [PATCH 13/49] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index e7a8288..2beb29e 100644 --- a/manifest.json +++ b/manifest.json @@ -31,7 +31,7 @@ }, { "name": "app_id", - "type": "app", + "type": "string", "ask": { "en": "Indicate a Custom Webapp ID", "fr": "Indiquez une ID de Custom Webapp" From dec4f403139b201c62ed4a246cb10f4f267fa742 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Mon, 29 Mar 2021 19:33:54 +0200 Subject: [PATCH 14/49] Update manifest.json --- manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 2beb29e..c1a1e0c 100644 --- a/manifest.json +++ b/manifest.json @@ -31,10 +31,10 @@ }, { "name": "app_id", - "type": "string", + "type": "app", "ask": { - "en": "Indicate a Custom Webapp ID", - "fr": "Indiquez une ID de Custom Webapp" + "en": "Choose a Custom Webapp", + "fr": "Choisissez une Custom Webapp" } } ] From 155261c9d30f092c1da187e031a448c9dc75e2f1 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:04:23 +0200 Subject: [PATCH 15/49] Update manifest.json --- manifest.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index c1a1e0c..edf5c50 100644 --- a/manifest.json +++ b/manifest.json @@ -31,10 +31,10 @@ }, { "name": "app_id", - "type": "app", + "type": "string", "ask": { - "en": "Choose a Custom Webapp", - "fr": "Choisissez une Custom Webapp" + "en": "Indicate the ID of the Custom Webapp where you want to install this app", + "fr": "Indiquez l'ID de la Custom Webapp dans laquelle vous voulez installer cette app" } } ] From 88b1e7762621d0aac82938191e1bb9a3696d487e Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:05:14 +0200 Subject: [PATCH 16/49] Update install --- scripts/install | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/scripts/install b/scripts/install index bc79ab0..9cc73ea 100755 --- a/scripts/install +++ b/scripts/install @@ -117,39 +117,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1 # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -### `yunohost service add` integrates a service in YunoHost. It then gets -### displayed in the admin interface and through the others `yunohost service` commands. -### (N.B.: this line only makes sense if the app adds a service to the system!) -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script -### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script -### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script - -yunohost service add $app --description="ICEcoder logs" --log="/var/log/$app/$app.log" - -### Additional options starting with 3.8: -### -### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed -### which will then be checked by YunoHost's diagnosis system -### (N.B. DO NOT USE THIS is the port is only internal!!!) -### -### --test_status "some command" a custom command to check the status of the service -### (only relevant if 'systemctl status' doesn't do a good job) -### -### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service -### -### Re-calling 'yunohost service add' during the upgrade script is the right way -### to proceed if you later realize that you need to enable some flags that -### weren't enabled on old installs (be careful it'll override the existing -### service though so you should re-provide all relevant flags when doing so) - - #================================================= # END OF SCRIPT #================================================= From 8b7f7e87489ad06c3470d91d8bd017f4c8b23621 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:05:38 +0200 Subject: [PATCH 17/49] Delete systemd.service --- conf/systemd.service | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 conf/systemd.service diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 886fb54..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=ICEcoder for YunoHost -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 - -[Install] -WantedBy=multi-user.target From 42c83009847fc98551989b832e2a910e5110a02c Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:10:26 +0200 Subject: [PATCH 18/49] Update install --- scripts/install | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/install b/scripts/install index 9cc73ea..7a461a0 100755 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,9 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder + +test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before installing this app instance!" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before installing this app!" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path From 03320bd0759fbd56c361ab2ab512136070aeb775 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:10:38 +0200 Subject: [PATCH 19/49] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 7a461a0..48d08fc 100755 --- a/scripts/install +++ b/scripts/install @@ -53,8 +53,8 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder -test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before installing this app instance!" -test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before installing this app!" +test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before installing this app instance" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before installing this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path From 9462a592b2c8625fac01683f2731d2afb6068a11 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:12:16 +0200 Subject: [PATCH 20/49] Update restore --- scripts/restore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/restore b/scripts/restore index 2b7f8a3..94a4623 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,6 +34,9 @@ app_id=$(ynh_app_setting_get --app=$app --key=app_id) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 +test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before restore this app!" + ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ From 87bb5fd1d2f162715904c51b6b4d849729092e83 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:12:52 +0200 Subject: [PATCH 21/49] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 48d08fc..3c12287 100755 --- a/scripts/install +++ b/scripts/install @@ -53,8 +53,8 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder -test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before installing this app instance" -test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before installing this app" +test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" +test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path From 0b2d6910fe37bedfa6b794e63299d1d0c1b163b3 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:34:39 +0200 Subject: [PATCH 22/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3c12287..5128396 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=`echo "/" `ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path` "/icecoder"` +path_url=`echo `ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path` "/icecoder"` app_id=$YNH_APP_ARG_APP_ID ### If it's a multi-instance app, meaning it can be installed several times independently From 4a71148e8e7b5f0dfef823a86d00079df62ce110 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:36:48 +0200 Subject: [PATCH 23/49] Update install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 5128396..507b6fb 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,8 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=`echo `ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path` "/icecoder"` +path_url=[ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path] +((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID ### If it's a multi-instance app, meaning it can be installed several times independently From d8ab884ff8e8a6cb6f7feaae50f7662d7eb5a20c Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:37:28 +0200 Subject: [PATCH 24/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 507b6fb..c87215f 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=[ynh_app_setting_get --app=$YNH_APP_ARG_APP_ID --key=path] +path_url=[ynh_app_setting_get --app $YNH_APP_ARG_APP_ID --key path] ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From 524b1d2dbb1578d062089e81e6ecf8339ab78fdd Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:41:40 +0200 Subject: [PATCH 25/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c87215f..e04256d 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=[ynh_app_setting_get --app $YNH_APP_ARG_APP_ID --key path] +path_url=[ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path] ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From 4fc00acae5e1d2db8c200c02c450ea432313751e Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:42:33 +0200 Subject: [PATCH 26/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index e04256d..6755bf1 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=[ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path] +path_url=ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From b814dd7feb1aa76a9c972de63e1d95fca94320c1 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:43:08 +0200 Subject: [PATCH 27/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 6755bf1..b527d6f 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path +ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From b6fc1ce0cd1b07cd6165e770d8f67cdbe23f567d Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:43:44 +0200 Subject: [PATCH 28/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b527d6f..2adc9ee 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path +ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path > $path_url ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From c4acae4d3ba35cbad864fdb68edb133f452c7f85 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:45:17 +0200 Subject: [PATCH 29/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 2adc9ee..ffc0c9a 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path > $path_url +echo ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path > $path_url ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From 962c28a478c9098cfde8bcdae141afa15d173b0a Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:45:51 +0200 Subject: [PATCH 30/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ffc0c9a..33e402a 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -echo ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path > $path_url +echo `ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path` > $path_url ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From 547fc26a51426a8f5d2647c5b8a2bf143c715076 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:47:18 +0200 Subject: [PATCH 31/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 33e402a..35fdc88 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -echo `ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path` > $path_url +path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path` ((path_url=$path_url+"/icecoder")) app_id=$YNH_APP_ARG_APP_ID From cd271dd04eaedd80f9fa37777017eaa6f21ba579 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:48:06 +0200 Subject: [PATCH 32/49] Update install --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 35fdc88..b9ee20f 100755 --- a/scripts/install +++ b/scripts/install @@ -21,8 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path` -((path_url=$path_url+"/icecoder")) +path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder app_id=$YNH_APP_ARG_APP_ID ### If it's a multi-instance app, meaning it can be installed several times independently From e2f8f078d8d98da3694d1b7add7c802a876db48c Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:49:06 +0200 Subject: [PATCH 33/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b9ee20f..6f770ab 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder -test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" +test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" From 8a7b7b338c627b6e0c3d965efb35c8dd85225a7e Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:49:22 +0200 Subject: [PATCH 34/49] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 94a4623..6b75648 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,7 @@ app_id=$(ynh_app_setting_get --app=$app --key=app_id) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" +test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before restore this app!" ynh_webpath_available --domain=$domain --path_url=$path_url \ From 3fac815437b1fbb508c3a26f455bc96d4fb0dea8 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:50:21 +0200 Subject: [PATCH 35/49] Update restore --- scripts/restore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 6b75648..24d4b37 100755 --- a/scripts/restore +++ b/scripts/restore @@ -34,7 +34,7 @@ app_id=$(ynh_app_setting_get --app=$app --key=app_id) #================================================= ynh_script_progression --message="Validating restoration parameters..." --weight=1 -test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" +#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already restored a app instance here before restore this app instance!" test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before restore this app!" ynh_webpath_available --domain=$domain --path_url=$path_url \ From fa58559b6cad559a1d165c064657c2ade247e92b Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:50:41 +0200 Subject: [PATCH 36/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 6f770ab..84f4d62 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder -test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" +#test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app" test ! -e "$final_path" || ynh_die --message="This path already contains a folder" From 9f695b8a5d5e85bb518a1345499f74a0fef58a8a Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:54:13 +0200 Subject: [PATCH 37/49] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 84f4d62..3572cf7 100755 --- a/scripts/install +++ b/scripts/install @@ -21,8 +21,8 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder app_id=$YNH_APP_ARG_APP_ID +path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -58,7 +58,7 @@ test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have inst test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +ynh_webpath_register --app=$app --domain=$domain --path_url="In $app_id's 'icecoder' folder" #================================================= # STORE SETTINGS FROM MANIFEST From 6294ecdcd75cffd9a768221e9562c1a8291623c3 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:55:38 +0200 Subject: [PATCH 38/49] Update install --- scripts/install | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 3572cf7..362b77c 100755 --- a/scripts/install +++ b/scripts/install @@ -22,7 +22,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN app_id=$YNH_APP_ARG_APP_ID -path_url=`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder +path_url="" +#`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID @@ -58,7 +59,7 @@ test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have inst test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url="In $app_id's 'icecoder' folder" +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST From 1b47ee7b1501e46ede41ba9e5e8b848ee1ef7107 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 20:58:12 +0200 Subject: [PATCH 39/49] Update install --- scripts/install | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 362b77c..316724c 100755 --- a/scripts/install +++ b/scripts/install @@ -22,8 +22,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN app_id=$YNH_APP_ARG_APP_ID -path_url="" -#`ynh_app_setting_get -a $YNH_APP_ARG_APP_ID -k path`/icecoder +path_url="/in-$app_id-folder" ### If it's a multi-instance app, meaning it can be installed several times independently ### The id of the app as stated in the manifest is available as $YNH_APP_ID From d4cdec3d6f18de506466f4da59ed1dda673bbee3 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:01:11 +0200 Subject: [PATCH 40/49] Delete config.php --- conf/config.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 conf/config.php diff --git a/conf/config.php b/conf/config.php deleted file mode 100644 index 909039c..0000000 --- a/conf/config.php +++ /dev/null @@ -1,15 +0,0 @@ -getConfigGlobalSettings(); - -print_r(getConfigUsersTemplate()); - -// Update the loginRequired setting to false -//$icSettings->updateConfigGlobalSettings( -// ["loginRequired" => false] -//); -?> From b9d78a9c779f73f4d72b259b31ecfdc04b8ddb14 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:01:18 +0200 Subject: [PATCH 41/49] Delete icecoder_settings.php --- conf/icecoder_settings.php | 231 ------------------------------------- 1 file changed, 231 deletions(-) delete mode 100644 conf/icecoder_settings.php diff --git a/conf/icecoder_settings.php b/conf/icecoder_settings.php deleted file mode 100644 index d7f08e7..0000000 --- a/conf/icecoder_settings.php +++ /dev/null @@ -1,231 +0,0 @@ -versionNo = "8.0"; - $this->docRoot = $_SERVER['DOCUMENT_ROOT']; - } - - - // ======== - // DATA DIR - // ======== - - public function getDataDirDetails() - { - clearstatcache(); - - // Return details about the data dir - $fullPath = dirname(__FILE__) . "/../data/"; - $exists = file_exists($fullPath); - $readable = is_readable($fullPath); - $writable = is_writable($fullPath); - return [ - "fullPath" => $fullPath, - "exists" => $exists, - "readable" => $readable, - "writable" => $writable, - ]; - } - - // ============= - // GLOBAL CONFIG - // ============= - - public function getConfigGlobalTemplate() - { - // Return the serialized global config template - $fileName = 'template-config-global.php'; - $fullPath = dirname(__FILE__) . "/../lib/" . $fileName; - if (function_exists('opcache_invalidate')) { - opcache_invalidate($fullPath, true); - } - $settings = file_get_contents($fullPath); - return $settings; - } - - public function getConfigGlobalFileDetails() - { - clearstatcache(); - - // Return details about the global config file - $fileName = 'config-global.php'; - $fullPath = dirname(__FILE__) . "/../data/" . $fileName; - $exists = file_exists($fullPath); - $readable = is_readable($fullPath); - $writable = is_writable($fullPath); - $filemtime = filemtime($fullPath); - return [ - "fileName" => $fileName, - "fullPath" => $fullPath, - "exists" => $exists, - "readable" => $readable, - "writable" => $writable, - "filemtime" => $filemtime - ]; - } - - public function getConfigGlobalSettings() - { - // Start an array with version number and document root - $settings = []; - $settings['versionNo'] = $this->versionNo; - $settings['docRoot'] = $this->docRoot; - // Get global config file details - $fullPath = $this->getConfigGlobalFileDetails()['fullPath']; - $settingsFromFile = $this->serializedFileData("get", $fullPath); - // Merge that with the array we started with and return - $settings = array_merge($settings, $settingsFromFile); - return $settings; - } - - public function setConfigGlobalSettings($settings): bool - { - // Get the global config file details - $fullPath = $this->getConfigGlobalFileDetails()['fullPath']; - if ($fConfigSettings = fopen($fullPath, 'w')) { - // If the settings we've received aren't in serialized format yet, do that now - // As $settings could be a serialized string or array - if (is_array($settings)) { - unset($settings['versionNo']); - unset($settings['docRoot']); - } - return $this->serializedFileData("set", $fullPath, $settings); - } else { - return false; - } - } - - public function updateConfigGlobalSettings($array): bool - { - // Update global config settings file - $settingsFromFile = $this->getConfigGlobalSettings(); - $settings = array_merge($settingsFromFile, $array); - return $this->setConfigGlobalSettings($settings); - } - - // ============ - // USERS CONFIG - // ============ - - public function getConfigUsersTemplate() - { - // Return the serialized users config template - $fileName = 'template-config-users.php'; - $fullPath = dirname(__FILE__) . "/../lib/" . $fileName; - if (function_exists('opcache_invalidate')) { - opcache_invalidate($fullPath, true); - } - $settings = file_get_contents($fullPath); - return $settings; - } - - public function getConfigUsersFileDetails($fileName) - { - // Return details about the users config file - $fullPath = dirname(__FILE__) . "/../data/" . $fileName; - $exists = file_exists($fullPath); - $readable = is_readable($fullPath); - $writable = is_writable($fullPath); - $filemtime = filemtime($fullPath); - return [ - "fileName" => $fileName, - "fullPath" => $fullPath, - "exists" => $exists, - "readable" => $readable, - "writable" => $writable, - "filemtime" => $filemtime, - ]; - } - - public function getConfigUsersSettings($fileName) - { - // Get users config file details - $fullPath = $this->getConfigUsersFileDetails($fileName)['fullPath']; - $settingsFromFile = $this->serializedFileData("get", $fullPath); - // Now return - return $settingsFromFile; - } - - public function setConfigUsersSettings($fileName, $settings): bool - { - // Get the users config file details - $fullPath = $this->getConfigUsersFileDetails($fileName)['fullPath']; - if ($fConfigSettings = fopen($fullPath, 'w')) { - return $this->serializedFileData("set", $fullPath, $settings); - } else { - return false; - } - } - - public function updateConfigUsersSettings($fileName, $array): bool - { - // Update users config settings file - $settingsFromFile = $this->getConfigUsersSettings($fileName); - $settings = array_merge($settingsFromFile, $array); - return $this->setConfigUsersSettings($fileName, $settings); - } - - public function updateConfigUsersCreateDate($fileName) - { - global $ICEcoderUserSettings; - - // Get users config file details - $filemtime = $this->getConfigUsersFileDetails($fileName)['filemtime']; - // Make it a number (avoids null, undefined etc) - $filemtime = intval($filemtime); - // Set it to the epoch time now if we don't have a real value - if (0 === $filemtime) { - $filemtime = time(); - } - // Update users config settings file - $ICEcoderSettingsFromFile = $this->getConfigUsersSettings($fileName); - $ICEcoderSettingsFromFile['configCreateDate'] = $filemtime; - $this->setConfigUsersSettings($fileName, $ICEcoderSettingsFromFile); - // Set the new value in array - $ICEcoderUserSettings['configCreateDate'] = $filemtime; - } - - public function createIPSettingsFileIfNotExist() - { - global $username, $settingsFile, $settingsFileAddr; - - // Create a duplicate version for the IP address of the domain if it doesn't exist yet - $serverAddr = $_SERVER['SERVER_ADDR'] ?? "1"; - if ($serverAddr == "1" || $serverAddr == "::1") { - $serverAddr = "127.0.0.1"; - } - $settingsFileAddr = 'config-' . $username . str_replace(".", "_", $serverAddr) . '.php'; - if (false === file_exists(dirname(__FILE__) . "/../data/" . $settingsFileAddr)) { - if (false === copy(dirname(__FILE__) . "/../data/" . $settingsFile, dirname(__FILE__) . "/../data/" . $settingsFileAddr)) { - $reqsFailures = ["phpCreateSettingsFileAddr"]; - include dirname(__FILE__) . "/../lib/requirements.php"; - } - } - } - - public function serializedFileData($do, $fullPath, $output=null) - { - if ("get" === $do) { - if (function_exists('opcache_invalidate')) { - opcache_invalidate($fullPath, true); - } - $data = file_get_contents($fullPath); - $data = str_replace("<"."?php\n/*\n\n", "", $data); - $data = str_replace("\n\n*/\n?".">", "", $data); - $data = unserialize($data); - return $data; - } - if ("set" === $do) { - if (true === is_array($output)) { - $output = serialize($output); - } - return false !== file_put_contents($fullPath, "<"."?php\n/*\n\n" . $output . "\n\n*/\n?" . ">"); - } - } -} From 8b5175df879e9a24a677ece6b2a22721883507f9 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:01:36 +0200 Subject: [PATCH 42/49] Update install --- scripts/install | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/install b/scripts/install index 316724c..d064729 100755 --- a/scripts/install +++ b/scripts/install @@ -82,13 +82,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" -#================================================= -# SPECIFIC SETUP -#================================================= - -# Change config (ban editor's folder) -php -f "../conf/config.php" - #================================================= #================================================= From 44e05ea09cdc2e02fbce2b5ec74caeff5f892e1e Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:04:47 +0200 Subject: [PATCH 43/49] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d064729..33a4df7 100755 --- a/scripts/install +++ b/scripts/install @@ -51,7 +51,7 @@ ynh_script_progression --message="Validating installation parameters..." --weigh ### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app" -final_path=/var/www/$YNH_APP_ARG_APP_ID/icecoder +final_path=/var/www/$YNH_APP_ARG_APP_ID/www/icecoder #test ! -e "/var/www/$YNH_APP_ARG_APP_ID/icecoder" || ynh_die --message="You have already installed a app instance here before install this app instance" test -e "/var/www/$YNH_APP_ARG_APP_ID" || ynh_die --message="You don't have installed a webapp before install this app" From 6da6dbe406728279cb60665370a5069a710800e3 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:05:23 +0200 Subject: [PATCH 44/49] Update restore --- scripts/restore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scripts/restore b/scripts/restore index 24d4b37..ed09db3 100755 --- a/scripts/restore +++ b/scripts/restore @@ -63,12 +63,6 @@ ynh_restore_file --origin_path="$final_path" chown -R $app_id $final_path -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # END OF SCRIPT #================================================= From b5978926a073b05126106c288327118bcf21adc3 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:05:45 +0200 Subject: [PATCH 45/49] Update backup --- scripts/backup | 8 -------- 1 file changed, 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index 567b188..3e23255 100755 --- a/scripts/backup +++ b/scripts/backup @@ -44,14 +44,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -#================================================= -# SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # END OF SCRIPT #================================================= From c2600ec8c8a8145d3947819fdadbfc39d56fab19 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:07:00 +0200 Subject: [PATCH 46/49] Update remove --- scripts/remove | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/scripts/remove b/scripts/remove index 97ad898..bc189a3 100755 --- a/scripts/remove +++ b/scripts/remove @@ -28,27 +28,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=1 # Remove the app directory securely ynh_secure_remove --file="$final_path" -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - -# Remove the app-specific logrotate config -ynh_remove_logrotate - -#================================================= -# CLOSE A PORT -#================================================= - -if yunohost firewall list | grep -q "\- $port$" -then - ynh_script_progression --message="Closing port $port..." --weight=1 - ynh_exec_warn_less yunohost firewall disallow TCP $port -fi - -# Remove the log files -ynh_secure_remove --file="/var/log/$app/" - #================================================= # END OF SCRIPT #================================================= From 9ee2f21a33f418e370fff7267e253364d2494e82 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:07:08 +0200 Subject: [PATCH 47/49] Update remove --- scripts/remove | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/remove b/scripts/remove index bc189a3..1fcfa68 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) #================================================= From da05d07784028de4791d13a836204f14ab47818f Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:08:10 +0200 Subject: [PATCH 48/49] Update upgrade --- scripts/upgrade | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a079094..bd9048a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -104,25 +104,12 @@ fi #================================================= # GENERIC FINALIZATION #================================================= -# SECURE FILES AND DIRECTORIES +# PERMISSIONS SETUP #================================================= - -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - - - # Configure internal permissions for ICEcoder chown -R $app $final_path - - #================================================= # END OF SCRIPT #================================================= From 176b0b8ac2a6fe4aff1673e72764ec4183fce466 Mon Sep 17 00:00:00 2001 From: Stylix58 <63605602+Stylix58@users.noreply.github.com> Date: Tue, 30 Mar 2021 21:10:32 +0200 Subject: [PATCH 49/49] Update manifest.json --- manifest.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifest.json b/manifest.json index edf5c50..f07b841 100644 --- a/manifest.json +++ b/manifest.json @@ -35,6 +35,10 @@ "ask": { "en": "Indicate the ID of the Custom Webapp where you want to install this app", "fr": "Indiquez l'ID de la Custom Webapp dans laquelle vous voulez installer cette app" + }, + "help": { + "en": "You can get the ID in Custom Webapp's settings.", + "fr": "Vous pouvez obtenir l'ID dans les paramètres de la Webapp personnalisée." } } ]