1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git synced 2024-09-03 18:36:09 +02:00

Merge pull request #74 from YunoHost-Apps/testing

Testing
This commit is contained in:
Maniack Crudelis 2020-05-03 12:37:44 +02:00 committed by GitHub
commit 7803ae3f6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 1801 additions and 174 deletions

50
CHANGELOG.md Normal file
View file

@ -0,0 +1,50 @@
Changelog
=========
## Unreleased
#### Changed
* [Update to mypads 1.7.10]()
## [1.8.0~ynh1](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74) - 2019-10-08
#### Added
* [Add actions and config-panel](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/49)
* [Add changelog](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/76)
#### Fixed
- [Show a link to mypads only if installed](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/46b50b32e58edfb74c143fe5a50362629294f50b)
#### Changed
* [Upgrade to 1.8.0](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/78)
* [Update to mypads 1.7.10](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/00060c99db7f0fcac57c910256a37b6deeb8c2fe)
* [Allow to enable or disable automatic logout](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/74/commits/fdc8d6cbdd8eb0931336311d53857dad7f966d93)
## [1.7.5~ynh2](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/69) - 2019-05-26
#### Changed
* [Upgrade to Etherpad 1.7.5](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/69/commits/d299b77dd865e9fff306c121235450e27ab9372a)
## [1.7.0~ynh2](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63) - 2019-03-29
#### Added
- [Progress bar](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/4489e07a059477802cfeb402e1980b79e1ddce97)
#### Fixed
- [Fix regression on ynh_system_user_create](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c0de9b2ee3ebc5ecb11e02655984e1fe793dd9d5)
#### Changed
- [Update to last standart](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c663ec74c1d97cccbc1291a9d3e74cdf3b7586e9)
* [Update to mypads 1.7.6](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/c87caaad6507a52a71572ef21529cc4f1022b53b)
- [Update helpers](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/bab779a39f3f6f45c0fcc6bdf640baa47a5e6821)
- [Allow to include a pad in an other page](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/63/commits/f27cca79957f88fd9972452db146fe6867ba3f79)
## [1.7.0~ynh1](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55) - 2018-12-08
#### Fixed
- [Set permissions during the restore script](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55/commits/85be69b5ce15db0d9df0f0ca191be43c2ea6bc31)
#### Changed
* [Update mypads to 1.6.8](https://github.com/YunoHost-Apps/etherpad_mypads_ynh/pull/55/commits/8c73fd242286029991b774d02ce9209c88793c21)

View file

@ -1,6 +1,6 @@
# Etherpad with mypads plugin for YunoHost
[![Integration level](https://dash.yunohost.org/integration/etherpad_mypads.svg)](https://dash.yunohost.org/appci/app/etherpad_mypads)
[![Integration level](https://dash.yunohost.org/integration/etherpad_mypads.svg)](https://dash.yunohost.org/appci/app/etherpad_mypads) ![](https://ci-apps.yunohost.org/ci/badges/etherpad_mypads.status.svg) [![](https://ci-apps.yunohost.org/ci/badges/etherpad_mypads.maintain.svg)](https://github.com/YunoHost/Apps/#what-to-do-if-i-cant-maintain-my-app-anymore-)
[![Install Etherpad with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=etherpad_mypads)
*[Lire ce readme en français.](./README_fr.md)*
@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
Etherpad is a highly customizable Open Source online editor providing collaborative editing in really real-time.
This package will install the same plugins than [Framapad](https://framapad.org/).
**Shipped version:** 1.7.5
**Shipped version:** 1.8.0
## Screenshots
@ -42,7 +42,7 @@ Supported, with LDAP.
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/)
* Buster x86-64b - [![](https://ci-buster.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-buster.nohost.me/ci/apps/etherpad_mypads/)
## Limitations

View file

@ -1,6 +1,6 @@
# Etherpad avec plugin mypads pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/etherpad_mypads.svg)](https://dash.yunohost.org/appci/app/etherpad_mypads)
[![Niveau d'intégration](https://dash.yunohost.org/integration/etherpad_mypads.svg)](https://dash.yunohost.org/appci/app/etherpad_mypads) ![](https://ci-apps.yunohost.org/ci/badges/etherpad_mypads.status.svg) [![](https://ci-apps.yunohost.org/ci/badges/etherpad_mypads.maintain.svg)](https://github.com/YunoHost/Apps/#what-to-do-if-i-cant-maintain-my-app-anymore-)
[![Installer Etherpad avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=etherpad_mypads)
*[Read this readme in english.](./README.md)*
@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/inst
Etherpad est un éditeur en ligne Open Source hautement personnalisable qui permet l'édition collaborative en temps réel.
Ce paquet installera les mêmes plugins que [Framapad](https://framapad.org/).
**Version embarquée:** 1.7.5
**Version embarquée:** 1.8.0
## Captures d'écran
@ -42,7 +42,7 @@ Supportée, avec LDAP.
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/)
* Buster x86-64b - [![](https://ci-buster.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-buster.nohost.me/ci/apps/etherpad_mypads/)
## Limitations

50
actions.toml Normal file
View file

@ -0,0 +1,50 @@
[add_remove_abiword]
name = "Install/remove abiword"
command = "/bin/bash scripts/actions/add_remove_abiword"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Install or remove abiword"
[add_remove_libreoffice]
name = "Install/remove libreoffice"
command = "/bin/bash scripts/actions/add_remove_libreoffice"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Install or remove libreoffice"
[list_all_pads]
name = "List all existing pads"
command = "/bin/bash scripts/actions/list_all_pads"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "List all existing pads."
[reset_default_config]
name = "Reset the config file and restore a default one."
command = "/bin/bash scripts/actions/reset_default_config \"settings.json\""
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Reset the config file settings.json."
[public_private]
name = "Move to public or private"
command = "/bin/bash scripts/actions/public_private"
# user = "root" # optional
# cwd = "/" # optional
# accepted_return_codes = [0, 1, 2, 3] # optional
accepted_return_codes = [0]
description = "Change the public access of the app."
[public_private.arguments]
[public_private.arguments.is_public]
type = "boolean"
ask = "Is it a public app ?"
default = true

View file

@ -9,6 +9,25 @@
export="libreoffice"
mypads=1
useldap=1
; Actions
is_public=0|1
; Config_panel
main.export.export=none|abiword|libreoffice
main.pad_configuration.pad_config_nocolors=1|0
main.pad_configuration.pad_config_showlinenumbers=0|1
main.pad_configuration.pad_config_chatandusers=1|0
main.pad_configuration.pad_config_alwaysshowchat=1|0
main.pad_configuration.pad_config_show_markdown=1|0
main.pad_configuration.pad_config_pageview=1|0
main.pad_configuration.pad_config_automatic_logout=0|1
main.pad_configuration.pad_config_skinname=noskin|colibris|noskin
main.mypads_configuration.mypads=0|1
main.mypads_configuration.useldap=0|1
main.is_public.is_public=1|0
main.overwrite_files.overwrite_settings=0|1
main.overwrite_files.overwrite_credentials=0|1
main.overwrite_files.overwrite_nginx=0|1
main.overwrite_files.overwrite_systemd=0|1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -19,9 +38,10 @@
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=1 (9001)
change_url=1
actions=1
config_panel=1
;; Test sans mypads
; Manifest
domain="domain.tld" (DOMAIN)
@ -41,7 +61,7 @@
;; Test abiword
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
path="/" (PATH)
admin="john" (USER)
password="password"
language="en"
@ -69,8 +89,8 @@
Level 5=auto
;;; Options
Email=
Notification=down
Notification=change
;;; Upgrade options
; commit=8bf300413ec3adcb416d168d2e9e98975dd9405b
name= Fix nodejs & global update
manifest_arg=domain=DOMAIN&admin=USER&password=password&language=en&is_public=1&abiword=0&
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&password=password&language=en&is_public=1&abiword=0&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.7.5.tar.gz
SOURCE_SUM=01971447ff7b4d0d2af52faf02edb032
SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.8.0.tar.gz
SOURCE_SUM=f5fc307e4206b1db13d12833024968bc
SOURCE_SUM_PRG=md5sum
ARCH_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -2,8 +2,23 @@
This file must be valid JSON. But comments are allowed
*/
{
//The Type of the database. You can choose between dirty, postgres, sqlite and mysql
//You shouldn't use "dirty" for for anything else than testing or development },
/*
* The type of the database.
*
* You can choose between many DB drivers, for example: dirty, postgres,
* sqlite, mysql.
*
* You shouldn't use "dirty" for for anything else than testing or
* development.
*
*
* Database specific settings are dependent on dbType, and go in dbSettings.
* Remember that since Etherpad 1.6.0 you can also store these informations in
* credentials.json.
*
* For a complete list of the supported drivers, please refer to:
* https://www.npmjs.com/package/ueberdb2
*/
/* An Example of MySQL Configuration */
"dbType" : "mysql",
@ -15,10 +30,20 @@
"charset" : "utf8mb4"
},
/* Users for basic authentication. is_admin = true gives access to /admin.
If you do not uncomment this, /admin will not be available! */
/*
* Users for basic authentication.
*
* is_admin = true gives access to /admin.
* If you do not uncomment this, /admin will not be available!
*
* WARNING: passwords should not be stored in plaintext in this file.
* If you want to mitigate this, please install ep_hash_auth and
* follow the section "secure your installation" in README.md
*/
"users": {
"__ADMIN__": {
// 1) "password" can be replaced with "hash" if you install ep_hash_auth
// 2) please note that if password is null, the user will not be created
"password": "__PASSWD__",
"is_admin": true
}

View file

@ -1,33 +1,109 @@
/*
This file must be valid JSON. But comments are allowed
Please edit settings.json, not settings.json.template
To still commit settings without credentials you can
store any credential settings in credentials.json
*/
* This file must be valid JSON. But comments are allowed
*
* Please edit settings.json, not settings.json.template
*
* Please note that starting from Etherpad 1.6.0 you can store DB credentials in
* a separate file (credentials.json).
*
*
* ENVIRONMENT VARIABLE SUBSTITUTION
* =================================
*
* All the configuration values can be read from environment variables using the
* syntax "${ENV_VAR}" or "${ENV_VAR:default_value}".
*
* This is useful, for example, when running in a Docker container.
*
* EXAMPLE:
* "port": "${PORT:9001}"
* "minify": "${MINIFY}"
* "skinName": "${SKIN_NAME:colibris}"
*
* Would read the configuration values for those items from the environment
* variables PORT, MINIFY and SKIN_NAME.
*
* If PORT and SKIN_NAME variables were not defined, the default values 9001 and
* "colibris" would be used.
* The configuration value "minify", on the other hand, does not have a
* designated default value. Thus, if the environment variable MINIFY were
* undefined, "minify" would be null.
*
* REMARKS:
* 1) please note that variable substitution always needs to be quoted.
*
* "port": 9001, <-- Literal values. When not using
* "minify": false substitution, only strings must be
* "skinName": "colibris" quoted. Booleans and numbers must not.
*
* "port": "${PORT:9001}" <-- CORRECT: if you want to use a variable
* "minify": "${MINIFY:true}" substitution, put quotes around its name,
* "skinName": "${SKIN_NAME}" even if the required value is a number or
* a boolean.
* Etherpad will take care of rewriting it
* to the proper type if necessary.
*
* "port": ${PORT:9001} <-- ERROR: this is not valid json. Quotes
* "minify": ${MINIFY} around variable names are missing.
* "skinName": ${SKIN_NAME}
*
* 2) Beware of undefined variables and default values: nulls and empty strings
* are different!
*
* This is particularly important for user's passwords (see the relevant
* section):
*
* "password": "${PASSW}" // if PASSW is not defined would result in password === null
* "password": "${PASSW:}" // if PASSW is not defined would result in password === ''
*
*/
{
// Name your instance!
/*
* Name your instance!
*/
"title": "Etherpad Mypads",
// favicon default name
// alternatively, set up a fully specified Url to your own favicon
/*
* favicon default name
* alternatively, set up a fully specified Url to your own favicon
*/
"favicon": "favicon.ico",
//IP and port which etherpad should bind at
/*
* Skin name.
*
* Its value has to be an existing directory under src/static/skins.
* You can write your own, or use one of the included ones:
*
* - "no-skin": an empty skin (default). This yields the unmodified,
* traditional Etherpad theme.
* - "colibris": the new experimental skin (since Etherpad 1.8), candidate to
* become the default in Etherpad 2.0
*/
"skinName": "no-skin",
/*
* IP and port which etherpad should bind at
*/
"ip": "127.0.0.1",
"port" : __PORT__,
// Option to hide/show the settings.json in admin page, default option is set to true
"showSettingsInAdminPage" : true,
/*
* Option to hide/show the settings.json in admin page.
*
* Default option is set to true
*/
"showSettingsInAdminPage": true,
/*
// Node native SSL support
// this is disabled by default
//
// make sure to have the minimum and correct file access permissions set
// so that the Etherpad server can access them
* Node native SSL support
*
* This is disabled by default.
* Make sure to have the minimum and correct file access permissions set so
* that the Etherpad server can access them
*/
/*
"ssl" : {
"key" : "/path-to-your/epl-server.key",
"cert" : "/path-to-your/epl-server.crt",
@ -35,21 +111,16 @@
},
*/
//The Type of the database. You can choose between dirty, postgres, sqlite and mysql
//You shouldn't use "dirty" for for anything else than testing or development
//"dbType" : "dirty",
//the database specific settings
//"dbSettings" : {
// "filename" : "var/dirty.db"
// },
/* An Example of MySQL Configuration */
// Withdrawn and moved...
//the default text of a pad
/*
* The default text of a pad
*/
"defaultPadText" : "Welcome to Etherpad!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n",
/* Default Pad behavior, users can override by changing */
/*
* Default Pad behavior.
*
* Change them if you want to override.
*/
"padOptions": {
"noColors": false,
"showControls": true,
@ -61,12 +132,39 @@
"rtl": false,
"alwaysShowChat": false,
"chatAndUsers": false,
"lang": "__LANGUAGE__",
"lang": "__LANGUAGE__",
/*
* Pad Shortcut Keys
*/
"padShortcutEnabled" : {
"altF9": true, /* focus on the File Menu and/or editbar */
"altC": true, /* focus on the Chat window */
"cmdShift2": true, /* shows a gritter popup showing a line author */
"delete": true,
"return": true,
"esc": true, /* in mozilla versions 14-19 avoid reconnecting pad */
"cmdS": true, /* save a revision */
"tab": true, /* indent */
"cmdZ": true, /* undo/redo */
"cmdY": true, /* redo */
"cmdI": true, /* italic */
"cmdB": true, /* bold */
"cmdU": true, /* underline */
"cmd5": true, /* strike through */
"cmdShiftL": true, /* unordered list */
"cmdShiftN": true, /* ordered list */
"cmdShift1": true, /* ordered list */
"cmdShiftC": true, /* clear authorship */
"cmdH": true, /* backspace */
"ctrlHome": true, /* scroll to top of pad */
"pageUp": true,
"pageDown": true
},
// Plugins config
// ep_automatic_logut
"automatic_logut_mins_show" : true, // Show logout time selector
// "automatic_logut_mins" : 30, // Set default time logout in minutes - Crash etherpad...
"automatic_logut_url" : "../../", // Redirection URL address
// ep_markdown
@ -112,70 +210,183 @@
//noldap }
//noldap },
/* Should we suppress errors from being visible in the default Pad Text? */
"suppressErrorsInPadText" : false,
/*
* Should we suppress errors from being visible in the default Pad Text?
*/
"suppressErrorsInPadText": false,
/* Users must have a session to access pads. This effectively allows only group pads to be accessed. */
"requireSession" : false,
/*
* If this option is enabled, a user must have a session to access pads.
* This effectively allows only group pads to be accessed.
*/
"requireSession": false,
/* Users may edit pads but not create new ones. Pad creation is only via the API. This applies both to group pads and regular pads. */
"editOnly" : false,
/*
* Users may edit pads but not create new ones.
*
* Pad creation is only via the API.
* This applies both to group pads and regular pads.
*/
"editOnly": false,
/* Users, who have a valid session, automatically get granted access to password protected pads */
"sessionNoPassword" : false,
/*
* If set to true, those users who have a valid session will automatically be
* granted access to password protected pads.
*/
"sessionNoPassword": false,
/* if true, all css & js will be minified before sending to the client. This will improve the loading performance massivly,
but makes it impossible to debug the javascript/css */
"minify" : true,
/*
* If true, all css & js will be minified before sending to the client.
*
* This will improve the loading performance massively, but makes it difficult
* to debug the javascript/css
*/
"minify": true,
/* How long may clients use served javascript code (in seconds)? Without versioning this
may cause problems during deployment. Set to 0 to disable caching */
"maxAge" : 21600, // 60 * 60 * 6 = 6 hours
/*
* How long may clients use served javascript code (in seconds)?
*
* Not setting this may cause problems during deployment.
* Set to 0 to disable caching.
*/
"maxAge": 21600, // 60 * 60 * 6 = 6 hours
/* This is the absolute path to the Abiword executable. Setting it to null, disables abiword.
Abiword is needed to advanced import/export features of pads*/
/*
* Absolute path to the Abiword executable.
*
* Abiword is needed to get advanced import/export features of pads. Setting
* it to null disables Abiword and will only allow plain text and HTML
* import/exports.
*/
"abiword" : null,
/* This is the absolute path to the soffice executable. Setting it to null, disables LibreOffice exporting.
LibreOffice can be used in lieu of Abiword to export pads */
/*
* This is the absolute path to the soffice executable.
*
* LibreOffice can be used in lieu of Abiword to export pads.
* Setting it to null disables LibreOffice exporting.
*/
"soffice" : null,
/* This is the path to the Tidy executable. Setting it to null, disables Tidy.
Tidy is used to improve the quality of exported pads*/
"tidyHtml" : null,
/*
* Path to the Tidy executable.
*
* Tidy is used to improve the quality of exported pads.
* Setting it to null disables Tidy.
*/
"tidyHtml": null,
/* Allow import of file types other than the supported types: txt, doc, docx, rtf, odt, html & htm */
"allowUnknownFileEnds" : true,
/*
* Allow import of file types other than the supported ones:
* txt, doc, docx, rtf, odt, html & htm
*/
"allowUnknownFileEnds": true,
/* This setting is used if you require authentication of all users.
Note: /admin always requires authentication. */
"requireAuthentication" : false,
/*
* This setting is used if you require authentication of all users.
*
* Note: "/admin" always requires authentication.
*/
"requireAuthentication": false,
/* Require authorization by a module, or a user with is_admin set, see below. */
"requireAuthorization" : false,
/*
* Require authorization by a module, or a user with is_admin set, see below.
*/
"requireAuthorization": false,
/*when you use NginX or another proxy/ load-balancer set this to true*/
"trustProxy" : false,
/*
* When you use NGINX or another proxy/load-balancer set this to true.
*
* This is especially necessary when the reverse proxy performs SSL
* termination, otherwise the cookies will not have the "secure" flag.
*
* The other effect will be that the logs will contain the real client's IP,
* instead of the reverse proxy's IP.
*/
"trustProxy": false,
/* Privacy: disable IP logging */
"disableIPlogging" : false,
/*
* Privacy: disable IP logging
*/
"disableIPlogging": false,
/* Users for basic authentication. is_admin = true gives access to /admin.
If you do not uncomment this, /admin will not be available! */
// Withdrawn and moved...
/*
* Time (in seconds) to automatically reconnect pad when a "Force reconnect"
* message is shown to user.
*
* Set to 0 to disable automatic reconnection.
*/
"automaticReconnectionTimeout": 0,
// restrict socket.io transport methods
/*
* By default, when caret is moved out of viewport, it scrolls the minimum
* height needed to make this line visible.
*/
"scrollWhenFocusLineIsOutOfViewport": {
/*
* Percentage of viewport height to be additionally scrolled.
*
* E.g.: use "percentage.editionAboveViewport": 0.5, to place caret line in
* the middle of viewport, when user edits a line above of the
* viewport
*
* Set to 0 to disable extra scrolling
*/
"percentage": {
"editionAboveViewport": 0,
"editionBelowViewport": 0
},
/*
* Time (in milliseconds) used to animate the scroll transition.
* Set to 0 to disable animation
*/
"duration": 0,
/*
* Flag to control if it should scroll when user places the caret in the
* last line of the viewport
*/
"scrollWhenCaretIsInTheLastLineOfViewport": false,
/*
* Percentage of viewport height to be additionally scrolled when user
* presses arrow up in the line of the top of the viewport.
*
* Set to 0 to let the scroll to be handled as default by Etherpad
*/
"percentageToScrollWhenUserPressesArrowUp": 0
},
/*
* Restrict socket.io transport methods
*/
"socketTransportProtocols" : ["xhr-polling", "jsonp-polling", "htmlfile"],
// Allow Load Testing tools to hit the Etherpad Instance. Warning this will disable security on the instance.
/*
* Allow Load Testing tools to hit the Etherpad Instance.
*
* WARNING: this will disable security on the instance.
*/
"loadTest": false,
// Disable indentation on new line when previous line ends with some special chars (':', '[', '(', '{')
/*
* Disable indentation on new line when previous line ends with some special
* chars (':', '[', '(', '{')
*/
/*
"indentationOnNewLine": false,
*/
/* The toolbar buttons configuration.
/*
* Toolbar buttons configuration.
*
* Uncomment to customize.
*/
/*
"toolbar": {
"left": [
["bold", "italic", "underline", "strikethrough"],
@ -194,38 +405,57 @@
},
*/
/* The log level we are using, can be: DEBUG, INFO, WARN, ERROR */
/*
* Expose Etherpad version in the web interface and in the Server http header.
*
* Do not enable on production machines.
*/
"exposeVersion": false,
/*
* The log level we are using.
*
* Valid values: DEBUG, INFO, WARN, ERROR
*/
"loglevel": "INFO",
//Logging configuration. See log4js documentation for further information
// https://github.com/nomiddlename/log4js-node
// You can add as many appenders as you want here:
/*
* Logging configuration. See log4js documentation for further information:
* https://github.com/nomiddlename/log4js-node
*
* You can add as many appenders as you want here.
*/
"logconfig" :
{ "appenders": [
{ "type": "console"
//, "category": "access"// only logs pad access
}
/*
/*
, { "type": "file"
, "filename": "your-log-file-here.log"
, "maxLogSize": 1024
, "backups": 3 // how many log files there're gonna be at max
//, "category": "test" // only log a specific category
}*/
/*
}
*/
/*
, { "type": "logLevelFilter"
, "level": "warn" // filters out all log messages that have a lower level than "error"
, "appender":
{ Use whatever appender you want here }
}*/
/*
}
*/
/*
, { "type": "logLevelFilter"
, "level": "error" // filters out all log messages that have a lower level than "error"
, "appender":
{ "type": "smtp"
, "subject": "An error occured in your EPL instance!"
, "subject": "An error occurred in your EPL instance!"
, "recipients": "bar@blurdybloop.com, baz@blurdybloop.com"
, "sendInterval": 60*5 // in secs -- will buffer log messages; set to 0 to send a mail for every message
, "sendInterval": 300 // 60 * 5 = 5 minutes -- will buffer log messages; set to 0 to send a mail for every message
, "transport": "SMTP", "SMTP": { // see https://github.com/andris9/Nodemailer#possible-transport-methods
"host": "smtp.example.com", "port": 465,
"secureConnection": true,
@ -235,7 +465,9 @@
}
}
}
}*/
}
*/
]
}
} // logconfig
}

111
config_panel.toml Normal file
View file

@ -0,0 +1,111 @@
version = "0.1"
name = "Etherpad configuration panel"
[main]
name = "Etherpad configuration"
[main.export]
name = "Export"
[main.export.export]
ask = "Use abiword (~260Mo) or libreoffice (~400Mo) (more stable) to expand export possibilities (pdf, doc) ?"
choices = ["none", "abiword", "libreoffice"]
default = "none"
[main.pad_configuration]
name = "Default pad configuration"
[main.pad_configuration.pad_config_nocolors]
ask = "Hide authorship colors ?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_showlinenumbers]
ask = "Show line numbers ?"
type = "boolean"
default = true
[main.pad_configuration.pad_config_chatandusers]
ask = "Show chat and users ?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_alwaysshowchat]
ask = "Always show chat ?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_show_markdown]
ask = "Show markdown syntax ?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_pageview]
ask = "Page view ?"
type = "boolean"
default = false
[main.pad_configuration.pad_config_automatic_logout]
ask = "Automatic logout"
type = "boolean"
default = true
[main.pad_configuration.pad_config_skinname]
ask = "Theme Name"
choices = ["noskin", "colibris"]
default = "noskin"
help = "noskin is the traditional Etherpad theme. colibris is the new theme."
[main.mypads_configuration]
name = "Mypads configuration"
[main.mypads_configuration.mypads]
ask = "Enable Mypads plugin ?"
type = "boolean"
default = true
[main.mypads_configuration.useldap]
ask = "Use ldap with Mypads ?"
type = "boolean"
default = true
[main.is_public]
name = "Public access"
[main.is_public.is_public]
ask = "Is it a public website?"
type = "boolean"
default = true
help = "If your etherpad instance is public, everyone will be able to create a pad or see an existing one."
[main.overwrite_files]
name = "Overwriting config files during an upgrade"
[main.overwrite_files.overwrite_settings]
ask = "Overwrite the config file settings.json ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_credentials]
ask = "Overwrite the config file credentials.json ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_nginx]
ask = "Overwrite the nginx config file ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."
[main.overwrite_files.overwrite_systemd]
ask = "Overwrite the systemd config file ?"
type = "boolean"
default = true
help = "If the file is overwritten, a backup will be created."

View file

@ -6,7 +6,7 @@
"en": "Framapad clone, a online editor providing collaborative editing in real-time.",
"fr": "Clone de Framapad, un éditeur en ligne fournissant l'édition collaborative en temps réel."
},
"version": "1.7.5~ynh2",
"version": "1.8.0~ynh1",
"url": "https://framapad.org",
"license": "Apache-2.0",
"maintainer": {
@ -14,7 +14,7 @@
"email": "maniackc_dev@crudelis.fr"
},
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 3.6"
},
"multi_instance": true,
"services": [

View file

@ -2,7 +2,7 @@
- *Description of why you made this PR*
## Solution
- *And how you fix that*
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
@ -14,10 +14,9 @@
## Validation
---
*Minor decision*
- **Upgrade previous version** :
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
*Code review and approval have to be from a member of @YunoHost-Apps/apps-group*
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*

View file

@ -1,5 +1,9 @@
#!/bin/bash
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# BACKUP
#=================================================
@ -180,6 +184,8 @@ ynh_maintenance_mode_ON () {
domain=$(ynh_app_setting_get $app domain)
fi
mkdir -p /var/www/html/
# Create an html to serve as maintenance notice
echo "<!DOCTYPE html>
<html>
@ -247,3 +253,156 @@ ynh_maintenance_mode_OFF () {
systemctl reload nginx
}
#=================================================
# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
#
# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
# | arg: -f --format= - Format in which the changelog will be printed
# markdown: Default format.
# html: Turn urls into html format.
# plain: Plain text changelog
# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
#
# The changelog is printed into the file ./changelog and ./changelog_lite
ynh_app_changelog () {
# Declare an array to define the options of this helper.
local legacy_args=foc
declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
local format
local output
local changelog
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
format=${format:-markdown}
output=${output:-changelog}
changelog=${changelog:-../CHANGELOG.md}
local original_changelog="$changelog"
local temp_changelog="changelog_temp"
local final_changelog="$output"
if [ ! -n "$original_changelog" ]
then
echo "No changelog available..." > "$final_changelog"
echo "No changelog available..." > "${final_changelog}_lite"
return 0
fi
local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
# Get the line of the version to update to into the changelog
local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
# If there's no entry for this version yet into the changelog
# Get the first available version
if [ -z "$update_version_line" ]
then
update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
fi
# Get the length of the complete changelog.
local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
# Cut the file before the version to update to.
tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
# Get the length of the troncated changelog.
changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
# Get the line of the current version into the changelog
# Keep only the last line found
local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
# If there's no entry for this version into the changelog
# Get the last available version
if [ -z "$current_version_line" ]
then
current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
fi
# Cut the file before the current version.
# Then grep the previous version into the changelog to get the line number of the previous version
local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
"$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
# If there's no previous version into the changelog
# Go until the end of the changelog
if [ -z "$previous_version_line" ]
then
previous_version_line=$changelog_length
fi
# Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
if [ "$format" = "html" ]
then
# Replace markdown links by html links
ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="<a href=\"\2\">\1</a>)" --target_file="$final_changelog"
ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="<a href=\"\2\">\1</a>" --target_file="$final_changelog"
elif [ "$format" = "plain" ]
then
# Change title format.
ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
# Change modifications lines format.
ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
fi
# else markdown. As the file is already in markdown, nothing to do.
# Keep only important changes into the changelog
# Remove all minor changes
sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
# Remove all blank lines (to keep a clear workspace)
sed --in-place '/^$/d' "${final_changelog}_lite"
# Add a blank line at the end
echo "" >> "${final_changelog}_lite"
# Clean titles if there's no significative changes
local line
local previous_line=""
while read line <&3
do
if [ -n "$previous_line" ]
then
# Remove the line if it's a title or a blank line, and the previous one was a title as well.
if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
then
ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
fi
fi
previous_line="$line"
done 3< "${final_changelog}_lite"
# Remove all blank lines again
sed --in-place '/^$/d' "${final_changelog}_lite"
# Restore changelog format with blank lines
ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
# Remove the 2 first blank lines
sed --in-place '1,2d' "${final_changelog}_lite"
# Add a blank line at the end
echo "" >> "${final_changelog}_lite"
# If changelog are empty, add an info
if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
then
echo "No changes from the changelog..." > "$final_changelog"
fi
if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
then
echo "No significative changes from the changelog..." > "${final_changelog}_lite"
fi
}
#=================================================
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}

View file

@ -7,8 +7,8 @@ abiword_app_depencencies="abiword"
libreoffice_app_dependencies="unoconv libreoffice-writer"
# NodeJS version
nodejs_version=6
nodejs_version=10
# Mypads version
# This variable is mostly used to force an upgrade of the package in case of new versions of mypads.
mypads_version=1.7.6
mypads_version=1.7.10

View file

@ -0,0 +1,113 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
then
# abiword is already a dependence of etherpad_mypads.
# abiword should be removed.
abiword=0
action1=removed
action2=Removing
else
# abiword isn't a dependence of etherpad_mypads.
# abiword should be installed.
abiword=1
action1=installed
action2=Installing
fi
ynh_print_info --message="Abiword will be $action1."
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
then
# libreoffice is already a dependence of etherpad_mypads.
# Keep it
libreoffice=1
else
# libreoffice isn't a dependence of etherpad_mypads.
# Do not add it
libreoffice=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# INSTALL OR REMOVE ABIWORD
#=================================================
ynh_script_progression --message="$action2 Abiword..." --weight=3
# Load common variables, and especially abiword dependencies.
source scripts/_variables
dependencies=""
if [ $abiword -eq 1 ]
then
# Add abiword dependencies if abiword has to be installed
dependencies="$dependencies $abiword_app_depencencies"
fi
if [ $libreoffice -eq 1 ]
then
# Add libreoffice dependencies if libreoffice is already installed to keep it as a dependence.
dependencies="$dependencies $libreoffice_app_dependencies"
fi
# Rebuild the meta package and install the new dependencies
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
ynh_install_app_dependencies $dependencies)
# Remove all unused dependencies
ynh_package_autopurge
#=================================================
# SET THE DEFAULT EXPORT APP
#=================================================
if [ $abiword -eq 1 ]
then
# Set abiword as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
elif [ $libreoffice -eq 1 ]
then
# Set libreoffice as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
else
# Remove any export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -0,0 +1,113 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
# Check the dependencies of the meta packages of etherpad_mypads with apt-cache
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet libreoffice-writer
then
# libreoffice is already a dependence of etherpad_mypads.
# libreoffice should be removed.
libreoffice=0
action1=removed
action2=Removing
else
# libreoffice isn't a dependence of etherpad_mypads.
# libreoffice should be installed.
libreoffice=1
action1=installed
action2=Installing
fi
ynh_print_info --message="Libreoffice will be $action1."
if apt-cache depends ${app//_/-}-ynh-deps | grep --quiet abiword
then
# abiword is already a dependence of etherpad_mypads.
# Keep it
abiword=1
else
# abiword isn't a dependence of etherpad_mypads.
# Do not add it
abiword=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# INSTALL OR REMOVE LIBREOFFICE
#=================================================
ynh_script_progression --message="$action2 Libreoffice..." --weight=3
# Load common variables, and especially libreoffice dependencies.
source scripts/_variables
dependencies=""
if [ $libreoffice -eq 1 ]
then
# Add libreoffice dependencies if libreoffice has to be installed
dependencies="$dependencies $libreoffice_app_dependencies"
fi
if [ $abiword -eq 1 ]
then
# Add abiword dependencies if abiword is already installed to keep it as a dependence.
dependencies="$dependencies $abiword_app_depencencies"
fi
# Rebuild the meta package and install the new dependencies
( cd scripts # Move to scripts directory to allow the helper to find the manifest where it expects to find it.
ynh_install_app_dependencies $dependencies)
# Remove all unused dependencies
ynh_package_autopurge
#=================================================
# SET THE DEFAULT EXPORT APP
#=================================================
if [ $libreoffice -eq 1 ]
then
# Set libreoffice as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=libreoffice"
elif [ $abiword -eq 1 ]
then
# Set abiword as default export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=abiword"
else
# Remove any export app
yunohost app config apply $app -a "YNH_CONFIG_MAIN_EXPORT_EXPORT=none"
fi
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

57
scripts/actions/list_all_pads Executable file
View file

@ -0,0 +1,57 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
#=================================================
# SPECIFIC ACTION
#=================================================
# LIST ALL PADS FROM THE DATABASE
#=================================================
ynh_script_progression --message="Listing all pads..." --weight=3
# Get the list of pads from the database
pad_list="$(ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< \
"select distinct substring(store.key,5,locate(\":\",store.key,5)-5) as \"pads\" from store where store.key like \"pad:%\"")"
# Remove empty lines
# Name the first line "> List of pads"
# Then for the second lines and following, add >> before the name of the pad.
ynh_print_info --message="$(echo "$pad_list" | sed '/^$/d' | sed '1 s/^/> List of /' | sed '2,$s/^/>> /g')"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

80
scripts/actions/public_private Executable file
View file

@ -0,0 +1,80 @@
#!/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
#=================================================
# Get is_public
is_public=${YNH_ACTION_IS_PUBLIC}
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF ARGUMENTS ARE CORRECT
#=================================================
#=================================================
# CHECK IF AN ACTION HAS TO BE DONE
#=================================================
is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
if [ $is_public -eq $is_public_old ]
then
ynh_die --message="is_public is already set as $is_public." --ret_code=0
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# MOVE TO PUBLIC OR PRIVATE
#=================================================
if [ $is_public -eq 0 ]; then
public_private="private"
else
public_private="public"
fi
ynh_script_progression --message="Moving the application to $public_private..." --weight=3
if [ $is_public -eq 0 ]
then
ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin" # etherpad admin page doesn't support SSO...
else
ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
fi
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Regen ssowat configuration
yunohost app ssowatconf
# Update the config of the app
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Execution completed" --last

View file

@ -0,0 +1,96 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
export=$(ynh_app_setting_get --app=$app --key=export)
language=$(ynh_app_setting_get --app=$app --key=language)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
#=================================================
# SORT OUT THE CONFIG FILE TO HANDLE
#=================================================
file="$1"
if [ "$file" = "settings.json" ]; then
config_file="$final_path/settings.json"
fi
#=================================================
# SPECIFIC ACTION
#=================================================
# RESET THE CONFIG FILE
#=================================================
ynh_script_progression --message="Resetting the config file $config_file..." --weight=3
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different --file="$config_file"
if [ "$file" = "settings.json" ]
then
# Get the default file and overwrite the current config
cp /etc/yunohost/apps/$app/conf/settings.json "$config_file"
# Recreate the default config
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
if [ "$export" = "abiword" ]
then
# Get abiword binary path
abiword_path=`which abiword`
# Set the path of abiword into etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
fi
fi
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config_file"
#=================================================
# CHECK ETHERPAD STARTING
#=================================================
ynh_script_progression --message="Restarting Etherpad..." --weight=9
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last

View file

@ -30,6 +30,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=40
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================

367
scripts/config Normal file
View file

@ -0,0 +1,367 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Load common variables for all scripts.
source _variables
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# SPECIFIC CODE
#=================================================
# DECLARE GENERIC FUNCTION
#=================================================
config_file="$final_path/settings.json"
get_config_value() {
option_name="$1"
# Get the value of this option in the config file
grep "^ *\"$option_name\" *:" "$config_file" | cut -d':' -f2 | sed s'/[ \"]//g' | cut -d',' -f1
}
#=================================================
# LOAD VALUES
#=================================================
# Load the real value from the app config or elsewhere.
# Then get the value from the form.
# If the form has a value for a variable, take the value from the form,
# Otherwise, keep the value from the app config.
# Export
old_export="$(ynh_app_setting_get $app export)"
export="${YNH_CONFIG_MAIN_EXPORT_EXPORT:-$old_export}"
# padOptions noColors
old_pad_config_nocolors="$(get_config_value noColors)"
pad_config_nocolors="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS:-$old_pad_config_nocolors}"
# padOptions showLineNumbers
old_pad_config_showlinenumbers="$(get_config_value showLineNumbers)"
pad_config_showlinenumbers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS:-$old_pad_config_showlinenumbers}"
# padOptions chatAndUsers
old_pad_config_chatandusers="$(get_config_value chatAndUsers)"
pad_config_chatandusers="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS:-$old_pad_config_chatandusers}"
# padOptions alwaysShowChat
old_pad_config_alwaysshowchat="$(get_config_value alwaysShowChat)"
pad_config_alwaysshowchat="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT:-$old_pad_config_alwaysshowchat}"
# Plugin option ep_markdown_default
old_pad_config_show_markdown="$(get_config_value ep_markdown_default)"
pad_config_show_markdown="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN:-$old_pad_config_show_markdown}"
# Plugin option ep_page_view_default
old_pad_config_pageview="$(get_config_value ep_page_view_default)"
pad_config_pageview="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_PAGEVIEW:-$old_pad_config_pageview}"
# Enable/disable ep_automatic_logut
if grep -q "//.*\"automatic_logut_" $config_file
then
# Disable
old_pad_config_automatic_logout=0
else
# Enable
old_pad_config_automatic_logout=1
fi
pad_config_automatic_logout="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT:-$old_pad_config_automatic_logout}"
# Etherpad skin
old_pad_config_skinname="$(get_config_value skinName)"
if [ "$old_pad_config_skinname" = "no-skin" ]; then
old_pad_config_skinname=noskin
fi
pad_config_skinname="${YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME:-$old_pad_config_skinname}"
if [ "$pad_config_skinname" = "no-skin" ]; then
pad_config_skinname=noskin
fi
# Mypads
if [ -d $final_path/node_modules/ep_mypads ]
then
# Enable
old_mypads=1
else
# Disable
old_mypads=0
fi
mypads="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS:-$old_mypads}"
# Ldap for Mypads
if grep -q "//noldap" $config_file
then
# Disable
old_useldap=0
else
# Enable
old_useldap=1
fi
useldap="${YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP:-$old_useldap}"
# is_public
old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
# Overwrite settings.json file
old_overwrite_settings="$(ynh_app_setting_get --app=$app --key=overwrite_settings)"
overwrite_settings="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS:-$old_overwrite_settings}"
# Overwrite credentials.json file
old_overwrite_credentials="$(ynh_app_setting_get --app=$app --key=overwrite_credentials)"
overwrite_credentials="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS:-$old_overwrite_credentials}"
# Overwrite nginx configuration
old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
# Overwrite systemd configuration
old_overwrite_systemd="$(ynh_app_setting_get --app=$app --key=overwrite_systemd)"
overwrite_systemd="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD:-$old_overwrite_systemd}"
#=================================================
# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND
#=================================================
show_config() {
# here you are supposed to read some config file/database/other then print the values
# ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value"
ynh_return "YNH_CONFIG_MAIN_EXPORT_EXPORT=$export"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_NOCOLORS=$pad_config_nocolors"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOWLINENUMBERS=$pad_config_showlinenumbers"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_CHATANDUSERS=$pad_config_chatandusers"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_ALWAYSSHOWCHAT=$pad_config_alwaysshowchat"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SHOW_MARKDOWN=$pad_config_show_markdown"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_PAGEVIEW=$pad_config_pageview"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_AUTOMATIC_LOGOUT=$pad_config_automatic_logout"
ynh_return "YNH_CONFIG_MAIN_PAD_CONFIGURATION_PAD_CONFIG_SKINNAME=$pad_config_skinname"
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_MYPADS=$mypads"
ynh_return "YNH_CONFIG_MAIN_MYPADS_CONFIGURATION_USELDAP=$useldap"
ynh_return "YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC=$is_public"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SETTINGS=$overwrite_settings"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_CREDENTIALS=$overwrite_credentials"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX=$overwrite_nginx"
ynh_return "YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_SYSTEMD=$overwrite_systemd"
}
#=================================================
# MODIFY THE CONFIGURATION
#=================================================
apply_config() {
#=================================================
# MODIFY ETHERPAD CONFIG
#=================================================
restart_etherpad=0
# Change configuration if needed
# padOptions noColors
if [ "$pad_config_nocolors" != "$old_pad_config_nocolors" ]
then
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_nocolors --value="$pad_config_nocolors"
restart_etherpad=1
fi
# padOptions showLineNumbers
if [ "$pad_config_showlinenumbers" != "$old_pad_config_showlinenumbers" ]
then
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_showlinenumbers --value="$pad_config_showlinenumbers"
restart_etherpad=1
fi
# padOptions chatAndUsers
if [ "$pad_config_chatandusers" != "$old_pad_config_chatandusers" ]
then
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_chatandusers --value="$pad_config_chatandusers"
restart_etherpad=1
fi
# padOptions alwaysShowChat
if [ "$pad_config_alwaysshowchat" != "$old_pad_config_alwaysshowchat" ]
then
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_alwaysshowchat --value="$pad_config_alwaysshowchat"
restart_etherpad=1
fi
# Plugin option ep_markdown_default
if [ "$pad_config_show_markdown" != "$old_pad_config_show_markdown" ]
then
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_show_markdown --value="$pad_config_show_markdown"
restart_etherpad=1
fi
# Plugin option ep_page_view_default
if [ "$pad_config_pageview" != "$old_pad_config_pageview" ]
then
ynh_replace_string --match_string="\(\"ep_page_view_default\" *: \).*," --replace_string="\1$pad_config_pageview," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_pageview --value="$pad_config_pageview"
restart_etherpad=1
fi
# Plugin option ep_automatic_logut
if [ "$pad_config_automatic_logout" != "$old_pad_config_automatic_logout" ]
then
ynh_use_nodejs
pushd "$final_path"
if [ "$pad_config_automatic_logout" = "0" ]
then
ynh_replace_string --match_string="^\(.*\"automatic_logut.*$\)" --replace_string="\/\/\1" --target_file="$config_file"
npm uninstall ep_automatic_logut
else
ynh_replace_string --match_string="^\/\/\(.*\"automatic_logut.*$\)" --replace_string="\1" --target_file="$config_file"
npm install ep_automatic_logut
fi
popd
chown -R $app: $final_path/node_modules
restart_etherpad=1
fi
# Plugin option ep_page_view_default
if [ "$pad_config_skinname" != "$old_pad_config_skinname" ]
then
if [ "$pad_config_skinname" = "noskin" ]; then
pad_config_skinname="no-skin"
fi
ynh_replace_string --match_string="\( *\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$config_file"
ynh_app_setting_set --app=$app --key=pad_config_skinname --value="$pad_config_skinname"
restart_etherpad=1
fi
# Export
if [ "$export" != "$old_export" ]
then
if [ "$export" = "abiword" ]
then
# if abiword isn't installed, call the action add_remove_abiword.
if ! which abiword > /dev/null
then
yunohost app action run $app add_remove_abiword
fi
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1\"$(which abiword)\"," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
elif [ "$export" = "libreoffice" ]
then
# if libreoffice isn't installed, call the action add_remove_libreoffice.
if ! which soffice > /dev/null
then
yunohost app action run $app add_remove_libreoffice
fi
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1\"$(which soffice)\"," --target_file="$config_file"
else
ynh_replace_string --match_string="\(\"abiword\" *: \).*," --replace_string="\1null," --target_file="$config_file"
ynh_replace_string --match_string="\(\"soffice\" *: \).*," --replace_string="\1null," --target_file="$config_file"
fi
ynh_app_setting_set --app=$app --key=export --value="$export"
restart_etherpad=1
fi
# Mypads
if [ "$mypads" != "$old_mypads" ]
then
ynh_use_nodejs
pushd "$final_path"
if [ "$mypads" = "1" ]
then
npm install ep_mypads@${mypads_version}
else
npm uninstall ep_mypads
fi
popd
chown -R $app: $final_path/node_modules
ynh_app_setting_set --app=$app --key=mypads --value="$mypads"
restart_etherpad=1
fi
# Ldap for Mypads
if [ "$useldap" != "$old_useldap" ]
then
if [ "$useldap" = "1" ]
then
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
else
ynh_replace_string --match_string="\(.*\) //useldap" --replace_string="//noldap\1" --target_file="$final_path/settings.json"
fi
ynh_app_setting_set --app=$app --key=useldap --value="$useldap"
restart_etherpad=1
fi
if [ $restart_etherpad -eq 1 ]
then
# Wait for etherpad to be fully started
ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
fi
#=================================================
# MODIFY PUBLIC ACCESSIBILITY
#=================================================
# Change public accessibility
if [ "$is_public" != "$old_is_public" ]
then
if [ "$is_public" = "1" ]
then
yunohost app action run $app public_private --args is_public=1
else
yunohost app action run $app public_private --args is_public=0
fi
fi
#=================================================
# MODIFY OVERWRITTING SETTINGS
#=================================================
# Set overwrite_settings
ynh_app_setting_set --app=$app --key=overwrite_settings --value="$overwrite_settings"
# Set overwrite_credentials
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="$overwrite_credentials"
# Set overwrite_nginx
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
# Set overwrite_systemd
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="$overwrite_systemd"
}
#=================================================
# GENERIC FINALIZATION
#=================================================
# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT
#=================================================
case $1 in
show) show_config;;
apply) apply_config;;
esac

View file

@ -6,11 +6,12 @@
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
# Load common variables for all scripts.
source _variables
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
@ -70,6 +71,10 @@ ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=export --value=$export
ynh_app_setting_set --app=$app --key=mypads --value=$mypads
ynh_app_setting_set --app=$app --key=useldap --value=$useldap
ynh_app_setting_set --app=$app --key=overwrite_settings --value="1"
ynh_app_setting_set --app=$app --key=overwrite_credentials --value="1"
ynh_app_setting_set --app=$app --key=overwrite_nginx --value="1"
ynh_app_setting_set --app=$app --key=overwrite_systemd --value="1"
#=================================================
# STANDARD MODIFICATIONS
@ -158,8 +163,15 @@ ynh_script_progression --message="Installing Etherpad..." --weight=90
# Install dependencies and proceed to the installation
ynh_use_nodejs
"$final_path/bin/installDeps.sh" > $install_log 2>&1 || ( ynh_exec_err cat "$install_log"; false )
npm install forever -g >> $install_log 2>&1 || ( ynh_exec_err cat "$install_log"; false )
(
cd "$final_path"
mkdir -p node_modules
cd node_modules
[ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite
cd ep_etherpad-lite
chown -R $app: $final_path
ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --save --loglevel warn
)
#=================================================
# CONFIGURE ETHERPAD
@ -191,7 +203,7 @@ ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="//noldap\(.*\)" --replace_string="\1 //useldap" --target_file="$final_path/settings.json"
fi
# Calculate and store the config file checksum into the app settings
@ -331,6 +343,9 @@ fi
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
if [ $mypads -eq 1 ]
then
Informations="You can access 2 different admin panels, for etherpad by accessing https://$domain${path_url%/}/admin and for mypads by accessing https://$domain${path_url%/}/mypads/?/admin."
@ -346,6 +361,9 @@ Your credentials for the admin panel are:
- login : $admin
- password : $password
You can configure this app easily by using the experimental config-panel feature $admin_panel/config-panel.
You can also find some specific actions for this app by using the experimental action feature $admin_panel/actions.
If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=install

View file

@ -28,7 +28,7 @@ export=$(ynh_app_setting_get --app=$app --key=export)
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
if ynh_exec_fully_quiet yunohost service status $app
then
ynh_script_progression --message="Removing $app service..."
yunohost service remove $app

View file

@ -6,11 +6,12 @@
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
# Load common variables for all scripts.
source ../settings/scripts/_variables
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
@ -127,8 +128,7 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Reinstalling Etherpad node dependencies..." --weight=17
ynh_use_nodejs
npm cache clean
npm install forever -g >> $install_log 2>&1
ynh_exec_warn_less npm cache clean --force
#=================================================
# RESTORE USER RIGHTS

View file

@ -6,11 +6,12 @@
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
# Load common variables for all scripts.
source _variables
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
@ -29,6 +30,18 @@ export=$(ynh_app_setting_get --app=$app --key=export)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
mypads=$(ynh_app_setting_get --app=$app --key=mypads)
useldap=$(ynh_app_setting_get --app=$app --key=useldap)
overwrite_settings=$(ynh_app_setting_get --app=$app --key=overwrite_settings)
overwrite_credentials=$(ynh_app_setting_get --app=$app --key=overwrite_credentials)
overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
overwrite_systemd=$(ynh_app_setting_get --app=$app --key=overwrite_systemd)
# Optional parameters from config-panel feature
pad_config_nocolors=$(ynh_app_setting_get --app=$app --key=pad_config_nocolors)
pad_config_showlinenumbers=$(ynh_app_setting_get --app=$app --key=pad_config_showlinenumbers)
pad_config_chatandusers=$(ynh_app_setting_get --app=$app --key=pad_config_chatandusers)
pad_config_alwaysshowchat=$(ynh_app_setting_get --app=$app --key=pad_config_alwaysshowchat)
pad_config_show_markdown=$(ynh_app_setting_get --app=$app --key=pad_config_show_markdown)
pad_config_skinname=$(ynh_app_setting_get --app=$app --key=pad_config_skinname)
#=================================================
# CHECK VERSION
@ -98,6 +111,30 @@ if [ -z "$path_url" ]; then
ynh_app_setting_set --app=$app --key=path --value=$path_url
fi
# If overwrite_settings doesn't exist, create it
if [ -z "$overwrite_settings" ]; then
overwrite_settings=1
ynh_app_setting_set $app overwrite_settings $overwrite_settings
fi
# If overwrite_credentials doesn't exist, create it
if [ -z "$overwrite_credentials" ]; then
overwrite_credentials=1
ynh_app_setting_set $app overwrite_credentials $overwrite_credentials
fi
# If overwrite_nginx doesn't exist, create it
if [ -z "$overwrite_nginx" ]; then
overwrite_nginx=1
ynh_app_setting_set $app overwrite_nginx $overwrite_nginx
fi
# If overwrite_systemd doesn't exist, create it
if [ -z "$overwrite_systemd" ]; then
overwrite_systemd=1
ynh_app_setting_set $app overwrite_systemd $overwrite_systemd
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -137,7 +174,7 @@ ynh_systemd_action --action=stop
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --time --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
@ -159,8 +196,11 @@ fi
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
# Overwrite the nginx configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ]
then
ynh_add_nginx_config
fi
#=================================================
# UPGRADE NODEJS
@ -182,17 +222,20 @@ ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_script_progression --message="Upgrading Etherpad npm modules..." --weight=60
# Update the main modules of etherpad
chown -R $app: $final_path
(cd "$final_path/src"
npm cache clean
ynh_exec_warn_less npm update)
ynh_exec_warn_less npm cache clean --force
# Remove package-lock.json to prevent any shit during npm update...
ynh_secure_remove --file="$final_path/src/package-lock.json"
ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" update)
# Then update the additionnal modules
(cd "$final_path"
npm cache clean
ynh_exec_warn_less npm cache clean --force
while read node_module
do
echo "Update $node_module"
ynh_exec_warn_less npm install --upgrade $node_module || true
echo "Update $node_module"
ynh_exec_warn_less ynh_exec_as $app PATH="$nodejs_path:$PATH" "$nodejs_path/npm" install --upgrade $node_module || true
done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")")
#=================================================
@ -205,49 +248,82 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfiguring Etherpad..." --weight=3
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/settings.json"
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/credentials.json"
cp ../conf/settings.json "$final_path/settings.json"
cp ../conf/credentials.json "$final_path/credentials.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
if [ "$export" = "abiword" ]
then
# Get abiword binary path
abiword_path=`which abiword`
# Set the path of abiword into etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
fi
if test -z "$language"; then
# If upgrading from a version which doesn't support translations, set language to English by default
language=en
ynh_app_setting_set --app=$app --key=language --value=$language
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
# Overwrite the settings config file only if it's allowed
if [ $overwrite_settings -eq 1 ]
then
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/settings.json"
cp ../conf/settings.json "$final_path/settings.json"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
fi
if [ "$export" = "abiword" ]
then
# Get abiword binary path
abiword_path=`which abiword`
# Set the path of abiword into etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
fi
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/settings.json"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/credentials.json"
if test -z "$language"; then
# If upgrading from a version which doesn't support translations, set language to English by default
language=en
ynh_app_setting_set --app=$app --key=language --value=$language
fi
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
# Use ldap for mypads
if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
then
ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
fi
# Optional parameters from config-panel feature
if [ -n "$pad_config_nocolors" ]; then
ynh_replace_string --match_string="\(\"noColors\" *: \).*," --replace_string="\1$pad_config_nocolors," --target_file="$final_path/settings.json"
fi
if [ -n "$pad_config_showlinenumbers" ]; then
ynh_replace_string --match_string="\(\"showLineNumbers\" *: \).*," --replace_string="\1$pad_config_showlinenumbers," --target_file="$final_path/settings.json"
fi
if [ -n "$pad_config_chatandusers" ]; then
ynh_replace_string --match_string="\(\"chatAndUsers\" *: \).*," --replace_string="\1$pad_config_chatandusers," --target_file="$final_path/settings.json"
fi
if [ -n "$pad_config_alwaysshowchat" ]; then
ynh_replace_string --match_string="\(\"alwaysShowChat\" *: \).*," --replace_string="\1$pad_config_alwaysshowchat," --target_file="$final_path/settings.json"
fi
if [ -n "$pad_config_show_markdown" ]; then
ynh_replace_string --match_string="\(\"ep_markdown_default\" *: \).*," --replace_string="\1$pad_config_show_markdown," --target_file="$final_path/settings.json"
fi
if [ -n "$pad_config_skinname" ]; then
ynh_replace_string --match_string="\(\"skinName\" *: \).*," --replace_string="\1\"$pad_config_skinname\"," --target_file="$final_path/settings.json"
fi
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/settings.json"
fi
# Overwrite the credentials config file only if it's allowed
if [ $overwrite_credentials -eq 1 ]
then
# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
ynh_backup_if_checksum_is_different --file="$final_path/credentials.json"
cp ../conf/credentials.json "$final_path/credentials.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/credentials.json"
fi
fi
#=================================================
@ -289,15 +365,18 @@ ynh_use_logrotate --non-append
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
# Create a dedicated systemd config
ynh_add_systemd_config
# Overwrite the systemd configuration only if it's allowed
if [ $overwrite_systemd -eq 1 ]
then
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_add_systemd_config
fi
#=================================================
# SOME HACKS
#=================================================
if [ $mypads -eq 1 ]
if [ "$upgrade_type" == "UPGRADE_APP" ] && [ $mypads -eq 1 ]
then
# Find the /div just after the field to open a pad
mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "</div>" | cut -d '-' -f 1)
@ -340,6 +419,47 @@ ynh_script_progression --message="Disabling maintenance mode..." --weight=5
ynh_maintenance_mode_OFF
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
# Build the changelog
# 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}"
# If a html email is required. Apply html to the changelog.
if [ "$admin_mail_html" -eq 1 ]; then
format=html
else
format=plain
fi
ynh_app_changelog --format=$format
if [ $mypads -eq 1 ]
then
Informations="You can access 2 different admin panels, for etherpad by accessing https://$domain${path_url%/}/admin and for mypads by accessing https://$domain${path_url%/}/mypads/?/admin."
else
Informations="You can access the admin panel by accessing https://$domain${path_url%/}/admin."
fi
echo "$Informations
Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
You can configure this app easily by using the experimental config-panel feature $admin_panel/config-panel.
You can also find some specific actions for this app by using the experimental action feature $admin_panel/actions.
If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh
---
Changelog since your last upgrade:
$(cat changelog)" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=upgrade
#=================================================
# END OF SCRIPT
#=================================================