torre 0.3.2.dev1__py3-none-any.whl → 0.3.2.dev2__py3-none-any.whl

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.
torre/__init__.py CHANGED
@@ -3,4 +3,4 @@
3
3
  Run the studio with `python -m torre.server.studio`, the command line with `python -m torre`.
4
4
  """
5
5
 
6
- __version__ = '0.3.2.dev1'
6
+ __version__ = '0.3.2.dev2'
torre/cli.py CHANGED
@@ -45,6 +45,8 @@ def parser():
45
45
  commands = top.add_subparsers(dest='command', required=True)
46
46
 
47
47
  serve = commands.add_parser('serve', parents=[common], help='start the local web app')
48
+ serve.add_argument('--host', default=argparse.SUPPRESS,
49
+ help='address to listen on (default: TORRE_HOST or 127.0.0.1)')
48
50
  serve.add_argument('--port', type=port_number, default=1886)
49
51
  serve.add_argument('--open-browser', action='store_true')
50
52
  serve.add_argument('--proxied', action='store_true', help='serve behind a same-origin proxy such as Vela')
@@ -101,6 +103,8 @@ def run_serve(args):
101
103
  '(or npm --prefix web run build).')
102
104
  from torre.server import studio
103
105
  argv = ['--data-dir', str(args.data_dir), '--port', str(args.port)]
106
+ if 'host' in args:
107
+ argv += ['--host', args.host]
104
108
  if args.open_browser:
105
109
  argv.append('--open-browser')
106
110
  if args.proxied:
torre/server/studio.py CHANGED
@@ -170,7 +170,7 @@ class Handler(BaseHTTPRequestHandler):
170
170
  return None
171
171
  # Keep this loopback application inaccessible to cross-origin form submissions.
172
172
  origin = self.headers.get('Origin')
173
- if not PROXIED and origin and origin != 'http://' + host:
173
+ if not PROXIED and origin and origin not in ('http://' + host, 'https://' + host):
174
174
  return 'Cross-origin requests are not allowed.', 403
175
175
  if self.headers.get('X-Chess-Studio') != '1':
176
176
  return 'Cross-origin requests are not allowed.', 403
@@ -248,6 +248,8 @@ class Handler(BaseHTTPRequestHandler):
248
248
  def main(argv=None):
249
249
  global PROXIED, ALLOWED_HOSTS
250
250
  parser = argparse.ArgumentParser(description=__doc__)
251
+ parser.add_argument('--host', default=os.environ.get('TORRE_HOST', '127.0.0.1'),
252
+ help='address to listen on (default: TORRE_HOST or 127.0.0.1; 0.0.0.0 in a container)')
251
253
  parser.add_argument('--port', type=int, default=1886) # first World Championship, Steinitz–Zukertort
252
254
  parser.add_argument('--open-browser', action='store_true')
253
255
  parser.add_argument('--data-dir', default=str(paths.DATA),
@@ -264,8 +266,8 @@ def main(argv=None):
264
266
  ALLOWED_HOSTS = args.allow_host + hosts.from_env()
265
267
  masters.start_fill() # a fresh install fetches the legends' games in the background
266
268
  api_games.auto_analyze() # games imported but never analyzed (or analyzed by an older scoring) catch up now
267
- server = ThreadingHTTPServer(('127.0.0.1', args.port), Handler)
268
- log.info('Torre is ready at http://127.0.0.1:%s (log: %s)', args.port, log_file)
269
+ server = ThreadingHTTPServer((args.host, args.port), Handler)
270
+ log.info('Torre is ready at http://%s:%s (log: %s)', args.host, args.port, log_file)
269
271
  if args.open_browser:
270
272
  threading.Timer(.5, lambda: webbrowser.open(f'http://127.0.0.1:{args.port}')).start()
271
273
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torre
3
- Version: 0.3.2.dev1
3
+ Version: 0.3.2.dev2
4
4
  Summary: Learn chess step by step: lessons, puzzles, bots to play and an honest review of every game with Stockfish.
5
5
  Author: Juan Denis
6
6
  License-Expression: GPL-3.0-only
@@ -208,7 +208,7 @@ run `python -m torre` from the project folder on Windows, macOS, or Linux.
208
208
  | `analyze [--limit N] [--depth 12] [--threads 8] [--no-mine]` | Analyze pending games using the existing Stockfish pipeline, then mine personal puzzles. A limit of 0 means all pending games. Completed analyses are reused on the next run. |
209
209
  | `report [--output FILE]` | Write the existing mistakes report to `report.md` in the selected data folder, or to the specified file. |
210
210
  | `coach [--ask] [--lang en\|es] [--model MODEL] [--force]` | Print the local coaching brief as JSON. `--ask` uses the configured AI model and shared advice cache; `--model` and `--force` require `--ask`. |
211
- | `serve [--port 1886] [--open-browser] [--proxied] [--allow-host NAME]` | Start the same local web server. It answers only IP addresses and local names (`localhost`, `.local`, `.lan`); `--allow-host` adds a domain, such as a proxy's. Build the interface first with `.\dev.ps1 build` or `npm --prefix web run build`. |
211
+ | `serve [--host 127.0.0.1] [--port 1886] [--open-browser] [--proxied] [--allow-host NAME]` | Start the same local web server, on loopback unless `--host` (or `TORRE_HOST`) says otherwise, such as `0.0.0.0` in a container. It answers only IP addresses and local names (`localhost`, `.local`, `.lan`); `--allow-host` adds a domain, such as a proxy's. Build the interface first with `.\dev.ps1 build` or `npm --prefix web run build`. |
212
212
  | `narrate [--lang en\|es] [--gender female\|male] [--force] [--list]` | Record the coach's voice packs into `dist/voice` with a local Kokoro server (`KOKORO_URL`), loudness-normalized with ffmpeg. Needs a source checkout; `.\dev.ps1 narrate` records both voices. |
213
213
  | `doctor [--json]` | Check Python, dependencies, Stockfish discovery, data paths, and the built interface. Engine discovery checks the binary's path, without launching it. Missing optional features are warnings. |
214
214
 
@@ -1,6 +1,6 @@
1
- torre/__init__.py,sha256=dckJGlkD-veGnY7kZRu0hhCR6xwLOhX5C56YrucbPYk,212
1
+ torre/__init__.py,sha256=qcQKSj4KGtTDLdhjdB9MU13H7PkbCUl3gb2zXbL066Y,212
2
2
  torre/__main__.py,sha256=DRYRiz37U0uletZJN3x9wkTFUTJlnx0soO5uFqzEwc0,109
3
- torre/cli.py,sha256=ghxyMO94JRbOMyWxFQaH-ptZ5j4RfNiNtCqPtfqGp3s,13371
3
+ torre/cli.py,sha256=T1L3wSXmvDr2vK2o6KZUVeMPMwDQWPT5aGA_ZFKUD4w,13579
4
4
  torre/jsonio.py,sha256=lzesifwXsATAuWGB9FN1Ervkvo2AOqWSDRD9kegCCv8,4448
5
5
  torre/net.py,sha256=HG36IE4rmbUphrdgw-NEJqRbUr13ji7BIx7MGYsNAt4,839
6
6
  torre/paths.py,sha256=92tOFmvW_DFJBLcx7MZ8t-XP2ASH2S6QM_IcDDqzcec,1260
@@ -313,7 +313,7 @@ torre/server/applog.py,sha256=Cd8SodjtodQ8GB3zQnHiND98tjTATqqsjfnhOQm8Jyc,1605
313
313
  torre/server/hosts.py,sha256=Vca4B_5OL5vhRAvZPUxWIggP8F4A8Ms6S-Dxz-9KY6o,1763
314
314
  torre/server/jobs.py,sha256=q4gEKtHhBxRPHbD62QU6IbuasaTLyLuACLGzTY3cyBI,3291
315
315
  torre/server/routes.py,sha256=UhsXNVl9RIA2WKDk-0wbT7NwIolr8IRo_j3lH8YRhQI,4623
316
- torre/server/studio.py,sha256=ivVP1b1ayXuV1pNtmC3EnLVwitMOCOWZC7BKEwbtq8c,12736
316
+ torre/server/studio.py,sha256=QjNvALVvFBkYg8k7puowfLeUkg4Za9NC443UpFKJaVA,12960
317
317
  torre/tools/__init__.py,sha256=FoTTmXj2wI0MC29DgdCi-y_JxYlsUaxIQRpdJjhG-x4,278
318
318
  torre/tools/build_opening_book.py,sha256=U_u_yCMYqvvc2pRBGGqbsS5h9UyywZbj7JrFhThiXUo,1710
319
319
  torre/tools/build_packs.py,sha256=cMIAyMtg4O_gg5xdX5U1wu2YE6ZL_wd8D5Yu4l80Aog,2406
@@ -1821,9 +1821,9 @@ torre/ui/locales/es/trainer.json,sha256=vRw9cO3F2oWXEryBEDIdAbiN4aK_acm6_hoY_OoZ
1821
1821
  torre/ui/locales/es/voice.json,sha256=6aGQ78EIhPH_E-seNlozB32ggcSfTd6MPsbB0Sq7uVA,2272
1822
1822
  torre/voice/__init__.py,sha256=L4aE8xBebHFFIVIydpyMAr3b6H4m3atZ6WG2-Xmmf3U,82
1823
1823
  torre/voice/narrate.py,sha256=MDNaM2JVl-MCERfInbnfgtCjAR1xTZoeFCsaW-pHwpk,14956
1824
- torre-0.3.2.dev1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
1825
- torre-0.3.2.dev1.dist-info/METADATA,sha256=HMKI0qjob8NECJ9uyG0hdTVqzq_yuz8W-w0EvujjNgk,24037
1826
- torre-0.3.2.dev1.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
1827
- torre-0.3.2.dev1.dist-info/entry_points.txt,sha256=YvglR4LljOGKFtNYYfm8bWgjFuOBlx_wQUvbqqH_VoY,41
1828
- torre-0.3.2.dev1.dist-info/top_level.txt,sha256=OVcT8IijulxI0HrUsQS_EBPEpM3iJ6Qe3dPyU2XtKvU,6
1829
- torre-0.3.2.dev1.dist-info/RECORD,,
1824
+ torre-0.3.2.dev2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
1825
+ torre-0.3.2.dev2.dist-info/METADATA,sha256=3jMd5bBA1TMHFrQTMw64mZHBEEm0DggC2g8IISnUnlg,24152
1826
+ torre-0.3.2.dev2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
1827
+ torre-0.3.2.dev2.dist-info/entry_points.txt,sha256=YvglR4LljOGKFtNYYfm8bWgjFuOBlx_wQUvbqqH_VoY,41
1828
+ torre-0.3.2.dev2.dist-info/top_level.txt,sha256=OVcT8IijulxI0HrUsQS_EBPEpM3iJ6Qe3dPyU2XtKvU,6
1829
+ torre-0.3.2.dev2.dist-info/RECORD,,