mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-07-11 09:51:44 +00:00
simplex-chat: sync nodejs and python libs with 7.0.0-beta.3 types (#7219)
This commit is contained in:
@@ -688,7 +688,7 @@ export class ChatApi {
|
||||
* Network usage: interactive.
|
||||
*/
|
||||
async apiConnectPlan(userId: number, connectionLink: string): Promise<[T.ConnectionPlan, T.CreatedConnLink]> {
|
||||
const r = await this.sendChatCmd(CC.APIConnectPlan.cmdString({userId, connectionLink, resolveKnown: false}))
|
||||
const r = await this.sendChatCmd(CC.APIConnectPlan.cmdString({userId, connectTarget: connectionLink, resolveMode: T.PlanResolveMode.Unknown}))
|
||||
if (r.type === "connectionPlan") return [r.connectionPlan, r.connLink]
|
||||
throw new ChatCommandError("error getting connect plan", r)
|
||||
}
|
||||
@@ -707,7 +707,7 @@ export class ChatApi {
|
||||
* Network usage: interactive.
|
||||
*/
|
||||
async apiConnectActiveUser(connLink: string): Promise<ConnReqType> {
|
||||
const r = await this.sendChatCmd(CC.Connect.cmdString({incognito: false, connLink_: connLink}))
|
||||
const r = await this.sendChatCmd(CC.Connect.cmdString({incognito: false, connTarget_: connLink}))
|
||||
return this.handleConnectResult(r)
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ export class ChatApi {
|
||||
* Network usage: no.
|
||||
*/
|
||||
async apiCreateActiveUser(profile?: T.Profile): Promise<T.User> {
|
||||
const r = await this.sendChatCmd(CC.CreateActiveUser.cmdString({newUser: {profile, pastTimestamp: false, userChatRelay: false}}))
|
||||
const r = await this.sendChatCmd(CC.CreateActiveUser.cmdString({newUser: {profile, pastTimestamp: false, userChatRelay: false, clientService: false}}))
|
||||
if (r.type === "activeUser") return r.user
|
||||
throw new ChatCommandError("unexpected response", r)
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ class ChatApi:
|
||||
) -> tuple[T.ConnectionPlan, T.CreatedConnLink]:
|
||||
r = await self.send_chat_cmd(
|
||||
CC.APIConnectPlan_cmd_string(
|
||||
{"userId": user_id, "connectionLink": connection_link, "resolveKnown": False}
|
||||
{"userId": user_id, "connectTarget": connection_link, "resolveMode": "unknown"}
|
||||
)
|
||||
)
|
||||
if r["type"] == "connectionPlan":
|
||||
@@ -487,7 +487,7 @@ class ChatApi:
|
||||
|
||||
async def api_connect_active_user(self, conn_link: str) -> ConnReqType:
|
||||
r = await self.send_chat_cmd(
|
||||
CC.Connect_cmd_string({"incognito": False, "connLink_": conn_link})
|
||||
CC.Connect_cmd_string({"incognito": False, "connTarget_": conn_link})
|
||||
)
|
||||
return self._handle_connect_result(r)
|
||||
|
||||
@@ -641,7 +641,7 @@ class ChatApi:
|
||||
raise
|
||||
|
||||
async def api_create_active_user(self, profile: T.Profile | None = None) -> T.User:
|
||||
new_user: T.NewUser = {"pastTimestamp": False, "userChatRelay": False}
|
||||
new_user: T.NewUser = {"pastTimestamp": False, "userChatRelay": False, "clientService": False}
|
||||
if profile is not None:
|
||||
new_user["profile"] = profile
|
||||
r = await self.send_chat_cmd(CC.CreateActiveUser_cmd_string({"newUser": new_user}))
|
||||
|
||||
@@ -4,6 +4,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from simplex_chat._native import _cache_root, _resolve_libs_dir, _download
|
||||
from simplex_chat._version import LIBS_VERSION
|
||||
|
||||
|
||||
def test_cache_root_linux(tmp_path, monkeypatch):
|
||||
@@ -41,7 +42,7 @@ def test_resolve_downloads_when_missing(tmp_path, monkeypatch):
|
||||
|
||||
monkeypatch.setattr("simplex_chat._native._download", fake_download)
|
||||
libs_dir = _resolve_libs_dir("sqlite")
|
||||
assert libs_dir == tmp_path / "simplex-chat" / "v6.5.2" / "sqlite"
|
||||
assert libs_dir == tmp_path / "simplex-chat" / f"v{LIBS_VERSION}" / "sqlite"
|
||||
assert called["backend"] == "sqlite"
|
||||
assert (libs_dir / "libsimplex.so").exists()
|
||||
|
||||
@@ -49,7 +50,7 @@ def test_resolve_downloads_when_missing(tmp_path, monkeypatch):
|
||||
def test_resolve_uses_cache_on_second_call(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("XDG_CACHE_HOME", str(tmp_path))
|
||||
monkeypatch.setattr("sys.platform", "linux")
|
||||
cached = tmp_path / "simplex-chat" / "v6.5.2" / "sqlite"
|
||||
cached = tmp_path / "simplex-chat" / f"v{LIBS_VERSION}" / "sqlite"
|
||||
cached.mkdir(parents=True)
|
||||
(cached / "libsimplex.so").touch()
|
||||
# Should NOT call _download — use the cached file.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from unittest.mock import patch
|
||||
import pytest
|
||||
from simplex_chat._native import _platform_tag, _libs_url, _libname
|
||||
from simplex_chat._version import LIBS_VERSION
|
||||
|
||||
|
||||
@patch("sys.platform", "linux")
|
||||
@@ -42,7 +43,7 @@ def test_url_sqlite(_):
|
||||
assert (
|
||||
_libs_url("sqlite")
|
||||
== "https://github.com/simplex-chat/simplex-chat-libs/releases/download/"
|
||||
"v6.5.2/simplex-chat-libs-linux-x86_64.zip"
|
||||
f"v{LIBS_VERSION}/simplex-chat-libs-linux-x86_64.zip"
|
||||
)
|
||||
|
||||
|
||||
@@ -51,5 +52,5 @@ def test_url_postgres(_):
|
||||
assert (
|
||||
_libs_url("postgres")
|
||||
== "https://github.com/simplex-chat/simplex-chat-libs/releases/download/"
|
||||
"v6.5.2/simplex-chat-libs-linux-x86_64-postgres.zip"
|
||||
f"v{LIBS_VERSION}/simplex-chat-libs-linux-x86_64-postgres.zip"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user