diff --git a/README.md b/README.md
index 4723ded..7023f82 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
# Standard Notes Syncing Server for YunoHost
-[](https://dash.yunohost.org/appci/app/snserver)
+[](https://dash.yunohost.org/appci/app/snserver)
+
+
+
[](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.*
## 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.
**Shipped version:** 3.13.6
-* Apps available for free. https://standardnotes.org/
+* Apps available for free. https://standardnotes.org/
* Desktop (Windows, Mac, Linux)
* Mobile (Android and iOS)
* Web https://app.standardnotes.org/
@@ -32,8 +35,9 @@ Extensions, Editors, Themes: https://standardnotes.org/extensions
## Configuration
-How to configure this app:
+How to configure this app:
* 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
## Documentation
@@ -53,14 +57,7 @@ How to configure this app:
## Limitations
-* Any known limitations.
-
-## Additional information
-
-* Other information you would add about this application
-
-**More information on the documentation page:**
-https://yunohost.org/packaging_apps
+* 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.
## Links
diff --git a/check_process b/check_process
index dbcb8a3..f12a538 100644
--- a/check_process
+++ b/check_process
@@ -5,9 +5,10 @@
;; Test complet
; Manifest
- domain="domain.tld" (DOMAIN)
- path="/path" (PATH)
- is_public=1 (PUBLIC|public=1|private=0)
+ domain="domain.tld" (DOMAIN)
+ path="/path" (PATH)
+ is_public=1 (PUBLIC|public=1|private=0)
+ access_domain="/"
; Checks
pkg_linter=1
setup_sub_dir=1
@@ -16,8 +17,10 @@
setup_private=1
setup_public=1
upgrade=1
+ # 3.13.6~ynh2
+ upgrade=1 from_commit=e755357f8306805084317c81e85807ed87fdbd47
# 3.13.6~ynh1
- upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979
+ #upgrade=1 from_commit=7474baadc1705ffe5981a52bdced16bdd1edf979
backup_restore=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.
@@ -28,10 +31,10 @@
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
-Email=wilkens.fabian+github@gmail.com
-Notification=all
+Email=
+Notification=
;;; Upgrade options
- ; commit=7474baadc1705ffe5981a52bdced16bdd1edf979
- name=3.13.6~ynh1
+ ; commit=e755357f8306805084317c81e85807ed87fdbd47
+ name=3.13.6~ynh2
manifest_arg=domain=DOMAIN&path=PATH&is_public=1
diff --git a/conf/env.sample b/conf/env.sample
index f443916..d6a7f95 100644
--- a/conf/env.sample
+++ b/conf/env.sample
@@ -45,9 +45,13 @@ DATADOG_ENABLED=false
# Mailer settings
SMTP_HOST=
SMTP_PORT=
-SMTP_USERNAME=
-SMTP_PASSWORD=
+#SMTP_USERNAME=
+#SMTP_PASSWORD=
SMTP_DOMAIN=
+# Enalbe STARTTLS
+# Empty is disabled
+# Any value is enabled
+SMTP_STARTTLS=
EMAIL_ATTACHMENT_MAX_SIZE=10485760
# SNS EVENTS
@@ -61,3 +65,8 @@ REVISIONS_FREQUENCY=300
# Sub-URI
RAILS_RELATIVE_URL_ROOT=/
+
+# Public file server
+# Empty is disabled
+# Any value is enabled
+RAILS_SERVE_STATIC_FILES=
diff --git a/conf/ext_action-bar.src b/conf/ext_action-bar.src
new file mode 100644
index 0000000..a22d22e
--- /dev/null
+++ b/conf/ext_action-bar.src
@@ -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
diff --git a/conf/ext_autobiography-theme.src b/conf/ext_autobiography-theme.src
new file mode 100644
index 0000000..45f25d2
--- /dev/null
+++ b/conf/ext_autobiography-theme.src
@@ -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
diff --git a/conf/ext_bold-editor.src b/conf/ext_bold-editor.src
new file mode 100644
index 0000000..9ca9c28
--- /dev/null
+++ b/conf/ext_bold-editor.src
@@ -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
diff --git a/conf/ext_code-editor.src b/conf/ext_code-editor.src
new file mode 100644
index 0000000..b35b2c8
--- /dev/null
+++ b/conf/ext_code-editor.src
@@ -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
diff --git a/conf/ext_dynamic-theme.src b/conf/ext_dynamic-theme.src
new file mode 100644
index 0000000..be7d2a0
--- /dev/null
+++ b/conf/ext_dynamic-theme.src
@@ -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
diff --git a/conf/ext_focus-theme.src b/conf/ext_focus-theme.src
new file mode 100644
index 0000000..9c4169c
--- /dev/null
+++ b/conf/ext_focus-theme.src
@@ -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
diff --git a/conf/ext_folders-component.src b/conf/ext_folders-component.src
new file mode 100644
index 0000000..350dbc4
--- /dev/null
+++ b/conf/ext_folders-component.src
@@ -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
diff --git a/conf/ext_futura-theme.src b/conf/ext_futura-theme.src
new file mode 100644
index 0000000..6bea15a
--- /dev/null
+++ b/conf/ext_futura-theme.src
@@ -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
diff --git a/conf/ext_github-push.src b/conf/ext_github-push.src
new file mode 100644
index 0000000..07c9135
--- /dev/null
+++ b/conf/ext_github-push.src
@@ -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
diff --git a/conf/ext_markdown-basic.src b/conf/ext_markdown-basic.src
new file mode 100644
index 0000000..c2ac13c
--- /dev/null
+++ b/conf/ext_markdown-basic.src
@@ -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
diff --git a/conf/ext_markdown-pro.src b/conf/ext_markdown-pro.src
new file mode 100644
index 0000000..fbc9628
--- /dev/null
+++ b/conf/ext_markdown-pro.src
@@ -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
diff --git a/conf/ext_math-editor.src b/conf/ext_math-editor.src
new file mode 100644
index 0000000..43ba63b
--- /dev/null
+++ b/conf/ext_math-editor.src
@@ -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
diff --git a/conf/ext_mfa-link.src b/conf/ext_mfa-link.src
new file mode 100644
index 0000000..34adef2
--- /dev/null
+++ b/conf/ext_mfa-link.src
@@ -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
diff --git a/conf/ext_midnight-theme.src b/conf/ext_midnight-theme.src
new file mode 100644
index 0000000..850a929
--- /dev/null
+++ b/conf/ext_midnight-theme.src
@@ -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
diff --git a/conf/ext_minimal-markdown-editor.src b/conf/ext_minimal-markdown-editor.src
new file mode 100644
index 0000000..f8ecdde
--- /dev/null
+++ b/conf/ext_minimal-markdown-editor.src
@@ -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
diff --git a/conf/ext_no-distraction-theme.src b/conf/ext_no-distraction-theme.src
new file mode 100644
index 0000000..ef63679
--- /dev/null
+++ b/conf/ext_no-distraction-theme.src
@@ -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
diff --git a/conf/ext_plus-editor.src b/conf/ext_plus-editor.src
new file mode 100644
index 0000000..6746d17
--- /dev/null
+++ b/conf/ext_plus-editor.src
@@ -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
diff --git a/conf/ext_quick-tags.src b/conf/ext_quick-tags.src
new file mode 100644
index 0000000..872cbd3
--- /dev/null
+++ b/conf/ext_quick-tags.src
@@ -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
diff --git a/conf/ext_simple-task-editor.src b/conf/ext_simple-task-editor.src
new file mode 100644
index 0000000..e0c102d
--- /dev/null
+++ b/conf/ext_simple-task-editor.src
@@ -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
diff --git a/conf/ext_solarized-theme.src b/conf/ext_solarized-theme.src
new file mode 100644
index 0000000..422d0d3
--- /dev/null
+++ b/conf/ext_solarized-theme.src
@@ -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
diff --git a/conf/ext_titanium-theme.src b/conf/ext_titanium-theme.src
new file mode 100644
index 0000000..77bae1d
--- /dev/null
+++ b/conf/ext_titanium-theme.src
@@ -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
diff --git a/conf/ext_token-vault.src b/conf/ext_token-vault.src
new file mode 100644
index 0000000..8961969
--- /dev/null
+++ b/conf/ext_token-vault.src
@@ -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
diff --git a/conf/ext_vim-editor.src b/conf/ext_vim-editor.src
new file mode 100644
index 0000000..a7b47a8
--- /dev/null
+++ b/conf/ext_vim-editor.src
@@ -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
diff --git a/conf/nginx.conf b/conf/nginx.conf
index 7f58986..cdc7768 100644
--- a/conf/nginx.conf
+++ b/conf/nginx.conf
@@ -13,7 +13,5 @@ location __PATH__/ {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
- # Include SSOWAT user panel.
- include conf.d/yunohost_panel.conf.inc;
- more_clear_input_headers 'Accept-Encoding';
+ more_set_headers "Content-Security-Policy: frame-ancestors 'self' __ACCESS_DOMAIN__";
}
diff --git a/config_panel.toml b/config_panel.toml
new file mode 100644
index 0000000..8c0d0f4
--- /dev/null
+++ b/config_panel.toml
@@ -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.
Example: domain.tld
Example: https://domain.tld
Example: domain.tld notes.domain.tld
Example: domain.tld https://notes.domain.tld"
diff --git a/manifest.json b/manifest.json
index dde9a15..c7d9e3c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -5,16 +5,15 @@
"description": {
"en": "The Standard Notes syncing server. An end-to-end encrypted note-taking app."
},
- "version": "3.13.6~ynh2",
+ "version": "3.13.6~ynh4",
"url": "https://github.com/standardnotes/syncing-server",
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "Fabian Wilkens",
- "email": "wilkens.fabian+github@gmail.com",
- "url": "https://github.com/FabianWilkens/snserver_ynh"
+ "email": "46000361+FabianWilkens@users.noreply.github.com"
},
"requirements": {
- "yunohost": ">= 4.0"
+ "yunohost": ">= 4.1.0"
},
"multi_instance": true,
"services": [
@@ -55,6 +54,16 @@
"de": "Ist die Application Öffendlich?"
},
"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": ""
}
]
}
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 02ec33c..7c70401 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -39,10 +39,162 @@ exec_as() {
fi
}
+# Check if service is ready
+is_service_ready() {
+ for ((i = 0 ; i < 15 ; i++))
+ do
+ if [ "200" -eq $(curl --silent --insecure --resolve $domain:443:127.0.0.1 https://$domain$path_url/ -o /dev/null --write-out "%{http_code}") ]
+ then
+ break
+ else
+ sleep 2
+ fi
+ done
+}
+
#================================================
# 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 "$" "
" mail_to_send
+
+ # Insert starting HTML tags
+ sed --in-place '1s@^@\n\n
" mail_to_send + ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send + + # Insert finishing HTML tags + echo -e "\n\n" >> 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 #================================================= diff --git a/scripts/change_url b/scripts/change_url index 515f083..8df1586 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,6 +29,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) port=$(ynh_app_setting_get --app=$app --key=port) +access_domain=$(ynh_app_setting_get --app=$app --key=access_domain) +mail=$(ynh_app_setting_get --app=$app --key=mail) # Add settings here as needed by your application #db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -93,7 +95,10 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config "port" + ynh_add_nginx_config "\ + port \ + access_domain\ + " fi # Change the domain for nginx @@ -114,6 +119,34 @@ ynh_script_progression --message="Modifying a config file..." --weight=1 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" +if [ $change_domain -eq 1 ] +then + new_mail="$app@$new_domain" + ynh_replace_string --match_string="$mail" --replace_string="$new_mail" --target_file="$final_path/live/app/mailers/application_mailer.rb" + ynh_replace_string --match_string="$domain" --replace_string="$new_domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" +fi +if [ $change_path -eq 1 ] +then + ynh_replace_string --match_string="$path_url" --replace_string="$new_path" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" +fi + +#================================================= +# Modify Standard Notes - Extensions +#================================================= +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 + #================================================= # SETUP FAIL2BAN #================================================= @@ -124,9 +157,9 @@ path_url=$new_path # Create a dedicated fail2ban config touch "/var/log/$app/$app.log" ynh_add_fail2ban_config --use_template --others_var="\ - domain \ - path_url \ - " + domain \ + path_url \ + " #================================================= # GENERIC FINALISATION @@ -136,7 +169,6 @@ ynh_add_fail2ban_config --use_template --others_var="\ ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -sleep 15 #================================================= # RELOAD NGINX @@ -145,6 +177,32 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# WAITING FOR SERVICE +#================================================= +ynh_script_progression --message="Waiting for service..." --weight=1 + +is_service_ready + +#================================================= +# 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" + +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__" +admin_mail_info="You changed the url of the server. All Extensions have to be reinstalled by the users. Or you can change the url back." + +echo -e "\ +Standard Notes - Syncing Server's url was successfully changed.\n\ +Please configure the Standard Notes web app or mobile app to use this syning server: https://$domain$path_url/\n\ +$config_panel\n\n\ +$admin_mail_info\ +" > message + +ynh_send_readme_to_admin --app_message="message" --type='change_url' + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/config b/scripts/config new file mode 100755 index 0000000..9169fac --- /dev/null +++ b/scripts/config @@ -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 diff --git a/scripts/install b/scripts/install index 9535227..55325b4 100755 --- a/scripts/install +++ b/scripts/install @@ -28,6 +28,12 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME +access_domain=$YNH_APP_ARG_ACCESS_DOMAIN +if [ -z "$access_domain" ] +then + access_domain=$domain +fi +mail="$app@$domain" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -46,6 +52,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=path --value=$path_url ynh_app_setting_set --app=$app --key=is_public --value=$is_public +ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain +ynh_app_setting_set --app=$app --key=mail --value=$mail #================================================= # STANDARD MODIFICATIONS @@ -92,7 +100,10 @@ ynh_setup_source --dest_dir="$final_path/live" ynh_script_progression --message="Configuring nginx web server..." --weight=3 # Create a dedicated nginx config -ynh_add_nginx_config "port" +ynh_add_nginx_config "\ + port \ + access_domain \ + " #================================================= # CREATE DEDICATED USER @@ -122,16 +133,25 @@ ynh_script_progression --message="Modifying a config file..." --weight=2 config_file="$final_path/live/.env" cp -f ../conf/env.sample $config_file -ynh_replace_string --match_string="EXPOSED_PORT=3000" --replace_string="EXPOSED_PORT=$port" --target_file="$config_file" +ynh_replace_string --match_string="EXPOSED_PORT=.*$" --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" +ynh_replace_string --match_string="SECRET_KEY_BASE=.*$" --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" +ynh_replace_string --match_string="PSEUDO_KEY_PARAMS_KEY=.*$" --replace_string="PSEUDO_KEY_PARAMS_KEY=$pseudo_key" --target_file="$config_file" +ynh_replace_string --match_string="RAILS_ENV=.*$" --replace_string="RAILS_ENV=production" --target_file="$config_file" +ynh_replace_string --match_string="DB_DATABASE=.*$" --replace_string="DB_DATABASE=$db_name" --target_file="$config_file" +ynh_replace_string --match_string="DB_USERNAME=.*$" --replace_string="DB_USERNAME=$db_user" --target_file="$config_file" +ynh_replace_string --match_string="DB_PASSWORD=.*$" --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" +ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file" +ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file" +ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file" +ynh_replace_string --match_string="SMTP_STARTTLS=.*$" --replace_string="SMTP_STARTTLS=" --target_file="$config_file" +ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file" + +ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" +ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" #================================================= # INSTALLING Standard Notes - Synicing Server @@ -145,8 +165,35 @@ 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 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 assets:precompile --quiet popd +#================================================= +# INSTALLING Standard Notes - Extensions +#================================================= +ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1 + + +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 + #================================================= # SETUP SYSTEMD #================================================= @@ -210,9 +257,9 @@ ynh_script_progression --message="Configuring fail2ban..." --weight=1 # Create a dedicated fail2ban config touch "/var/log/$app/$app.log" ynh_add_fail2ban_config --use_template --others_var="\ - domain \ - path_url \ - " + domain \ + path_url \ + " #================================================= # SETUP SSOWAT @@ -232,7 +279,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -sleep 15 #================================================= # RELOAD NGINX @@ -241,6 +287,38 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# WAITING FOR SERVICE +#================================================= +ynh_script_progression --message="Waiting for service..." --weight=1 + +is_service_ready + +#================================================= +# 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" +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__" + +admin_mail_info="\ +Standard Notes extensions are hosted with this package.\n\ +New users will get an e-mail with install instructions.\n\ +With the current SMTP settings you can not send e-mails to all e-mail providers. For example GMail will probably not recive this e-mails.\n\ +Please setup the SMTP account in this file: \"$final_path/live/.env\" under \"#Mailer settings\" if you want to fix this.\n\ +Please setup the Access-Domain for the extensions in the __URL_TAG1__config-panel__URL_TAG2__$admin_panel/config-panel__URL_TAG3__ if not already done during the installation settings.\ +" + +echo -e "\ +Standard Notes - Syncing Server was successfully installed.\n\ +Please configure the Standard Notes web app or mobile app to use this syning server: https://$domain$path_url/\n\ +$config_panel\n\n\ +$admin_mail_info\ +" > message + +ynh_send_readme_to_admin --app_message="message" --type='install' + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 62997c3..2f5ab51 100755 --- a/scripts/restore +++ b/scripts/restore @@ -130,7 +130,6 @@ yunohost service add $app --description "Standard Notes - Syncing Server" --log ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -sleep 15 #================================================= # RESTORE THE LOGROTATE CONFIGURATION @@ -158,6 +157,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=2 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# WAITING FOR SERVICE +#================================================= +ynh_script_progression --message="Waiting for service..." --weight=1 + +is_service_ready + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 549cb13..b4ffdcf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,6 +25,8 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) +access_domain=$(ynh_app_setting_get --app=$app --key=access_domain) +mail=$(ynh_app_setting_get --app=$app --key=mail) #================================================= # CHECK VERSION @@ -38,6 +40,20 @@ port=$(ynh_app_setting_get --app=$app --key=port) ### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do. upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -64,19 +80,36 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +# 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 -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# If mail doesn't exist, create it +if [ -z "$mail" ]; then + mail="$app@$domain" + ynh_app_setting_set --app=$app --key=mail --value=$mail +fi + +if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4" +then + # Add Variables to .env config file + echo -e "\ + \n# Public file server\ + \n# Empty is disabled\ + \n# Any value is enabled\ + \nRAILS_SERVE_STATIC_FILES=\ + " >> "$final_path/live/.env" + + # Apply Patch + if [ -f "$YNH_CWD/../sources/patches/app-01-add-mail.patch" ] + then + pushd "$final_path/live" + patch --strip=1 < "$YNH_CWD/../sources/patches/app-01-add-mail.patch" + popd + fi +fi #================================================= # STANDARD UPGRADE STEPS @@ -91,22 +124,41 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=1 - # Backup files to keep tmpdir=$(mktemp -d) - if [ -d $final_path/live/log ] ; then - cp -Rp $final_path/live/log $tmpdir + if [ -f "$final_path/live/.env" ] ; then + cp -Rp "$final_path/live/.env" "$tmpdir" + fi + if [ -d "$final_path/live/log" ] ; then + cp -Rp "$final_path/live/log" "$tmpdir" fi # Remove destination directory - ynh_secure_remove --file=$final_path + ynh_secure_remove --file="$final_path/live" # Download, check integrity, uncompress and patch the source from app.src - mkdir -p $final_path + mkdir -p "$final_path" ynh_setup_source --dest_dir="$final_path/live" - if [ -d $tmpdir/log ] ; then - cp -Rp $tmpdir/log $final_path/live + if [ -f "$tmpdir/.env" ] ; then + cp -Rp "$tmpdir/.env" "$final_path/live" + fi + if [ -d "$tmpdir/log" ] ; then + cp -Rp "$tmpdir/log" "$final_path/live" + fi +fi + +if [ "$upgrade_type" == "UPGRADE_PACKAGE" ] +then + ynh_secure_remove --file="$final_path/live/public/extensions" +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 @@ -116,8 +168,10 @@ fi ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 # Create a dedicated nginx config -ynh_add_nginx_config "port" - +ynh_add_nginx_config "\ + port \ + access_domain \ + " #================================================= # UPGRADE DEPENDENCIES @@ -149,22 +203,23 @@ ynh_system_user_create --username=$app --home_dir=$final_path # MODIFY A CONFIG FILE #================================================= config_file="$final_path/live/.env" -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Modifying a config file..." --weight=2 +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" +if ynh_compare_current_package_version --comparison lt --version "3.13.6~ynh4" +then + ynh_replace_string --match_string="SMTP_HOST=.*$" --replace_string="SMTP_HOST=localhost" --target_file="$config_file" + ynh_replace_string --match_string="SMTP_PORT=.*$" --replace_string="SMTP_PORT=25" --target_file="$config_file" + ynh_replace_string --match_string="SMTP_USERNAME=.*$" --replace_string="#&" --target_file="$config_file" + ynh_replace_string --match_string="SMTP_PASSWORD=.*$" --replace_string="#&" --target_file="$config_file" + ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="SMTP_DOMAIN=localhost" --target_file="$config_file" + ynh_replace_string --match_string="SMTP_DOMAIN=.*$" --replace_string="&\n# Enable STARTTLS\n# Empty is disabled\n# Any value is enabled\nSMTP_STARTTLS=" --target_file="$config_file" + ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file" fi + +ynh_replace_string --match_string="__MAIL__" --replace_string="$mail" --target_file="$final_path/live/app/mailers/application_mailer.rb" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" +ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/live/app/views/user_mailer/welcome.html.erb" + #================================================= # INSTALLING Standard Notes - Synicing Server #================================================= @@ -179,9 +234,35 @@ 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 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 assets:precompile --quiet popd fi +#================================================= +# INSTALLING Standard Notes - Extensions +#================================================= +ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1 + +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 + #================================================= # SETUP SYSTEMD #================================================= @@ -242,9 +323,9 @@ ynh_script_progression --message="Reconfiguring fail2ban..." --weight=1 # Create a dedicated fail2ban config touch "/var/log/$app/$app.log" ynh_add_fail2ban_config --use_template --others_var="\ - domain \ - path_url \ - " + domain \ + path_url \ + " #================================================= # SETUP SSOWAT @@ -266,7 +347,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" -sleep 15 #================================================= # RELOAD NGINX @@ -275,6 +355,38 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# WAITING FOR SERVICE +#================================================= +ynh_script_progression --message="Waiting for service..." --weight=1 + +is_service_ready + +#================================================= +# 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" +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__" +admin_mail_info="\ +New Feature ( 3.13.6~ynh4 ):\n\ +Now Standard Notes extensions are hosted with this package.\n\ +Only new users will get an e-mail with install instructions.\n\ +With the current SMTP settings you can not send e-mails to all e-mail providers. For example GMail will probably not recive this e-mails.\n\ +Please setup the SMTP account in this file: \"$final_path/live/.env\" under \"#Mailer settings\" if you want to fix this.\n\ +Please setup the Access-Domain for the extensions in the __URL_TAG1__config-panel__URL_TAG2__$admin_panel/config-panel__URL_TAG3__\ +" + +echo -e "\ +Standard Notes - Syncing Server was successfully upgraded.\n\ +Please configure the Standard Notes web app or mobile app to use this syning server: https://$domain$path_url/\n\ +$config_panel\n\n\ +$admin_mail_info\ +" > message + +ynh_send_readme_to_admin --app_message="message" --type='upgrade' + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/ynh_install_ruby b/scripts/ynh_install_ruby index 87ad815..74b526f 100644 --- a/scripts/ynh_install_ruby +++ b/scripts/ynh_install_ruby @@ -97,7 +97,7 @@ ynh_install_ruby () { CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $ruby_version # Store the ID of this app and the version of ruby requested for it - echo "$YNH_APP_ID:$ruby_version" | tee --append "$rbenv_install_dir/ynh_app_version" + echo "$YNH_APP_INSTANCE_NAME:$ruby_version" | tee --append "$rbenv_install_dir/ynh_app_version" # Store ruby_version into the config of this app ynh_app_setting_set $app ruby_version $ruby_version @@ -127,7 +127,7 @@ ynh_remove_ruby () { ruby_version=$(ynh_app_setting_get $app ruby_version) # Remove the line for this app - sed --in-place "/$YNH_APP_ID:$ruby_version/d" "$rbenv_install_dir/ynh_app_version" + sed --in-place "/$YNH_APP_INSTANCE_NAME:$ruby_version/d" "$rbenv_install_dir/ynh_app_version" # If no other app uses this version of ruby, remove it. if ! grep --quiet "$ruby_version" "$rbenv_install_dir/ynh_app_version" diff --git a/sources/extra_files/app/app/views/user_mailer/welcome.html.erb b/sources/extra_files/app/app/views/user_mailer/welcome.html.erb new file mode 100644 index 0000000..785204e --- /dev/null +++ b/sources/extra_files/app/app/views/user_mailer/welcome.html.erb @@ -0,0 +1,223 @@ + + + + + + + +++ + diff --git a/sources/extra_files/app/public/extensions/repo.json b/sources/extra_files/app/public/extensions/repo.json new file mode 100644 index 0000000..369c163 --- /dev/null +++ b/sources/extra_files/app/public/extensions/repo.json @@ -0,0 +1,302 @@ +{ + "content_type": "SN|Repo", + "packages": [ + { + "area": "theme", + "content_type": "SN|Theme", + "description": "Autobiography", + "dock_icon": { + "background_color": "#9D7441", + "border_color": "#9D7441", + "foreground_color": "#ECE4DB", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/autobiography-theme/archive/1.0.0.zip", + "identifier": "org.stndardnotes.autobiography-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/autobiography-theme.json", + "name": "Autobiography Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/autobiography-theme/dist/dist.css", + "version": "1.0.0" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "Light on the eyes, heavy on the spirit.", + "dock_icon": { + "background_color": "#a464c2", + "border_color": "#a464c2", + "foreground_color": "#ffffff", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/focus-theme/archive/1.2.3.zip", + "identifier": "org.stndardnotes.focus-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/focus-theme.json", + "name": "Focus Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/focus-theme/dist/dist.css", + "version": "1.2.3" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "Calm and relaxed. Take some time off.", + "dock_icon": { + "background_color": "#fca429", + "border_color": "#fca429", + "foreground_color": "#ffffff", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/futura-theme/archive/1.2.2.zip", + "identifier": "org.standardnotes.futura-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/futura-theme.json", + "name": "Futura Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/futura-theme/dist/dist.css", + "version": "1.2.2" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "Elegant utilitarianism.", + "dock_icon": { + "background_color": "#086DD6", + "border_color": "#086DD6", + "foreground_color": "#ffffff", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/midnight-theme/archive/1.2.1.zip", + "identifier": "org.standardnotes.midnight-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme.json", + "name": "Midnight Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/midnight-theme/dist/dist.css", + "version": "1.2.1" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "The perfect theme for any time.", + "dock_icon": { + "background_color": "#2AA198", + "border_color": "#2AA198", + "foreground_color": "#ffffff", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/solarized-dark-theme/archive/1.2.1.zip", + "identifier": "org.stndardnotes.solarized-dark-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/solarized-dark-theme.json", + "name": "Solarized Dark Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/solarized-theme/dist/dist.css", + "version": "1.2.1" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "Light on the eyes, heavy on the spirit.", + "dock_icon": { + "background_color": "#6e2b9e", + "border_color": "#6e2b9e", + "foreground_color": "#ffffff", + "type": "circle" + }, + "download_url": "https://github.com/sn-extensions/titanium-theme/archive/1.2.2.zip", + "identifier": "org.stndardnotes.titanium-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/titanium-theme.json", + "name": "Titanium Theme", + "url": "https://__DOMAIN__PATH__/extensions/src/titanium-theme/dist/dist.css", + "version": "1.2.2" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "A smart theme that minimizes the tags and notes panels when they are not in use..", + "download_url": "https://github.com/sn-extensions/dynamic-theme/archive/1.0.0.zip", + "identifier": "org.standardnotes.dynamic-theme", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/dynamic-theme.json", + "layerable": true, + "name": "Dynamic Theme", + "no_mobile": true, + "url": "https://__DOMAIN__PATH__/extensions/src/dynamic-theme/dist/dist.css", + "version": "1.0.0" + }, + { + "area": "theme", + "content_type": "SN|Theme", + "description": "A distraction-free writing environment for high levels of clarity and focus.", + "dock_icon": { + "source": "", + "type": "svg" + }, + "download_url": "https://github.com/sn-extensions/no-distraction-theme/archive/1.2.2.zip", + "identifier": "org.standardnotes.no-distraction", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/no-distraction-theme.json", + "layerable": true, + "name": "No Distraction Theme", + "no_mobile": true, + "url": "https://__DOMAIN__PATH__/extensions/src/no-distraction-theme/dist/dist.css", + "version": "1.2.2" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "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.", + "download_url": "https://github.com/standardnotes/bold-editor/archive/1.1.0.zip", + "identifier": "org.standardnotes.bold-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/bold-editor.json", + "name": "Bold Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/bold-editor/dist/index.html", + "version": "1.1.0" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "Syntax highlighting and convenient keyboard shortcuts for over 120 programming languages. Ideal for code snippets and procedures.", + "download_url": "https://github.com/standardnotes/code-editor/archive/1.3.5.zip", + "identifier": "org.standardnotes.code-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/code-editor.json", + "name": "Code Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/code-editor/index.html", + "version": "1.3.5" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "A Markdown editor with dynamic split-pane preview.", + "download_url": "https://github.com/standardnotes/markdown-basic/archive/1.3.6.zip", + "identifier": "org.standardnotes.markdown-basic-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic.json", + "name": "Markdown Basic", + "url": "https://__DOMAIN__PATH__/extensions/src/markdown-basic/dist/index.html", + "version": "1.3.6" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "A fully featured Markdown editor that supports live preview, a styling toolbar, and split pane support.", + "download_url": "https://github.com/standardnotes/markdown-pro/archive/1.3.9.zip", + "identifier": "org.standardnotes.markdown-pro", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro.json", + "name": "Markdown Pro", + "url": "https://__DOMAIN__PATH__/extensions/src/markdown-pro/index.html", + "version": "1.3.9" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "A beautiful split-pane Markdown editor with synced-scroll, LaTeX support, and colorful syntax.", + "download_url": "https://github.com/sn-extensions/math-editor/archive/1.3.4.zip", + "identifier": "org.standardnotes.math-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/math-editor.json", + "name": "Math Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/math-editor/index.html", + "version": "1.3.4" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "A minimal Markdown editor with inline style support.", + "download_url": "https://github.com/sn-extensions/minimal-markdown-editor/archive/1.3.5.zip", + "identifier": "org.stndardnotes.minimal-markdown-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor.json", + "name": "Minimal Markdown Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/minimal-markdown-editor/index.html", + "version": "1.3.5" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "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.)", + "download_url": "https://github.com/standardnotes/plus-editor/archive/1.4.3.zip", + "identifier": "org.standardnotes.plus-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/plus-editor.json", + "name": "Plus Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/plus-editor/index.html", + "version": "1.4.3" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "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.", + "download_url": "https://github.com/sn-extensions/simple-task-editor/archive/1.3.5.zip", + "identifier": "org.standardnotes.simple-task-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor.json", + "name": "Task Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/simple-task-editor/dist/index.html", + "version": "1.3.5" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "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.", + "download_url": "https://github.com/sn-extensions/token-vault/archive/1.0.5.zip", + "identifier": "org.stndardnotes.token-vault", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/token-vault.json", + "name": "Token Vault", + "url": "https://__DOMAIN__PATH__/extensions/src/token-vault/dist/index.html", + "version": "1.0.5" + }, + { + "area": "editor-editor", + "content_type": "SN|Component", + "description": "A code editor with Vim key bindings.", + "download_url": "https://github.com/sn-extensions/vim-editor/archive/1.3.2.zip", + "identifier": "org.stndardnotes.vim-editor", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/vim-editor.json", + "name": "Vim Editor", + "url": "https://__DOMAIN__PATH__/extensions/src/vim-editor/index.html", + "version": "1.3.2" + }, + { + "area": "editor-stack", + "content_type": "SN|Component", + "description": "Useful utility bar with information about the current note as well as actions like duplicate, copy, and save.", + "download_url": "https://github.com/standardnotes/action-bar/archive/1.3.1.zip", + "identifier": "org.stndardnotes.action-bar", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/action-bar.json", + "name": "Action Bar", + "url": "https://__DOMAIN__PATH__/extensions/src/action-bar/index.html", + "version": "1.3.1" + }, + { + "area": "tags-list", + "content_type": "SN|Component", + "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.", + "download_url": "https://github.com/standardnotes/folders-component/archive/1.3.5.zip", + "identifier": "org.stndardnotes.folders-component", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/folders-component.json", + "name": "Folders", + "url": "https://__DOMAIN__PATH__/extensions/src/folders-component/index.html", + "version": "1.3.5" + }, + { + "area": "editor-stack", + "content_type": "SN|Component", + "description": "Push note changes to a public or private GitHub repository, with options for file extension and commit message.", + "download_url": "https://github.com/sn-extensions/github-push/archive/1.2.2.zip", + "identifier": "org.stndardnotes.github-push", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/github-push.json", + "name": "Github Push", + "url": "https://__DOMAIN__PATH__/extensions/src/github-push/index.html", + "version": "1.2.2" + }, + { + "area": "modal", + "content_type": "SN|Component", + "description": "Set up 2FA to enable an extra layer of security on your private notes account.", + "download_url": "https://github.com/sn-extensions/mfa-link/archive/1.2.2.zip", + "identifier": "org.stndardnotes.mfa-link", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/mfa-link.json", + "name": "MFA-Link", + "url": "https://__DOMAIN__PATH__/extensions/src/mfa-link/dist/index.html", + "version": "1.2.2" + }, + { + "area": "note-tags", + "content_type": "SN|Component", + "description": "Work more efficiently by quickly selecting from a live list of tags while you type. Supports keyboard shortcuts and folders.", + "download_url": "https://github.com/standardnotes/quick-tags/archive/1.3.2.zip", + "identifier": "org.stndardnotes.quick-tags", + "latest_url": "https://__DOMAIN__PATH__/extensions/src/quick-tags.json", + "name": "Quick Tags", + "url": "https://__DOMAIN__PATH__/extensions/src/quick-tags/index.html", + "version": "1.3.2" + } + ] +} diff --git a/sources/extra_files/app/public/extensions/src/action-bar.json b/sources/extra_files/app/public/extensions/src/action-bar.json new file mode 100644 index 0000000..531031d --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/action-bar.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/autobiography-theme.json b/sources/extra_files/app/public/extensions/src/autobiography-theme.json new file mode 100644 index 0000000..3a354a0 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/autobiography-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/bold-editor.json b/sources/extra_files/app/public/extensions/src/bold-editor.json new file mode 100644 index 0000000..f01d550 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/bold-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/code-editor.json b/sources/extra_files/app/public/extensions/src/code-editor.json new file mode 100644 index 0000000..e83473a --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/code-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/dynamic-theme.json b/sources/extra_files/app/public/extensions/src/dynamic-theme.json new file mode 100644 index 0000000..df2ded1 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/dynamic-theme.json @@ -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 +} diff --git a/sources/extra_files/app/public/extensions/src/focus-theme.json b/sources/extra_files/app/public/extensions/src/focus-theme.json new file mode 100644 index 0000000..02fc461 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/focus-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/folders-component.json b/sources/extra_files/app/public/extensions/src/folders-component.json new file mode 100644 index 0000000..909f771 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/folders-component.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/futura-theme.json b/sources/extra_files/app/public/extensions/src/futura-theme.json new file mode 100644 index 0000000..b869315 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/futura-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/github-push.json b/sources/extra_files/app/public/extensions/src/github-push.json new file mode 100644 index 0000000..c5a3458 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/github-push.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/markdown-basic.json b/sources/extra_files/app/public/extensions/src/markdown-basic.json new file mode 100644 index 0000000..caf9d95 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/markdown-basic.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/markdown-pro.json b/sources/extra_files/app/public/extensions/src/markdown-pro.json new file mode 100644 index 0000000..494ba84 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/markdown-pro.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/math-editor.json b/sources/extra_files/app/public/extensions/src/math-editor.json new file mode 100644 index 0000000..cbc9884 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/math-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/mfa-link.json b/sources/extra_files/app/public/extensions/src/mfa-link.json new file mode 100644 index 0000000..189b32d --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/mfa-link.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/midnight-theme.json b/sources/extra_files/app/public/extensions/src/midnight-theme.json new file mode 100644 index 0000000..15dcac1 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/midnight-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/minimal-markdown-editor.json b/sources/extra_files/app/public/extensions/src/minimal-markdown-editor.json new file mode 100644 index 0000000..9f6be92 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/minimal-markdown-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/no-distraction-theme.json b/sources/extra_files/app/public/extensions/src/no-distraction-theme.json new file mode 100644 index 0000000..3955ba4 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/no-distraction-theme.json @@ -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":"" + } +} diff --git a/sources/extra_files/app/public/extensions/src/plus-editor.json b/sources/extra_files/app/public/extensions/src/plus-editor.json new file mode 100644 index 0000000..d1f387c --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/plus-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/quick-tags.json b/sources/extra_files/app/public/extensions/src/quick-tags.json new file mode 100644 index 0000000..bc2e1e5 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/quick-tags.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/simple-task-editor.json b/sources/extra_files/app/public/extensions/src/simple-task-editor.json new file mode 100644 index 0000000..5bd31b6 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/simple-task-editor.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/solarized-dark-theme.json b/sources/extra_files/app/public/extensions/src/solarized-dark-theme.json new file mode 100644 index 0000000..5e3f43e --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/solarized-dark-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/titanium-theme.json b/sources/extra_files/app/public/extensions/src/titanium-theme.json new file mode 100644 index 0000000..0b20079 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/titanium-theme.json @@ -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" + } +} diff --git a/sources/extra_files/app/public/extensions/src/token-vault.json b/sources/extra_files/app/public/extensions/src/token-vault.json new file mode 100644 index 0000000..b119f61 --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/token-vault.json @@ -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" +} diff --git a/sources/extra_files/app/public/extensions/src/vim-editor.json b/sources/extra_files/app/public/extensions/src/vim-editor.json new file mode 100644 index 0000000..0c1db7a --- /dev/null +++ b/sources/extra_files/app/public/extensions/src/vim-editor.json @@ -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" +} diff --git a/sources/patches/app-01-add-mail.patch b/sources/patches/app-01-add-mail.patch new file mode 100644 index 0000000..b708039 --- /dev/null +++ b/sources/patches/app-01-add-mail.patch @@ -0,0 +1,49 @@ +diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb +index a813bad..b7f2e2f 100644 +--- a/app/mailers/application_mailer.rb ++++ b/app/mailers/application_mailer.rb +@@ -1,4 +1,4 @@ + class ApplicationMailer < ActionMailer::Base +- default from: 'Standard Notes+++++++++ Welcome to + Standard Notes. +++ Registered as <%= @email %> +++++ Hi there, +
++ Welcome to your new private notes account. + We created Standard Notes to be a safe, private, and lasting place for your most important work. +
++ You should know: +
++
+- + Your notes are fully encrypted on your device before they're ever sent to our servers. + This means even we can't read the contents of your notes. +
+- + Standard Notes is available on all your devices. Download the + iOS + and + Android + app to go mobile. Use the + web app on the go. Or download the desktop app on + Mac, Windows, and Linux. +
++ Install instructions for Extensions: +
++
+- + Open the Standard Notes web or Desktop app +
+- + Press Extensions in the button left corner +
+- + Press on Import Extensions in the button right corner of the new window. +
+- + Enter https://__DOMAIN____PATH__/extensions/repo.json in the field. +
+- + Press Enter on your keyboard. +
+- + Now you can see Editors, Themes and Components which you can install +
+To have all Standard Notes extensions use Standard Notes Extened:
+ +++++Standard Notes Extended
++ Unlock entirely new workflows with powerful editors and cloud backup options + with + Extended. + Extended is our paid extensions program, and how we support continued development on Standard Notes. +
++ Benefits: +
++
+ +- +
+✓ Encrypted attachments for your notes stored directly in your Dropbox, Google Drive, or WebDAV.
+- +
+✓ Unlimited access to powerful extensions, editors, and beautiful themes.
+- +
+✓ Note version history (up to 100 years)
+- +
+✓ Automatic daily backups of your data to your email inbox, Dropbox, OneDrive, and Google Drive
+- +
+✓ Two-factor authentication
+- +
+✓ Support our mission for privacy and longevity in software
+As low as
+$2.48/month
+ + +Learn More+ +' ++ default from: 'Standard Notes <__MAIL__>' + layout 'mailer' + end +diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb +index 6bbbb11..ac7f55e 100644 +--- a/app/mailers/user_mailer.rb ++++ b/app/mailers/user_mailer.rb +@@ -25,4 +25,9 @@ class UserMailer < ApplicationMailer + user = User.find(user_id) + mail(to: user.email, subject: 'Two-factor authentication has been disabled for your account.') + end ++ ++ def welcome(user) ++ @email = user.email ++ mail(to: @email, subject: 'Welcome to your private notes account') ++ end + end +diff --git a/config/application.rb b/config/application.rb +index 3c749e2..feff27c 100644 +--- a/config/application.rb ++++ b/config/application.rb +@@ -79,7 +79,7 @@ module SyncingServer + :user_name => ENV['SMTP_USERNAME'], + :password => ENV['SMTP_PASSWORD'], + :authentication => 'login', +- :enable_starttls_auto => true # detects and uses STARTTLS ++ :enable_starttls_auto => ENV['SMTP_STARTTLS'].present? # detects and uses STARTTLS + } + + # Custom configuration +diff --git a/lib/sync_engine/abstract/user_manager.rb b/lib/sync_engine/abstract/user_manager.rb +index 26a549a..af92835 100644 +--- a/lib/sync_engine/abstract/user_manager.rb ++++ b/lib/sync_engine/abstract/user_manager.rb +@@ -29,6 +29,7 @@ module SyncEngine + else + user = @user_class.new(email: email, encrypted_password: hash_password(password)) + user.update!(registration_params(params)) ++ UserMailer.welcome(user).deliver_later + return success_auth_response(user, params) + end + end