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

Merge pull request #5 from FabianWilkens/extensions

Extensions
This commit is contained in:
Fabian Wilkens 2021-01-24 22:54:58 +01:00 committed by GitHub
commit 22948cdea0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 1313 additions and 55 deletions

View file

@ -1,9 +1,12 @@
# Standard Notes Syncing Server for YunoHost # Standard Notes Syncing Server for YunoHost
[![Integration level](https://dash.yunohost.org/integration/snserver.svg)](https://dash.yunohost.org/appci/app/snserver) [![Integration level](https://dash.yunohost.org/integration/snserver.svg)](https://dash.yunohost.org/appci/app/snserver)
![Status](https://ci-apps.yunohost.org/ci/badges/snserver.status.svg)
![Maintained](https://ci-apps.yunohost.org/ci/badges/snserver.maintain.svg)
[![Install SNServer with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snserver) [![Install SNServer with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=snserver)
> *This package allow you to install snserver quickly and simply on a YunoHost server. > *This package allow you to install snserver quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview ## Overview
@ -13,7 +16,7 @@ Standard Notes syncing server
You can run your own Standard Notes server and use it with any Standard Notes app. This allows you to have 100% control of your data. You can run your own Standard Notes server and use it with any Standard Notes app. This allows you to have 100% control of your data.
**Shipped version:** 3.13.6 **Shipped version:** 3.13.6
* Apps available for free. https://standardnotes.org/ * Apps available for free. https://standardnotes.org/
* Desktop (Windows, Mac, Linux) * Desktop (Windows, Mac, Linux)
* Mobile (Android and iOS) * Mobile (Android and iOS)
* Web https://app.standardnotes.org/ * Web https://app.standardnotes.org/
@ -32,8 +35,10 @@ Extensions, Editors, Themes: https://standardnotes.org/extensions
## Configuration ## Configuration
How to configure this app: How to configure this app:
* The config-file is stored under "/opt/yunohost/$app/live/.env" * The config-file is stored under "/opt/yunohost/$app/live/.env"
* You can find additional config features under https://your-domain.tld/yunohost/admin/#/apps/$app/config-panel
* You can find additional action feutures unter https://your-domain.tld/yunohost/admin/#/apps/$app/actions
## Documentation ## Documentation
@ -53,14 +58,7 @@ How to configure this app:
## Limitations ## Limitations
* Any known limitations. * If users have installed the extensions included in this package. The URL of the server should not be changed anymore. Otherwise the users will have to reinstall the extensions.
## Additional information
* Other information you would add about this application
**More information on the documentation page:**
https://yunohost.org/packaging_apps
## Links ## Links

10
actions.toml Normal file
View file

@ -0,0 +1,10 @@
[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 scripts/actions/remove_extensions"

View file

@ -5,9 +5,11 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
is_public=1 (PUBLIC|public=1|private=0) is_public=1 (PUBLIC|public=1|private=0)
install_extensions=1
access_domain="/"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -16,8 +18,10 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 3.13.6~ynh2
upgrade=1 from_commit=e755357f8306805084317c81e85807ed87fdbd47
# 3.13.6~ynh1 # 3.13.6~ynh1
upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979 #upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
@ -28,10 +32,10 @@
# If the level 5 (Package linter) is forced to 1. Please add justifications here. # If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto Level 5=auto
;;; Options ;;; Options
Email=wilkens.fabian+github@gmail.com Email=
Notification=all Notification=
;;; Upgrade options ;;; Upgrade options
; commit=7474baadc1705ffe5981a52bdced16bdd1edf979 ; commit=e755357f8306805084317c81e85807ed87fdbd47
name=3.13.6~ynh1 name=3.13.6~ynh2
manifest_arg=domain=DOMAIN&path=PATH&is_public=1 manifest_arg=domain=DOMAIN&path=PATH&is_public=1

View file

@ -61,3 +61,8 @@ REVISIONS_FREQUENCY=300
# Sub-URI # Sub-URI
RAILS_RELATIVE_URL_ROOT=/ RAILS_RELATIVE_URL_ROOT=/
# Public file server
# Empty is disabled
# Any value is enabled
RAILS_SERVE_STATIC_FILES=

5
conf/ext_action-bar.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/action-bar/archive/1.3.1.zip
SOURCE_SUM=413F74598DA5C5B401D95620B330E23A094BEEF9DD9C2EBC653199E7FDBB7F7F
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/autobiography-theme/archive/1.0.0.zip
SOURCE_SUM=cbc8e07fa7703bdf8b7c9c3ef30a6d87d4ade7e5eb58ce7a983a34f1199a819d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_bold-editor.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/bold-editor/archive/1.1.0.zip
SOURCE_SUM=a842181f1e2e0cc93a29ff1c532c4650cbcc3327742267bb3471f1018406df0f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_code-editor.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/code-editor/archive/1.3.5.zip
SOURCE_SUM=e928b1e474e5c391d5ac2654982177238081e3cd11a6e318d7805c36030bd879
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/dynamic-theme/archive/1.0.0.zip
SOURCE_SUM=2be90456a6d8e90b4c6c666c797b96c72935b41fde8aa2b29a219368ce100c99
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_focus-theme.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/focus-theme/archive/1.2.3.zip
SOURCE_SUM=371a48128bc0e95f2298053dc39c333454a2c11962a28e9a7749435da0e85340
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/folders-component/archive/1.3.5.zip
SOURCE_SUM=190CE79BAD28C772955960A16D6027BE8B7B7A9B8850BD65D79F5FAB4FF64E90
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/futura-theme/archive/1.2.2.zip
SOURCE_SUM=900cebb84e2a794ca5cd6d62d28705e18181ae6cac76c2d8fa6d109a24386e94
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_github-push.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/github-push/archive/1.2.2.zip
SOURCE_SUM=9b64cd9797254120b82b9e43bee7bb0d65b950d8cfeab1b16311a96eedd93527
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/markdown-basic/archive/1.3.6.zip
SOURCE_SUM=b0e77cc3713a2c7ddf330af37b164a1fee356c65d1ff5352d31f0d8a2bf5d8f9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip
SOURCE_SUM=70a21fa13554d4a7a6d3ac5ae06acf4b97a88b6ea5af804e958774273aaf1c40
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_math-editor.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/math-editor/archive/1.3.4.zip
SOURCE_SUM=e8e69f082231f3052185c1f74c7bacdbc26b75fe1047045da2cf22f4459d97bf
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_mfa-link.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/mfa-link/archive/1.2.2.zip
SOURCE_SUM=6B41F549FCB8721D429FA216D261C8221C2FC8304EF5C2BF9F98A58C1D7D7388
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/midnight-theme/archive/1.2.1.zip
SOURCE_SUM=f219de3cf26494a73d506139082463a06782a5fc1717290d96da9c8a54102342
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/minimal-markdown-editor/archive/1.3.5.zip
SOURCE_SUM=c062db588a500e227524bc0e28335dcfebbd913badd19784e00ab607bec7abbf
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/no-distraction-theme/archive/1.2.2.zip
SOURCE_SUM=c6b3116aab0e87bdba25632f6e0820c98a47c10248c4760853fb69facc860088
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_plus-editor.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/plus-editor/archive/1.4.3.zip
SOURCE_SUM=c1e023b8b78304773a4b447ed5da601bcf799587c44e07f9f793488b933bbd0a
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_quick-tags.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/standardnotes/quick-tags/archive/1.3.2.zip
SOURCE_SUM=62B815B436F519412B16A58622D356219F391B11A6FBB88F5E018FF3520214CF
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/simple-task-editor/archive/1.3.5.zip
SOURCE_SUM=2cb836e9932a8e39b41397fc6f9ef721c894e422a3f898db66cb340d9cbf931b
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/solarized-dark-theme/archive/1.2.1.zip
SOURCE_SUM=4f05dfb4edc9ce81fd22c01d101cc453509791e24475cfefd235dab15b4abfc6
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/titanium-theme/archive/1.2.2.zip
SOURCE_SUM=aa42d8911a514d454af045dc65433aef6361ecfd67ad27f1d8093b9da01bf2b3
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_token-vault.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions/token-vault/archive/1.0.5.zip
SOURCE_SUM=a9f4e1bafec6194499dd163fd53bdb9876689c99e7218b36a8e26dbe0c096f21
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/ext_vim-editor.src Normal file
View file

@ -0,0 +1,5 @@
SOURCE_URL=https://github.com/sn-extensions//vim-editor/archive/1.3.2.zip
SOURCE_SUM=a32fb89d63dea190302b966f0adb2e0ce3a1ef07248277b7d5abf52646585c74
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

5
conf/message Normal file
View file

@ -0,0 +1,5 @@
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

@ -13,7 +13,5 @@ location __PATH__/ {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off; proxy_buffering off;
# Include SSOWAT user panel. more_set_headers "Content-Security-Policy: frame-ancestors 'self' __ACCESS_DOMAIN__";
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
} }

14
config_panel.toml Normal file
View file

@ -0,0 +1,14 @@
version = "1.0"
name = "SNServer configuration panel"
[main]
name = "SNserver configuration"
[main.access_domain]
name = "Access Domain"
[main.access_domain.access_domain]
ask = "Which web app can access the Standart Notes Extensions?"
type = "string"
default = ""
help = "Please enter the domain(s) without the path of a Standart Notes Web App, which should have access to the Standard Notes Extensions.<br>Example: domain.tld<br>Example: https://domain.tld<br>Example: domain.tld notes.domain.tld<br>Example: domain.tld https://notes.domain.tld"

View file

@ -5,16 +5,15 @@
"description": { "description": {
"en": "The Standard Notes syncing server. An end-to-end encrypted note-taking app." "en": "The Standard Notes syncing server. An end-to-end encrypted note-taking app."
}, },
"version": "3.13.6~ynh2", "version": "3.13.6~ynh3",
"url": "https://github.com/standardnotes/syncing-server", "url": "https://github.com/standardnotes/syncing-server",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "Fabian Wilkens", "name": "Fabian Wilkens",
"email": "wilkens.fabian+github@gmail.com", "email": "46000361+FabianWilkens@users.noreply.github.com"
"url": "https://github.com/FabianWilkens/snserver_ynh"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.0" "yunohost": ">= 4.1.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -55,6 +54,28 @@
"de": "Ist die Application Öffendlich?" "de": "Ist die Application Öffendlich?"
}, },
"default": true "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",
"ask": {
"en": "Choose a domain which has access to the extensions. E.g. the Standard-Notes web app."
},
"optional": true,
"example": "example.tld",
"default": ""
} }
] ]
} }

View file

@ -43,6 +43,145 @@ exec_as() {
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
# | arg: -m --app_message= - The file with the content to send to the administrator.
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
ynh_send_readme_to_admin() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
local app_message
local recipients
local type
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
app_message="${app_message:-}"
recipients="${recipients:-root}"
type="${type:-install}"
# Get the value of admin_mail_html
admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
admin_mail_html="${admin_mail_html:-0}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
# Subject base
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
# Adapt the subject according to the type of mail required.
if [ "$type" = "backup" ]; then
mail_subject="$mail_subject has just been backup."
elif [ "$type" = "change_url" ]; then
mail_subject="$mail_subject has just been moved to a new URL!"
elif [ "$type" = "remove" ]; then
mail_subject="$mail_subject has just been removed!"
elif [ "$type" = "restore" ]; then
mail_subject="$mail_subject has just been restored!"
elif [ "$type" = "upgrade" ]; then
mail_subject="$mail_subject has just been upgraded!"
else # install
mail_subject="$mail_subject has just been installed!"
fi
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$(if [ -n "$app_message" ]
then
cat "$app_message"
else
echo "...No specific information..."
fi)
---
Automatic diagnosis data from YunoHost
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
# Store the message into a file for further modifications.
echo "$mail_message" > mail_to_send
# If a html email is required. Apply html tags to the message.
if [ "$admin_mail_html" -eq 1 ]
then
# Insert 'br' tags at each ending of lines.
ynh_replace_string "$" "<br>" mail_to_send
# Insert starting HTML tags
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
# Keep tabulations
ynh_replace_string " " "\&#160;\&#160;" mail_to_send
ynh_replace_string "\t" "\&#160;\&#160;" mail_to_send
# Insert url links tags
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
# Insert pre tags
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
# Insert finishing HTML tags
echo -e "\n</body>\n</html>" >> mail_to_send
# Otherwise, remove tags to keep a plain text.
else
# Remove URL tags
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
# Remove PRE tags
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
fi
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
if [ "$admin_mail_html" -eq 1 ]
then
content_type="text/html"
else
content_type="text/plain"
fi
# Send the email to the recipients
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
}
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================

View file

@ -0,0 +1,94 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
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 || \
! -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
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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -0,0 +1,90 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -29,6 +29,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
# Add settings here as needed by your application # Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_name=$(ynh_app_setting_get --app=$app --key=db_name)
@ -93,7 +95,10 @@ then
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config "port" ynh_add_nginx_config "\
port \
access_domain\
"
fi fi
# Change the domain for nginx # Change the domain for nginx
@ -114,6 +119,26 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
config_file="$final_path/live/.env" config_file="$final_path/live/.env"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file" ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file"
#=================================================
# Modify Standard Notes - Extensions
#=================================================
if [ $install_extensions -eq 1 ]
then
ynh_script_progression --message="Modify Standard Notes - Extensions..." --weight=1
if [ $new_path = "/" ]
then
path=""
else
path=$new_path
fi
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
do
ynh_replace_string --match_string='"url": "https://.*/extensions/src/' --replace_string='"url": "https://$domain$path/extensions/src/' --target_file="$file"
done
fi
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN
#================================================= #=================================================
@ -124,9 +149,9 @@ path_url=$new_path
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
touch "/var/log/$app/$app.log" touch "/var/log/$app/$app.log"
ynh_add_fail2ban_config --use_template --others_var="\ ynh_add_fail2ban_config --use_template --others_var="\
domain \ domain \
path_url \ path_url \
" "
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -145,6 +170,33 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
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."
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="" --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'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

66
scripts/config Executable file
View file

@ -0,0 +1,66 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ./_common.sh
source /usr/share/yunohost/helpers
# Stop script if errors
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
#=================================================
show_config() {
if [ ! -z $access_domain ]
then
ynh_return "YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN=$(echo $access_domain | sed "s@;@ @g")"
else
ynh_return "YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN=$domain"
fi
}
#=================================================
# MODIFY THE CONFIGURATION
#=================================================
apply_config() {
access_domain=${YNH_CONFIG_MAIN_ACCESS_DOMAIN_ACCESS_DOMAIN:-$access_domain}
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
access_domains=$(echo $access_domain | sed "s@;@ @g")
nginx_conf_path=/etc/nginx/conf.d/$domain.d/$app.conf
ynh_delete_file_checksum --file=$nginx_conf_path
ynh_replace_string \
--match_string='more_set_headers "Content-Security-Policy: frame-ancestors '"'self'"'.*";' \
--replace_string='more_set_headers "Content-Security-Policy: frame-ancestors '"'self' $access_domains"'";' \
--target_file=$nginx_conf_path
ynh_store_file_checksum --file=$nginx_conf_path
systemctl reload nginx
}
#=================================================
# GENERIC FINALIZATION
#=================================================
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
#=================================================
case $1 in
show) show_config;;
apply) apply_config;;
esac

View file

@ -28,6 +28,17 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
install_extensions=$YNH_APP_ARG_INSTALL_EXTENSIONS
if [ $install_extensions -eq 0 ]
then
access_domain=$domain
else
access_domain=$YNH_APP_ARG_ACCESS_DOMAIN
if [ -z $access_domain ]
then
access_domain=$domain
fi
fi
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -46,6 +57,8 @@ 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=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url 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=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
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -92,7 +105,10 @@ ynh_setup_source --dest_dir="$final_path/live"
ynh_script_progression --message="Configuring nginx web server..." --weight=3 ynh_script_progression --message="Configuring nginx web server..." --weight=3
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config "port" ynh_add_nginx_config "\
port \
access_domain \
"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -145,8 +161,37 @@ pushd "$final_path/live"
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development' exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development'
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install
exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet
# exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet
popd popd
#=================================================
# INSTALLING Standard Notes - Extensions
#=================================================
if [ $install_extensions -eq 1 ]
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
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
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -210,9 +255,9 @@ ynh_script_progression --message="Configuring fail2ban..." --weight=1
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
touch "/var/log/$app/$app.log" touch "/var/log/$app/$app.log"
ynh_add_fail2ban_config --use_template --others_var="\ ynh_add_fail2ban_config --use_template --others_var="\
domain \ domain \
path_url \ path_url \
" "
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
@ -241,6 +286,35 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
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 configure this app by using the config-panel"
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'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -35,6 +35,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED

View file

@ -25,6 +25,8 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -64,6 +66,27 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If install_extensions doesn't exist, create it
if [ -z "$install_extensions" ]; then
install_extensions=0
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
fi
# If access_domain doesn't exist, create it
if [ -z "$access_domain" ]; then
access_domain=$domain
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
fi
if [[ ! -d "$final_path/live/public/extensions/" || \
! -d "$final_path/live/public/extensions/src/" ]]
then
if test -e "../sources/extra_files/app"
then
cp -a "../sources/extra_files/app/." "$final_path/live"
fi
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -116,8 +139,10 @@ fi
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config "port" ynh_add_nginx_config "\
port \
access_domain \
"
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -149,22 +174,20 @@ ynh_system_user_create --username=$app --home_dir=$final_path
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
config_file="$final_path/live/.env" config_file="$final_path/live/.env"
if [ "$upgrade_type" == "UPGRADE_APP" ] ynh_script_progression --message="Modifying a config file..." --weight=2
then
ynh_script_progression --message="Modifying a config file..." --weight=2 cp -f ../conf/env.sample $config_file
ynh_replace_string --match_string="EXPOSED_PORT=3000" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file"
secret_key=$(ynh_string_random --length=48 | base64)
ynh_replace_string --match_string="SECRET_KEY_BASE=changeme123" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file"
pseudo_key=$(ynh_string_random --length=48 | base64)
ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=changeme456" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_ENV=development" --replace_string="RAILS_ENV=production" --target_file="$config_file"
ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file"
ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
cp -f ../conf/env.sample $config_file
ynh_replace_string --match_string="EXPOSED_PORT=3000" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file"
secret_key=$(ynh_string_random --length=48 | base64)
ynh_replace_string --match_string="SECRET_KEY_BASE=changeme123" --replace_string="SECRET_KEY_BASE=$secret_key" --target_file="$config_file"
pseudo_key=$(ynh_string_random --length=48 | base64)
ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=changeme456" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_ENV=development" --replace_string="RAILS_ENV=production" --target_file="$config_file"
ynh_replace_string --match_string="DB_DATABASE=standard_notes_db" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file"
ynh_replace_string --match_string="DB_USERNAME=std_notes_user" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file"
ynh_replace_string --match_string="DB_PASSWORD=changeme123" --replace_string="DB_PASSWORD=$db_pwd" --target_file="$config_file"
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=/" --replace_string="RAILS_RELATIVE_URL_ROOT=$path_url" --target_file="$config_file"
fi
#================================================= #=================================================
# INSTALLING Standard Notes - Synicing Server # INSTALLING Standard Notes - Synicing Server
#================================================= #=================================================
@ -179,9 +202,38 @@ then
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development' exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development'
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install
exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet
# exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet
popd popd
fi fi
#=================================================
# INSTALLING Standard Notes - Extensions
#=================================================
if [ $install_extensions -eq 1 ]
then
ynh_script_progression --message="Reinstalling 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
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
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -242,9 +294,9 @@ ynh_script_progression --message="Reconfiguring fail2ban..." --weight=1
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
touch "/var/log/$app/$app.log" touch "/var/log/$app/$app.log"
ynh_add_fail2ban_config --use_template --others_var="\ ynh_add_fail2ban_config --use_template --others_var="\
domain \ domain \
path_url \ path_url \
" "
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
@ -275,6 +327,35 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
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 configure this app by using the config-panel"
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'
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

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

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>StandardNotes Extensions</title>
<script type="text/javascript" src="js.js"></script>
<link rel="stylesheet" href="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 "Extensions" in the button left corner</li>
<li>Press on "Import Extensions" in the button right corner of the new window.</li>
<li>Enter one of the Extension Links from below.</li>
<li>Press "Enter" on your keyboard.</li>
<li>Press on "Install"</li>
</ul>
</div>
<div id="themesData">
<h3>Themes</h3>
</div>
<div id="editorsData">
<h3>Editors</h3>
</div>
<div id="componentsData">
<h3>Components</h3>
</div>
</body>
</html>

View file

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

View file

@ -0,0 +1,23 @@
loadJSON("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 + "</a></td>"
mainContainer.appendChild(tr);
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.action-bar",
"name": "Action Bar",
"content_type": "SN|Component",
"area": "editor-stack",
"version": "1.3.1",
"description": "Useful utility bar with information about the current note as well as actions like duplicate, copy, and save.",
"url": "https://__DOMAIN__PATH__/extensions/src/action-bar/index.html",
"download_url": "https://github.com/standardnotes/action-bar/archive/1.3.1.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/action-bar.json"
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.stndardnotes.autobiography-theme",
"name": "Autobiography Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.0.0",
"description": "Autobiography",
"url": "https://__DOMAIN__PATH__/extensions/src/autobiography-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/autobiography-theme/archive/1.0.0.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/autobiography-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#9D7441",
"foreground_color":"#ECE4DB",
"border_color":"#9D7441"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.bold-editor",
"name": "Bold Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.1.0",
"description": "A simple and peaceful rich editor that helps you write and think clearly. Features FileSafe integration, so you can embed your images, videos, and audio recordings directly inline.",
"url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html",
"download_url": "https://github.com/standardnotes/bold-editor/archive/1.1.0.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.code-editor",
"name": "Code Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.5",
"description": "Syntax highlighting and convenient keyboard shortcuts for over 120 programming languages. Ideal for code snippets and procedures.",
"url": "https://__DOMAIN__PATH__/extensions/src/code-editor/index.html",
"download_url": "https://github.com/standardnotes/code-editor/archive/1.3.5.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/code-editor.json"
}

View file

@ -0,0 +1,13 @@
{
"identifier": "org.standardnotes.dynamic-theme",
"name": "Dynamic Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.0.0",
"description": "A smart theme that minimizes the tags and notes panels when they are not in use..",
"url": "https://__DOMAIN__PATH__/extensions/src/dynamic-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/dynamic-theme/archive/1.0.0.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/dynamic-theme.json",
"layerable":true,
"no_mobile":true
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.stndardnotes.focus-theme",
"name": "Focus Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.3",
"description": "Light on the eyes, heavy on the spirit.",
"url": "https://__DOMAIN__PATH__/extensions/src/focus-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/focus-theme/archive/1.2.3.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/focus-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#a464c2",
"foreground_color":"#ffffff",
"border_color":"#a464c2"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.folders-component",
"name": "Folders",
"content_type": "SN|Component",
"area": "tags-list",
"version": "1.3.5",
"description": "Create nested folders from your tags with easy drag and drop. Folders also supports Smart Tags, which allow you to build custom filters for viewing your notes.",
"url": "https://__DOMAIN__PATH__/extensions/src/folders-component/index.html",
"download_url": "https://github.com/standardnotes/folders-component/archive/1.3.5.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/folders-component.json"
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.standardnotes.futura-theme",
"name": "Futura Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.2",
"description": "Calm and relaxed. Take some time off.",
"url": "https://__DOMAIN__PATH__/extensions/src/futura-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/futura-theme/archive/1.2.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/futura-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#fca429",
"foreground_color":"#ffffff",
"border_color":"#fca429"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.github-push",
"name": "Github Push",
"content_type": "SN|Component",
"area": "editor-stack",
"version": "1.2.2",
"description": "Push note changes to a public or private GitHub repository, with options for file extension and commit message.",
"url": "https://__DOMAIN__PATH__/extensions/src/github-push/index.html",
"download_url": "https://github.com/sn-extensions/github-push/archive/1.2.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/github-push.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.markdown-basic-editor",
"name": "Markdown Basic",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.6",
"description": "A Markdown editor with dynamic split-pane preview.",
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic/dist/index.html",
"download_url": "https://github.com/standardnotes/markdown-basic/archive/1.3.6.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.markdown-pro",
"name": "Markdown Pro",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.9",
"description": "A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.",
"url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/index.html",
"download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.math-editor",
"name": "Math Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.4",
"description": "A beautiful split-pane Markdown editor with synced-scroll, LaTeX support, and colorful syntax.",
"url": "https://__DOMAIN__PATH__/extensions/src/math-editor/index.html",
"download_url": "https://github.com/sn-extensions/math-editor/archive/1.3.4.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/math-editor.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.mfa-link",
"name": "MFA-Link",
"content_type": "SN|Component",
"area": "editor-stack",
"version": "1.2.2",
"description": "Set up 2FA to enable an extra layer of security on your private notes account.",
"url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html",
"download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json"
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.standardnotes.midnight-theme",
"name": "Midnight Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.1",
"description": "Elegant utilitarianism.",
"url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/midnight-theme/archive/1.2.1.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#086DD6",
"foreground_color":"#ffffff",
"border_color":"#086DD6"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.minimal-markdown-editor",
"name": "Minimal Markdown Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.5",
"description": "A minimal Markdown editor with inline style support.",
"url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor/index.html",
"download_url": "https://github.com/sn-extensions/minimal-markdown-editor/archive/1.3.5.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor.json"
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.standardnotes.no-distraction",
"name": "No Distraction Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.2",
"description": "A distraction-free writing environment for high levels of clarity and focus.",
"url": "https://__DOMAIN__PATH__/extensions/src/no-distraction-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/no-distraction-theme/archive/1.2.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/no-distraction-theme.json",
"layerable":true,
"no_mobile":true,
"dock_icon":{
"type":"svg",
"source":"<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M424 64H88c-26.6 0-48 21.6-48 48v288c0 26.4 21.4 48 48 48h336c26.4 0 48-21.6 48-48V112c0-26.4-21.4-48-48-48zm0 336H88V176h336v224z\"/></svg>"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.plus-editor",
"name": "Plus Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.4.3",
"description": "From highlighting to custom font sizes and colors, to tables and lists, this editor is perfect for crafting any document. (Converts your note to an HTML format.)",
"url": "https://__DOMAIN__PATH__/extensions/src/plus-editor/index.html",
"download_url": "https://github.com/standardnotes/plus-editor/archive/1.4.3.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/plus-editor.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.quick-tags",
"name": "Quick Tags",
"content_type": "SN|Component",
"area": "note-tags",
"version": "1.3.2",
"description": "Work more efficiently by quickly selecting from a live list of tags while you type. Supports keyboard shortcuts and folders.",
"url": "https://__DOMAIN__PATH__/extensions/src/quick-tags/index.html",
"download_url": "https://github.com/standardnotes/quick-tags/archive/1.3.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/quick-tags.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.standardnotes.simple-task-editor",
"name": "Task Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.5",
"description": "A great way to manage short-term and long-term to-do's. You can mark simple-tasks as completed, change their order, and edit the text naturally in place.",
"url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor/dist/index.html",
"download_url": "https://github.com/sn-extensions/simple-task-editor/archive/1.3.5.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor.json"
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.stndardnotes.solarized-dark-theme",
"name": "Solarized Dark Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.1",
"description": "The perfect theme for any time.",
"url": "https://__DOMAIN__PATH__/extensions/src/solarized-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/solarized-dark-theme/archive/1.2.1.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/solarized-dark-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#2AA198",
"foreground_color":"#ffffff",
"border_color":"#2AA198"
}
}

View file

@ -0,0 +1,17 @@
{
"identifier": "org.stndardnotes.titanium-theme",
"name": "Titanium Theme",
"content_type": "SN|Theme",
"area": "theme",
"version": "1.2.2",
"description": "Light on the eyes, heavy on the spirit.",
"url": "https://__DOMAIN__PATH__/extensions/src/titanium-theme/dist/dist.css",
"download_url": "https://github.com/sn-extensions/titanium-theme/archive/1.2.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/titanium-theme.json",
"dock_icon":{
"type":"circle",
"background_color":"#6e2b9e",
"foreground_color":"#ffffff",
"border_color":"#6e2b9e"
}
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.token-vault",
"name": "Token Vault",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.0.5",
"description": "Use Standard Notes on both desktop and mobile as your authenticator app. TokenVault handles your 2FA secrets so that you never lose them again, or have to start over when you get a new device.",
"url": "https://__DOMAIN__PATH__/extensions/src/token-vault/dist/index.html",
"download_url": "https://github.com/sn-extensions/token-vault/archive/1.0.5.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/token-vault.json"
}

View file

@ -0,0 +1,11 @@
{
"identifier": "org.stndardnotes.vim-editor",
"name": "Vim Editor",
"content_type": "SN|Component",
"area": "editor-editor",
"version": "1.3.2",
"description": "A code editor with Vim key bindings.",
"url": "https://__DOMAIN__PATH__/extensions/src/vim-editor/index.html",
"download_url": "https://github.com/sn-extensions/vim-editor/archive/1.3.2.zip",
"latest_url": "https://__DOMAIN__PATH__/extensions/src/vim-editor.json"
}