ghostbit-cli 1.1.0__tar.gz → 1.2.0__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: ghostbit-cli
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Ghostbit CLI — create end-to-end encrypted pastes from the terminal
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/stackopshq/ghostbit
@@ -23,6 +23,7 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: certifi
26
27
  Provides-Extra: color
27
28
  Requires-Dist: pygments>=2.17.0; extra == "color"
28
29
  Provides-Extra: markdown
@@ -16,15 +16,32 @@ import base64
16
16
  import getpass
17
17
  import json
18
18
  import os
19
+ import ssl
19
20
  import sys
20
21
  import time
21
22
  import urllib.error
22
23
  import urllib.request
23
24
  from pathlib import Path
24
25
 
25
- __version__ = "1.1.0"
26
+ # Version is read from the installed package metadata (single source of truth:
27
+ # cli/pyproject.toml). Falls back to "dev" when running from a source checkout.
28
+ try:
29
+ from importlib.metadata import PackageNotFoundError, version as _pkg_version
30
+ try:
31
+ __version__ = _pkg_version("ghostbit-cli")
32
+ except PackageNotFoundError:
33
+ __version__ = "dev"
34
+ except ImportError:
35
+ __version__ = "dev"
26
36
  _USER_AGENT = f"Ghostbit-CLI/{__version__}"
27
37
 
38
+ # Build an SSL context that works on macOS (certifi) and everywhere else.
39
+ try:
40
+ import certifi
41
+ _SSL_CTX = ssl.create_default_context(cafile=certifi.where())
42
+ except ImportError:
43
+ _SSL_CTX = ssl.create_default_context()
44
+
28
45
  LANGUAGES = [
29
46
  "python", "javascript", "typescript", "go", "rust", "ruby", "php",
30
47
  "java", "c", "cpp", "csharp", "bash", "powershell", "html", "css",
@@ -333,7 +350,7 @@ def cmd_view(args):
333
350
  api_url = f"{server}/api/v1/pastes/{paste_id}"
334
351
  req = urllib.request.Request(api_url, headers={"User-Agent": _USER_AGENT})
335
352
  try:
336
- with urllib.request.urlopen(req, timeout=15) as resp:
353
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX) as resp:
337
354
  data = json.loads(resp.read())
338
355
  except urllib.error.HTTPError as e:
339
356
  body = e.read().decode(errors="replace")
@@ -394,7 +411,7 @@ def _api_create(server: str, payload: dict) -> dict:
394
411
  method="POST",
395
412
  )
396
413
  try:
397
- with urllib.request.urlopen(req, timeout=15) as resp:
414
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX) as resp:
398
415
  return json.loads(resp.read())
399
416
  except urllib.error.HTTPError as e:
400
417
  body = e.read().decode(errors="replace")
@@ -461,7 +478,7 @@ def cmd_delete(url: str) -> None:
461
478
  method="DELETE",
462
479
  )
463
480
  try:
464
- with urllib.request.urlopen(req, timeout=15):
481
+ with urllib.request.urlopen(req, timeout=15, context=_SSL_CTX):
465
482
  pass
466
483
  print(f"Deleted {paste_id}.")
467
484
  except urllib.error.HTTPError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghostbit-cli
3
- Version: 1.1.0
3
+ Version: 1.2.0
4
4
  Summary: Ghostbit CLI — create end-to-end encrypted pastes from the terminal
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/stackopshq/ghostbit
@@ -23,6 +23,7 @@ Classifier: Topic :: Utilities
23
23
  Requires-Python: >=3.10
24
24
  Description-Content-Type: text/markdown
25
25
  Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: certifi
26
27
  Provides-Extra: color
27
28
  Requires-Dist: pygments>=2.17.0; extra == "color"
28
29
  Provides-Extra: markdown
@@ -1,4 +1,5 @@
1
1
  cryptography>=42.0.0
2
+ certifi
2
3
 
3
4
  [all]
4
5
  pygments>=2.17.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghostbit-cli"
7
- version = "1.1.0"
7
+ version = "1.2.0"
8
8
  description = "Ghostbit CLI — create end-to-end encrypted pastes from the terminal"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -27,6 +27,7 @@ classifiers = [
27
27
  ]
28
28
  dependencies = [
29
29
  "cryptography>=42.0.0",
30
+ "certifi",
30
31
  ]
31
32
 
32
33
  [project.optional-dependencies]
File without changes
File without changes
File without changes