doploy-cli 0.2.5__tar.gz → 0.2.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doploy-cli
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: doploy CLI: watch builds, read logs, and drive Odoo deployments from a terminal
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://doploy.io
@@ -183,8 +183,12 @@ def _free_port() -> int:
183
183
  return s.getsockname()[1]
184
184
 
185
185
 
186
- def _wait_for_callback(port: int, state: str, timeout: float = 300.0) -> str:
187
- """Serve one loopback request and return the OAuth `code` it carried."""
186
+ def _wait_for_callback(port: int, state: str, done_url: str, timeout: float = 300.0) -> str:
187
+ """Serve one loopback request and return the OAuth `code` it carried.
188
+
189
+ The browser is sent on to ``done_url?status=...`` (a branded page hosted by
190
+ the doploy server) rather than shown bare text from this loopback server.
191
+ """
188
192
  from urllib.parse import parse_qs, urlparse
189
193
  result: dict = {}
190
194
 
@@ -192,15 +196,15 @@ def _wait_for_callback(port: int, state: str, timeout: float = 300.0) -> str:
192
196
  def do_GET(self): # noqa: N802
193
197
  q = parse_qs(urlparse(self.path).query)
194
198
  if q.get('state', [''])[0] != state:
195
- body, result['error'] = 'State mismatch. Close this tab and retry.', 'state mismatch'
199
+ status, result['error'] = 'error', 'state mismatch'
196
200
  elif q.get('error'):
197
- body, result['error'] = 'Login cancelled. You can close this tab.', q['error'][0]
201
+ status, result['error'] = 'cancelled', q['error'][0]
198
202
  else:
199
- body, result['code'] = 'Logged in to doploy. You can close this tab.', q.get('code', [''])[0]
200
- self.send_response(200)
201
- self.send_header('Content-Type', 'text/html')
203
+ status, result['code'] = 'ok', q.get('code', [''])[0]
204
+ self.send_response(302)
205
+ self.send_header('Location', f'{done_url}?status={status}')
206
+ self.send_header('Content-Length', '0')
202
207
  self.end_headers()
203
- self.wfile.write(f'<html><body style="font-family:sans-serif"><p>{body}</p></body></html>'.encode())
204
208
 
205
209
  def log_message(self, *a): # silence
206
210
  pass
@@ -241,7 +245,7 @@ def _browser_login(base: str) -> None:
241
245
  print('Opening your browser to sign in to doploy. If it does not open, visit:')
242
246
  print(f' {url}')
243
247
  webbrowser.open(url)
244
- code = _wait_for_callback(port, state)
248
+ code = _wait_for_callback(port, state, f'{issuer}/cli/complete')
245
249
 
246
250
  tok = _oauth_token_request(base, {
247
251
  'grant_type': 'authorization_code', 'code': code, 'redirect_uri': redirect_uri,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: doploy-cli
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: doploy CLI: watch builds, read logs, and drive Odoo deployments from a terminal
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://doploy.io
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "doploy-cli"
7
- version = "0.2.5"
7
+ version = "0.2.6"
8
8
  description = "doploy CLI: watch builds, read logs, and drive Odoo deployments from a terminal"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
File without changes
File without changes
File without changes