Mercurial > libervia-backend
annotate doc/libervia-cli/pubsub_attachments.rst @ 4212:5f2d496c633f
core: get rid of `pickle`:
Use of `pickle` to serialise data was a technical legacy that was causing trouble to store
in database, to update (if a class was serialised, a change could break update), and to
security (pickle can lead to code execution).
This patch remove all use of Pickle in favour in JSON, notably:
- for caching data, a Pydantic model is now used instead
- for SQLAlchemy model, the LegacyPickle is replaced by JSON serialisation
- in XEP-0373 a class `PublicKeyMetadata` was serialised. New method `from_dict` and
`to_dict` method have been implemented to do serialisation.
- new methods to (de)serialise data can now be specified with Identity data types. It is
notably used to (de)serialise `path` of avatars.
A migration script has been created to convert data (for upgrade or downgrade), with
special care for XEP-0373 case. Depending of size of database, this migration script can
be long to run.
rel 443
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 23 Feb 2024 13:31:04 +0100 |
parents | 8b76caa89aa0 |
children |
rev | line source |
---|---|
3873
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 .. _libervia-cli_pubsub_attachments: |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 ======================================================= |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 pubsub/attachments: (Un)Attach Metadata to Pubsub Items |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 ======================================================= |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 ``attachments`` is a subcommand grouping all pubsub commands related to "pubsub |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 attachments" specification. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 With them, you can (un)attach data to any pubsub item. This is notably used to handle |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 data like saying if an item is (un)noticed, or add emoji reactions. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 get |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 === |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 Retrieve a list of all attached data to an item. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 By default all attachments of the item are returned, this can be filtered by using ``-j |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 JIDS, --jid JIDS`` |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 example |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 ------- |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 Louise check all attachments on her last blog post:: |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 $ li pubsub attachments get -s louise@example.org -n urn:xmpp:microblog:0 -i some-news-acf0 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 set |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 === |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 Update or replace attachments. By default new attachments are updated, but if the ``-R, |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 --replace`` is used, new attachments replace the whole former one where it make sense. For |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 instance, ``-R`` doesn't change anything for ``noticed`` attachments, but it will replace |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 all reactions (potentially with no reaction at all), where the default behaviour is to |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 merge former and new reactions. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 Note that only specified attachments are affected, if unknown or unspecified attachments |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 exist, they will stay unmodified. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 For now, only ``noticed`` (to say that an element has been seen and taken into account) |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 and ``reactions`` (emojis to show emotion or other kind of reaction about something) are |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 managed. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 ``-N [BOOLEAN], --noticed [BOOLEAN]`` takes on optional argument to say if the item is |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 noticed or not. If the optional argument is not specified, if will be the same as if the |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 ``true`` value was used. |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 examples |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 -------- |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 Pierre wants to indicate to Louise that is has seen and he took into account her last blog post:: |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 $ li pubsub attachments set -s louise@example.org -n urn:xmpp:microblog:0 -i some-news-acf0 -N |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 Louise wants to react to Pierre blog post about night trains:: |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 |
8b76caa89aa0
doc (cli/pubsub, cli/blog): `attachments` subcommands documentation:
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 $ li pubsub attachments set -s pierre@example.net -n urn:xmpp:microblog:0 -i nigh-train-are-great-f120 -r 🚆🌜💤 |