mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
feat: Redirect callback URL to website if code param is missing
This commit is contained in:
parent
f124cdbb6f
commit
5d77eb1314
1 changed files with 8 additions and 9 deletions
|
@ -195,20 +195,19 @@ def start_openrouter_oauth_flow(io, analytics):
|
||||||
b"You can close this browser tab.</p></body></html>"
|
b"You can close this browser tab.</p></body></html>"
|
||||||
)
|
)
|
||||||
# Signal the main thread to shut down the server
|
# Signal the main thread to shut down the server
|
||||||
|
# Signal the main thread to shut down the server
|
||||||
shutdown_server.set()
|
shutdown_server.set()
|
||||||
else:
|
else:
|
||||||
server_error = "Missing 'code' parameter in callback URL."
|
# Redirect to aider website if 'code' is missing (e.g., user visited manually)
|
||||||
self.send_response(400)
|
self.send_response(302) # Found (temporary redirect)
|
||||||
self.send_header("Content-type", "text/html")
|
self.send_header("Location", urls.website)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(
|
# No need to set server_error, just redirect and shut down
|
||||||
b"<html><body><h1>Error</h1>"
|
|
||||||
b"<p>Missing 'code' parameter in callback URL.</p>"
|
|
||||||
b"<p>Please check the Aider terminal.</p></body></html>"
|
|
||||||
)
|
|
||||||
shutdown_server.set()
|
shutdown_server.set()
|
||||||
else:
|
else:
|
||||||
self.send_response(404)
|
# Redirect anything else to the main website as well
|
||||||
|
self.send_response(302)
|
||||||
|
self.send_header("Location", urls.website)
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(b"Not Found")
|
self.wfile.write(b"Not Found")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue