fbchat-v2 2.3.0__tar.gz → 2.3.1__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 (58) hide show
  1. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/CHANGELOG.md +12 -5
  2. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/PKG-INFO +2 -2
  3. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/pyproject.toml +1 -1
  4. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/__init__.py +1 -1
  5. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/__init__.py +3 -0
  6. fbchat_v2-2.3.1/src/fbchat_v2/_features/_facebook/_reactionPost.py +145 -0
  7. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_listening_e2ee.py +55 -60
  8. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/.gitignore +0 -0
  9. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/LICENSE +0 -0
  10. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/README.md +0 -0
  11. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/README_EN.md +0 -0
  12. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/__init__.py +0 -0
  13. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/README.md +0 -0
  14. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/README_EN.md +0 -0
  15. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_facebookLogin.py +0 -0
  16. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_http.py +0 -0
  17. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_permissions.py +0 -0
  18. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_session.py +0 -0
  19. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_storage.py +0 -0
  20. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_types.py +0 -0
  21. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_core/_utils.py +0 -0
  22. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/README.md +0 -0
  23. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/README_EN.md +0 -0
  24. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/__init__.py +0 -0
  25. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_archivePost.py +0 -0
  26. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_blocking.py +0 -0
  27. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_changeBio.py +0 -0
  28. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_createPost.py +0 -0
  29. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_deletePost.py +0 -0
  30. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_get_user_info.py +0 -0
  31. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_marketplace.py +0 -0
  32. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_notification.py +0 -0
  33. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_professional.py +0 -0
  34. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_registerOnProfile.py +0 -0
  35. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_search.py +0 -0
  36. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_facebook/_unFriend.py +0 -0
  37. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/__init__.py +0 -0
  38. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/_addAdmin.py +0 -0
  39. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/_all_thread_data.py +0 -0
  40. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/_changeEmoji.py +0 -0
  41. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/_changeNameThread.py +0 -0
  42. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_features/_thread/_changeNickname.py +0 -0
  43. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/README.md +0 -0
  44. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/README_EN.md +0 -0
  45. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/__init__.py +0 -0
  46. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_attachments.py +0 -0
  47. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_bridge_actions.py +0 -0
  48. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_bridge_checksums.py +0 -0
  49. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_changeTheme.py +0 -0
  50. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_createNotes.py +0 -0
  51. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_editMessage.py +0 -0
  52. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_listening.py +0 -0
  53. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_message_requests.py +0 -0
  54. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_reactions.py +0 -0
  55. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_send.py +0 -0
  56. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_send_e2ee.py +0 -0
  57. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/_messaging/_unsend.py +0 -0
  58. {fbchat_v2-2.3.0 → fbchat_v2-2.3.1}/src/fbchat_v2/py.typed +0 -0
@@ -9,6 +9,13 @@ phiên bản tuân theo [Semantic Versioning](https://semver.org/lang/vi/).
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [2.3.1] - 2026-09-07
13
+
14
+ ### Added
15
+
16
+ - Bổ sung module _features._facebook._reactionPost: Hỗ trợ thả cảm xúc (LIKE, LOVE, CARE, HAHA, WOW, SAD, ANGRY) hoặc gỡ cảm xúc (UNDO/UNREACT) trên bài viết cá nhân bằng GraphQL CometUFIFeedbackReactMutation.
17
+ - Đồng bộ export _reactionPost, _archivePost, _deletePost trong _features._facebook.__all__.
18
+
12
19
  ## [2.3.0] - 2026-08-29
13
20
 
14
21
  ### Changed
@@ -46,13 +53,13 @@ phiên bản tuân theo [Semantic Versioning](https://semver.org/lang/vi/).
46
53
 
47
54
  ### Packaging and CI
48
55
 
49
- - Wheel PyPI giữ public namespace `fbchat_v2` của các bản trước, không đóng gói
50
- namespace nội bộ `src`; thêm smoke test cho wheel và sdist cài sạch.
56
+ - Wheel PyPI giữ public namespace `fbchat_v2` của các bản trước, không đóng gói
57
+ namespace nội bộ `src`; thêm smoke test cho wheel và sdist cài sạch.
51
58
  - CI enforce compile, Ruff, Black, mypy, pytest Python 3.10-3.14, Go test/vet,
52
59
  package smoke test và JavaScript syntax.
53
- - Nhúng checksum của đúng năm binary từ GitHub Release `v2.3.0`; auto-download
54
- pin canonical repository/tag/path và fail-closed nếu URL, digest hoặc nội dung
55
- tải về không khớp.
60
+ - Nhúng checksum của đúng năm binary từ GitHub Release `v2.3.0`; auto-download
61
+ pin canonical repository/tag/path và fail-closed nếu URL, digest hoặc nội dung
62
+ tải về không khớp.
56
63
 
57
64
  ## [2.2.0-beta] - 2026-07-06
58
65
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: fbchat-v2
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Async-first, account-based Python library for the unofficial Facebook Messenger API with E2EE support.
5
5
  Project-URL: Homepage, https://github.com/MinhHuyDev/fbchat-v2
6
6
  Project-URL: Documentation, https://github.com/MinhHuyDev/fbchat-v2/blob/main/DOCS.md
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fbchat-v2"
7
- version = "2.3.0"
7
+ version = "2.3.1"
8
8
  description = "Async-first, account-based Python library for the unofficial Facebook Messenger API with E2EE support."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -22,6 +22,6 @@ from importlib.metadata import version, PackageNotFoundError
22
22
  try:
23
23
  __version__ = version("fbchat-v2")
24
24
  except PackageNotFoundError:
25
- __version__ = "2.3.0"
25
+ __version__ = "2.3.1"
26
26
 
27
27
  __all__ = ["_session", "_utils", "_facebookLogin", "__version__"]
@@ -28,4 +28,7 @@ __all__ = [
28
28
  "_registerOnProfile",
29
29
  "_search",
30
30
  "_unFriend",
31
+ "_archivePost",
32
+ "_deletePost",
33
+ "_reactionPost",
31
34
  ]
@@ -0,0 +1,145 @@
1
+ """
2
+ Đường dẫn file:
3
+ src/fbchat_v2/_features/_facebook/_reactionPost.py
4
+
5
+ Mục đích:
6
+ - Thả cảm xúc (Reaction) hoặc gỡ cảm xúc trên bài viết Facebook.
7
+
8
+ Cách hoạt động:
9
+ - Nạp dependency/guard cần thiết, thực hiện các async HTTP requests tới GraphQL của Facebook.
10
+ - Sử dụng mutation CometUFIFeedbackReactMutation để cập nhật cảm xúc.
11
+ - Các thao tác request đều phải thông qua httpx.AsyncClient và module _core._utils để bảo đảm an toàn kết nối.
12
+ - Payload gửi đi/nhận về được xử lý JSON cẩn thận, bắt lỗi try-except đầy đủ để tránh crash hệ thống.
13
+
14
+ File liên quan:
15
+ - src/main.py và các entrypoint khác.
16
+ - Phụ thuộc vào _core._session, _core._utils để khởi tạo và thao tác HTTP.
17
+
18
+ Author: @m008v (MinhHuyDev)
19
+ """
20
+
21
+ from __future__ import annotations
22
+
23
+ import base64
24
+ import json
25
+ import random
26
+ import time
27
+ import uuid
28
+ from typing import Any
29
+
30
+ import httpx
31
+
32
+ from fbchat_v2._core._utils import formAll, post_form_json_async
33
+
34
+ _URL = "https://www.facebook.com/api/graphql/"
35
+ _DOC_ID = 27646120298312844
36
+
37
+ _REACTION_MAP: dict[str, str] = {
38
+ "LIKE": "1635855486666999",
39
+ "LOVE": "1678524932434102",
40
+ "CARE": "613557422527858",
41
+ "SUPPORT": "613557422527858",
42
+ "HAHA": "115940658764963",
43
+ "WOW": "478547315650144",
44
+ "SAD": "908563459236466",
45
+ "SORRY": "908563459236466",
46
+ "ANGRY": "444813342392137",
47
+ "ANGER": "444813342392137",
48
+ "UNDO": "0",
49
+ "UNREACT": "0",
50
+ "NONE": "0",
51
+ }
52
+
53
+
54
+ def _resolve_feedback_id(post_id: str | int) -> str:
55
+ raw_id = str(post_id).strip()
56
+ if not raw_id:
57
+ raise ValueError("ID bài viết không được để trống.")
58
+
59
+ if raw_id.startswith("ZmVlZGJhY2s6"):
60
+ return raw_id
61
+
62
+ target = raw_id if raw_id.startswith("feedback:") else f"feedback:{raw_id}"
63
+ return base64.b64encode(target.encode()).decode()
64
+
65
+
66
+ def _build_form(
67
+ dataFB: dict[str, Any], postID: str | int, typeReactions: str = "LIKE"
68
+ ) -> tuple[dict[str, Any], bool]:
69
+ clean_reaction = str(typeReactions).strip().upper()
70
+ if clean_reaction not in _REACTION_MAP:
71
+ valid_keys = ", ".join(
72
+ k for k in _REACTION_MAP.keys() if k not in {"SUPPORT", "SORRY", "ANGER", "NONE"}
73
+ )
74
+ raise ValueError(
75
+ f"Loại cảm xúc '{typeReactions}' không hợp lệ. Vui lòng sử dụng một trong các loại: {valid_keys}."
76
+ )
77
+
78
+ reaction_id = _REACTION_MAP[clean_reaction]
79
+ is_undo = reaction_id == "0"
80
+ feedback_id_b64 = _resolve_feedback_id(postID)
81
+
82
+ data_form = formAll(dataFB, "CometUFIFeedbackReactMutation", _DOC_ID)
83
+ actor_id = str(dataFB["FacebookID"])
84
+ jazoest = str(dataFB.get("jazoest") or "")
85
+ now_ms = int(time.time() * 1000)
86
+
87
+ data_form["variables"] = json.dumps(
88
+ {
89
+ "input": {
90
+ "attribution_id_v2": (
91
+ f"ProfileCometTimelineListViewRoot.react,comet.profile.timeline.list,"
92
+ f"tap_bookmark,{now_ms},{jazoest},{actor_id}"
93
+ ),
94
+ "feedback_id": feedback_id_b64,
95
+ "feedback_reaction_id": reaction_id,
96
+ "feedback_source": "PROFILE",
97
+ "feedback_referrer": f"/{actor_id}",
98
+ "session_id": str(uuid.uuid4()),
99
+ "actor_id": actor_id,
100
+ "client_mutation_id": str(random.randint(1, 10000)),
101
+ },
102
+ "scale": 1,
103
+ "canUseNicknameOnComet": False,
104
+ "useDefaultActor": False,
105
+ "__relay_internal__pv__CometUFIReactionsEnableShortNamerelayprovider": False,
106
+ },
107
+ separators=(",", ":"),
108
+ )
109
+
110
+ return data_form, is_undo
111
+
112
+
113
+ def _parse_result(payload: dict[str, Any], is_undo: bool) -> dict[str, Any]:
114
+ errors = payload.get("errors") or []
115
+ if errors and isinstance(errors, list):
116
+ message = errors[0].get("message") if isinstance(errors[0], dict) else None
117
+ return {"error": 1, "messages": message or "Facebook không phản hồi hợp lệ."}
118
+
119
+ data = payload.get("data")
120
+ if not isinstance(data, dict) or not data.get("feedback_react"):
121
+ return {"error": 1, "messages": "Facebook không xác nhận thao tác cảm xúc."}
122
+
123
+ action_text = "Gỡ reaction" if is_undo else "Thả reaction"
124
+ return {"success": 1, "messages": f"{action_text} thành công!"}
125
+
126
+
127
+ async def func(
128
+ dataFB: dict[str, Any],
129
+ postID: str | int,
130
+ typeReactions: str = "LIKE",
131
+ *,
132
+ client: httpx.AsyncClient | None = None,
133
+ ) -> dict[str, Any]:
134
+ """Tương tác thả cảm xúc hoặc gỡ cảm xúc trên bài viết Facebook."""
135
+ try:
136
+ data_form, is_undo = _build_form(dataFB, postID, typeReactions)
137
+ payload = await post_form_json_async(
138
+ _URL,
139
+ data_form,
140
+ dataFB["cookieFacebook"],
141
+ client=client,
142
+ )
143
+ return _parse_result(payload, is_undo)
144
+ except (httpx.HTTPError, ValueError, TypeError, KeyError) as exc:
145
+ return {"error": 1, "messages": str(exc)}
@@ -64,10 +64,10 @@ from fbchat_v2._messaging._bridge_checksums import BRIDGE_RELEASE_VERSION, BRIDG
64
64
  # ---------------------------------------------------------------------------
65
65
 
66
66
 
67
- _MAX_BRIDGE_SIZE = 200 * 1024 * 1024
68
- _RELEASE_VERSION_PATTERN = re.compile(r"[0-9A-Za-z][0-9A-Za-z._+-]*")
69
- _GITHUB_RELEASE_REPOSITORY = "m008v/fbchat-v2"
70
- _TRUSTED_DOWNLOAD_HOSTS = {
67
+ _MAX_BRIDGE_SIZE = 200 * 1024 * 1024
68
+ _RELEASE_VERSION_PATTERN = re.compile(r"[0-9A-Za-z][0-9A-Za-z._+-]*")
69
+ _GITHUB_RELEASE_REPOSITORY = "m008v/fbchat-v2"
70
+ _TRUSTED_DOWNLOAD_HOSTS = {
71
71
  "api.github.com",
72
72
  "github.com",
73
73
  "objects.githubusercontent.com",
@@ -102,43 +102,43 @@ def _binary_name() -> str:
102
102
  return name
103
103
 
104
104
 
105
- def _default_binary_path() -> Path:
106
- name = _binary_name()
107
- project_root = _source_project_root()
108
- if project_root is not None and _is_source_checkout():
109
- return project_root / "build" / name
105
+ def _default_binary_path() -> Path:
106
+ name = _binary_name()
107
+ project_root = _source_project_root()
108
+ if project_root is not None and _is_source_checkout():
109
+ return project_root / "build" / name
110
110
 
111
111
  if sys.platform.startswith("win"):
112
112
  cache_root = Path(os.environ.get("LOCALAPPDATA") or Path.home())
113
113
  else:
114
114
  cache_root = Path(os.environ.get("XDG_CACHE_HOME") or (Path.home() / ".cache"))
115
- package_version = _expected_package_version()
116
- return cache_root / "fbchat-v2" / "bridge" / f"v{package_version}" / name
117
-
118
-
119
- def _source_project_root() -> Path | None:
120
- """Tìm project root cho cả layout `src/_messaging` và `src/fbchat_v2`."""
121
- here = Path(__file__).resolve()
122
- for parent_index in (2, 3):
123
- try:
124
- candidate = here.parents[parent_index]
125
- except IndexError: # pragma: no cover - đường dẫn module luôn đủ sâu
126
- continue
127
- if (candidate / "pyproject.toml").is_file():
128
- return candidate
129
- return None
130
-
131
-
132
- def _is_source_checkout() -> bool:
133
- project_root = _source_project_root()
134
- return project_root is not None and (project_root / "bridge-e2ee").is_dir()
135
-
136
-
137
- def _expected_package_version() -> str:
138
- """Resolve version from the checkout instead of stale installed metadata."""
139
- project_root = _source_project_root()
140
- if project_root is not None:
141
- pyproject = project_root / "pyproject.toml"
115
+ bridge_version = BRIDGE_RELEASE_VERSION or _expected_package_version()
116
+ return cache_root / "fbchat-v2" / "bridge" / f"v{bridge_version}" / name
117
+
118
+
119
+ def _source_project_root() -> Path | None:
120
+ """Tìm project root cho cả layout `src/_messaging` và `src/fbchat_v2`."""
121
+ here = Path(__file__).resolve()
122
+ for parent_index in (2, 3):
123
+ try:
124
+ candidate = here.parents[parent_index]
125
+ except IndexError: # pragma: no cover - đường dẫn module luôn đủ sâu
126
+ continue
127
+ if (candidate / "pyproject.toml").is_file():
128
+ return candidate
129
+ return None
130
+
131
+
132
+ def _is_source_checkout() -> bool:
133
+ project_root = _source_project_root()
134
+ return project_root is not None and (project_root / "bridge-e2ee").is_dir()
135
+
136
+
137
+ def _expected_package_version() -> str:
138
+ """Resolve version from the checkout instead of stale installed metadata."""
139
+ project_root = _source_project_root()
140
+ if project_root is not None:
141
+ pyproject = project_root / "pyproject.toml"
142
142
  match = re.search(
143
143
  r'^version\s*=\s*"([0-9A-Za-z][0-9A-Za-z._+-]*)"\s*$',
144
144
  pyproject.read_text(encoding="utf-8"),
@@ -150,12 +150,12 @@ def _expected_package_version() -> str:
150
150
  return _PACKAGE_VERSION
151
151
 
152
152
 
153
- def _source_bridge_inputs() -> list[Path]:
154
- """Liệt kê source/asset có thể làm thay đổi bridge được build."""
155
- project_root = _source_project_root()
156
- if project_root is None:
157
- return []
158
- bridge_root = project_root / "bridge-e2ee"
153
+ def _source_bridge_inputs() -> list[Path]:
154
+ """Liệt kê source/asset có thể làm thay đổi bridge được build."""
155
+ project_root = _source_project_root()
156
+ if project_root is None:
157
+ return []
158
+ bridge_root = project_root / "bridge-e2ee"
159
159
  inputs = {
160
160
  path
161
161
  for path in bridge_root.rglob("*.go")
@@ -186,15 +186,10 @@ def _source_bridge_is_stale(binary: Path) -> bool:
186
186
  return False
187
187
 
188
188
 
189
- def _release_version_and_digest(binary_name: str) -> tuple[str, str]:
190
- package_version = _expected_package_version()
191
- release_version = BRIDGE_RELEASE_VERSION or package_version
189
+ def _release_version_and_digest(binary_name: str) -> tuple[str, str]:
190
+ release_version = BRIDGE_RELEASE_VERSION or _expected_package_version()
192
191
  if not _RELEASE_VERSION_PATTERN.fullmatch(release_version):
193
- raise RuntimeError("Phiên bản package không hợp lệ để tải bridge an toàn.")
194
- if BRIDGE_RELEASE_VERSION and BRIDGE_RELEASE_VERSION != package_version:
195
- raise RuntimeError(
196
- "Bảng checksum bridge không khớp phiên bản package đang cài đặt."
197
- )
192
+ raise RuntimeError("Phiên bản bridge không hợp lệ để tải an toàn.")
198
193
 
199
194
  expected_sha256 = (
200
195
  (os.environ.get("FBCHAT_E2EE_SHA256") or BRIDGE_SHA256.get(binary_name) or "")
@@ -294,10 +289,10 @@ def _download_bridge(target_path: Path) -> None:
294
289
  )
295
290
 
296
291
  release_tag = f"v{release_version}"
297
- api_url = (
298
- f"https://api.github.com/repos/{_GITHUB_RELEASE_REPOSITORY}/releases/tags/"
299
- f"{release_tag}"
300
- )
292
+ api_url = (
293
+ f"https://api.github.com/repos/{_GITHUB_RELEASE_REPOSITORY}/releases/tags/"
294
+ f"{release_tag}"
295
+ )
301
296
  temporary_path: Path | None = None
302
297
  try:
303
298
  resp = httpx.get(api_url, timeout=10, follow_redirects=True)
@@ -325,10 +320,10 @@ def _download_bridge(target_path: Path) -> None:
325
320
  _validate_https_download_url(download_url)
326
321
  if (parsed_url.hostname or "").lower() != "github.com":
327
322
  raise RuntimeError("GitHub API trả về asset URL không chính thức.")
328
- expected_path = (
329
- f"/{_GITHUB_RELEASE_REPOSITORY}/releases/download/"
330
- f"{release_tag}/{binary_name}"
331
- )
323
+ expected_path = (
324
+ f"/{_GITHUB_RELEASE_REPOSITORY}/releases/download/"
325
+ f"{release_tag}/{binary_name}"
326
+ )
332
327
  if unquote(parsed_url.path) != expected_path:
333
328
  raise RuntimeError("GitHub API trả về asset ngoài release đã pin.")
334
329
  if github_digest:
@@ -438,8 +433,8 @@ def _resolve_binary() -> Path:
438
433
  raise FileNotFoundError(
439
434
  f"{e}\n"
440
435
  f"Vui lòng tự build: cd fbchat-v2/bridge-e2ee && go build -o ../build/{candidate.name} .\n"
441
- "Hoặc đặt FBCHAT_E2EE_BIN; source checkout không có checksum nhúng "
442
- "cần FBCHAT_E2EE_SHA256 tin cậy."
436
+ "Hoặc đặt FBCHAT_E2EE_BIN; source checkout không có checksum nhúng "
437
+ "cần FBCHAT_E2EE_SHA256 tin cậy."
443
438
  ) from e
444
439
  return candidate
445
440
 
File without changes
File without changes
File without changes
File without changes