Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support binding IPv4 AND IPv6 instead of just either one or the other #2593

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bazarr/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def base_url_slash_cleaner(uri):


def validate_ip_address(ip_string):
if ip_string == '*':
return True
try:
ip_address(ip_string)
return True
Expand Down Expand Up @@ -67,7 +69,7 @@ def check_parser_binary(value):
# general section
Validator('general.flask_secret_key', must_exist=True, default=hexlify(os.urandom(16)).decode(),
is_type_of=str),
Validator('general.ip', must_exist=True, default='0.0.0.0', is_type_of=str, condition=validate_ip_address),
Validator('general.ip', must_exist=True, default='*', is_type_of=str, condition=validate_ip_address),
Validator('general.port', must_exist=True, default=6767, is_type_of=int, gte=1, lte=65535),
Validator('general.base_url', must_exist=True, default='', is_type_of=str),
Validator('general.path_mappings', must_exist=True, default=[], is_type_of=list),
Expand Down
9 changes: 6 additions & 3 deletions bazarr/app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ def formatException(self, record):

class UnwantedWaitressMessageFilter(logging.Filter):
def filter(self, record):
if settings.general.debug:
# no filtering in debug mode
if settings.general.debug or "BAZARR" in record.msg:
# no filtering in debug mode or if originating from us
return True

if record.level != loggin.ERROR:
return False

unwantedMessages = [
"Exception while serving /api/socket.io/",
['Session is disconnected', 'Session not found'],
Expand Down Expand Up @@ -161,7 +164,7 @@ def configure_logging(debug=False):
logging.getLogger("websocket").setLevel(logging.CRITICAL)
logging.getLogger("ga4mp.ga4mp").setLevel(logging.ERROR)

logging.getLogger("waitress").setLevel(logging.ERROR)
logging.getLogger("waitress").setLevel(logging.INFO)
morpheus65535 marked this conversation as resolved.
Show resolved Hide resolved
logging.getLogger("waitress").addFilter(UnwantedWaitressMessageFilter())
logging.getLogger("knowit").setLevel(logging.CRITICAL)
logging.getLogger("enzyme").setLevel(logging.CRITICAL)
Expand Down
5 changes: 2 additions & 3 deletions bazarr/app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def configure_server(self):
self.connected = True
except OSError as error:
if error.errno == errno.EADDRNOTAVAIL:
logging.exception("BAZARR cannot bind to specified IP, trying with default (0.0.0.0)")
logging.exception("BAZARR cannot bind to specified IP, trying with 0.0.0.0")
self.address = '0.0.0.0'
self.connected = False
super(Server, self).__init__()
Expand All @@ -76,8 +76,7 @@ def interrupt_handler(self, signum, frame):
self.shutdown(EXIT_INTERRUPT)

def start(self):
logging.info(f'BAZARR is started and waiting for request on http://{self.server.effective_host}:'
f'{self.server.effective_port}')
self.server.print_listen("BAZARR is started and waiting for requests on: http://{}:{}")
morpheus65535 marked this conversation as resolved.
Show resolved Hide resolved
signal.signal(signal.SIGINT, self.interrupt_handler)
try:
self.server.run()
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/Settings/General/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const SettingsGeneralView: FunctionComponent = () => {
<Section header="Host">
<Text
label="Address"
placeholder="0.0.0.0"
placeholder="*"
settingKey="settings-general-ip"
></Text>
<Message>Valid IPv4 address or '0.0.0.0' for all interfaces</Message>
<Message>Valid IP address or '*' for all interfaces</Message>
<Number
label="Port"
placeholder="6767"
Expand Down