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:
parent
99776c1513
commit
48f167876c
@ -6,40 +6,73 @@ import sys
|
||||
import os
|
||||
|
||||
|
||||
class TestApp(npyscreen.NPSApp):
|
||||
class OptionsApp(npyscreen.NPSApp):
|
||||
def main(self):
|
||||
# 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.
|
||||
npyscreen.setTheme(npyscreen.Themes.BlackOnWhiteTheme)
|
||||
|
||||
form = npyscreen.Form(name = "Mail-in-a-Box Options",)
|
||||
postgrey_text = form.add(
|
||||
form.add(
|
||||
npyscreen.TitleFixedText,
|
||||
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
|
||||
)
|
||||
form.add(npyscreen.FixedText)
|
||||
|
||||
postgrey_text = form.add(
|
||||
npyscreen.MultiLineEditable,
|
||||
form.add(
|
||||
npyscreen.TitleFixedText,
|
||||
name="POSTSRSD",
|
||||
value="",
|
||||
editable=False
|
||||
)
|
||||
form.add(
|
||||
npyscreen.MultiLineEdit,
|
||||
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"
|
||||
"paths rewritten",
|
||||
max_height=4,
|
||||
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(
|
||||
npyscreen.TitleMultiSelect,
|
||||
max_height=-2,
|
||||
value = [
|
||||
int(os.getenv('POSTGREY', 1)),
|
||||
int(os.getenv('POSTSRSD', 0)),
|
||||
int(os.getenv('POLICY_SPF', 0))
|
||||
],
|
||||
value=init_values,
|
||||
name="Options",
|
||||
values= ["POSTGREY","POSTSRSD","POLICY_SPF"],
|
||||
scroll_exit=True
|
||||
@ -56,5 +89,5 @@ class TestApp(npyscreen.NPSApp):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
App = TestApp()
|
||||
App = OptionsApp()
|
||||
App.run()
|
||||
|
@ -195,6 +195,9 @@ if [ -z "${STORAGE_ROOT:-}" ]; then
|
||||
fi
|
||||
|
||||
python3 setup/options-dialog.py
|
||||
source ./_options.sh
|
||||
rm _optoins.sh
|
||||
|
||||
|
||||
# Show the configuration, since the user may have not entered it manually.
|
||||
echo
|
||||
|
Loading…
Reference in New Issue
Block a user