From 301a199172ed9a6b502658b1b7459f57b2b12ce7 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Tue, 31 Oct 2023 08:29:52 +0100 Subject: [PATCH] Enable allow_email and add a post install doc (#39) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Enable allow_email and add post install doc * WIP post config with API * Auto-update README * tests: add missing args for upgrade from * tests: add missing args for upgrade from² --------- Co-authored-by: yunohost-bot --- README.md | 1 - README_fr.md | 1 - doc/POST_INSTALL.md | 16 ++++++++++++++++ manifest.toml | 12 ++++++++---- scripts/_common.sh | 23 +++++++++++++++++++++++ tests.toml | 3 +++ 6 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 doc/POST_INSTALL.md diff --git a/README.md b/README.md index db5d485..58eee85 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ Listmonk is a standalone, self-hosted, newsletter and mailing list manager. It i * Official app website: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index f5308cf..da6b4c2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -32,7 +32,6 @@ Listmonk est un gestionnaire de newsletter et de liste de diffusion autonome et * Site officiel de l’app : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md new file mode 100644 index 0000000..fbf8d69 --- /dev/null +++ b/doc/POST_INSTALL.md @@ -0,0 +1,16 @@ +You have to configure SMTP from the web interface at https://__DOMAIN__/admin + +Visit Settings -> General and replace these values: + +- Root URL: https://__DOMAIN__ +- Default from email: listmonk <__APP__@__DOMAIN__> + +Visit Settings -> SMTP and replace with these values: + +- Host: 127.0.0.1 +- Port: 25 +- Auth protocol: PLAIN +- User: __APP__ +- Password: __MAIL_PWD__ + +Then, test the connection diff --git a/manifest.toml b/manifest.toml index 1b5ca1d..08b4076 100644 --- a/manifest.toml +++ b/manifest.toml @@ -34,9 +34,6 @@ ram.runtime = "50M" type = "group" default = "visitors" - [install.admin] - type = "user" - [resources] [resources.sources] @@ -50,7 +47,13 @@ ram.runtime = "50M" arm64.sha256 = "832c5a34ed78446c179ed5423cdbce51d3e51333c1ea6cf11c74b63e0776193a" in_subdir = false + autoupdate.strategy = "latest_github_release" + autoupdate.asset.amd64 = ".*_linux_amd64.tar.gz" + autoupdate.asset.armhf = ".*_linux_armv7.tar.gz" + autoupdate.asset.arm64 = ".*_linux_arm64.tar.gz" + [resources.system_user] + allow_email = true [resources.ports] @@ -65,10 +68,11 @@ ram.runtime = "50M" admin.auth_header = false admin.allowed = "admins" + # internal API, should not be allowed to visitors api.url = "/api" api.show_tile = false api.auth_header = false - api.allowed = "visitors" + api.allowed = "admins" [resources.apt] packages = "postgresql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..35ad7ea 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,29 @@ # PERSONAL HELPERS #================================================= +# FIXME https://listmonk.app/docs/swagger/#/Settings/getSettings +_listmonk_configure_with_api () { + python -c """ +from urllib.request import urlopen, Request +with urlopen('http://localhost:$port/api/settings') as url: + data = json.load(url) + +data['data']['app.root_url'] = "https://$domain" +data['data']['app.from_email'] = "listmonk " +data['data']['smtp'][0]['host'] = "127.0.0.1" +data['data']['smtp'][0]['auth_protocol'] = "plain" +data['data']['smtp'][0]['username'] = "$app" +data['data']['smtp'][0]['password'] = "$mail_pwd" + +data_bytes = bytes(json.dumps(data), encoding='utf8') + +request = Request('http://localhost:$port/api/settings', method='PUT', data=data_bytes, headers={'Content-Type': 'application/json'}) + +with urlopen(request) as response: + print(response.read()) +""" +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/tests.toml b/tests.toml index a26dece..cc52fda 100644 --- a/tests.toml +++ b/tests.toml @@ -7,3 +7,6 @@ test_format = 1.0 # ------------------------------- test_upgrade_from.4b1297d8.name = "Upgrade from 2.3.0" + test_upgrade_from.4b1297d8.args.admin = "package_checker" + test_upgrade_from.4b1297d8.args.password = "much_s3cur1ty" + test_upgrade_from.4b1297d8.args.domain = "domain.tld"