1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-12-24 07:37:04 +00:00

Options dialog updates

This commit is contained in:
John Supplee 2019-03-09 12:29:37 +02:00
parent 99776c1513
commit 48f167876c
2 changed files with 49 additions and 13 deletions

View File

@ -6,40 +6,73 @@ import sys
import os import os
class TestApp(npyscreen.NPSApp): class OptionsApp(npyscreen.NPSApp):
def main(self): def main(self):
# These lines create the form and populate it with widgets. # These lines create the form and populate it with widgets.
# A fairly complex screen in only 8 or so lines of code - a line for each control. # A fairly complex screen in only 8 or so lines of code - a line for each control.
npyscreen.setTheme(npyscreen.Themes.BlackOnWhiteTheme) npyscreen.setTheme(npyscreen.Themes.BlackOnWhiteTheme)
form = npyscreen.Form(name = "Mail-in-a-Box Options",) form = npyscreen.Form(name = "Mail-in-a-Box Options",)
postgrey_text = form.add( form.add(
npyscreen.TitleFixedText, npyscreen.TitleFixedText,
name="POSTGREY", name="POSTGREY",
value="Should Postgrey be used to greylist messages?", value="",
editable=False
)
form.add(
npyscreen.MultiLineEdit,
value="The Postgrey service greylists incoming messages from unknown senders.\n"
"It can be useful for fighting spam but often causes message delivery\n"
"delays of several minutes.",
max_height=4,
editable=False editable=False
) )
form.add(npyscreen.FixedText)
postgrey_text = form.add( form.add(
npyscreen.MultiLineEditable, npyscreen.TitleFixedText,
name="POSTSRSD", name="POSTSRSD",
value="",
editable=False
)
form.add(
npyscreen.MultiLineEdit,
value="The PostSRSd daemon performs return path rewriting using the SRS protocol.\n" value="The PostSRSd daemon performs return path rewriting using the SRS protocol.\n"
"Not that all messages, including locally delivered mail will have their return\n" "Not that all messages, including locally delivered mail will have their return\n"
"paths rewritten", "paths rewritten",
max_height=4, max_height=4,
editable=False editable=False
) )
form.add(npyscreen.FixedText)
form.add(
npyscreen.TitleFixedText,
name="POLICY_SPF",
value="",
editable=False
)
form.add(
npyscreen.MultiLineEdit,
value=""
"The policy SPF service checks the SPF of incoming mails and rejects those\n"
"that do not qualify. This helps to prevent spoofing, but if valid mail does\n"
"not have SPF configured properly it will be rejected.",
max_height=4,
editable=False
)
init_values = []
if int(os.getenv('POSTGREY', 1)) == 1:
init_values.append(0)
if int(os.getenv('POSTSRSD', 0)) == 1:
init_values.append(1)
if int(os.getenv('POLICY_SPF', 0)) == 1:
init_values.append(2)
options = form.add( options = form.add(
npyscreen.TitleMultiSelect, npyscreen.TitleMultiSelect,
max_height=-2, max_height=-2,
value = [ value=init_values,
int(os.getenv('POSTGREY', 1)),
int(os.getenv('POSTSRSD', 0)),
int(os.getenv('POLICY_SPF', 0))
],
name="Options", name="Options",
values= ["POSTGREY","POSTSRSD","POLICY_SPF"], values= ["POSTGREY","POSTSRSD","POLICY_SPF"],
scroll_exit=True scroll_exit=True
@ -56,5 +89,5 @@ class TestApp(npyscreen.NPSApp):
if __name__ == "__main__": if __name__ == "__main__":
App = TestApp() App = OptionsApp()
App.run() App.run()

View File

@ -195,6 +195,9 @@ if [ -z "${STORAGE_ROOT:-}" ]; then
fi fi
python3 setup/options-dialog.py python3 setup/options-dialog.py
source ./_options.sh
rm _optoins.sh
# Show the configuration, since the user may have not entered it manually. # Show the configuration, since the user may have not entered it manually.
echo echo