mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
www: get actual account restrictions from chatmail.ini
This commit is contained in:
@@ -130,7 +130,15 @@ def test_cmd(args, out):
|
|||||||
out.check_call(f"{sys.executable} -m pip install deltachat")
|
out.check_call(f"{sys.executable} -m pip install deltachat")
|
||||||
|
|
||||||
pytest_path = shutil.which("pytest")
|
pytest_path = shutil.which("pytest")
|
||||||
pytest_args = [pytest_path, "cmdeploy/src/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
|
pytest_args = [
|
||||||
|
pytest_path,
|
||||||
|
"cmdeploy/src/",
|
||||||
|
"-n4",
|
||||||
|
"-rs",
|
||||||
|
"-x",
|
||||||
|
"-vrx",
|
||||||
|
"--durations=5",
|
||||||
|
]
|
||||||
if args.slow:
|
if args.slow:
|
||||||
pytest_args.append("--slow")
|
pytest_args.append("--slow")
|
||||||
ret = out.run_ret(pytest_args)
|
ret = out.run_ret(pytest_args)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class TestEndToEndDeltaChat:
|
|||||||
Example input: 100M, 2.4T, 500 K
|
Example input: 100M, 2.4T, 500 K
|
||||||
"""
|
"""
|
||||||
units = {"B": 1, "K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
|
units = {"B": 1, "K": 2**10, "M": 2**20, "G": 2**30, "T": 2**40}
|
||||||
size = re.sub(r'([KMGT])', r' \1', limit.upper())
|
size = re.sub(r"([KMGT])", r" \1", limit.upper())
|
||||||
number, unit = [string.strip() for string in size.split()]
|
number, unit = [string.strip() for string in size.split()]
|
||||||
return int(float(number) * units[unit])
|
return int(float(number) * units[unit])
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,53 @@ def build_webpages(src_dir, build_dir, config):
|
|||||||
print(traceback.format_exc())
|
print(traceback.format_exc())
|
||||||
|
|
||||||
|
|
||||||
|
def timespan_to_english(timespan):
|
||||||
|
val = int(timespan[:-1])
|
||||||
|
c = timespan[-1].lower()
|
||||||
|
match c:
|
||||||
|
case "y":
|
||||||
|
return f"{val} years"
|
||||||
|
case "m":
|
||||||
|
return f"{val} months"
|
||||||
|
case "w":
|
||||||
|
return f"{val} weeks"
|
||||||
|
case "d":
|
||||||
|
return f"{val} days"
|
||||||
|
case "h":
|
||||||
|
return f"{val} hours"
|
||||||
|
case "c":
|
||||||
|
return f"{val} seconds"
|
||||||
|
case _:
|
||||||
|
raise ValueError(
|
||||||
|
c
|
||||||
|
+ " is not a valid time unit. Try [y]ears, [w]eeks, [d]ays, or [h]ours"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def int_to_english(number):
|
||||||
|
if number >= 0 and number <= 12:
|
||||||
|
a = [
|
||||||
|
"zero",
|
||||||
|
"one",
|
||||||
|
"two",
|
||||||
|
"three",
|
||||||
|
"four",
|
||||||
|
"five",
|
||||||
|
"six",
|
||||||
|
"seven",
|
||||||
|
"eight",
|
||||||
|
"nine",
|
||||||
|
"ten",
|
||||||
|
"eleven",
|
||||||
|
"twelve",
|
||||||
|
]
|
||||||
|
return a[number]
|
||||||
|
elif number <= 50:
|
||||||
|
return str(number)
|
||||||
|
if number > 50:
|
||||||
|
return "more"
|
||||||
|
|
||||||
|
|
||||||
def _build_webpages(src_dir, build_dir, config):
|
def _build_webpages(src_dir, build_dir, config):
|
||||||
mail_domain = config.mail_domain
|
mail_domain = config.mail_domain
|
||||||
assert src_dir.exists(), src_dir
|
assert src_dir.exists(), src_dir
|
||||||
@@ -48,6 +95,18 @@ def _build_webpages(src_dir, build_dir, config):
|
|||||||
for path in src_dir.iterdir():
|
for path in src_dir.iterdir():
|
||||||
if path.suffix == ".md":
|
if path.suffix == ".md":
|
||||||
render_vars, content = prepare_template(path)
|
render_vars, content = prepare_template(path)
|
||||||
|
render_vars["username_min_length"] = int_to_english(
|
||||||
|
config.username_min_length
|
||||||
|
)
|
||||||
|
render_vars["username_max_length"] = int_to_english(
|
||||||
|
config.username_max_length
|
||||||
|
)
|
||||||
|
render_vars["password_min_length"] = int_to_english(
|
||||||
|
config.password_min_length
|
||||||
|
)
|
||||||
|
render_vars["delete_mails_after"] = timespan_to_english(
|
||||||
|
config.delete_mails_after
|
||||||
|
)
|
||||||
target = build_dir.joinpath(path.stem + ".html")
|
target = build_dir.joinpath(path.stem + ".html")
|
||||||
|
|
||||||
# recursive jinja2 rendering
|
# recursive jinja2 rendering
|
||||||
|
|||||||
@@ -9,10 +9,21 @@ In the Delta Chat account setup
|
|||||||
you may tap `LOG INTO YOUR E-MAIL ACCOUNT`
|
you may tap `LOG INTO YOUR E-MAIL ACCOUNT`
|
||||||
and fill the two fields like this:
|
and fill the two fields like this:
|
||||||
|
|
||||||
- `Address`: invent a word with *exactly* nine characters
|
- `Address`: invent a word with
|
||||||
and append `@{{config.mail_domain}}` to it.
|
{% if username_min_length == username_max_length %}
|
||||||
|
*exactly* {{ username_min_length }}
|
||||||
|
{% else %}
|
||||||
|
{{ username_min_length}}
|
||||||
|
{% if username_max_length == "more" %}
|
||||||
|
or more
|
||||||
|
{% else %}
|
||||||
|
to {{ username_max_length }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
characters
|
||||||
|
and append `@{{config.mail_domain}}` to it.
|
||||||
|
|
||||||
- `Password`: invent at least 9 characters.
|
- `Password`: invent at least {{ password_min_length }} characters.
|
||||||
|
|
||||||
If the e-mail address is not yet taken, you'll get that account.
|
If the e-mail address is not yet taken, you'll get that account.
|
||||||
The first login sets your password.
|
The first login sets your password.
|
||||||
@@ -24,11 +35,11 @@ The first login sets your password.
|
|||||||
{{config.mail_domain}} but setting up contact via [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
{{config.mail_domain}} but setting up contact via [QR invite codes](https://delta.chat/en/help#howtoe2ee)
|
||||||
allows your messages to pass freely to any outside recipients.
|
allows your messages to pass freely to any outside recipients.
|
||||||
|
|
||||||
- You may send up to 60 messages per minute
|
- You may send up to {{ config.max_user_send_per_minute }} messages per minute.
|
||||||
|
|
||||||
- Seen messages are removed 40 days after arriving on the server
|
- Seen messages are removed {{ delete_mails_after }} after arriving on the server.
|
||||||
|
|
||||||
- You can store up to [100MB messages on the server](https://delta.chat/en/help#what-happens-if-i-turn-on-delete-old-messages-from-server)
|
- You can store up to [{{ config.max_mailbox_size }} messages on the server](https://delta.chat/en/help#what-happens-if-i-turn-on-delete-old-messages-from-server).
|
||||||
|
|
||||||
|
|
||||||
### Who are the operators? Which software is running?
|
### Who are the operators? Which software is running?
|
||||||
|
|||||||
Reference in New Issue
Block a user