1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

Remove not longer needed files and scripts

This commit is contained in:
Fabian Wilkens 2021-02-06 02:01:06 +01:00
parent 8481641ba0
commit 27c10e8322
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
13 changed files with 26 additions and 522 deletions

View file

@ -1,11 +0,0 @@
[install_extensions]
name = "Install Extensions"
description = "Intall Standard Notes - Extensions"
command = "/bin/bash actions/install_extensions"
cwd = "/etc/yunohost/apps/$app/scripts"
[remove_extensions]
name = "Remove Extensions"
description = "Remove Standard Notes - Extensions"
command = "/bin/bash actions/remove_extensions"
cwd = "/etc/yunohost/apps/$app/scripts"

View file

@ -8,7 +8,6 @@
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
is_public=1 (PUBLIC|public=1|private=0)
install_extensions=1
access_domain="/"
; Checks
pkg_linter=1

View file

@ -1,5 +1,3 @@
Standard Notes - Syncing Server was successfully __TYPE__.
Please configure the Standard Notes web app or mobile app to use this syning server: https://__DOMAIN____PATH_URL__/
__ACTION__
__CONFIG_PANEL__
__EXTENSIONS__

View file

@ -55,18 +55,6 @@
},
"default": true
},
{
"name": "install_extensions",
"type": "boolean",
"help": {
"en": "Once you've installed the extensions, you cannot change the domain without the users having to reinstall the extensions"
},
"ask": {
"en": "Do you want to install the Standard Notes Extensions?",
"de": "Willst du die Standard Notes Extensions installieren?"
},
"default": true
},
{
"name": "access_domain",
"type": "string",

View file

@ -1,115 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
path_url=$(ynh_app_setting_get --app=$app --key=path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
final_path=/opt/yunohost/$app
config_file="$final_path/live/.env"
if [[ ! -f $config_file || \
! -d "$final_path/live/public/extensions/" || \
! -d "$final_path/live/public/extensions/src/" ]]
then
ynh_die --message="Standard Notes - Extensions can not be installed. Please upgrade snserver" --ret_code=1
fi
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
install_extensions_old=$(ynh_app_setting_get --app=$app --key=install_extensions)
if [ $install_extensions_old -eq 1 ]
then
ynh_die --message="Standard Notes - Extensions should alredy be installed." --ret_code=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# MOVE TO PUBLIC OR PRIVATE
#=================================================
ynh_script_progression --message="Installing Standard Notes - Extensions ..." --weight=5
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
if [ "$path_url" = "/" ]
then
path=""
else
path=$path_url
fi
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
done
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
do
basename=$(basename -as .src $file)
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
ynh_secure_remove --file="$basename.zip"
done
# Update the config of the app
ynh_app_setting_set --app=$app --key=install_extensions --value="1"
#=================================================
# RESTART Systemd
#=================================================
ynh_script_progression --message="Restarting $app ..."
ynh_systemd_action --service_name=$app --action=restart
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# CONFIG INFORMATION
#=================================================
ynh_script_progression --message="Configuration Informations" --weight=1
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
ynh_print_info "You need to set the access_domain in the <a href=\"$admin_panel/config-panel\">config-panel</a> to be able to access the extentions via the Standard Notes web app."
ynh_print_info "access_domain is currently set to: $(echo $access_domain | sed "s@;@ @g")"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -1,98 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
path_url=$(ynh_app_setting_get --app=$app --key=path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
final_path=/opt/yunohost/$app
config_file="$final_path/live/.env"
if [ ! -f $config_file ]
then
ynh_die --message="Standard Notes - Extensions can not be removed." --ret_code=1
fi
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
install_extensions_old=$(ynh_app_setting_get --app=$app --key=install_extensions)
if [ $install_extensions_old -eq 0 ]
then
ynh_die --message="Standard Notes - Extensions should not be installed." --ret_code=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# MOVE TO PUBLIC OR PRIVATE
#=================================================
ynh_script_progression --message="Remove Standard Notes - Extensions ..." --weight=5
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=" --target_file="$config_file"
if [ "$path_url" = "/" ]
then
path=""
else
path=$path_url
fi
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do
ynh_replace_string --match_string="$domain$path" --replace_string="__DOMAIN__PATH__" --target_file="$file"
done
find "$final_path/live/public/extensions/src/" -mindepth 1 -maxdepth 1 -type d -print0 | while read -d $'\0' dir
do
ynh_secure_remove --file="$dir"
done
# Update the config of the app
ynh_app_setting_set --app=$app --key=install_extensions --value="0"
#=================================================
# RESTART Systemd
#=================================================
ynh_script_progression --message="Restarting $app ..."
ynh_systemd_action --service_name=$app --action=restart
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -194,24 +194,12 @@ ynh_script_progression --message="Sending a readme for the admin..."
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
message_extensions="To install extensions open this page: https://$domain$path_url/extensions/\n\
You changed the url of the syncing server. All extensions installed from here must be reinstalled by the users."
message_no_extensions="You have no extensions installed.\n\
You can install the extensions by using the actions feature."
action="You can find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__"
config_panel="You can find some specific configurations for this app by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__"
ynh_replace_string --match_string="__TYPE__" --replace_string="changed the url" --target_file="../conf/message"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message"
if [ $install_extensions -eq 1 ]
then
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_extensions" --target_file="../conf/message"
else
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_no_extensions" --target_file="../conf/message"
fi
ynh_replace_string --match_string="__ACTION__" --replace_string="$action" --target_file="../conf/message"
ynh_replace_string --match_string="__CONFIG_PANEL__" --replace_string="$config_panel" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message" --type='change_url'

View file

@ -28,16 +28,10 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
install_extensions=$YNH_APP_ARG_INSTALL_EXTENSIONS
if [ $install_extensions -eq 0 ]
access_domain=$YNH_APP_ARG_ACCESS_DOMAIN
if [ -z "$access_domain" ]
then
access_domain=$domain
else
access_domain=$YNH_APP_ARG_ACCESS_DOMAIN
if [ -z "$access_domain" ]
then
access_domain=$domain
fi
fi
mail=$app$domain
@ -58,7 +52,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=3
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=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
ynh_app_setting_set --app=$app --key=mail --value=$mail
@ -176,33 +169,33 @@ popd
#=================================================
# INSTALLING Standard Notes - Extensions
#=================================================
if [ $install_extensions -eq 1 ]
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
if [ $path_url = "/" ]
then
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
if [ $path_url = "/" ]
then
path=""
else
path=$path_url
fi
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
done
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
do
basename=$(basename -as .src $file)
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
done
path=""
else
path=$path_url
fi
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$final_path/live/public/extensions/repo.json"
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
done
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
do
basename=$(basename -as .src $file)
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
done
install_extensions=1
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
#=================================================
# SETUP SYSTEMD
#=================================================
@ -308,26 +301,13 @@ is_service_ready
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
message_extensions="To install extensions open this page: https://$domain$path_url/extensions/\n\
If you want to change the url of the syncing server all extensions from here have to be reinstalled be the users."
message_no_extensions="You have no extensions installed.\n\
You can install the extensions by using the actions feature."
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
action="You can find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__"
config_panel="You can find some specific configurations for this app by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__"
ynh_replace_string --match_string="__TYPE__" --replace_string="installed" --target_file="../conf/message"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message"
if [ $install_extensions -eq 1 ]
then
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_extensions" --target_file="../conf/message"
else
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_no_extensions" --target_file="../conf/message"
fi
ynh_replace_string --match_string="__ACTION__" --replace_string="$action" --target_file="../conf/message"
ynh_replace_string --match_string="__CONFIG_PANEL__" --replace_string="$config_panel" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message" --type='install'

View file

@ -348,26 +348,13 @@ is_service_ready
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
message_extensions="To install extensions open this page: https://$domain$path_url/extensions/\n\
If you want to change the url of the syncing server all extensions from here have to be reinstalled be the users."
message_no_extensions="You have no extensions installed.\n\
You can install the extensions by using the actions feature."
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
action="You can find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__"
config_panel="You can find some specific configurations for this app by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__"
ynh_replace_string --match_string="__TYPE__" --replace_string="installed" --target_file="../conf/message"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/message"
ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="../conf/message"
if [ $install_extensions -eq 1 ]
then
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_extensions" --target_file="../conf/message"
else
ynh_replace_string --match_string="__EXTENSIONS__" --replace_string="$message_no_extensions" --target_file="../conf/message"
fi
ynh_replace_string --match_string="__ACTION__" --replace_string="$action" --target_file="../conf/message"
ynh_replace_string --match_string="__CONFIG_PANEL__" --replace_string="$config_panel" --target_file="../conf/message"
ynh_send_readme_to_admin --app_message="../conf/message" --type='upgrade'

View file

@ -1,16 +0,0 @@
body {
padding-left: 50px;
}
td {
/*border: 1px solid #999;*/
padding: 0.25rem;
}
td#id {
width: 20px;
}
td#name {
width: 250px;
}
td#url {
width: 300px;
}

View file

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>StandardNotes Extensions</title>
<script type="text/javascript" src="extensions/js.js"></script>
<link rel="stylesheet" href="extensions/css.css">
</head>
<body>
<div id="head">
<h1>Standard Notes - Extensions</h1>
<h2>These Extensions are open source. You can find them on Github.</br>
<a href=https://github.com/standardnotes/>Standard Notes on Github</a></br>
<a href=https://github.com/sn-extensions/>SN Extensions on Github</a></br>
</h2>
<h3>To get all original extensions from Standard-Notes please consider to pay for
<a href=https://standardnotes.org/extensions>Extended Extensions</a>
</h3>
<h3>Install Instructions</h3>
<ul>
<li>Open StandardNotes Web or Desktop App</li>
<li>Press on <strong>Extensions</strong> in the button left corner</li>
<li>Press on <strong>Import Extensions</strong> in the button right corner of the new window.</li>
<li>Insert one of the Extension Links from below.</li>
<li>Press <strong>Enter</strong> on your keyboard.</li>
<li>Press on <strong>Install</strong></li>
</ul>
</div>
<div id="repos">
<h3>Repo</h3>
<table id="reposData">
<tr>
<td id="name">Extensions Repo</br>(Includes all Extentions from below)</td>
<td id="url">
<a href="extensions/repo.json">repo.json</a>
</td>
</tr>
</table>
</div>
<div id="themes">
<h3>Themes</h3>
<table id="themesData">
</table>
</div>
<div id="editors">
<h3>Editors</h3>
<table id="editorsData">
</table>
</div>
<div id="components">
<h3>Components</h3>
<table id="componentsData">
</table>
</div>
</body>
</html>

View file

@ -1,117 +0,0 @@
[
{
"name": "Autobiography Theme",
"url": "extensions/src/autobiography-theme.json",
"extension": "theme"
},
{
"name": "Focus Theme",
"url": "extensions/src/focus-theme.json",
"extension": "theme"
},
{
"name": "Futura Theme",
"url": "extensions/src/futura-theme.json",
"extension": "theme"
},
{
"name": "Midnight Theme",
"url": "extensions/src/midnight-theme.json",
"extension": "theme"
},
{
"name": "Solarized Dark Theme",
"url": "extensions/src/solarized-dark-theme.json",
"extension": "theme"
},
{
"name": "Titanium Theme",
"url": "extensions/src/titanium-theme.json",
"extension": "theme"
},
{
"name": "Dynamic Theme",
"url": "extensions/src/dynamic-theme.json",
"extension": "theme"
},
{
"name": "No Distraction Theme",
"url": "extensions/src/no-distraction-theme.json",
"extension": "theme"
},
{
"name": "Bold Editor",
"url": "extensions/src/bold-editor.json",
"extension": "editor"
},
{
"name": "Code Editor",
"url": "extensions/src/code-editor.json",
"extension": "editor"
},
{
"name": "Markdown Basic",
"url": "extensions/src/markdown-basic.json",
"extension": "editor"
},
{
"name": "Markdown Pro",
"url": "extensions/src/markdown-pro.json",
"extension": "editor"
},
{
"name": "Math Editor",
"url": "extensions/src/math-editor.json",
"extension": "editor"
},
{
"name": "Minimal Markdown Editor",
"url": "extensions/src/minimal-markdown-editor.json",
"extension": "editor"
},
{
"name": "Plus Editor",
"url": "extensions/src/plus-editor.json",
"extension": "editor"
},
{
"name": "Simple Task Editor",
"url": "extensions/src/simple-task-editor.json",
"extension": "editor"
},
{
"name": "Token Vault",
"url": "extensions/src/token-vault.json",
"extension": "editor"
},
{
"name": "Vim Editor",
"url": "extensions/src/vim-editor.json",
"extension": "editor"
},
{
"name": "Action Bar",
"url": "extensions/src/action-bar.json",
"extension": "component"
},
{
"name": "Folders Component",
"url": "extensions/src/folders-component.json",
"extension": "component"
},
{
"name": "Github Push",
"url": "extensions/src/github-push.json",
"extension": "component"
},
{
"name": "MFA Link",
"url": "extensions/src/mfa-link.json",
"extension": "component"
},
{
"name": "Quick Tags",
"url": "extensions/src/quick-tags.json",
"extension": "component"
}
]

View file

@ -1,23 +0,0 @@
loadJSON("extensions/index.json");
function loadJSON(file){
fetch(file)
.then(function (response) {
return response.json();
})
.then(function (data) {
appendData(data);
})
.catch(function (err) {
console.log('error: ' + err);
});
}
function appendData(data) {
for (var i = 0; i < data.length; i++) {
var mainContainer = document.getElementById(data[i].extension + "sData");
var tr = document.createElement("tr");
tr.innerHTML =
"<td id='name'>" + data[i].name + "</td>" +
"<td id='url'><a href=" + data[i].url + ">" + data[i].url.substr(15) + "</a></td>"
mainContainer.appendChild(tr);
}
}