sing-box-cli 0.1.6__tar.gz → 0.1.7__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 (37) hide show
  1. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/PKG-INFO +1 -1
  2. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/docs/config-serve.md +3 -3
  3. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/pyproject.toml +1 -1
  4. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/__init__.py +1 -1
  5. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/serve.py +3 -41
  6. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/main.py +2 -2
  7. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/.gitignore +0 -0
  8. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/LICENSE +0 -0
  9. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/README.md +0 -0
  10. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/docs/traefik-config-serve.yml +0 -0
  11. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/hatch_build.py +0 -0
  12. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/__init__.py +0 -0
  13. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/client.py +0 -0
  14. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/connections.py +0 -0
  15. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/logs.py +0 -0
  16. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/monitor.py +0 -0
  17. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/policy.py +0 -0
  18. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/api/widget.py +0 -0
  19. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/common.py +0 -0
  20. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/__init__.py +0 -0
  21. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/_serve_worker.py +0 -0
  22. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/config.py +0 -0
  23. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/serve_backend.py +0 -0
  24. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/serve_tokens.py +0 -0
  25. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/config/utils.py +0 -0
  26. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/installation.py +0 -0
  27. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/py.typed +0 -0
  28. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/service/__init__.py +0 -0
  29. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/src/sing_box_cli/service/manager.py +0 -0
  30. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/common.go +0 -0
  31. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/common_test.go +0 -0
  32. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/go.mod +0 -0
  33. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/go.sum +0 -0
  34. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/integration_windows_test.go +0 -0
  35. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/main_other.go +0 -0
  36. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/main_windows.go +0 -0
  37. {sing_box_cli-0.1.6 → sing_box_cli-0.1.7}/windows-service/testdata/core.go +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sing-box-cli
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: cross-platform sing-box manager.
5
5
  Project-URL: Homepage, https://github.com/aittcuszz/sing-box-service
6
6
  Project-URL: Issues, https://github.com/atticuszz/sing-box-service/issues
@@ -33,9 +33,9 @@ every token for that file without affecting other files. Multiple tokens may
33
33
  authorize the same file, so rotation can create a replacement before revoking the
34
34
  old token. Revocation never prints the secret.
35
35
 
36
- The longer `config serve token -l/-c/-r` forms remain supported. The previous
37
- `config serve token create/list/revoke` subcommands remain hidden compatibility
38
- aliases; the legacy `revoke NAME` form still accepts a token name.
36
+ Token management uses only the top-level `sbc token` options. The previous
37
+ `config serve token` entry point and `token create/list/revoke` subcommands have
38
+ been removed.
39
39
 
40
40
  Clients can send the token as a Bearer header using `-t` / `--token`, or use the
41
41
  printed URL with `?token=...` in applications that cannot set headers:
@@ -215,7 +215,7 @@ topo_order = false
215
215
  sort_commits = "oldest"
216
216
 
217
217
  [tool.bumpversion]
218
- current_version = "0.1.6"
218
+ current_version = "0.1.7"
219
219
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
220
220
  serialize = ["{major}.{minor}.{patch}"]
221
221
  search = "{current_version}"
@@ -2,4 +2,4 @@ from .main import main
2
2
 
3
3
  __all__ = ["main"]
4
4
 
5
- __version__ = "0.1.6"
5
+ __version__ = "0.1.7"
@@ -25,17 +25,10 @@ from .serve_backend import (
25
25
  state_directory,
26
26
  validate_config,
27
27
  )
28
- from .serve_tokens import (
29
- create_token,
30
- load_tokens,
31
- revoke_subscription_tokens,
32
- revoke_token,
33
- )
28
+ from .serve_tokens import create_token, load_tokens, revoke_subscription_tokens
34
29
 
35
30
  WORKER_MODULE = "sing_box_cli.config._serve_worker"
36
31
  serve = typer.Typer(help="Serve private GitHub configurations through your own domain.")
37
- tokens = typer.Typer(help="Create, list and revoke independent subscription tokens.")
38
- serve.add_typer(tokens, name="token")
39
32
 
40
33
 
41
34
  class ProcessState(BaseModel):
@@ -278,7 +271,6 @@ def start(
278
271
  print(f"Log: {directory / 'serve.log'}")
279
272
 
280
273
 
281
- @tokens.callback(invoke_without_command=True)
282
274
  def token_options(
283
275
  ctx: typer.Context,
284
276
  list_: Annotated[
@@ -310,12 +302,8 @@ def token_options(
310
302
  str | None, typer.Option("--name", "-n", help="Optional name for a new token.")
311
303
  ] = None,
312
304
  ) -> None:
313
- """Manage subscription tokens with -l, -c FILE or -r TOKEN_OR_FILE."""
305
+ """Create, list and revoke independent subscription tokens."""
314
306
  actions = int(list_) + int(create is not None) + int(revoke is not None)
315
- if ctx.invoked_subcommand is not None:
316
- if actions or domain is not None or name is not None:
317
- raise typer.BadParameter("Use options or a legacy subcommand, not both.")
318
- return
319
307
  if actions == 0 and domain is None and name is None:
320
308
  print(ctx.get_help())
321
309
  return
@@ -348,18 +336,7 @@ def token_options(
348
336
  print(f"Revoked {count} subscription token(s).")
349
337
 
350
338
 
351
- @tokens.command("create", hidden=True)
352
- def token_create(
353
- name: Annotated[
354
- str, typer.Argument(help="Unique name for this subscription token.")
355
- ],
356
- domain: Annotated[
357
- str, typer.Option("--domain", help="Registered subscription domain.")
358
- ],
359
- filename: Annotated[
360
- str, typer.Option("--file", help="Root configuration filename.")
361
- ],
362
- ) -> None:
339
+ def token_create(name: str, domain: str, filename: str) -> None:
363
340
  """Generate a file-scoped token and print its secret and URL once."""
364
341
  with command_errors():
365
342
  domain = normalize_domain(domain)
@@ -379,7 +356,6 @@ def token_create(
379
356
  print("Save the token now; only its hash is stored on the server.")
380
357
 
381
358
 
382
- @tokens.command("list", hidden=True)
383
359
  def token_list() -> None:
384
360
  """List token names and scopes without displaying their secrets."""
385
361
  with command_errors():
@@ -390,20 +366,6 @@ def token_list() -> None:
390
366
  print(f"{item.name}\t{item.domain}\t{item.filename}\t{item.created_at}")
391
367
 
392
368
 
393
- @tokens.command("revoke", hidden=True)
394
- def token_revoke(
395
- name: Annotated[
396
- str, typer.Argument(help="Name of the subscription token to revoke.")
397
- ],
398
- ) -> None:
399
- """Revoke a token; the next request is denied without a service restart."""
400
- with command_errors():
401
- directory = state_directory()
402
- with control_lock(directory):
403
- revoke_token(directory, name)
404
- print(f"Revoked subscription token: {name}")
405
-
406
-
407
369
  @serve.command("stop")
408
370
  def stop() -> None:
409
371
  """Stop this user's background configuration service."""
@@ -9,7 +9,7 @@ from sing_box_cli.api import api as api_app
9
9
  from sing_box_cli.common import ClearCacheOption, UpdateConfigOption, ensure_root
10
10
  from sing_box_cli.config import config as config_app
11
11
  from sing_box_cli.config.config import get_config, run_args
12
- from sing_box_cli.config.serve import tokens as token_app
12
+ from sing_box_cli.config.serve import token_options
13
13
  from sing_box_cli.installation import install_launchers
14
14
  from sing_box_cli.service import SharedContext, get_context_obj, service as service_app
15
15
  from sing_box_cli.service.manager import create_service
@@ -18,7 +18,7 @@ app = typer.Typer(help="sing-box manager.")
18
18
  app.add_typer(api_app)
19
19
  app.add_typer(service_app, name="service")
20
20
  app.add_typer(config_app, name="config")
21
- app.add_typer(token_app, name="token")
21
+ app.command("token")(token_options)
22
22
 
23
23
 
24
24
  @app.callback(invoke_without_command=False)
File without changes
File without changes
File without changes