streamembed 0.3.1__tar.gz → 0.3.3__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.
Files changed (50) hide show
  1. {streamembed-0.3.1 → streamembed-0.3.3}/PKG-INFO +3 -2
  2. {streamembed-0.3.1 → streamembed-0.3.3}/PYPI.md +1 -1
  3. {streamembed-0.3.1 → streamembed-0.3.3}/README.md +1 -1
  4. {streamembed-0.3.1 → streamembed-0.3.3}/docs/reference.md +2 -2
  5. {streamembed-0.3.1 → streamembed-0.3.3}/pyproject.toml +4 -1
  6. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/__init__.py +1 -1
  7. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/api.py +4 -4
  8. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/capture.py +49 -2
  9. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/cli.py +41 -1
  10. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/service.py +6 -1
  11. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/static/results.html +144 -79
  12. streamembed-0.3.3/tests/test_screen_permission.py +31 -0
  13. {streamembed-0.3.1 → streamembed-0.3.3}/.gitignore +0 -0
  14. {streamembed-0.3.1 → streamembed-0.3.3}/.hgignore +0 -0
  15. {streamembed-0.3.1 → streamembed-0.3.3}/LICENSE +0 -0
  16. {streamembed-0.3.1 → streamembed-0.3.3}/NOTICE +0 -0
  17. {streamembed-0.3.1 → streamembed-0.3.3}/examples/main.py +0 -0
  18. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/__main__.py +0 -0
  19. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/ann.py +0 -0
  20. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/config.py +0 -0
  21. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/defaults.toml +0 -0
  22. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/encoder.py +0 -0
  23. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/__init__.py +0 -0
  24. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/config.py +0 -0
  25. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/engine.py +0 -0
  26. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/llm.py +0 -0
  27. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/macs.py +0 -0
  28. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/model.py +0 -0
  29. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/pause.py +0 -0
  30. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/qwen_embedder.py +0 -0
  31. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/spatial.py +0 -0
  32. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/temporal.py +0 -0
  33. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/engine/vit.py +0 -0
  34. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/gate.py +0 -0
  35. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/index.py +0 -0
  36. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/models.py +0 -0
  37. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/queryserver.py +0 -0
  38. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/visualize.py +0 -0
  39. {streamembed-0.3.1 → streamembed-0.3.3}/src/streamembed/webui.py +0 -0
  40. {streamembed-0.3.1 → streamembed-0.3.3}/tests/conftest.py +0 -0
  41. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_api.py +0 -0
  42. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_config.py +0 -0
  43. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_defer.py +0 -0
  44. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_encoder_order.py +0 -0
  45. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_front.py +0 -0
  46. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_idle.py +0 -0
  47. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_models.py +0 -0
  48. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_pause.py +0 -0
  49. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_prune.py +0 -0
  50. {streamembed-0.3.1 → streamembed-0.3.3}/tests/test_search_wait.py +0 -0
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: streamembed
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Search your own screen history by describing what you saw, from screenshots, on your machine
5
+ Project-URL: Repository, https://github.com/StarTrail-org/StreamEmbed
5
6
  License-Expression: Apache-2.0
6
7
  License-File: LICENSE
7
8
  License-File: NOTICE
@@ -39,7 +40,7 @@ uv tool install streamembed # the streamembed command, in an environment of
39
40
  uv pip install streamembed # or into your project's environment
40
41
  ```
41
42
 
42
- Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
43
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
43
44
 
44
45
  ## Quick Start
45
46
 
@@ -9,7 +9,7 @@ uv tool install streamembed # the streamembed command, in an environment of
9
9
  uv pip install streamembed # or into your project's environment
10
10
  ```
11
11
 
12
- Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
12
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
13
13
 
14
14
  ## Quick Start
15
15
 
@@ -9,7 +9,7 @@ uv tool install streamembed # the streamembed command, in an environment of
9
9
  uv pip install streamembed # or into your project's environment
10
10
  ```
11
11
 
12
- Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow Screen Recording for Python when asked, then run `streamembed start` again.
12
+ Python 3.12 or later. The first run downloads the model (about 4 GB). On macOS, allow screen capture for Python when asked (System Settings > Privacy & Security > Screen & System Audio Recording; nothing records audio, only the name mentions it). StreamEmbed opens that pane and prints what to turn on; then run `streamembed start` again.
13
13
 
14
14
  ## Quick Start
15
15
 
@@ -4,7 +4,7 @@ Everything the README leaves out: every command and function, all settings, the
4
4
 
5
5
  ## Requirements
6
6
 
7
- Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs Screen Recording permission for the app that runs Python; `build_index_from_now` raises `PermissionError` until it is granted. On Windows, capture needs a logged-in desktop session: while the screen is locked, captures fail and are retried. Indexing `~/Desktop` on macOS needs access to it for the terminal (or, for `streamembed start --folder`, the service's Python): allow it in System Settings > Privacy & Security > Files and Folders; without it, indexing stops with a permission error.
7
+ Python 3.12 or later. Tested on macOS 15 (Apple silicon, GPU), Ubuntu 24.04 under X11 (Xvfb; CPU) and Windows Server 2025 (CPU): installing, indexing a folder, searching, capturing, and the background service (start, pause, resume, stop, restart after a reboot). Not tested: Wayland (not supported), Windows with several monitors, CUDA GPUs. On macOS, capturing the screen needs the Screen & System Audio Recording permission (Screen Recording before macOS 15; no audio is recorded) for the app that runs Python: the terminal app, or for the background service the Python itself. No command can grant it: `build_index_from_now` opens that pane in System Settings and raises `PermissionError` saying what to turn on, until it is granted. On Windows, capture needs a logged-in desktop session: while the screen is locked, captures fail and are retried. Indexing `~/Desktop` on macOS needs access to it for the terminal (or, for `streamembed start --folder`, the service's Python): allow it in System Settings > Privacy & Security > Files and Folders; without it, indexing stops with a permission error.
8
8
 
9
9
  Dependencies are pinned to torch 2.8.0 and transformers 5.17.0: the stream encoder re-implements parts of the Qwen3-VL forward pass against transformers internals, and its outputs were checked for equality with these versions. Install StreamEmbed in its own environment (for example `uv tool`, `pipx`, or a venv) if your project needs other versions.
10
10
 
@@ -149,7 +149,7 @@ se.uninstall_service() # stops it and removes it; the
149
149
 
150
150
  | System | Service | Notes |
151
151
  |---|---|---|
152
- | macOS | launchd user agent `org.streamembed.capture` (`~/Library/LaunchAgents/`) | The first start asks for Screen Recording permission for this Python (System Settings > Privacy & Security > Screen Recording); allow it, then run `streamembed start` (or `install_service()`) again. With `--folder ~/Desktop`, this Python also needs access to the Desktop folder (Files and Folders); without it, `service.log` says so and the service captures without the folder |
152
+ | macOS | launchd user agent `org.streamembed.capture` (`~/Library/LaunchAgents/`) | The first start asks for screen capture permission for this Python (System Settings > Privacy & Security > Screen & System Audio Recording; Screen Recording before macOS 15), opens that pane and writes the Python to turn on to `service.log`; `streamembed start` then prints it as a warning and exits with 1 (nothing when capture is allowed). Allow it, then run `streamembed start` (or `install_service()`) again. With `--folder ~/Desktop`, this Python also needs access to the Desktop folder (Files and Folders); without it, `service.log` says so and the service captures without the folder |
153
153
  | Linux | systemd user service `streamembed-capture.service` (`~/.config/systemd/user/`) | X11 only. Install from a terminal in your desktop session: the service keeps that session's `DISPLAY` |
154
154
  | Windows | Task Scheduler task `StreamEmbedCapture`, at logon, run with `pythonw` (no console window) | Stopping it ends the process at once; the index drops a half-written row when it is next opened |
155
155
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "streamembed"
3
- version = "0.3.1"
3
+ version = "0.3.3"
4
4
  description = "Search your own screen history by describing what you saw, from screenshots, on your machine"
5
5
  readme = "PYPI.md"
6
6
  license = "Apache-2.0"
@@ -29,6 +29,9 @@ dependencies = [
29
29
  "pyobjc-framework-Quartz>=10; sys_platform == 'darwin'",
30
30
  ]
31
31
 
32
+ [project.urls]
33
+ Repository = "https://github.com/StarTrail-org/StreamEmbed"
34
+
32
35
  [project.optional-dependencies]
33
36
  dev = ["pytest>=8"]
34
37
  # index_type="hnsw". chroma-hnswlib is hnswlib (same module and API) with prebuilt wheels; hnswlib itself ships only a source
@@ -4,7 +4,7 @@ from .api import (Capture, Result, Results, available_index_types, available_mod
4
4
  from .config import get_config, reset_config, set_config
5
5
  from .service import install_service, service_status, uninstall_service
6
6
 
7
- __version__ = "0.3.1"
7
+ __version__ = "0.3.3"
8
8
  __all__ = ["Capture", "Result", "Results", "available_index_types", "available_models", "build_index_from_directory", "build_index_from_now", "configure", "query_index",
9
9
  "visualize_results", "install_service", "service_status", "uninstall_service", "pause", "resume", "is_paused",
10
10
  "get_config", "set_config", "reset_config"]
@@ -28,7 +28,8 @@ import numpy as np
28
28
  from typing import Callable, Iterator
29
29
 
30
30
  from .ann import require_hnswlib
31
- from .capture import fit_width, folder_files, load_frames, screen_frames, screen_permission
31
+ from .capture import (fit_width, folder_files, load_frames, open_screen_settings, screen_frames, screen_permission,
32
+ screen_permission_help)
32
33
  from .gate import Gate
33
34
  from .index import INDEX_TYPES, Index
34
35
  from . import models as _models
@@ -713,9 +714,8 @@ def build_index_from_now(interval: float | None = None, duration: float | None =
713
714
  "after 30 s." if _state["capture"].stalled else ""))
714
715
  if frames is None:
715
716
  interval = max(interval, MIN_LIVE_INTERVAL)
716
- if not screen_permission():
717
- raise PermissionError("Screen Recording permission is missing. Allow it for this app in System Settings > Privacy & Security "
718
- "> Screen Recording, then run again.")
717
+ if not screen_permission(): # opens the pane too: the system prompt shows only the first time
718
+ raise PermissionError(screen_permission_help(opened=open_screen_settings()))
719
719
  frames = screen_frames(_settings()["width"], monitors)
720
720
  _index()._writable() # check the lock and load the model before the thread starts, so errors surface here
721
721
  try:
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
 
4
4
  import os
5
5
  import re
6
+ import subprocess
6
7
  import sys
7
8
  import time
8
9
  from collections import deque
@@ -170,6 +171,52 @@ def screen_permission() -> bool:
170
171
  return False
171
172
 
172
173
 
174
+ # macOS 15 renamed the pane "Screen & System Audio Recording"; only the name changed (nothing here records audio). No command can
175
+ # turn the permission on (it is kept in the SIP-protected TCC database), so we open the pane and say what to turn on in it.
176
+ SCREEN_PANE = "System Settings > Privacy & Security > Screen & System Audio Recording (Screen Recording before macOS 15)"
177
+ SCREEN_SETTINGS_URL = "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"
178
+ TERMINALS = {"Apple_Terminal": "Terminal", "iTerm.app": "iTerm", "vscode": "Visual Studio Code (or Cursor)", "WezTerm": "WezTerm",
179
+ "ghostty": "Ghostty", "WarpTerminal": "Warp", "tmux": "the terminal app that runs tmux"}
180
+
181
+
182
+ def python_app() -> str:
183
+ """The Python macOS lists in the pane when Python itself is asked (the background service, started by launchd): Python.app for a
184
+ framework build (python.org, Homebrew), else the interpreter with symlinks resolved (a venv's python links to it)."""
185
+ app = Path(sys.base_prefix) / "Resources" / "Python.app"
186
+ return str(app if app.is_dir() else Path(os.path.realpath(sys.executable)))
187
+
188
+
189
+ def permission_app() -> str:
190
+ """What to turn on in the pane: macOS asks for the app that started this process, the terminal app when it runs in one."""
191
+ term = os.environ.get("TERM_PROGRAM")
192
+ return TERMINALS.get(term, term) if term else python_app()
193
+
194
+
195
+ def turn_on(app: str) -> str:
196
+ """'turn on X' for the pane; a path is added with + when it is not listed yet."""
197
+ if not app.startswith("/"):
198
+ return f"turn on {app}"
199
+ name = Path(app).stem if app.endswith(".app") else Path(app).name # as the pane lists it
200
+ return f"turn on {name}, or add it with + (press Cmd-Shift-G and paste {app})"
201
+
202
+
203
+ def open_screen_settings() -> bool:
204
+ """Open the pane in System Settings (macOS). False when it could not be opened, or elsewhere."""
205
+ if not MACOS:
206
+ return False
207
+ try:
208
+ return subprocess.run(["open", SCREEN_SETTINGS_URL], capture_output=True, timeout=10).returncode == 0
209
+ except (OSError, subprocess.SubprocessError):
210
+ return False
211
+
212
+
213
+ def screen_permission_help(opened: bool = False) -> str:
214
+ """How to allow screen capture, in one message. `opened`: the pane was opened (open_screen_settings)."""
215
+ return (f"Screen capture needs a permission that only you can give: in {SCREEN_PANE}, {turn_on(permission_app())}, then run "
216
+ "it again. Nothing records audio; only the pane's name mentions it. "
217
+ + ("System Settings is open at that pane now." if opened else f"To open the pane: open '{SCREEN_SETTINGS_URL}'"))
218
+
219
+
173
220
  def _preflight() -> bool:
174
221
  """Whether this process may record the screen (macOS), without asking for it."""
175
222
  try:
@@ -387,8 +434,8 @@ def screen_frames(width: int, monitors: str | list[int] = "all",
387
434
  took = time.monotonic() - t0
388
435
  if took > SLOW_GRAB_S and not slow:
389
436
  slow = True
390
- why = (" The app that started Python has no Screen Recording permission: System Settings > Privacy & "
391
- "Security > Screen Recording." if MACOS and not _preflight() else
437
+ why = (f" The app that started Python has no permission to record the screen: {SCREEN_PANE}."
438
+ if MACOS and not _preflight() else
392
439
  " Another app that records the screen at the same time can slow it down.")
393
440
  print(f"streamembed: a screen grab took {took:.0f} s.{why}", file=sys.stderr, flush=True)
394
441
  img = Image.frombytes("RGB", shot.size, shot.rgb) # full size: _ingest fits it to `width`
@@ -146,6 +146,40 @@ def _service_index_dir(se, given: str | None):
146
146
  return None
147
147
 
148
148
 
149
+ def _screen_allowed(log, offset: int, timeout: float = 20.0) -> bool | None:
150
+ """Whether the service just started may record the screen (macOS): its first line in `log` after `offset` says so.
151
+ None when its first line is something else (a bad setting stops it before the check) or it wrote nothing within `timeout` s."""
152
+ from .service import SCREEN_ALLOWED, SCREEN_NOT_ALLOWED
153
+ end = time.monotonic() + timeout
154
+ while time.monotonic() < end:
155
+ try:
156
+ with open(log, encoding="utf-8", errors="replace") as f:
157
+ f.seek(offset)
158
+ lines = f.read().splitlines()
159
+ except FileNotFoundError:
160
+ lines = []
161
+ for line in lines:
162
+ if line in (SCREEN_ALLOWED, SCREEN_NOT_ALLOWED):
163
+ return line == SCREEN_ALLOWED
164
+ if line.startswith("streamembed service:"):
165
+ return None
166
+ time.sleep(0.2)
167
+ return None
168
+
169
+
170
+ def _warn_screen_permission() -> None:
171
+ """The service cannot record the screen: say what to turn on, as a warning on stderr."""
172
+ import os
173
+ from .capture import SCREEN_PANE, python_app, turn_on
174
+ head = "Warning: the background service cannot record the screen yet, so it stopped."
175
+ if sys.stderr.isatty() and not os.environ.get("NO_COLOR"):
176
+ head = f"\033[1;33m{head}\033[0m"
177
+ print(f"{head}\n"
178
+ f" In {SCREEN_PANE},\n"
179
+ f" {turn_on(python_app())}.\n"
180
+ " Then run `streamembed start` again. Only the pane's name mentions audio: nothing records sound.", file=sys.stderr)
181
+
182
+
149
183
  def _stamp(ts: float | None, default: str) -> str:
150
184
  return time.strftime("%Y-%m-%d %H:%M", time.localtime(ts)) if ts is not None else default
151
185
 
@@ -178,7 +212,12 @@ def _run(a) -> int:
178
212
  if settings:
179
213
  se.configure(**settings)
180
214
  if a.command == "start":
215
+ log = Path(_settings()["index_dir"]).expanduser().resolve() / "service.log" # where install_service points the service
216
+ offset = log.stat().st_size if log.is_file() else 0
181
217
  path = se.install_service(interval=a.interval, monitors=a.monitors, skip_unchanged=a.skip_unchanged, directory=a.folder)
218
+ if sys.platform == "darwin" and _screen_allowed(log, offset) is False:
219
+ _warn_screen_permission()
220
+ return 1
182
221
  print(f"Started. It runs from now on and after every login ({path}).\nstreamembed status | pause | resume | stop")
183
222
  elif a.command == "stop":
184
223
  paused = se.service_status()["paused"]
@@ -221,8 +260,9 @@ def _run(a) -> int:
221
260
  cap = se.build_index_from_now(interval=a.interval, monitors=a.monitors, skip_unchanged=a.skip_unchanged, block=True)
222
261
  if cap.stalled:
223
262
  cap.stop(timeout=0)
263
+ from .capture import SCREEN_PANE
224
264
  print(f"streamembed: error: screen capture has not returned for {se.api.STALL_S:.0f} s ({_n(cap.stats['encoded'], 'screen')} "
225
- "indexed). Check System Settings > Privacy & Security > Screen Recording, then run it again.", file=sys.stderr)
265
+ f"indexed). Check {SCREEN_PANE}, then run it again.", file=sys.stderr)
226
266
  return 1
227
267
  print(f"Stopped: {_n(cap.stats['encoded'], 'screen')} indexed.")
228
268
  elif a.command == "search":
@@ -33,6 +33,8 @@ LABEL = "org.streamembed.capture" # launchd
33
33
  UNIT = "streamembed-capture.service" # systemd
34
34
  TASK = "StreamEmbedCapture" # Task Scheduler
35
35
  ENV_KEYS = ("HF_HOME", "HF_HUB_CACHE", "STREAMEMBED_MODELS") # passed on to the service, which starts with no shell environment
36
+ # the service's first line on macOS; `streamembed start` waits for it to warn only when capture cannot work
37
+ SCREEN_ALLOWED, SCREEN_NOT_ALLOWED = "streamembed service: screen capture allowed", "streamembed service: screen capture not allowed"
36
38
 
37
39
 
38
40
  def _run(*args: str) -> subprocess.CompletedProcess:
@@ -293,6 +295,9 @@ def main(argv: list[str] | None = None) -> int:
293
295
  interval = max(_coerce("interval", get_config("interval") if a.interval is None else a.interval), se.api.MIN_LIVE_INTERVAL)
294
296
  except (KeyError, ValueError, ImportError) as e: # a bad setting: restarting would not help
295
297
  return _bad_setting(e)
298
+ if sys.platform == "darwin": # first thing, so that `streamembed start` can say at once whether capture will work
299
+ from .capture import _preflight
300
+ print(SCREEN_ALLOWED if _preflight() else SCREEN_NOT_ALLOWED, flush=True)
296
301
  if a.folder:
297
302
  def interrupt(*_):
298
303
  raise KeyboardInterrupt # build_index_from_directory stops after the screenshot in progress
@@ -312,7 +317,7 @@ def main(argv: list[str] | None = None) -> int:
312
317
  try:
313
318
  cap = se.build_index_from_now(interval=interval, monitors=monitors, skip_unchanged=a.skip_unchanged)
314
319
  except PermissionError as e:
315
- print(f"streamembed service: {e} Then run `streamembed start` (or se.install_service()) again.", flush=True)
320
+ print(f"streamembed service: {e} To run it again: `streamembed start` (or se.install_service()).", flush=True)
316
321
  return 0 # a clean exit: not restarted until it is installed again
317
322
  except (ValueError, NotImplementedError) as e:
318
323
  return _bad_setting(e)
@@ -5,68 +5,130 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>__TITLE__</title>
7
7
  <link rel="icon" href="data:,">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap">
8
11
  <style>
9
- :root { color-scheme: light dark; --bg: #fbfbfa; --fg: #1d1d1b; --muted: #6b6b66; --line: #deded9; --card: #fff; }
10
- @media (prefers-color-scheme: dark) { :root { --bg: #171716; --fg: #ececea; --muted: #a0a09a; --line: #33332f; --card: #20201e; } }
12
+ :root {
13
+ color-scheme: light dark;
14
+ --bg: #f6f5f2; --bar: #fdfcfa; --fg: #1c1c1a; --muted: #6d6c66; --faint: #9a998f; --line: #e3e1db; --line-strong: #cfccc4;
15
+ --card: #ffffff; --well: #ecebe6; --accent: #2b59c3; --accent-fg: #ffffff; --accent-soft: #e7edfb;
16
+ --shadow: 0 1px 2px rgb(28 28 26 / 6%), 0 4px 14px rgb(28 28 26 / 6%);
17
+ --shadow-up: 0 2px 4px rgb(28 28 26 / 8%), 0 12px 32px rgb(28 28 26 / 12%);
18
+ --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236d6c66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
19
+ --radius: 10px;
20
+ }
21
+ @media (prefers-color-scheme: dark) {
22
+ :root {
23
+ --bg: #141413; --bar: #1a1a19; --fg: #ecebe7; --muted: #a3a29b; --faint: #77766f; --line: #2c2c29; --line-strong: #3d3d39;
24
+ --card: #1f1f1d; --well: #262624; --accent: #8fb0f7; --accent-fg: #10131a; --accent-soft: #1e2638;
25
+ --shadow: 0 1px 2px rgb(0 0 0 / 30%); --shadow-up: 0 2px 6px rgb(0 0 0 / 40%), 0 14px 36px rgb(0 0 0 / 45%);
26
+ --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a3a29b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
27
+ }
28
+ }
11
29
  * { box-sizing: border-box; }
12
- body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 Lato, -apple-system, "Segoe UI", sans-serif; }
13
- header { border-bottom: 1px solid var(--line); padding: 14px 16px; }
14
- header > div { max-width: 1200px; margin: 0 auto; }
15
- .top { display: flex; align-items: flex-start; gap: 12px; }
16
- .top .titles { flex: 1; min-width: 0; }
17
- #q { font-weight: 700; overflow-wrap: anywhere; }
18
- #sub { color: var(--muted); font-size: 13px; }
19
- #lang { font: inherit; font-size: 13px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; }
20
- #search { display: flex; gap: 8px; margin-bottom: 10px; }
21
- #qbox { flex: 1; min-width: 0; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
22
- #go { font: inherit; color: var(--bg); background: var(--fg); border: 1px solid var(--fg); border-radius: 6px; padding: 7px 14px; cursor: pointer; }
23
- #go:disabled { opacity: .6; cursor: default; }
24
- main { max-width: 1200px; margin: 0 auto; padding: 16px; }
25
- #grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
26
- figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; cursor: zoom-in; }
27
- figure:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
28
- figure img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
29
- figcaption { padding: 8px 10px; font-size: 13px; }
30
- figcaption .when { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
31
- .where { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
32
- #empty { color: var(--muted); }
33
- #dates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
34
- #dates button, #more { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; }
35
- #dates button { cursor: pointer; }
36
- #dates button[aria-pressed="true"] { border-color: var(--fg); font-weight: 700; }
30
+ body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
31
+ button, input, select { font: inherit; color: inherit; }
32
+ :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
33
+
34
+ /* ---- header: the name, the search box and the language on one line; the question; then the filters */
35
+ header { background: var(--bar); border-bottom: 1px solid var(--line); }
36
+ header > div { max-width: 1320px; margin: 0 auto; padding: 14px 24px 16px; }
37
+ .bar { display: flex; align-items: center; gap: 16px; }
38
+ .brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; white-space: nowrap; }
39
+ .brand svg { display: block; color: var(--accent); }
40
+ .bar .space { flex: 1; }
41
+ #search:not([hidden]) + .space { display: none; }
42
+ #search { flex: 1; display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
43
+ .qwrap { position: relative; flex: 1; min-width: 0; }
44
+ .qwrap svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
45
+ #qbox { width: 100%; height: 44px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 18px 0 42px; font-size: 16px; transition: border-color .15s, box-shadow .15s; }
46
+ #qbox::placeholder { color: var(--faint); }
47
+ #qbox:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
48
+ #go { height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 700; cursor: pointer; transition: filter .15s; }
49
+ #go:hover { filter: brightness(1.08); }
50
+ #go:disabled { opacity: .6; cursor: progress; }
51
+ select { appearance: none; -webkit-appearance: none; background: var(--card) var(--chev) no-repeat right 11px center; border: 1px solid var(--line); border-radius: 8px; padding: 5px 30px 5px 11px; font-size: 13px; cursor: pointer; }
52
+ select:hover { border-color: var(--line-strong); }
53
+ .head { margin-top: 18px; }
54
+ #q { font-size: 26px; font-weight: 900; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
55
+ #q:empty { display: none; }
56
+ #sub { color: var(--muted); font-size: 14px; margin-top: 2px; font-variant-numeric: tabular-nums; }
57
+ #q:empty + #sub { font-size: 17px; color: var(--fg); margin-top: 6px; }
58
+ #dates { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; }
59
+ #dates button, #more { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
60
+ #dates button:hover, #more:hover { border-color: var(--line-strong); }
61
+ #dates button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
37
62
  #chips { display: contents; }
38
- #chips button.extra { display: none; }
39
- #chips.all button.extra { display: inline-block; }
40
- #more { display: block; margin: 16px auto 0; cursor: pointer; }
41
- #tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin-top: 8px; font-size: 13px; color: var(--muted); }
42
- #tools label { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
43
- #range { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
44
- #tools select { font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px; }
63
+ #tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; margin-top: 12px; font-size: 13px; color: var(--muted); }
64
+ #tools label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
65
+ #range { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
66
+ #tools select { color: var(--fg); }
67
+
68
+ /* ---- the grid of matches: the best one gets a row of its own */
69
+ main { max-width: 1320px; margin: 0 auto; padding: 24px; }
70
+ #empty { color: var(--muted); font-size: 16px; text-align: center; padding: 48px 0; margin: 0; }
71
+ #grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; transition: opacity .2s; }
72
+ body:has(#go:disabled) #grid { opacity: .45; }
73
+ figure { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; box-shadow: var(--shadow); transition: box-shadow .2s, transform .2s, border-color .2s; }
74
+ figure:hover { box-shadow: var(--shadow-up); transform: translateY(-2px); border-color: var(--line-strong); }
75
+ .pic { position: relative; overflow: hidden; background: var(--well); }
76
+ .pic img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform .45s cubic-bezier(.2, .7, .2, 1); }
77
+ figure:hover .pic img { transform: scale(1.045); }
78
+ /* a hint that a card opens the viewer, with the screens before and after it */
79
+ .more { position: absolute; right: 10px; bottom: 10px; padding: 5px 12px; border-radius: 999px; background: rgb(20 20 19 / 78%); color: #fff; font-size: 12px; font-weight: 700; opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; pointer-events: none; }
80
+ figure:hover .more, figure:focus-visible .more { opacity: 1; transform: none; }
81
+ @media (hover: none) { .more { opacity: 1; transform: none; } }
82
+ figcaption { padding: 11px 14px 13px; font-size: 13px; min-width: 0; }
83
+ figcaption .when { display: flex; align-items: baseline; gap: 8px; min-width: 0; white-space: nowrap; }
84
+ .when .time { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
85
+ .when .day { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
86
+ .where { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
87
+ #more { display: block; margin: 32px auto 8px; padding: 9px 22px; font-size: 14px; font-weight: 700; }
45
88
 
46
- #viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: #121211; color: #ececea; }
47
- #viewer::backdrop { background: #121211; }
48
- #viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
49
- .vtop { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #2c2c29; min-width: 0; }
89
+ /* ---- the viewer: one screenshot large, the frames around it below */
90
+ #viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: #0f0f0e; color: #ecebe7; }
91
+ #viewer::backdrop { background: #0f0f0e; }
92
+ #viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: fade .18s ease-out; }
93
+ @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
94
+ .vtop { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #262624; min-width: 0; }
50
95
  .vtop .meta { flex: 1; min-width: 0; }
51
- .vtop .when { font-weight: 700; }
52
- .vtop .where { color: #a0a09a; }
53
- .vtop a, .vtop button { color: inherit; background: #20201e; text-decoration: none; padding: 6px 10px; border: 1px solid #3a3a36; border-radius: 6px; font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; }
54
- .stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 12px 56px; min-height: 0; }
55
- .stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
56
- .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 64px; padding: 0; border: 1px solid #3a3a36; border-radius: 6px; background: rgb(32 32 30 / 80%); color: #ececea; font-size: 22px; cursor: pointer; }
57
- .nav:disabled { opacity: .3; cursor: default; }
58
- .nav.prev { left: 8px; } .nav.next { right: 8px; }
59
- .strip { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding: 10px 16px 14px; border-top: 1px solid #2c2c29; scrollbar-width: thin; }
60
- .tick { flex: 0 0 auto; width: 152px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; color: #a0a09a; text-align: left; cursor: pointer; font: inherit; }
61
- .tick img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 4px; background: #20201e; }
62
- .tick span { display: block; font-size: 12px; padding: 3px 2px 0; }
63
- .tick.active { border-color: #ececea; color: #ececea; }
64
- .tick.hit span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7aa7f5; margin-right: 5px; vertical-align: 1px; }
65
- .gap { flex: 0 0 auto; align-self: stretch; display: flex; align-items: center; color: #8a8a84; font-size: 12px; border-left: 1px dashed #3a3a36; padding-left: 8px; }
96
+ .vtop .when { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
97
+ .vtop .where { color: #9d9c95; font-size: 13px; }
98
+ #vcount { color: #9d9c95; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
99
+ .vtop a, .vtop button { color: inherit; background: #1f1f1d; text-decoration: none; padding: 7px 14px; border: 1px solid #353532; border-radius: 999px; font-size: 13px; white-space: nowrap; cursor: pointer; transition: background .15s; }
100
+ .vtop a:hover, .vtop button:hover { background: #2a2a28; }
101
+ .stage { position: relative; display: flex; align-items: center; justify-content: center; padding: 20px 72px; min-height: 0; }
102
+ .stage img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; border-radius: 6px; box-shadow: 0 10px 40px rgb(0 0 0 / 50%); }
103
+ .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 0; border: 1px solid #353532; border-radius: 50%; background: rgb(31 31 29 / 85%); color: #ecebe7; font-size: 24px; line-height: 1; cursor: pointer; transition: background .15s; }
104
+ .nav:hover:not(:disabled) { background: #2f2f2c; }
105
+ .nav:disabled { opacity: .25; cursor: default; }
106
+ .nav.prev { left: 16px; } .nav.next { right: 16px; }
107
+ .strip { display: flex; align-items: flex-end; gap: 10px; overflow-x: auto; padding: 12px 20px 16px; border-top: 1px solid #262624; scrollbar-width: thin; scrollbar-color: #3a3a37 transparent; }
108
+ .tick { flex: 0 0 auto; width: 148px; padding: 4px 4px 0; border: 0; background: none; color: #8b8a84; text-align: left; cursor: pointer; opacity: .7; transition: opacity .15s; }
109
+ .tick:hover { opacity: 1; }
110
+ .tick img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 6px; background: #1f1f1d; outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .15s; }
111
+ .tick span { display: block; font-size: 12px; padding: 6px 2px 0; font-variant-numeric: tabular-nums; }
112
+ .tick.active { opacity: 1; color: #ecebe7; }
113
+ .tick.active img { outline-color: #ecebe7; }
114
+ .tick.hit span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #8fb0f7; margin-right: 6px; vertical-align: 1px; }
115
+ .gap { flex: 0 0 auto; align-self: stretch; display: flex; align-items: center; color: #7d7c76; font-size: 12px; border-left: 1px dashed #3a3a37; padding-left: 10px; white-space: nowrap; }
66
116
  html, body { overflow-x: hidden; }
67
117
  [hidden] { display: none !important; }
118
+ @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
119
+ @media (max-width: 760px) {
120
+ }
68
121
  @media (max-width: 640px) {
69
- .stage { padding: 8px; } .nav { display: none; } .tick { width: 112px; }
122
+ header > div { padding: 12px 16px 14px; }
123
+ .bar { flex-wrap: wrap; gap: 10px 12px; }
124
+ .bar .space { display: block !important; }
125
+ #search { order: 3; flex: 1 0 100%; }
126
+ #go { padding: 0 16px; }
127
+ #q { font-size: 21px; }
128
+ main { padding: 16px; }
129
+ #grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
130
+ .vtop { padding: 10px 14px; flex-wrap: wrap; } .vtop .meta { flex: 1 0 100%; }
131
+ .stage { padding: 8px; } .nav { display: none; } .tick { width: 108px; }
70
132
  /* the date chips get a row of their own, above From and To, that scrolls sideways */
71
133
  #chips { display: flex; order: -1; flex: 1 0 100%; min-width: 0; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; position: relative; }
72
134
  #dates button { flex: 0 0 auto; white-space: nowrap; }
@@ -75,17 +137,18 @@ html, body { overflow-x: hidden; }
75
137
  </head>
76
138
  <body>
77
139
  <header><div>
78
- <form id="search" hidden><input id="qbox" type="search" autocomplete="off"><button type="submit" id="go"></button></form>
79
- <div class="top">
80
- <div class="titles"><div id="q"></div><div id="sub"></div></div>
140
+ <div class="bar">
141
+ <span class="brand"><svg width="20" height="20" viewBox="0 0 20 20" aria-hidden="true"><rect x="1.5" y="3" width="17" height="12" rx="2.5" fill="none" stroke="currentColor" stroke-width="1.6"/><path d="M7 18h6" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>StreamEmbed</span>
142
+ <form id="search" hidden><span class="qwrap"><svg width="17" height="17" viewBox="0 0 20 20" aria-hidden="true"><circle cx="8.5" cy="8.5" r="6" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M13 13l5 5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg><input id="qbox" type="search" autocomplete="off"></span><button type="submit" id="go"></button></form>
143
+ <span class="space"></span>
81
144
  <select id="lang" aria-label="Language">
82
145
  <option value="en">English</option><option value="ko">한국어</option><option value="zh">中文</option>
83
146
  </select>
84
147
  </div>
148
+ <div class="head"><div id="q"></div><div id="sub"></div></div>
85
149
  <div id="dates">
86
150
  <button type="button" id="alldates"></button>
87
151
  <span id="chips"></span>
88
- <button type="button" id="morechips" hidden></button>
89
152
  </div>
90
153
  <div id="tools" hidden>
91
154
  <span id="range"><label><span id="lfrom"></span> <select id="from"></select></label>
@@ -101,6 +164,7 @@ html, body { overflow-x: hidden; }
101
164
  <dialog id="viewer">
102
165
  <div class="vtop">
103
166
  <div class="meta"><div class="when" id="vwhen"></div><div class="where" id="vwhere"></div></div>
167
+ <span id="vcount"></span>
104
168
  <a id="vopen" target="_blank" rel="noopener"></a>
105
169
  <button type="button" id="vclose"></button>
106
170
  </div>
@@ -120,33 +184,33 @@ const $ = (id) => document.getElementById(id);
120
184
  const TEXT = {
121
185
  en: { results: "Results", count: (a, b) => `${a} of ${b} results`, on: (d) => ` on ${d}`, fromTo: (a, b) => ` from ${a} to ${b}`,
122
186
  fromOn: (a) => ` from ${a} on`, upTo: (b) => ` up to ${b}`, searched: (w) => ` · searched ${w}`, to: "to", from: "From", until: "to",
123
- all: "All dates", moreDates: (n) => `${n} more dates`, fewer: "Fewer dates", none: "No results.",
187
+ all: "All dates", none: "No results.",
124
188
  noneHere: (n) => `No results from these dates. All dates shows ${n}.`, more: "Show more", full: "Full size", close: "Close",
125
189
  earlier: "Earlier frame", later: "Later frame", viewer: "Screenshot viewer", match: (s) => `match ${s}`,
126
190
  nearby: (n, m) => `${n} more within ${m} min`, onScreen: (s) => `on screen ${s}`, before: (s) => `${s} before the match`,
127
191
  after: (s) => `${s} after the match`, openMatch: (s) => `Open the match from ${s}`, s: "s", min: "min", h: "h", days: "days",
128
192
  ask: "Describe a screen you saw", go: "Search", searching: "Searching…", failed: (m) => `Search failed: ${m}`,
129
- start: (n) => `Search ${n} screens: describe what you saw.`, screenshot: "Screenshot", language: "Language",
193
+ start: (n) => `Search ${n} screens: describe what you saw.`, screenshot: "Screenshot", seeMore: "See nearby screens", language: "Language",
130
194
  sort: "Sort", byMatch: "Best match", newest: "Newest first", oldest: "Oldest first" },
131
195
  ko: { results: "결과", count: (a, b) => `결과 ${b}개 중 ${a}개`, on: (d) => ` · ${d}`, fromTo: (a, b) => ` · ${a}부터 ${b}까지`,
132
196
  fromOn: (a) => ` · ${a}부터`, upTo: (b) => ` · ${b}까지`, searched: (w) => ` · 검색 기간 ${w}`, to: "~", from: "기간", until: "~",
133
- all: "모든 날짜", moreDates: (n) => `날짜 ${n}개 더`, fewer: "날짜 줄이기", none: "결과가 없어요.",
197
+ all: "모든 날짜", none: "결과가 없어요.",
134
198
  noneHere: (n) => `이 날짜에는 결과가 없어요. 모든 날짜로 보면 ${n}개예요.`, more: "더 보기", full: "원본 크기", close: "닫기",
135
199
  earlier: "이전 화면", later: "다음 화면", viewer: "스크린샷 보기", match: (s) => `일치도 ${s}`,
136
200
  nearby: (n, m) => `${m}분 안에 ${n}개 더`, onScreen: (s) => `${s} 동안 화면에 있음`, before: (s) => `결과보다 ${s} 전`,
137
201
  after: (s) => `결과보다 ${s} 후`, openMatch: (s) => `${s} 결과 열기`, s: "초", min: "분", h: "시간", days: "일",
138
202
  ask: "본 화면을 설명해 주세요", go: "검색", searching: "검색 중…", failed: (m) => `검색 실패: ${m}`,
139
- start: (n) => `화면 ${n}장에서 검색해요. 본 화면을 설명해 주세요.`, screenshot: "스크린샷", language: "언어",
203
+ start: (n) => `화면 ${n}장에서 검색해요. 본 화면을 설명해 주세요.`, screenshot: "스크린샷", seeMore: "앞뒤 화면 보기", language: "언어",
140
204
  sort: "정렬", byMatch: "관련도순", newest: "최신순", oldest: "오래된순" },
141
205
  zh: { results: "结果", count: (a, b) => `共 ${b} 个结果,显示 ${a} 个`, on: (d) => ` · ${d}`, fromTo: (a, b) => ` · ${a} 至 ${b}`,
142
206
  fromOn: (a) => ` · ${a} 起`, upTo: (b) => ` · 至 ${b}`, searched: (w) => ` · 搜索范围 ${w}`, to: "至", from: "日期", until: "至",
143
- all: "全部日期", moreDates: (n) => `另外 ${n} 个日期`, fewer: "收起日期", none: "没有结果。",
207
+ all: "全部日期", none: "没有结果。",
144
208
  noneHere: (n) => `这些日期没有结果。全部日期共有 ${n} 个。`, more: "显示更多", full: "原始大小", close: "关闭",
145
209
  earlier: "上一张", later: "下一张", viewer: "截图查看", match: (s) => `匹配度 ${s}`,
146
210
  nearby: (n, m) => `${m} 分钟内另有 ${n} 个`, onScreen: (s) => `在屏幕上 ${s}`, before: (s) => `比结果早 ${s}`,
147
211
  after: (s) => `比结果晚 ${s}`, openMatch: (s) => `打开 ${s} 的结果`, s: "秒", min: "分钟", h: "小时", days: "天",
148
212
  ask: "描述你看到的画面", go: "搜索", searching: "搜索中…", failed: (m) => `搜索失败:${m}`,
149
- start: (n) => `在 ${n} 张截图中搜索:描述你看到的画面。`, screenshot: "截图", language: "语言",
213
+ start: (n) => `在 ${n} 张截图中搜索:描述你看到的画面。`, screenshot: "截图", seeMore: "查看前后画面", language: "语言",
150
214
  sort: "排序", byMatch: "相关度", newest: "最新优先", oldest: "最早优先" },
151
215
  };
152
216
  const LOCALES = { en: "en-US", ko: "ko-KR", zh: "zh-CN" };
@@ -196,7 +260,7 @@ function windowText(a, b) { // whole days as days ("Nov 6", "Nov 3 to N
196
260
  // the better one's viewer shows the frames around it. fold is null for folder screenshots with no time in their file name, which are
197
261
  // never left out this way.
198
262
  const FOLD_S = 300;
199
- const CHIPS = 7;
263
+ const CHIPS = 5;
200
264
  let CARDS = [], DAYS = [], counts = {};
201
265
  const SORTS = ["match", "new", "old"];
202
266
  let SORT = "match";
@@ -227,18 +291,16 @@ function texts() {
227
291
  $("vopen").textContent = t.full; $("vclose").textContent = t.close; $("viewer").setAttribute("aria-label", t.viewer);
228
292
  $("vprev").setAttribute("aria-label", t.earlier); $("vnext").setAttribute("aria-label", t.later);
229
293
  $("q").textContent = DATA && DATA.query ? `"${DATA.query}"` : LIVE ? "" : t.results;
230
- // one chip per day with results, the CHIPS most recent first; the rest behind a toggle. Results from one day only: no date bar.
294
+ // one chip per day with results, at most the CHIPS most recent; older days are picked with From and To. Results from one day only: no date bar.
231
295
  $("dates").hidden = DAYS.length < 2;
232
- $("chips").replaceChildren(...DAYS.map((k, n) => {
296
+ $("chips").replaceChildren(...DAYS.slice(0, CHIPS).map((k) => {
233
297
  const b = document.createElement("button");
234
298
  b.type = "button"; b.dataset.day = k;
235
- if (n >= CHIPS) b.className = "extra";
236
299
  b.textContent = `${yearDay(k)} (${counts[k]})`;
237
300
  b.title = day(new Date(k + "T12:00").getTime() / 1000);
238
301
  b.onclick = () => { F.from = F.to = k; F.shown = PAGE; render(); };
239
302
  return b;
240
303
  }));
241
- $("morechips").hidden = DAYS.length <= CHIPS;
242
304
  // the range: two lists of the days with results, oldest first; the sort order
243
305
  $("lfrom").textContent = t.from; $("lto").textContent = t.until; $("lsort").textContent = t.sort;
244
306
  const opts = () => DAYS.slice().reverse().map((k) => { const o = document.createElement("option"); o.value = k; o.textContent = yearDay(k); return o; });
@@ -246,8 +308,6 @@ function texts() {
246
308
  const so = $("sort").options; so[0].textContent = t.byMatch; so[1].textContent = t.newest; so[2].textContent = t.oldest;
247
309
  $("tools").hidden = CARDS.length < 2;
248
310
  $("range").hidden = DAYS.length < 2;
249
- const label = () => { $("morechips").textContent = $("chips").classList.contains("all") ? t.fewer : t.moreDates(DAYS.length - CHIPS); };
250
- label(); $("morechips").onclick = () => { $("chips").classList.toggle("all"); label(); };
251
311
  render();
252
312
  }
253
313
 
@@ -279,15 +339,19 @@ function render() {
279
339
 
280
340
  function card(r) {
281
341
  const t = T(), f = r.frames.find((x) => x.id === r.id);
282
- const fig = document.createElement("figure");
283
- const img = document.createElement("img");
342
+ const el = (tag, cls, text) => { const e = document.createElement(tag); if (cls) e.className = cls; if (text != null) e.textContent = text; return e; };
343
+ const fig = el("figure");
344
+ const pic = el("div", "pic"), img = el("img");
284
345
  img.loading = "lazy"; img.src = f.thumb; img.alt = where(f) || t.screenshot;
285
- const cap = document.createElement("figcaption");
286
- const when = document.createElement("div");
287
- when.className = "when"; when.textContent = `${shortDay(f.ts)} · ${hm(f.ts)}`; when.title = t.match(r.score.toFixed(3));
288
- const w = document.createElement("div");
289
- w.className = "where"; w.textContent = where(f); if (f.source) w.title = f.source;
290
- cap.append(when); if (where(f)) cap.append(w); fig.append(img, cap);
346
+ pic.append(img, el("span", "more", t.seeMore));
347
+ const cap = el("figcaption");
348
+ // the time, the day beside it
349
+ const when = el("div", "when");
350
+ when.append(el("span", "time", hm(f.ts)), el("span", "day", shortDay(f.ts)));
351
+ when.title = t.match(r.score.toFixed(3));
352
+ const w = el("div", "where", where(f)); if (f.source) w.title = f.source;
353
+ cap.append(when); if (where(f)) cap.append(w);
354
+ fig.append(pic, cap);
291
355
  fig.tabIndex = 0; fig.setAttribute("role", "button");
292
356
  fig.setAttribute("aria-label", t.openMatch(stamp(f.ts)));
293
357
  fig.onclick = () => open(r);
@@ -402,6 +466,7 @@ function show() {
402
466
  else if (hit) when += ` · ${f.ts < hit.ts ? t.before(span(hit.ts - f.ts)) : t.after(span(f.ts - hit.ts))}`;
403
467
  $("vwhen").textContent = when; $("vwhere").textContent = where(f) || " "; $("vwhere").title = f.source || "";
404
468
  $("vprev").disabled = V.i === 0; $("vnext").disabled = V.i === fr.length - 1;
469
+ $("vcount").textContent = fr.length > 1 ? `${V.i + 1} / ${fr.length}` : "";
405
470
  $("vstrip").querySelectorAll(".tick").forEach((b) => b.classList.toggle("active", Number(b.dataset.k) === V.i));
406
471
  $("vstrip").querySelector(".tick.active")?.scrollIntoView({ block: "nearest", inline: "center" });
407
472
  }
@@ -0,0 +1,31 @@
1
+ """`streamembed start` on macOS reads the service's first log line to warn only when screen capture is not allowed."""
2
+ from streamembed.cli import _screen_allowed, _warn_screen_permission
3
+ from streamembed.service import SCREEN_ALLOWED, SCREEN_NOT_ALLOWED
4
+
5
+
6
+ def _log(tmp_path, *lines):
7
+ p = tmp_path / "service.log"
8
+ p.write_text("".join(l + "\n" for l in lines), encoding="utf-8")
9
+ return p
10
+
11
+
12
+ def test_allowed_and_not_allowed(tmp_path):
13
+ assert _screen_allowed(_log(tmp_path, SCREEN_ALLOWED), 0, timeout=1) is True
14
+ assert _screen_allowed(_log(tmp_path, SCREEN_NOT_ALLOWED, "streamembed service: Screen capture needs ..."), 0, timeout=1) is False
15
+
16
+
17
+ def test_reads_only_after_offset(tmp_path):
18
+ old = SCREEN_NOT_ALLOWED + "\n" # an earlier run's line stays in the log
19
+ p = _log(tmp_path, SCREEN_NOT_ALLOWED, SCREEN_ALLOWED)
20
+ assert _screen_allowed(p, len(old.encode()), timeout=1) is True
21
+
22
+
23
+ def test_other_first_line_or_nothing(tmp_path):
24
+ assert _screen_allowed(_log(tmp_path, "streamembed service: unknown model x. Fix the setting"), 0, timeout=5) is None
25
+ assert _screen_allowed(tmp_path / "missing.log", 0, timeout=0.3) is None
26
+
27
+
28
+ def test_warning_text(capsys):
29
+ _warn_screen_permission()
30
+ err = capsys.readouterr().err
31
+ assert err.startswith("Warning: ") and "Screen & System Audio Recording" in err and "streamembed start" in err
File without changes
File without changes
File without changes
File without changes