slidge 0.1.3__py3-none-any.whl → 0.2.0a1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- slidge/__init__.py +3 -5
- slidge/__main__.py +2 -196
- slidge/__version__.py +5 -0
- slidge/command/adhoc.py +8 -1
- slidge/command/admin.py +6 -7
- slidge/command/base.py +1 -2
- slidge/command/register.py +32 -16
- slidge/command/user.py +85 -6
- slidge/contact/contact.py +165 -49
- slidge/contact/roster.py +122 -47
- slidge/core/config.py +14 -11
- slidge/core/gateway/base.py +148 -36
- slidge/core/gateway/caps.py +7 -5
- slidge/core/gateway/disco.py +2 -4
- slidge/core/gateway/mam.py +1 -4
- slidge/core/gateway/muc_admin.py +1 -1
- slidge/core/gateway/ping.py +2 -3
- slidge/core/gateway/presence.py +1 -1
- slidge/core/gateway/registration.py +32 -21
- slidge/core/gateway/search.py +3 -5
- slidge/core/gateway/session_dispatcher.py +120 -57
- slidge/core/gateway/vcard_temp.py +7 -5
- slidge/core/mixins/__init__.py +11 -1
- slidge/core/mixins/attachment.py +32 -14
- slidge/core/mixins/avatar.py +90 -25
- slidge/core/mixins/base.py +8 -2
- slidge/core/mixins/db.py +18 -0
- slidge/core/mixins/disco.py +0 -10
- slidge/core/mixins/message.py +18 -8
- slidge/core/mixins/message_maker.py +17 -9
- slidge/core/mixins/presence.py +17 -4
- slidge/core/pubsub.py +54 -220
- slidge/core/session.py +69 -34
- slidge/db/__init__.py +4 -0
- slidge/db/alembic/env.py +64 -0
- slidge/db/alembic/script.py.mako +26 -0
- slidge/db/alembic/versions/09f27f098baa_add_missing_attributes_in_room.py +36 -0
- slidge/db/alembic/versions/2461390c0af2_store_contacts_caps_verstring_in_db.py +36 -0
- slidge/db/alembic/versions/29f5280c61aa_store_subject_setter_in_room.py +37 -0
- slidge/db/alembic/versions/2b1f45ab7379_store_room_subject_setter_by_nickname.py +41 -0
- slidge/db/alembic/versions/82a4af84b679_add_muc_history_filled.py +48 -0
- slidge/db/alembic/versions/8d2ced764698_rely_on_db_to_store_contacts_rooms_and_.py +133 -0
- slidge/db/alembic/versions/aa9d82a7f6ef_db_creation.py +85 -0
- slidge/db/alembic/versions/b33993e87db3_move_everything_to_persistent_db.py +214 -0
- slidge/db/alembic/versions/b64b1a793483_add_source_and_legacy_id_for_archived_.py +48 -0
- slidge/db/alembic/versions/c4a8ec35a0e8_per_room_user_nick.py +34 -0
- slidge/db/alembic/versions/e91195719c2c_store_users_avatars_persistently.py +26 -0
- slidge/db/avatar.py +235 -0
- slidge/db/meta.py +65 -0
- slidge/db/models.py +375 -0
- slidge/db/store.py +1078 -0
- slidge/group/archive.py +58 -14
- slidge/group/bookmarks.py +72 -57
- slidge/group/participant.py +87 -28
- slidge/group/room.py +369 -211
- slidge/main.py +201 -0
- slidge/migration.py +30 -0
- slidge/slixfix/__init__.py +35 -2
- slidge/slixfix/roster.py +11 -4
- slidge/slixfix/xep_0292/vcard4.py +3 -0
- slidge/util/archive_msg.py +2 -1
- slidge/util/db.py +1 -47
- slidge/util/test.py +71 -4
- slidge/util/types.py +29 -4
- slidge/util/util.py +22 -0
- {slidge-0.1.3.dist-info → slidge-0.2.0a1.dist-info}/METADATA +4 -4
- slidge-0.2.0a1.dist-info/RECORD +114 -0
- slidge/core/cache.py +0 -183
- slidge/util/schema.sql +0 -126
- slidge/util/sql.py +0 -508
- slidge-0.1.3.dist-info/RECORD +0 -96
- {slidge-0.1.3.dist-info → slidge-0.2.0a1.dist-info}/LICENSE +0 -0
- {slidge-0.1.3.dist-info → slidge-0.2.0a1.dist-info}/WHEEL +0 -0
- {slidge-0.1.3.dist-info → slidge-0.2.0a1.dist-info}/entry_points.txt +0 -0
@@ -1,25 +1,25 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: slidge
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0a1
|
4
4
|
Summary: XMPP bridging framework
|
5
5
|
Home-page: https://sr.ht/~nicoco/slidge/
|
6
6
|
License: AGPL-3.0-or-later
|
7
7
|
Author: Nicolas Cedilnik
|
8
8
|
Author-email: nicoco@nicoco.fr
|
9
|
-
Requires-Python: >=3.
|
9
|
+
Requires-Python: >=3.11,<4.0
|
10
10
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
14
12
|
Classifier: Programming Language :: Python :: 3.11
|
15
13
|
Requires-Dist: ConfigArgParse (>=1.5.3,<2.0.0)
|
16
14
|
Requires-Dist: Pillow (>=10,<11)
|
17
15
|
Requires-Dist: aiohttp[speedups] (>=3.8.3,<4.0.0)
|
16
|
+
Requires-Dist: alembic (>=1.13.1,<2.0.0)
|
18
17
|
Requires-Dist: blurhash-python (>=1.2.1,<2.0.0)
|
19
18
|
Requires-Dist: pickle-secure (>=0.99.9,<0.100.0)
|
20
19
|
Requires-Dist: python-magic (>=0.4.27,<0.5.0)
|
21
20
|
Requires-Dist: qrcode (>=7.4.1,<8.0.0)
|
22
21
|
Requires-Dist: slixmpp (>=1.8.5,<2.0.0)
|
22
|
+
Requires-Dist: sqlalchemy (>=2.0.29,<3.0.0)
|
23
23
|
Project-URL: Documentation, https://slidge.im/
|
24
24
|
Project-URL: Repository, https://git.sr.ht/~nicoco/slidge/
|
25
25
|
Description-Content-Type: text/markdown
|
@@ -0,0 +1,114 @@
|
|
1
|
+
slidge/__init__.py,sha256=S0tUjqpZlzsr8G4Y_1Xt-KCYB07qaknTB0OwHU8k29U,1587
|
2
|
+
slidge/__main__.py,sha256=Y12eh1TD_C5MB50KgEAuMffGnRFCvKYFKHD4UYSmHA0,72
|
3
|
+
slidge/__version__.py,sha256=I-T5nrkdyqNFMxbn8y7FgSsLGaj0eM2dLL9f5LDsI2Q,170
|
4
|
+
slidge/command/__init__.py,sha256=UYf1mjCYbZ5G7PIgaFTWSQRAzEJkQ6dTH8Fu_e_XnO0,613
|
5
|
+
slidge/command/adhoc.py,sha256=5xLLoWyUJqCJB7kAwD2VKYTl_7MObCsgdz-qg_WkWGs,9417
|
6
|
+
slidge/command/admin.py,sha256=JAN8s-b2KckgUozAQNBGOzkrEaQv-LtwezYgOsAR6Ng,5768
|
7
|
+
slidge/command/base.py,sha256=xTlzxAbTWTpbFgQ0FxKjmp3ZImzempwJvGn9UiVUUTc,13044
|
8
|
+
slidge/command/categories.py,sha256=BJCfaga2qoAxnHfgHD7I_RKZuBA5nnNOukkWHJwsUFE,99
|
9
|
+
slidge/command/chat_command.py,sha256=kMnxrzmD7LhWgyO1w9Rgz1eA7PhfAJ2Rf34YWjoKrwQ,9975
|
10
|
+
slidge/command/register.py,sha256=fzPcGUoJtainnDOiC13gWV-uYLuJcsmdKGJ-jXT1qIo,6697
|
11
|
+
slidge/command/user.py,sha256=nJnoU4t1r9oPkFFHSHHwSY8WOQNLQn9mMcwZp-yZaKA,11422
|
12
|
+
slidge/contact/__init__.py,sha256=WMMaHk7UW7YT9EH2LtPdkU0bHQaOp4ikBhbBQskmoc8,191
|
13
|
+
slidge/contact/contact.py,sha256=Ag4Gq81jlEsz8MMXyU_VcLGJY7_IUgY76jOMlmAQpJc,20237
|
14
|
+
slidge/contact/roster.py,sha256=2EGV7q0km6JEahn2brr-td0KJILtXQGFWiSPuORA86I,10756
|
15
|
+
slidge/core/__init__.py,sha256=RG7Jj5JCJERjhqJ31lOLYV-7bH_oblClQD1KF9LsTXo,68
|
16
|
+
slidge/core/config.py,sha256=leNcN_TI0Ka1hhzOHx7cBW3fNj5xZwsiv9l8AfRY_vU,7630
|
17
|
+
slidge/core/gateway/__init__.py,sha256=rZckY2gAE-mon77_DSsAW1XtWqhBAETE2d4FqZ8pJXk,58
|
18
|
+
slidge/core/gateway/base.py,sha256=V-9HMokUfeTpIO_dqU1ONDMXnNMBCEJJbmob-oYjD8s,38600
|
19
|
+
slidge/core/gateway/caps.py,sha256=jemB4tB_2MTAxqQw5Bs4b7qNQ8gLPuAve0aoH6TzLEs,1937
|
20
|
+
slidge/core/gateway/delivery_receipt.py,sha256=AT_9gvZrtWpSRsDJcYjE8CmF7TW-YBbUPdqNW5zWAdo,1352
|
21
|
+
slidge/core/gateway/disco.py,sha256=uazgDXSDb5KrardjPCvElItARcxkeBRohtx82A2BlCQ,2203
|
22
|
+
slidge/core/gateway/mam.py,sha256=ZUZXX7YcpK1WHq8RlgYrXo2zrLm5pOM1sVzON61mXYQ,2418
|
23
|
+
slidge/core/gateway/muc_admin.py,sha256=PslX1gZK_PhY2VaeAPP1nEzThMaBBGPRgs-wiJ35zJQ,1033
|
24
|
+
slidge/core/gateway/ping.py,sha256=_zzPkjqvxjTxLNP1jbj0WVLMaybxbYqrKDRM5jHSDjs,1729
|
25
|
+
slidge/core/gateway/presence.py,sha256=Ls8IY4uNQaW8F3F1CpRhfyFIVbd_py_VkZyJKMMei8s,2732
|
26
|
+
slidge/core/gateway/registration.py,sha256=JXwIQ-QqZCPXEmCU2G8FvIYDGvD8L8CqGb_Qkbycgt0,2303
|
27
|
+
slidge/core/gateway/search.py,sha256=08ds6gvzX3EnTH-AU8X8J8JKEKYaSrRGTFwwClTT-Rc,3495
|
28
|
+
slidge/core/gateway/session_dispatcher.py,sha256=mV3ds7zulD1_ivaV-QfilRKk2aN8T0XgcicCYOiYfx0,32306
|
29
|
+
slidge/core/gateway/vcard_temp.py,sha256=5Trs0O240mpOoFeRzprAYX86W7Qaq9hFhi06437w0Yg,4694
|
30
|
+
slidge/core/mixins/__init__.py,sha256=muReAzgvENgMvlfm0Fpe6BQFfm2EMjoDe9ZhGgo6Vig,627
|
31
|
+
slidge/core/mixins/attachment.py,sha256=YXuObz68eem2AND1q-RBeZ-X9Zi_IlUgx0DRMiwM3Xw,18706
|
32
|
+
slidge/core/mixins/avatar.py,sha256=ke3cwm6Iiz1AM0_SiARTUTU2nGYskPZlxtFrXKQT5fI,7812
|
33
|
+
slidge/core/mixins/base.py,sha256=9hjf2Pw5r0poSi1Abv-_znk83Kngsu9EXTf05gpFDdI,768
|
34
|
+
slidge/core/mixins/db.py,sha256=5Qpegd7D8e5TLXLLINYcf_DuVdN-7wNmsfztUuFYPcU,442
|
35
|
+
slidge/core/mixins/disco.py,sha256=jk3Z1B6zTuisHv8VKNRJodIo0ee5btYHh2ZrlflPj_Q,3670
|
36
|
+
slidge/core/mixins/lock.py,sha256=mVzwVVEoq1hrAMgGLh4K84BTLt7JTJ33B8HSGSorTdY,913
|
37
|
+
slidge/core/mixins/message.py,sha256=jJz_peNQmDf0uVQcI7TWG7oUaSGjUL8eiulNicGgWhI,15071
|
38
|
+
slidge/core/mixins/message_maker.py,sha256=TcCutHi0sIwL6beJNkN7XyR0aDIbA0xZyxd2Gc9ulG4,6022
|
39
|
+
slidge/core/mixins/presence.py,sha256=yywo6KAw8C7GaZSMrSMuioNfhW08MrnobHt8XbHd0q8,7891
|
40
|
+
slidge/core/mixins/recipient.py,sha256=U-YppozUO8pA94jmD3-qmhkykTebPNaOVWc3JDPC9w8,1302
|
41
|
+
slidge/core/pubsub.py,sha256=QUwh1o5n9SVn1QBuflgfP4GR5yx6AJqRByDD3AGVCTY,12298
|
42
|
+
slidge/core/session.py,sha256=IUZur7huNj066uy-Nh-I-R0etYmPJccgXFIimcSQ148,27161
|
43
|
+
slidge/db/__init__.py,sha256=EBDH1JSEhgqYcli2Bw11CRC749wJk8AOucgBzmhDSvU,105
|
44
|
+
slidge/db/alembic/env.py,sha256=hsBlRNs0zF5diSHGRSa8Fi3qRVQDA2rJdR41AEIdvxc,1642
|
45
|
+
slidge/db/alembic/script.py.mako,sha256=MEqL-2qATlST9TAOeYgscMn1uy6HUS9NFvDgl93dMj8,635
|
46
|
+
slidge/db/alembic/versions/09f27f098baa_add_missing_attributes_in_room.py,sha256=mUL-0Io6ZPd_QbnKfwGYyjdMcM2uxQ0Wg72H23-2t_E,1033
|
47
|
+
slidge/db/alembic/versions/2461390c0af2_store_contacts_caps_verstring_in_db.py,sha256=CLB-kOP9Rc0FJIKDLef912L5sYkjpTIPC8fhrIdrC7k,1084
|
48
|
+
slidge/db/alembic/versions/29f5280c61aa_store_subject_setter_in_room.py,sha256=f8TFS28CXjGhvIn41UYMoHYeODfqhKfo4O7gk-JwA1E,1134
|
49
|
+
slidge/db/alembic/versions/2b1f45ab7379_store_room_subject_setter_by_nickname.py,sha256=CMVP2wFz6s7t57eWdSaGtck8BXzfVPJhHE5AoWi34tI,1359
|
50
|
+
slidge/db/alembic/versions/82a4af84b679_add_muc_history_filled.py,sha256=g37po0ydp8ZmzJrE5oFV7GscnploxjCtPDpw28SqVGk,1429
|
51
|
+
slidge/db/alembic/versions/8d2ced764698_rely_on_db_to_store_contacts_rooms_and_.py,sha256=olXaOEEsUSasqaaKdlP1cBODsMhmV1i90qbpDM2vTm4,4696
|
52
|
+
slidge/db/alembic/versions/aa9d82a7f6ef_db_creation.py,sha256=qBEw4KSf8NLn9piRxCn7VQbNS4XJQAfHIKmc2Rj1H5U,2320
|
53
|
+
slidge/db/alembic/versions/b33993e87db3_move_everything_to_persistent_db.py,sha256=2tiRxoC9PYOQn6XQrwK0JTEsb45Pzp2PsKoZSS4rcIA,7564
|
54
|
+
slidge/db/alembic/versions/b64b1a793483_add_source_and_legacy_id_for_archived_.py,sha256=N6HYpFBhMckAFLZFW8PY8Us1qzXlauEQiDwEYwd9_K8,1422
|
55
|
+
slidge/db/alembic/versions/c4a8ec35a0e8_per_room_user_nick.py,sha256=jjQmlRv6nqdm5q6LbwVpSUSkTBj1c76Hiq8e8q77q3g,933
|
56
|
+
slidge/db/alembic/versions/e91195719c2c_store_users_avatars_persistently.py,sha256=8Ga3VFgKrzMs_-B8OPtfP-0rey_MFaDg-QGtSbaft3o,640
|
57
|
+
slidge/db/avatar.py,sha256=khMqkhUSLOOAulhWHUtkIlE8asdqUuaY8cieij97Hsw,7640
|
58
|
+
slidge/db/meta.py,sha256=-MxJ66fI2hUs86geCTC4PSFDlRfJTvqJYvhdXydO6w8,1538
|
59
|
+
slidge/db/models.py,sha256=r6AyhSJ18kOiEgiArZLhBxMD6a07xbZVOIQ0RsQ8Tmo,12834
|
60
|
+
slidge/db/store.py,sha256=4QplqGaU8IPPf9MZU_P2LLZkbQB60GXDkxQrkkemfbc,40329
|
61
|
+
slidge/group/__init__.py,sha256=yFt7cHqeaKIMN6f9ZyhhspOcJJvBtLedGv-iICG7lto,258
|
62
|
+
slidge/group/archive.py,sha256=xGPkdSk8-BT6t6lNVo1FEwiFVAttoxCma8Tsyk5r8Kg,5279
|
63
|
+
slidge/group/bookmarks.py,sha256=NGEOTSrIIzSYVxUp2QlbW4cRNavPCaFLo21WrOjxBPc,6647
|
64
|
+
slidge/group/participant.py,sha256=FhI8RjVMp5fpYMLxG38wWPI3GEke8rTs-tmLklCIpzA,16764
|
65
|
+
slidge/group/room.py,sha256=Y5-0u7erskQF9L68htc4Yh6MnrzQwpT5zvIOrOah6fA,45032
|
66
|
+
slidge/main.py,sha256=gIlF9MEtychpdeUcOE1PWe_QPlOmsQAYvpcOfwRNoQo,6119
|
67
|
+
slidge/migration.py,sha256=qUrux9dYCtOfFjPIlvGfWjoyqhkdxzaOByJRqTmCoUI,1072
|
68
|
+
slidge/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
69
|
+
slidge/slixfix/__init__.py,sha256=7GevigEt68hwgwHqXcsFogN5jRXRHPeqR6kwODCH4hc,3055
|
70
|
+
slidge/slixfix/link_preview/__init__.py,sha256=TDPTSEH5FQxgGpQpQIde-D72AHg-6YVWG-tOj4KpKmU,290
|
71
|
+
slidge/slixfix/link_preview/link_preview.py,sha256=9PgdfnoyVMHnXS0w5OFp0wz3ku96Ck-HtRXbVUlDi1U,448
|
72
|
+
slidge/slixfix/link_preview/stanza.py,sha256=YAXoNw2MD0a3nzvldGKlvSemjUMbUEG23regzmj4Ntc,2664
|
73
|
+
slidge/slixfix/roster.py,sha256=zdcO8vsk8gqkqye-vqIynfj-pmozbjD-tRtoqwpKW7I,1680
|
74
|
+
slidge/slixfix/xep_0077/__init__.py,sha256=0lY1YXdgAsfrfxI_Woxaf1etHCJXe35Xtntq_icF6nA,325
|
75
|
+
slidge/slixfix/xep_0077/register.py,sha256=6nwTfHNL7Z9-1wUhpAF743TNbjQLCMP7Rflkdad8d60,10431
|
76
|
+
slidge/slixfix/xep_0077/stanza.py,sha256=Lngly7F1ChCkNKn7yl1QmN838fO-KqkAhkazxzDsz80,2410
|
77
|
+
slidge/slixfix/xep_0100/__init__.py,sha256=AtEXDQOrEWodkN3fgKR0W3Ezsz_Zza6cgO5ZaZS-JOo,107
|
78
|
+
slidge/slixfix/xep_0100/gateway.py,sha256=Fhxs2sUPnVRPa1o7RXCncnbBO2gjeZx3pbItug-8OiA,4501
|
79
|
+
slidge/slixfix/xep_0100/stanza.py,sha256=7vCzej9VFQupsTpGGl0cJWuGNH4I6oVcckBu_-fE55c,232
|
80
|
+
slidge/slixfix/xep_0153/__init__.py,sha256=wZCTLaVsXQn_wYEHA8YXdGCsspvj2rvq92iyi16W0xA,319
|
81
|
+
slidge/slixfix/xep_0153/stanza.py,sha256=qhVfxlJEKuYDuWnd_I_VT4TtJbpX2opN6kG8oxYrc3o,735
|
82
|
+
slidge/slixfix/xep_0153/vcard_avatar.py,sha256=mzaReW5c1OaeL39CeGvuzIkh3j-Z5mc2joLqn5cNc5Q,658
|
83
|
+
slidge/slixfix/xep_0264/__init__.py,sha256=c6g_y-PAwQJZ4ZLWcwXc6Q5xRPeXTvvvJH4ZKQpkj3o,109
|
84
|
+
slidge/slixfix/xep_0264/stanza.py,sha256=YvkI9rsGztkc9yOZBjf5PNKReW8aeGdF6MnrsfDckYs,864
|
85
|
+
slidge/slixfix/xep_0264/thumbnail.py,sha256=6ukgPCWJTFUnew4USB6hNtEk_ZcpWcFAvHr2r0T5znw,456
|
86
|
+
slidge/slixfix/xep_0292/__init__.py,sha256=_MvS9wGra6ig3P_dPAVlCPDJkiOFvUWGjaRsHj1woUg,98
|
87
|
+
slidge/slixfix/xep_0292/vcard4.py,sha256=uuZp_6DR1_-QuRNV-IfYwu9eX-wBT1jxh5p-PO92Nm8,3211
|
88
|
+
slidge/slixfix/xep_0313/__init__.py,sha256=rpvXxN4Fi-ey4Ww39OEAXoiaeWs3XMqvzR64hA6j_x4,368
|
89
|
+
slidge/slixfix/xep_0313/mam.py,sha256=2USgMGgklnGXPcw_1F3482HxIyd41TLx0uit43_RthA,9211
|
90
|
+
slidge/slixfix/xep_0313/stanza.py,sha256=WriAx6XKiiyZTkoTw5RHcgu3ZYdkDd6hjQ0wHqDkXE0,10249
|
91
|
+
slidge/slixfix/xep_0317/__init__.py,sha256=KRMpj3n2TYTyXzlGHdGXzNbMEvbHxn7Qd1WxqRIkrhU,104
|
92
|
+
slidge/slixfix/xep_0317/hats.py,sha256=HAZ7y5DNehpdPVpNpgo1JxnG2GVhVSElLYdARiL9KJQ,290
|
93
|
+
slidge/slixfix/xep_0317/stanza.py,sha256=HYSJSUHqPNHmrpJsschb__qazfb2Jm3WUxLsrmPqC4I,659
|
94
|
+
slidge/slixfix/xep_0356_old/__init__.py,sha256=3jGWJX2m5gWgDCxcVqCsCCVPRTcfmU96yenwvAJtOKE,180
|
95
|
+
slidge/slixfix/xep_0356_old/privilege.py,sha256=kcJzFbzhOHtQMtzOJpvvwm1pghSpealWnqhC0zc8dGo,5338
|
96
|
+
slidge/slixfix/xep_0356_old/stanza.py,sha256=i7aqcaTg6PBhVwbHToLtlrwxBj7uO-M7VrYSyElyEKI,1229
|
97
|
+
slidge/slixfix/xep_0424/__init__.py,sha256=ngz0GBepiJs_cocaohkDRTiaB8mvaEwXoqQBv9Av9o8,284
|
98
|
+
slidge/slixfix/xep_0424/retraction.py,sha256=VmJQCj4umtjslnU1ydVOL6KquZnVvqgPTAyoE1KQKwE,2448
|
99
|
+
slidge/slixfix/xep_0424/stanza.py,sha256=mT8QzRX3YcyTqTSfaaWKxyhag1s1-iQy5QW9nH6cyU8,753
|
100
|
+
slidge/slixfix/xep_0490/__init__.py,sha256=Rhu_1h1P34LfIP_yr4JQ_PBHcuNBLDzLdJMnNmNJRrE,158
|
101
|
+
slidge/slixfix/xep_0490/mds.py,sha256=KaITeEzSWgpGyU7RP-iwipjSyCEdVMPiVIT5vHVK-RM,1527
|
102
|
+
slidge/slixfix/xep_0490/stanza.py,sha256=ztec_ipyhUFz_uWQYkS0Q6LlsNiSBBC5aZK-qSmhHXk,443
|
103
|
+
slidge/util/__init__.py,sha256=BELovoTMPcPPGz3D48esBr8A4BRRHXTvavfgnArBgEc,301
|
104
|
+
slidge/util/archive_msg.py,sha256=xXAR0BI5r3d6KKWjae9594izCOv6iI03z2WLuTecNw8,1724
|
105
|
+
slidge/util/conf.py,sha256=1j2OnOsCBar1tOObErhXR5RC3Vl3faliOZ1U8J3My58,6613
|
106
|
+
slidge/util/db.py,sha256=zFOv0JEWQQK0_TMRlU4Z0G5Mc9pxvEErLyOzXmRAe5Q,5209
|
107
|
+
slidge/util/test.py,sha256=yRl3_dmNrn_v-FtOsRo_9eZr3Owj5JB5YIS0PozFU0E,13266
|
108
|
+
slidge/util/types.py,sha256=Gif-Z9NVd_eTei1uM3_KOsdok3B1yMQwdOkOzf9vheE,5224
|
109
|
+
slidge/util/util.py,sha256=8JeE0QObNGQr_Tw4OFPwQSz_EB_zh_0t9IJmNNhW0ic,9114
|
110
|
+
slidge-0.2.0a1.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
111
|
+
slidge-0.2.0a1.dist-info/METADATA,sha256=_6VENlq93oEe42OuGW4DM-Riq0-08DziC-hTrb0fl5s,4723
|
112
|
+
slidge-0.2.0a1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
113
|
+
slidge-0.2.0a1.dist-info/entry_points.txt,sha256=SNl72KSocF5plsu_67xyH6wVWfGTXQbzkQgXbLtzDrQ,47
|
114
|
+
slidge-0.2.0a1.dist-info/RECORD,,
|
slidge/core/cache.py
DELETED
@@ -1,183 +0,0 @@
|
|
1
|
-
import asyncio
|
2
|
-
import hashlib
|
3
|
-
import io
|
4
|
-
import logging
|
5
|
-
import shelve
|
6
|
-
import uuid
|
7
|
-
from concurrent.futures import ThreadPoolExecutor
|
8
|
-
from dataclasses import dataclass
|
9
|
-
from http import HTTPStatus
|
10
|
-
from pathlib import Path
|
11
|
-
from typing import Optional
|
12
|
-
|
13
|
-
import aiohttp
|
14
|
-
from multidict import CIMultiDictProxy
|
15
|
-
from PIL import Image
|
16
|
-
from slixmpp import JID
|
17
|
-
|
18
|
-
from ..util.types import URL, LegacyFileIdType
|
19
|
-
from . import config
|
20
|
-
|
21
|
-
|
22
|
-
@dataclass
|
23
|
-
class CachedAvatar:
|
24
|
-
filename: str
|
25
|
-
hash: str
|
26
|
-
height: int
|
27
|
-
width: int
|
28
|
-
root: Path
|
29
|
-
etag: Optional[str] = None
|
30
|
-
last_modified: Optional[str] = None
|
31
|
-
|
32
|
-
@property
|
33
|
-
def data(self):
|
34
|
-
return self.path.read_bytes()
|
35
|
-
|
36
|
-
@property
|
37
|
-
def path(self):
|
38
|
-
return self.root / self.filename
|
39
|
-
|
40
|
-
|
41
|
-
class AvatarCache:
|
42
|
-
_shelf_path: str
|
43
|
-
_jid_to_legacy_path: str
|
44
|
-
dir: Path
|
45
|
-
http: aiohttp.ClientSession
|
46
|
-
|
47
|
-
def __init__(self):
|
48
|
-
self._thread_pool = ThreadPoolExecutor(config.AVATAR_RESAMPLING_THREADS)
|
49
|
-
|
50
|
-
def set_dir(self, path: Path):
|
51
|
-
self.dir = path
|
52
|
-
self.dir.mkdir(exist_ok=True)
|
53
|
-
self._shelf_path = str(path / "slidge_avatar_cache.shelf")
|
54
|
-
self._jid_to_legacy_path = str(path / "jid_to_avatar_unique_id.shelf")
|
55
|
-
|
56
|
-
def close(self):
|
57
|
-
self._thread_pool.shutdown(cancel_futures=True)
|
58
|
-
|
59
|
-
def __get_http_headers(self, cached: Optional[CachedAvatar]):
|
60
|
-
headers = {}
|
61
|
-
if cached and (self.dir / cached.filename).exists():
|
62
|
-
if last_modified := cached.last_modified:
|
63
|
-
headers["If-Modified-Since"] = last_modified
|
64
|
-
if etag := cached.etag:
|
65
|
-
headers["If-None-Match"] = etag
|
66
|
-
return headers
|
67
|
-
|
68
|
-
async def get_avatar_from_url_alone(self, url: str, jid: JID):
|
69
|
-
"""
|
70
|
-
Used when no avatar unique ID is passed. Store and use http headers
|
71
|
-
to avoid fetching ut
|
72
|
-
"""
|
73
|
-
cached = self.get(url)
|
74
|
-
headers = self.__get_http_headers(cached)
|
75
|
-
async with _download_lock:
|
76
|
-
return await self.__download(cached, url, headers, jid)
|
77
|
-
|
78
|
-
async def __download(
|
79
|
-
self,
|
80
|
-
cached: Optional[CachedAvatar],
|
81
|
-
url: str,
|
82
|
-
headers: dict[str, str],
|
83
|
-
jid: JID,
|
84
|
-
):
|
85
|
-
async with self.http.get(url, headers=headers) as response:
|
86
|
-
if response.status == HTTPStatus.NOT_MODIFIED:
|
87
|
-
log.debug("Using avatar cache for %s", jid)
|
88
|
-
return cached
|
89
|
-
log.debug("Download avatar for %s", jid)
|
90
|
-
return await self.convert_and_store(
|
91
|
-
Image.open(io.BytesIO(await response.read())),
|
92
|
-
url,
|
93
|
-
jid,
|
94
|
-
response.headers,
|
95
|
-
)
|
96
|
-
|
97
|
-
async def url_has_changed(self, url: URL):
|
98
|
-
with shelve.open(self._shelf_path) as s:
|
99
|
-
cached = s.get(url)
|
100
|
-
if cached is None:
|
101
|
-
return True
|
102
|
-
headers = self.__get_http_headers(cached)
|
103
|
-
async with self.http.head(url, headers=headers) as response:
|
104
|
-
return response.status != HTTPStatus.NOT_MODIFIED
|
105
|
-
|
106
|
-
def get(self, unique_id: LegacyFileIdType) -> Optional[CachedAvatar]:
|
107
|
-
with shelve.open(self._shelf_path) as s:
|
108
|
-
return s.get(str(unique_id))
|
109
|
-
|
110
|
-
def get_cached_id_for(self, jid: JID) -> Optional[LegacyFileIdType]:
|
111
|
-
with shelve.open(self._jid_to_legacy_path) as s:
|
112
|
-
return s.get(str(jid))
|
113
|
-
|
114
|
-
def store_jid(self, jid: JID, uid: LegacyFileIdType):
|
115
|
-
with shelve.open(self._jid_to_legacy_path) as s:
|
116
|
-
s[str(jid)] = uid
|
117
|
-
|
118
|
-
def delete_jid(self, jid: JID):
|
119
|
-
try:
|
120
|
-
with shelve.open(self._jid_to_legacy_path) as s:
|
121
|
-
del s[str(jid)]
|
122
|
-
except KeyError:
|
123
|
-
pass
|
124
|
-
|
125
|
-
async def convert_and_store(
|
126
|
-
self,
|
127
|
-
img: Image.Image,
|
128
|
-
unique_id: LegacyFileIdType,
|
129
|
-
jid: JID,
|
130
|
-
response_headers: Optional[CIMultiDictProxy[str]] = None,
|
131
|
-
) -> CachedAvatar:
|
132
|
-
resize = (size := config.AVATAR_SIZE) and any(x > size for x in img.size)
|
133
|
-
if resize:
|
134
|
-
await asyncio.get_event_loop().run_in_executor(
|
135
|
-
self._thread_pool, img.thumbnail, (size, size)
|
136
|
-
)
|
137
|
-
log.debug("Resampled image to %s", img.size)
|
138
|
-
|
139
|
-
filename = str(uuid.uuid1()) + ".png"
|
140
|
-
file_path = self.dir / filename
|
141
|
-
|
142
|
-
if (
|
143
|
-
not resize
|
144
|
-
and img.format == "PNG"
|
145
|
-
and isinstance(unique_id, str)
|
146
|
-
and (path := Path(unique_id))
|
147
|
-
and path.exists()
|
148
|
-
):
|
149
|
-
img_bytes = path.read_bytes()
|
150
|
-
else:
|
151
|
-
with io.BytesIO() as f:
|
152
|
-
img.save(f, format="PNG")
|
153
|
-
img_bytes = f.getvalue()
|
154
|
-
|
155
|
-
with file_path.open("wb") as file:
|
156
|
-
file.write(img_bytes)
|
157
|
-
|
158
|
-
hash_ = hashlib.sha1(img_bytes).hexdigest()
|
159
|
-
|
160
|
-
avatar = CachedAvatar(
|
161
|
-
filename=filename,
|
162
|
-
hash=hash_,
|
163
|
-
height=img.height,
|
164
|
-
width=img.width,
|
165
|
-
root=self.dir,
|
166
|
-
)
|
167
|
-
if response_headers:
|
168
|
-
avatar.etag = response_headers.get("etag")
|
169
|
-
avatar.last_modified = response_headers.get("last-modified")
|
170
|
-
with shelve.open(self._shelf_path) as s:
|
171
|
-
s[str(unique_id)] = avatar
|
172
|
-
self.store_jid(jid, unique_id)
|
173
|
-
return avatar
|
174
|
-
|
175
|
-
|
176
|
-
avatar_cache = AvatarCache()
|
177
|
-
log = logging.getLogger(__name__)
|
178
|
-
_download_lock = asyncio.Lock()
|
179
|
-
|
180
|
-
__all__ = (
|
181
|
-
"CachedAvatar",
|
182
|
-
"avatar_cache",
|
183
|
-
)
|
slidge/util/schema.sql
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
CREATE TABLE user(
|
2
|
-
id INTEGER PRIMARY KEY,
|
3
|
-
jid TEXT UNIQUE
|
4
|
-
);
|
5
|
-
|
6
|
-
CREATE TABLE muc(
|
7
|
-
id INTEGER PRIMARY KEY,
|
8
|
-
jid TEXT,
|
9
|
-
user_id INTEGER,
|
10
|
-
FOREIGN KEY(user_id) REFERENCES user(id),
|
11
|
-
UNIQUE(user_id, jid)
|
12
|
-
);
|
13
|
-
|
14
|
-
CREATE TABLE mam_message(
|
15
|
-
id INTEGER PRIMARY KEY,
|
16
|
-
message_id TEXT,
|
17
|
-
sent_on INTEGER,
|
18
|
-
sender_jid TEXT,
|
19
|
-
xml TEXT,
|
20
|
-
muc_id INTEGER,
|
21
|
-
user_id INTEGER,
|
22
|
-
FOREIGN KEY(muc_id) REFERENCES muc(id),
|
23
|
-
FOREIGN KEY(user_id) REFERENCES user(id),
|
24
|
-
UNIQUE(user_id, muc_id, message_id)
|
25
|
-
);
|
26
|
-
|
27
|
-
CREATE INDEX mam_sent_on ON mam_message(sent_on);
|
28
|
-
CREATE INDEX muc_jid ON muc(jid);
|
29
|
-
|
30
|
-
CREATE TABLE session_message_sent(
|
31
|
-
id INTEGER PRIMARY KEY,
|
32
|
-
legacy_id UNIQUE,
|
33
|
-
xmpp_id TEXT,
|
34
|
-
user_id INTEGER,
|
35
|
-
FOREIGN KEY(user_id) REFERENCES user(id)
|
36
|
-
);
|
37
|
-
|
38
|
-
CREATE INDEX session_message_sent_legacy_id
|
39
|
-
ON session_message_sent(legacy_id);
|
40
|
-
CREATE INDEX session_message_sent_xmpp_id
|
41
|
-
ON session_message_sent(xmpp_id);
|
42
|
-
|
43
|
-
CREATE TABLE session_message_sent_muc(
|
44
|
-
id INTEGER PRIMARY KEY,
|
45
|
-
legacy_id UNIQUE,
|
46
|
-
xmpp_id TEXT,
|
47
|
-
user_id INTEGER,
|
48
|
-
FOREIGN KEY(user_id) REFERENCES user(id)
|
49
|
-
);
|
50
|
-
|
51
|
-
CREATE INDEX session_message_sent_muc_legacy_id
|
52
|
-
ON session_message_sent_muc(legacy_id);
|
53
|
-
CREATE INDEX session_message_sent_muc_xmpp_id
|
54
|
-
ON session_message_sent_muc(xmpp_id);
|
55
|
-
|
56
|
-
CREATE TABLE session_thread_sent_muc(
|
57
|
-
id INTEGER PRIMARY KEY,
|
58
|
-
legacy_id UNIQUE,
|
59
|
-
xmpp_id TEXT,
|
60
|
-
user_id INTEGER,
|
61
|
-
FOREIGN KEY(user_id) REFERENCES user(id)
|
62
|
-
);
|
63
|
-
|
64
|
-
CREATE INDEX session_thread_sent_muc_legacy_id
|
65
|
-
ON session_thread_sent_muc(legacy_id);
|
66
|
-
CREATE INDEX session_thread_sent_muc_xmpp_id
|
67
|
-
ON session_thread_sent_muc(xmpp_id);
|
68
|
-
|
69
|
-
|
70
|
-
CREATE TABLE attachment(
|
71
|
-
id INTEGER PRIMARY KEY,
|
72
|
-
legacy_id UNIQUE,
|
73
|
-
url TEXT UNIQUE,
|
74
|
-
sims TEXT,
|
75
|
-
sfs TEXT
|
76
|
-
);
|
77
|
-
|
78
|
-
CREATE INDEX attachment_legacy_id ON attachment(legacy_id);
|
79
|
-
CREATE INDEX attachment_url ON attachment(url);
|
80
|
-
|
81
|
-
CREATE TABLE attachment_legacy_msg_id(
|
82
|
-
id INTEGER PRIMARY KEY,
|
83
|
-
legacy_id UNIQUE
|
84
|
-
);
|
85
|
-
|
86
|
-
CREATE TABLE attachment_xmpp_ids(
|
87
|
-
id INTEGER PRIMARY KEY,
|
88
|
-
legacy_msg_id INTEGER,
|
89
|
-
xmpp_id TEXT,
|
90
|
-
FOREIGN KEY(legacy_msg_id) REFERENCES attachment_legacy_msg_id(id)
|
91
|
-
);
|
92
|
-
|
93
|
-
CREATE TABLE nick(
|
94
|
-
id INTEGER PRIMARY KEY,
|
95
|
-
jid UNIQUE,
|
96
|
-
nick TEXT,
|
97
|
-
user_id INTEGER,
|
98
|
-
FOREIGN KEY(user_id) REFERENCES user(id),
|
99
|
-
UNIQUE(jid, user_id)
|
100
|
-
);
|
101
|
-
|
102
|
-
CREATE INDEX nick_jid ON nick(jid);
|
103
|
-
|
104
|
-
|
105
|
-
CREATE TABLE avatar(
|
106
|
-
id INTEGER PRIMARY KEY,
|
107
|
-
jid TEXT UNIQUE,
|
108
|
-
cached_id TEXT
|
109
|
-
);
|
110
|
-
|
111
|
-
CREATE INDEX avatar_jid ON avatar(jid);
|
112
|
-
|
113
|
-
|
114
|
-
CREATE TABLE presence(
|
115
|
-
id INTEGER PRIMARY KEY,
|
116
|
-
jid TEXT,
|
117
|
-
last_seen INTEGER,
|
118
|
-
ptype TEXT,
|
119
|
-
pstatus TEXT,
|
120
|
-
pshow TEXT,
|
121
|
-
user_id INTEGER,
|
122
|
-
FOREIGN KEY(user_id) REFERENCES user(id),
|
123
|
-
UNIQUE(jid, user_id)
|
124
|
-
);
|
125
|
-
|
126
|
-
CREATE INDEX presence_jid ON presence(jid);
|