dimples 1.3.2__tar.gz → 1.3.4__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.
- {dimples-1.3.2 → dimples-1.3.4}/PKG-INFO +9 -9
- {dimples-1.3.2 → dimples-1.3.4}/README.md +8 -8
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/__init__.py +2 -8
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/compatible.py +40 -15
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/messenger.py +5 -5
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/packer.py +3 -23
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/protocol/ws.py +2 -2
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/meta.py +8 -1
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/meta.py +11 -2
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/manager.py +3 -4
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/facebook.py +16 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/session.py +1 -1
- {dimples-1.3.2 → dimples-1.3.4}/dimples/station/shared.py +6 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/PKG-INFO +9 -9
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/requires.txt +1 -1
- {dimples-1.3.2 → dimples-1.3.4}/setup.py +2 -2
- {dimples-1.3.2 → dimples-1.3.4}/dimples/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/checker.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/checkpoint.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/commands.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/creator.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/customized.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/group.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_expel.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_invite.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_join.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_query.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_quit.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_reset.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/grp_resign.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/cpu/handshake.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/facebook.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/messenger.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/network/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/network/session.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/network/state.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/network/transition.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/packer.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/processor.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/client/terminal.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/anonymous.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/ans.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/archivist.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/checker.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/address.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/entity.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/loader.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/meta.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/compat/network.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/dbi/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/dbi/account.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/dbi/message.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/dbi/session.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/facebook.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/processer.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/ans.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/block.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/customized.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/group.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/handshake.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/login.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/mute.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/password.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/report.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/utils.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/protocol/version.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/register.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/common/session.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/flexible.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/gate.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/gatekeeper.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/mars.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/mtp.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/protocol/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/protocol/mars.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/queue.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/seeker.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/session.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/conn/ws.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/account.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/base.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/document.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/group.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/group_history.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/group_keys.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/login.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/private.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/station.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/dos/user.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/message.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/base.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/document.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/group.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/grp_history.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/grp_keys.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/login.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/message.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/station.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/redis/user.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/session.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_base.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_cipherkey.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_document.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_group.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_group_history.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_group_keys.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_login.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_message.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_meta.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_private.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_station.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/database/t_user.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/edge/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/edge/messenger.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/edge/octopus.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/edge/shared.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/edge/start.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/emitter.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/admin.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/builder.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/delegate.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/emitter.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/helper.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/packer.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/group/shared.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/register/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/register/base.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/register/ext.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/register/run.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/register/shared.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/checker.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/ans.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/creator.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/document.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/handshake.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/login.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/cpu/report.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/deliver.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/dis_roamer.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/dispatcher.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/messenger.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/packer.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/processor.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/push.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/session_center.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/server/trace.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/station/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/station/handler.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/station/start.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/utils/__init__.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/utils/cache.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/utils/checker.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/utils/config.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples/utils/log.py +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/SOURCES.txt +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/dependency_links.txt +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/entry_points.txt +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/dimples.egg-info/top_level.txt +0 -0
- {dimples-1.3.2 → dimples-1.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dimples
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: DIMP Library for Edges and Stations
|
|
5
5
|
Home-page: https://github.com/dimchat/demo-py
|
|
6
6
|
Author: Albert Moky
|
|
@@ -30,16 +30,16 @@ Description: # DIMP Library for Edges and Stations (Python version)
|
|
|
30
30
|
# 'pycryptodome', # 3.14.1
|
|
31
31
|
# 'base58', # 1.0.3
|
|
32
32
|
# 'ecdsa', # 0.16.1
|
|
33
|
-
'dimplugins>=2.2.
|
|
33
|
+
'dimplugins>=2.2.2',
|
|
34
34
|
|
|
35
|
-
'dimsdk>=2.2.
|
|
36
|
-
# 'dimp>=2.2.
|
|
37
|
-
# 'dkd>=2.2.
|
|
38
|
-
# 'mkm>=2.2.
|
|
35
|
+
'dimsdk>=2.2.2',
|
|
36
|
+
# 'dimp>=2.2.2',
|
|
37
|
+
# 'dkd>=2.2.2',
|
|
38
|
+
# 'mkm>=2.2.2',
|
|
39
39
|
|
|
40
|
-
'startrek>=2.2.
|
|
41
|
-
'tcp>=2.2.
|
|
42
|
-
'udp>=2.2.
|
|
40
|
+
'startrek>=2.2.2',
|
|
41
|
+
'tcp>=2.2.2',
|
|
42
|
+
'udp>=2.2.2',
|
|
43
43
|
|
|
44
44
|
'aiou>=0.3.0',
|
|
45
45
|
]
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
# 'pycryptodome', # 3.14.1
|
|
23
23
|
# 'base58', # 1.0.3
|
|
24
24
|
# 'ecdsa', # 0.16.1
|
|
25
|
-
'dimplugins>=2.2.
|
|
25
|
+
'dimplugins>=2.2.2',
|
|
26
26
|
|
|
27
|
-
'dimsdk>=2.2.
|
|
28
|
-
# 'dimp>=2.2.
|
|
29
|
-
# 'dkd>=2.2.
|
|
30
|
-
# 'mkm>=2.2.
|
|
27
|
+
'dimsdk>=2.2.2',
|
|
28
|
+
# 'dimp>=2.2.2',
|
|
29
|
+
# 'dkd>=2.2.2',
|
|
30
|
+
# 'mkm>=2.2.2',
|
|
31
31
|
|
|
32
|
-
'startrek>=2.2.
|
|
33
|
-
'tcp>=2.2.
|
|
34
|
-
'udp>=2.2.
|
|
32
|
+
'startrek>=2.2.2',
|
|
33
|
+
'tcp>=2.2.2',
|
|
34
|
+
'udp>=2.2.2',
|
|
35
35
|
|
|
36
36
|
'aiou>=0.3.0',
|
|
37
37
|
]
|
|
@@ -41,10 +41,7 @@ from .meta import CompatibleMetaFactory
|
|
|
41
41
|
from .loader import CommonLoader
|
|
42
42
|
from .loader import CommonPluginLoader
|
|
43
43
|
|
|
44
|
-
from .compatible import
|
|
45
|
-
from .compatible import fix_file_content
|
|
46
|
-
from .compatible import fix_cmd, fix_command
|
|
47
|
-
from .compatible import fix_receipt_command, fix_document_command, fix_report_command
|
|
44
|
+
from .compatible import Compatible
|
|
48
45
|
|
|
49
46
|
|
|
50
47
|
__all__ = [
|
|
@@ -62,9 +59,6 @@ __all__ = [
|
|
|
62
59
|
'CommonLoader',
|
|
63
60
|
'CommonPluginLoader',
|
|
64
61
|
|
|
65
|
-
'
|
|
66
|
-
'fix_file_content',
|
|
67
|
-
'fix_cmd', 'fix_command',
|
|
68
|
-
'fix_receipt_command', 'fix_document_command', 'fix_report_command',
|
|
62
|
+
'Compatible',
|
|
69
63
|
|
|
70
64
|
]
|
|
@@ -41,15 +41,32 @@ from ..protocol import MetaType
|
|
|
41
41
|
#
|
|
42
42
|
# Compatible with old versions
|
|
43
43
|
#
|
|
44
|
+
class Compatible:
|
|
44
45
|
|
|
46
|
+
@classmethod
|
|
47
|
+
def fix_meta_attachment(cls, msg: ReliableMessage):
|
|
48
|
+
return _fix_meta_attachment(msg=msg)
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
@classmethod
|
|
51
|
+
def fix_meta_version(cls, meta: dict):
|
|
52
|
+
return _fix_meta_version(meta=meta)
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def fix_file_content(cls, content: FileContent):
|
|
56
|
+
return _fix_file_content(content=content)
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def fix_command(cls, content: Command) -> Command:
|
|
60
|
+
return _fix_command(content=content)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _fix_meta_attachment(msg: ReliableMessage):
|
|
47
64
|
meta = msg.get('meta')
|
|
48
65
|
if meta is not None:
|
|
49
|
-
|
|
66
|
+
return _fix_meta_version(meta=meta)
|
|
50
67
|
|
|
51
68
|
|
|
52
|
-
def
|
|
69
|
+
def _fix_meta_version(meta: dict):
|
|
53
70
|
version = meta.get('type')
|
|
54
71
|
if version is None:
|
|
55
72
|
version = meta.get('version') # compatible with MKM 0.9.*
|
|
@@ -65,7 +82,7 @@ def fix_meta_version(meta: dict):
|
|
|
65
82
|
return meta
|
|
66
83
|
|
|
67
84
|
|
|
68
|
-
def
|
|
85
|
+
def _fix_file_content(content: FileContent):
|
|
69
86
|
pwd = content.get('key')
|
|
70
87
|
if pwd is not None:
|
|
71
88
|
# Tarsier version > 1.3.7
|
|
@@ -80,21 +97,29 @@ def fix_file_content(content: FileContent):
|
|
|
80
97
|
return content
|
|
81
98
|
|
|
82
99
|
|
|
83
|
-
def
|
|
100
|
+
def _fix_command(content: Command) -> Command:
|
|
84
101
|
# 1. fix 'cmd'
|
|
85
|
-
content =
|
|
102
|
+
content = _fix_cmd(content=content)
|
|
86
103
|
# 2. fix other commands
|
|
87
104
|
if isinstance(content, ReceiptCommand):
|
|
88
|
-
|
|
105
|
+
# receipt
|
|
106
|
+
_fix_receipt_command(content=content)
|
|
107
|
+
elif isinstance(content, ReportCommand):
|
|
108
|
+
# report
|
|
109
|
+
_fix_report_command(content=content)
|
|
110
|
+
elif isinstance(content, DocumentCommand):
|
|
111
|
+
# document
|
|
112
|
+
_fix_document_command(content=content)
|
|
89
113
|
elif isinstance(content, MetaCommand):
|
|
114
|
+
# meta
|
|
90
115
|
meta = content.get('meta')
|
|
91
116
|
if meta is not None:
|
|
92
|
-
|
|
117
|
+
_fix_meta_version(meta=meta)
|
|
93
118
|
# OK
|
|
94
119
|
return content
|
|
95
120
|
|
|
96
121
|
|
|
97
|
-
def
|
|
122
|
+
def _fix_cmd(content: Command):
|
|
98
123
|
cmd = content.get('cmd')
|
|
99
124
|
if cmd is None:
|
|
100
125
|
cmd = content.get('command')
|
|
@@ -105,7 +130,7 @@ def fix_cmd(content: Command):
|
|
|
105
130
|
return content
|
|
106
131
|
|
|
107
132
|
|
|
108
|
-
def
|
|
133
|
+
def _copy_receipt_values(content: ReceiptCommand, env: dict):
|
|
109
134
|
for key in ['sender', 'receiver', 'sn', 'signature']:
|
|
110
135
|
value = env.get(key)
|
|
111
136
|
if value is not None:
|
|
@@ -113,14 +138,14 @@ def copy_receipt_values(content: ReceiptCommand, env: dict):
|
|
|
113
138
|
|
|
114
139
|
|
|
115
140
|
# TODO: remove after all server/client upgraded
|
|
116
|
-
def
|
|
141
|
+
def _fix_receipt_command(content: ReceiptCommand):
|
|
117
142
|
origin = content.get('origin')
|
|
118
143
|
if origin is not None:
|
|
119
144
|
# (v2.0)
|
|
120
145
|
# compatible with v1.0
|
|
121
146
|
content['envelope'] = origin
|
|
122
147
|
# compatible with older version
|
|
123
|
-
|
|
148
|
+
_copy_receipt_values(content=content, env=origin)
|
|
124
149
|
return content
|
|
125
150
|
# check for old version
|
|
126
151
|
env = content.get('envelope')
|
|
@@ -129,7 +154,7 @@ def fix_receipt_command(content: ReceiptCommand):
|
|
|
129
154
|
# compatible with v2.0
|
|
130
155
|
content['origin'] = env
|
|
131
156
|
# compatible with older version
|
|
132
|
-
|
|
157
|
+
_copy_receipt_values(content=content, env=env)
|
|
133
158
|
return content
|
|
134
159
|
# check for older version
|
|
135
160
|
if 'sender' in content: # and 'receiver' in content:
|
|
@@ -147,7 +172,7 @@ def fix_receipt_command(content: ReceiptCommand):
|
|
|
147
172
|
|
|
148
173
|
|
|
149
174
|
# TODO: remove after all server/client upgraded
|
|
150
|
-
def
|
|
175
|
+
def _fix_document_command(content: DocumentCommand):
|
|
151
176
|
info = content.get('document')
|
|
152
177
|
if info is not None:
|
|
153
178
|
# (v2.0)
|
|
@@ -186,7 +211,7 @@ def fix_document_command(content: DocumentCommand):
|
|
|
186
211
|
return content
|
|
187
212
|
|
|
188
213
|
|
|
189
|
-
def
|
|
214
|
+
def _fix_report_command(content: ReportCommand):
|
|
190
215
|
# check state for oldest version
|
|
191
216
|
state = content.get('state')
|
|
192
217
|
if state == 'background':
|
|
@@ -53,7 +53,7 @@ from .dbi import MessageDBI
|
|
|
53
53
|
from .facebook import CommonFacebook
|
|
54
54
|
from .session import Transmitter, Session
|
|
55
55
|
|
|
56
|
-
from .compat import
|
|
56
|
+
from .compat import Compatible
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
class CommonMessenger(Messenger, Transmitter, Logging, ABC):
|
|
@@ -136,18 +136,18 @@ class CommonMessenger(Messenger, Transmitter, Logging, ABC):
|
|
|
136
136
|
# Override
|
|
137
137
|
async def serialize_content(self, content: Content, key: SymmetricKey, msg: InstantMessage) -> bytes:
|
|
138
138
|
if isinstance(content, Command):
|
|
139
|
-
content = fix_command(content=content)
|
|
139
|
+
content = Compatible.fix_command(content=content)
|
|
140
140
|
elif isinstance(content, FileContent):
|
|
141
|
-
content = fix_file_content(content=content)
|
|
141
|
+
content = Compatible.fix_file_content(content=content)
|
|
142
142
|
return await super().serialize_content(content=content, key=key, msg=msg)
|
|
143
143
|
|
|
144
144
|
# Override
|
|
145
145
|
async def deserialize_content(self, data: bytes, key: SymmetricKey, msg: SecureMessage) -> Optional[Content]:
|
|
146
146
|
content = await super().deserialize_content(data=data, key=key, msg=msg)
|
|
147
147
|
if isinstance(content, Command):
|
|
148
|
-
content = fix_command(content=content)
|
|
148
|
+
content = Compatible.fix_command(content=content)
|
|
149
149
|
elif isinstance(content, FileContent):
|
|
150
|
-
content = fix_file_content(content=content)
|
|
150
|
+
content = Compatible.fix_file_content(content=content)
|
|
151
151
|
return content
|
|
152
152
|
|
|
153
153
|
#
|
|
@@ -28,16 +28,13 @@ from typing import Optional, Dict
|
|
|
28
28
|
|
|
29
29
|
from dimsdk import EncryptKey
|
|
30
30
|
from dimsdk import ID
|
|
31
|
-
from dimsdk import ReceiptCommand, DocumentCommand
|
|
32
31
|
from dimsdk import InstantMessage, SecureMessage, ReliableMessage
|
|
33
32
|
from dimsdk import MessagePacker
|
|
34
33
|
from dimsdk import MessageUtils
|
|
35
34
|
|
|
36
35
|
from ..utils import Logging
|
|
37
36
|
|
|
38
|
-
from .compat import
|
|
39
|
-
from .compat import fix_receipt_command
|
|
40
|
-
from .compat import fix_document_command
|
|
37
|
+
from .compat import Compatible
|
|
41
38
|
|
|
42
39
|
|
|
43
40
|
class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
@@ -135,25 +132,8 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
|
135
132
|
else:
|
|
136
133
|
self.warning(msg='receiver not ready: %s' % msg.receiver)
|
|
137
134
|
return None
|
|
138
|
-
content = msg.content
|
|
139
|
-
if isinstance(content, ReceiptCommand):
|
|
140
|
-
# compatible with v1.0
|
|
141
|
-
fix_receipt_command(content=content)
|
|
142
135
|
return await super().encrypt_message(msg=msg)
|
|
143
136
|
|
|
144
|
-
# Override
|
|
145
|
-
async def decrypt_message(self, msg: SecureMessage) -> Optional[InstantMessage]:
|
|
146
|
-
i_msg = await super().decrypt_message(msg=msg)
|
|
147
|
-
if i_msg is not None:
|
|
148
|
-
content = i_msg.content
|
|
149
|
-
if isinstance(content, ReceiptCommand):
|
|
150
|
-
# compatible with v1.0
|
|
151
|
-
fix_receipt_command(content=content)
|
|
152
|
-
elif isinstance(content, DocumentCommand):
|
|
153
|
-
# compatible with v1.0
|
|
154
|
-
fix_document_command(content=content)
|
|
155
|
-
return i_msg
|
|
156
|
-
|
|
157
137
|
# Override
|
|
158
138
|
async def verify_message(self, msg: ReliableMessage) -> Optional[SecureMessage]:
|
|
159
139
|
# 1. check receiver/group with local user
|
|
@@ -183,10 +163,10 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
|
183
163
|
# return None
|
|
184
164
|
msg = await super().deserialize_message(data=data)
|
|
185
165
|
if msg is not None:
|
|
186
|
-
fix_meta_attachment(msg=msg)
|
|
166
|
+
Compatible.fix_meta_attachment(msg=msg)
|
|
187
167
|
return msg
|
|
188
168
|
|
|
189
169
|
# Override
|
|
190
170
|
async def serialize_message(self, msg: ReliableMessage) -> bytes:
|
|
191
|
-
fix_meta_attachment(msg=msg)
|
|
171
|
+
Compatible.fix_meta_attachment(msg=msg)
|
|
192
172
|
return await super().serialize_message(msg=msg)
|
|
@@ -172,7 +172,7 @@ class WebSocket:
|
|
|
172
172
|
mask = None
|
|
173
173
|
# 4. get payload
|
|
174
174
|
if stream_len < pos + msg_len:
|
|
175
|
-
Log.info(msg='incomplete ws package for payload: %d, msg len: %d' % (stream_len, msg_len))
|
|
175
|
+
# Log.info(msg='incomplete ws package for payload: %d, msg len: %d' % (stream_len, msg_len))
|
|
176
176
|
return None, stream
|
|
177
177
|
payload = stream[pos:pos+msg_len]
|
|
178
178
|
pos += msg_len
|
|
@@ -212,7 +212,7 @@ class WebSocket:
|
|
|
212
212
|
# cut the received package(s) and return the remaining
|
|
213
213
|
stream = stream[pos:]
|
|
214
214
|
break
|
|
215
|
-
Log.info(msg='received ws payload len: %d, left: %d' % (len(data), len(stream)))
|
|
215
|
+
# Log.info(msg='received ws payload len: %d, left: %d' % (len(data), len(stream)))
|
|
216
216
|
return data, stream
|
|
217
217
|
|
|
218
218
|
@classmethod
|
|
@@ -28,12 +28,14 @@ from typing import Optional
|
|
|
28
28
|
from dimsdk import ID, Meta
|
|
29
29
|
|
|
30
30
|
from ...utils import template_replace
|
|
31
|
+
from ...utils import Logging
|
|
32
|
+
from ...common.compat import Compatible
|
|
31
33
|
from ...common import MetaDBI
|
|
32
34
|
|
|
33
35
|
from .base import Storage
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
class MetaStorage(Storage, MetaDBI):
|
|
38
|
+
class MetaStorage(Storage, Logging, MetaDBI):
|
|
37
39
|
"""
|
|
38
40
|
Meta for Entities (User/Group)
|
|
39
41
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -69,5 +71,10 @@ class MetaStorage(Storage, MetaDBI):
|
|
|
69
71
|
if info is None:
|
|
70
72
|
# file not found
|
|
71
73
|
self.warning(msg='meta file not found: %s' % path)
|
|
74
|
+
return None
|
|
72
75
|
else:
|
|
76
|
+
Compatible.fix_meta_version(meta=info)
|
|
77
|
+
try:
|
|
73
78
|
return Meta.parse(meta=info)
|
|
79
|
+
except Exception as error:
|
|
80
|
+
self.error(msg='meta error: %s, %s' % (error, info))
|
|
@@ -28,11 +28,13 @@ from typing import Optional
|
|
|
28
28
|
from dimsdk import ID, Meta
|
|
29
29
|
|
|
30
30
|
from ...utils import json_encode, json_decode, utf8_encode, utf8_decode
|
|
31
|
+
from ...utils import Logging
|
|
32
|
+
from ...common.compat import Compatible
|
|
31
33
|
|
|
32
34
|
from .base import Cache
|
|
33
35
|
|
|
34
36
|
|
|
35
|
-
class MetaCache(Cache):
|
|
37
|
+
class MetaCache(Cache, Logging):
|
|
36
38
|
|
|
37
39
|
# meta cached in Redis will be removed after 10 hours, after that
|
|
38
40
|
# it will be reloaded from local storage if it's still need.
|
|
@@ -58,12 +60,19 @@ class MetaCache(Cache):
|
|
|
58
60
|
async def get_meta(self, identifier: ID) -> Optional[Meta]:
|
|
59
61
|
key = self.__cache_name(identifier=identifier)
|
|
60
62
|
value = await self.get(name=key)
|
|
61
|
-
if value is
|
|
63
|
+
if value is None:
|
|
64
|
+
# cache not found
|
|
65
|
+
return None
|
|
66
|
+
else:
|
|
62
67
|
js = utf8_decode(data=value)
|
|
63
68
|
assert js is not None, 'failed to decode string: %s' % value
|
|
64
69
|
info = json_decode(string=js)
|
|
65
70
|
assert info is not None, 'meta error: %s' % value
|
|
71
|
+
Compatible.fix_meta_version(meta=info)
|
|
72
|
+
try:
|
|
66
73
|
return Meta.parse(meta=info)
|
|
74
|
+
except Exception as error:
|
|
75
|
+
self.error(msg='meta error: %s, %s' % (error, info))
|
|
67
76
|
|
|
68
77
|
async def save_meta(self, meta: Meta, identifier: ID) -> bool:
|
|
69
78
|
dictionary = meta.dictionary
|
|
@@ -67,15 +67,15 @@ class GroupManager(TripletsHelper):
|
|
|
67
67
|
|
|
68
68
|
def _create_packer(self) -> GroupPacker:
|
|
69
69
|
""" override for customized packer """
|
|
70
|
-
return GroupPacker(self.
|
|
70
|
+
return GroupPacker(self.delegate)
|
|
71
71
|
|
|
72
72
|
def _create_helper(self) -> GroupCommandHelper:
|
|
73
73
|
""" override for customized helper """
|
|
74
|
-
return GroupCommandHelper(self.
|
|
74
|
+
return GroupCommandHelper(self.delegate)
|
|
75
75
|
|
|
76
76
|
def _create_builder(self) -> GroupHistoryBuilder:
|
|
77
77
|
""" override for customized builder """
|
|
78
|
-
return GroupHistoryBuilder(self.
|
|
78
|
+
return GroupHistoryBuilder(self.delegate)
|
|
79
79
|
|
|
80
80
|
async def create_group(self, members: List[ID]) -> Optional[ID]:
|
|
81
81
|
"""
|
|
@@ -232,7 +232,6 @@ class GroupManager(TripletsHelper):
|
|
|
232
232
|
"""
|
|
233
233
|
Invite new members to this group
|
|
234
234
|
|
|
235
|
-
|
|
236
235
|
:param members: inviting member list
|
|
237
236
|
:param group: group ID
|
|
238
237
|
:return: False on error
|
|
@@ -34,6 +34,7 @@ from typing import Optional, List
|
|
|
34
34
|
|
|
35
35
|
from dimsdk import ID, User
|
|
36
36
|
|
|
37
|
+
from ..common import BroadcastUtils
|
|
37
38
|
from ..common import CommonFacebook
|
|
38
39
|
|
|
39
40
|
|
|
@@ -67,16 +68,31 @@ class ServerFacebook(CommonFacebook):
|
|
|
67
68
|
|
|
68
69
|
# Override
|
|
69
70
|
async def get_founder(self, identifier: ID) -> Optional[ID]:
|
|
71
|
+
assert identifier.is_group, 'group ID error: %s' % identifier
|
|
72
|
+
# check broadcast group
|
|
73
|
+
if identifier.is_broadcast:
|
|
74
|
+
# founder of broadcast group
|
|
75
|
+
return BroadcastUtils.broadcast_founder(group=identifier)
|
|
70
76
|
self.error(msg='DO NOT CALL ME: %s' % identifier)
|
|
71
77
|
return None
|
|
72
78
|
|
|
73
79
|
# Override
|
|
74
80
|
async def get_owner(self, identifier: ID) -> Optional[ID]:
|
|
81
|
+
assert identifier.is_group, 'group ID error: %s' % identifier
|
|
82
|
+
# check broadcast group
|
|
83
|
+
if identifier.is_broadcast:
|
|
84
|
+
# owner of broadcast group
|
|
85
|
+
return BroadcastUtils.broadcast_owner(group=identifier)
|
|
75
86
|
self.error(msg='DO NOT CALL ME: %s' % identifier)
|
|
76
87
|
return None
|
|
77
88
|
|
|
78
89
|
# Override
|
|
79
90
|
async def get_members(self, identifier: ID) -> List[ID]:
|
|
91
|
+
assert identifier.is_group, 'group ID error: %s' % identifier
|
|
92
|
+
# check broadcast group
|
|
93
|
+
if identifier.is_broadcast:
|
|
94
|
+
# members of broadcast group
|
|
95
|
+
return BroadcastUtils.broadcast_members(group=identifier)
|
|
80
96
|
self.error(msg='DO NOT CALL ME: %s' % identifier)
|
|
81
97
|
return []
|
|
82
98
|
|
|
@@ -275,6 +275,6 @@ async def remove_reliable_message(msg: ReliableMessage, receiver: ID, database:
|
|
|
275
275
|
# return False
|
|
276
276
|
receiver = msg.receiver
|
|
277
277
|
info = get_msg_info(msg=msg)
|
|
278
|
-
Log.info(msg='message sent
|
|
278
|
+
Log.info(msg='message sent, remove it: %s' % info)
|
|
279
279
|
# remove sent message from database
|
|
280
280
|
return await database.remove_reliable_message(msg=msg, receiver=receiver)
|
|
@@ -131,6 +131,12 @@ class GlobalVariable:
|
|
|
131
131
|
dispatcher.facebook = facebook
|
|
132
132
|
dispatcher.deliver = deliver
|
|
133
133
|
dispatcher.roamer = roamer
|
|
134
|
+
# this messenger is only for encryption, so don't need a session
|
|
135
|
+
messenger = create_messenger(facebook=facebook, database=mdb, session=None)
|
|
136
|
+
self.__messenger = messenger
|
|
137
|
+
checker = facebook.checker
|
|
138
|
+
assert isinstance(checker, ServerChecker), 'entity checker error: %s' % checker
|
|
139
|
+
checker.messenger = messenger
|
|
134
140
|
|
|
135
141
|
async def login(self, current_user: ID):
|
|
136
142
|
facebook = self.facebook
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dimples
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.4
|
|
4
4
|
Summary: DIMP Library for Edges and Stations
|
|
5
5
|
Home-page: https://github.com/dimchat/demo-py
|
|
6
6
|
Author: Albert Moky
|
|
@@ -30,16 +30,16 @@ Description: # DIMP Library for Edges and Stations (Python version)
|
|
|
30
30
|
# 'pycryptodome', # 3.14.1
|
|
31
31
|
# 'base58', # 1.0.3
|
|
32
32
|
# 'ecdsa', # 0.16.1
|
|
33
|
-
'dimplugins>=2.2.
|
|
33
|
+
'dimplugins>=2.2.2',
|
|
34
34
|
|
|
35
|
-
'dimsdk>=2.2.
|
|
36
|
-
# 'dimp>=2.2.
|
|
37
|
-
# 'dkd>=2.2.
|
|
38
|
-
# 'mkm>=2.2.
|
|
35
|
+
'dimsdk>=2.2.2',
|
|
36
|
+
# 'dimp>=2.2.2',
|
|
37
|
+
# 'dkd>=2.2.2',
|
|
38
|
+
# 'mkm>=2.2.2',
|
|
39
39
|
|
|
40
|
-
'startrek>=2.2.
|
|
41
|
-
'tcp>=2.2.
|
|
42
|
-
'udp>=2.2.
|
|
40
|
+
'startrek>=2.2.2',
|
|
41
|
+
'tcp>=2.2.2',
|
|
42
|
+
'udp>=2.2.2',
|
|
43
43
|
|
|
44
44
|
'aiou>=0.3.0',
|
|
45
45
|
]
|
|
@@ -14,7 +14,7 @@ import io
|
|
|
14
14
|
|
|
15
15
|
from setuptools import setup, find_packages
|
|
16
16
|
|
|
17
|
-
__version__ = '1.3.
|
|
17
|
+
__version__ = '1.3.4'
|
|
18
18
|
__author__ = 'Albert Moky'
|
|
19
19
|
__contact__ = 'albert.moky@gmail.com'
|
|
20
20
|
|
|
@@ -51,7 +51,7 @@ setup(
|
|
|
51
51
|
# 'pycryptodome', # 3.14.1
|
|
52
52
|
# 'base58', # 1.0.3
|
|
53
53
|
# 'ecdsa', # 0.16.1
|
|
54
|
-
'dimplugins>=2.2.
|
|
54
|
+
'dimplugins>=2.2.2',
|
|
55
55
|
|
|
56
56
|
'dimsdk>=2.2.2',
|
|
57
57
|
# 'dimp>=2.2.2',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|