mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-19 20:14:13 -04:00
When shutting down the web server, only use basic auth if there is a password -- this avoids warnings when running tests
This commit is contained in:
parent
699884df80
commit
29620cb39c
1 changed files with 9 additions and 4 deletions
|
@ -386,10 +386,15 @@ class Web:
|
||||||
# To stop flask, load http://shutdown:[shutdown_password]@127.0.0.1/[shutdown_password]/shutdown
|
# To stop flask, load http://shutdown:[shutdown_password]@127.0.0.1/[shutdown_password]/shutdown
|
||||||
# (We're putting the shutdown_password in the path as well to make routing simpler)
|
# (We're putting the shutdown_password in the path as well to make routing simpler)
|
||||||
if self.running:
|
if self.running:
|
||||||
requests.get(
|
if self.password:
|
||||||
f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown",
|
requests.get(
|
||||||
auth=requests.auth.HTTPBasicAuth("onionshare", self.password),
|
f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown",
|
||||||
)
|
auth=requests.auth.HTTPBasicAuth("onionshare", self.password),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
requests.get(
|
||||||
|
f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown"
|
||||||
|
)
|
||||||
|
|
||||||
# Reset any password that was in use
|
# Reset any password that was in use
|
||||||
self.password = None
|
self.password = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue