mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## untagged
|
## untagged
|
||||||
|
|
||||||
|
- Make www upload path configurable
|
||||||
|
([#618](https://github.com/chatmail/relay/pull/618))
|
||||||
|
|
||||||
- Check whether GCC is installed in initenv.sh
|
- Check whether GCC is installed in initenv.sh
|
||||||
([#608](https://github.com/chatmail/relay/pull/608))
|
([#608](https://github.com/chatmail/relay/pull/608))
|
||||||
|
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -255,6 +255,18 @@ This starts a local live development cycle for chatmail web pages:
|
|||||||
|
|
||||||
- Starts a browser window automatically where you can "refresh" as needed.
|
- Starts a browser window automatically where you can "refresh" as needed.
|
||||||
|
|
||||||
|
#### Custom web pages
|
||||||
|
|
||||||
|
You can skip uploading a web page
|
||||||
|
by setting `www_folder=disabled` in `chatmail.ini`.
|
||||||
|
|
||||||
|
If you want to manage your web pages outside this git repository,
|
||||||
|
you can set `www_folder` in `chatmail.ini` to a custom directory on your computer.
|
||||||
|
`cmdeploy run` will upload it as the server's home page,
|
||||||
|
and if it contains a `src/index.md` file,
|
||||||
|
will build it with hugo.
|
||||||
|
|
||||||
|
|
||||||
## Mailbox directory layout
|
## Mailbox directory layout
|
||||||
|
|
||||||
Fresh chatmail addresses have a mailbox directory that contains:
|
Fresh chatmail addresses have a mailbox directory that contains:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class Config:
|
|||||||
self.password_min_length = int(params["password_min_length"])
|
self.password_min_length = int(params["password_min_length"])
|
||||||
self.passthrough_senders = params["passthrough_senders"].split()
|
self.passthrough_senders = params["passthrough_senders"].split()
|
||||||
self.passthrough_recipients = params["passthrough_recipients"].split()
|
self.passthrough_recipients = params["passthrough_recipients"].split()
|
||||||
|
self.www_folder = params.get("www_folder")
|
||||||
self.filtermail_smtp_port = int(params["filtermail_smtp_port"])
|
self.filtermail_smtp_port = int(params["filtermail_smtp_port"])
|
||||||
self.filtermail_smtp_port_incoming = int(
|
self.filtermail_smtp_port_incoming = int(
|
||||||
params["filtermail_smtp_port_incoming"]
|
params["filtermail_smtp_port_incoming"]
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from io import StringIO
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from chatmaild.config import Config, read_config
|
from chatmaild.config import Config, read_config
|
||||||
from pyinfra import facts, host
|
from pyinfra import facts, host, logger
|
||||||
from pyinfra.api import FactBase
|
from pyinfra.api import FactBase
|
||||||
from pyinfra.facts.files import File
|
from pyinfra.facts.files import File
|
||||||
from pyinfra.facts.server import Sysctl
|
from pyinfra.facts.server import Sysctl
|
||||||
@@ -751,12 +751,24 @@ def deploy_chatmail(config_path: Path, disable_mail: bool) -> None:
|
|||||||
packages=["fcgiwrap"],
|
packages=["fcgiwrap"],
|
||||||
)
|
)
|
||||||
|
|
||||||
www_path = importlib.resources.files(__package__).joinpath("../../../www").resolve()
|
reporoot = importlib.resources.files(__package__).joinpath("../../../").resolve()
|
||||||
|
www_path = Path(config.www_folder)
|
||||||
build_dir = www_path.joinpath("build")
|
# if www_folder was not set, use default directory
|
||||||
src_dir = www_path.joinpath("src")
|
if not config.www_folder:
|
||||||
build_webpages(src_dir, build_dir, config)
|
www_path = reporoot.joinpath("www")
|
||||||
files.rsync(f"{build_dir}/", "/var/www/html", flags=["-avz"])
|
# if www_folder was set to a non-existing folder, skip upload
|
||||||
|
if not www_path.is_dir():
|
||||||
|
logger.warning("Building web pages is disabled in chatmail.ini, skipping")
|
||||||
|
else:
|
||||||
|
build_dir = www_path.joinpath("build")
|
||||||
|
src_dir = www_path.joinpath("src")
|
||||||
|
# if www_folder is a hugo page, build it
|
||||||
|
if src_dir.joinpath("index.md").is_file():
|
||||||
|
build_webpages(src_dir, build_dir, config)
|
||||||
|
# if it is not a hugo page, upload it as is
|
||||||
|
else:
|
||||||
|
build_dir = www_path
|
||||||
|
files.rsync(f"{build_dir}/", "/var/www/html", flags=["-avz"])
|
||||||
|
|
||||||
_install_remote_venv_with_chatmaild(config)
|
_install_remote_venv_with_chatmaild(config)
|
||||||
debug = False
|
debug = False
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import importlib.resources
|
|||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import webbrowser
|
import webbrowser
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
from chatmaild.config import read_config
|
from chatmaild.config import read_config
|
||||||
@@ -106,7 +107,9 @@ def main():
|
|||||||
config = read_config(inipath)
|
config = read_config(inipath)
|
||||||
config.webdev = True
|
config.webdev = True
|
||||||
assert config.mail_domain
|
assert config.mail_domain
|
||||||
www_path = reporoot.joinpath("www")
|
www_path = Path(config.www_folder)
|
||||||
|
if not config.www_folder:
|
||||||
|
www_path = reporoot.joinpath("www")
|
||||||
src_path = www_path.joinpath("src")
|
src_path = www_path.joinpath("src")
|
||||||
stats = None
|
stats = None
|
||||||
build_dir = www_path.joinpath("build")
|
build_dir = www_path.joinpath("build")
|
||||||
|
|||||||
Reference in New Issue
Block a user