mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +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>"
|
||||
)
|
||||
# Signal the main thread to shut down the server
|
||||
# Signal the main thread to shut down the server
|
||||
shutdown_server.set()
|
||||
else:
|
||||
server_error = "Missing 'code' parameter in callback URL."
|
||||
self.send_response(400)
|
||||
self.send_header("Content-type", "text/html")
|
||||
# Redirect to aider website if 'code' is missing (e.g., user visited manually)
|
||||
self.send_response(302) # Found (temporary redirect)
|
||||
self.send_header("Location", urls.website)
|
||||
self.end_headers()
|
||||
self.wfile.write(
|
||||
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>"
|
||||
)
|
||||
# No need to set server_error, just redirect and shut down
|
||||
shutdown_server.set()
|
||||
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.wfile.write(b"Not Found")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue