Commit graph

3,425 commits

Author SHA1 Message Date
Goffi
36ec44730d docker (e2e): added libervia and libervia.test in certificates 2020-11-27 16:26:36 +01:00
Goffi
96bf65cb7a docker(libervia): build site in the image:
this will avoid a build each time the container starts fresh (notably with tests), as this
is time and resource consuming (notably with node modules which would need to be
downloaded each time).
2020-11-27 16:25:02 +01:00
Goffi
b2cf3efd8b docker: added libervia e2e image and include it in docker-compose_e2e:
The `libervia_e2e` image is based on main `libervia` one, and add, register and set the
same test certificates as the ones used in `backend_e2e`.
2020-11-16 14:51:15 +01:00
Goffi
670bea6e55 docker (backend_e2e): set xmpp_domain in conf. 2020-11-16 14:51:13 +01:00
Goffi
2df24ca3b1 docker (backend): fixed media_dir in conf. 2020-11-16 14:50:55 +01:00
Goffi
6ebc7da1f1 tools(utils): fixed error catching when getting repository data with pkg_resources 2020-11-16 14:44:43 +01:00
Goffi
2556a2c332 docker (libervia): expose HTTP and HTTPS ports 2020-11-15 17:05:47 +01:00
Goffi
18fc12222b docker (compose): name libervia image 2020-11-15 17:05:14 +01:00
Goffi
190f473cab plugin app manager: fixed public_url value check 2020-11-14 21:20:48 +01:00
Goffi
6f07157904 core (launcher): exit code can now specified
Exit code can now be specified by setting the `_exitCode` variable in
`twisted.application.app` module.
2020-11-14 21:19:40 +01:00
Goffi
fffc08be54 tests: end-2-end tests first draft:
- e2e tests are launched inside the new docker e2e test environment
- `run_e2e.py` launch the docker container, mount the current code base in it, launch the
  e2e tests and print report in real time
- `conftest.py` are pytest fixtures managing many things such as account creation, fake files
  management, JSON or Domish.Element parsing, fake editor, etc.
- `test_jp.py` are end-to-end test done with `jp`. `sh` library is used to make tests
  writting as user-friendly as possible. The `SAT_TEST_ENV_E2E` environment variable is
  checked, and tests will be skipped if it's not set.
2020-11-12 14:53:16 +01:00
Goffi
92e424e685 jp (roster): delete implementation 2020-11-12 14:53:16 +01:00
Goffi
df6428c14c jp (pubsub/node/info, pubsub/get): better exit code:
the correct exit code is now returned in case of NOT_FOUND or bridge exception. If the
exception is not a bridge exception, an internal error exit code is used.
2020-11-12 14:53:16 +01:00
Goffi
d818f1737b jp (base, pubsub/set): new --quiet argument:
`--quiet` can be used to only return essential data from command. This is notably useful
to remove message and trailing line feed when returning a data which must be parsed by an
other program.
2020-11-12 14:53:16 +01:00
Goffi
1d9d13dc04 jp: follow best practices and use a dash (-) instead of underscore (_) for long options. 2020-11-12 14:53:16 +01:00
Goffi
cc61784c2e jp (file/receive): display or answer to C.META_TYPE_NOT_IN_ROSTER_LEAK dialog:
when a file is proposed by an entity not in roster, the dialog asking for confirmation
is displayed. If the bare jid of the sender is explicitely waited (i.e. it's in
arguments), then the dialog is automatically confirmed.
2020-11-12 14:53:16 +01:00
Goffi
f1ec7b4d43 jp: new confirm method:
it completes `confirmOrQuit` method to ask confirmation without quitting.
2020-11-12 14:53:16 +01:00
Goffi
ed39d5340d jp (file/send): don't add main resource to bare jid anymore:
bare jid sending is now managed by backend (at least for Jingle), so resource must not be
added automatically anymore.
2020-11-12 14:53:16 +01:00
Goffi
f4c7f5e55e jp: replace no_lf argument by end in disp (same as in print) 2020-11-12 14:53:16 +01:00
Goffi
883a07c591 core (constants): moved shell exit code constants to core constants:
Well defined shell exit code are generally useful, not only for jp, thus constants have been
moved to core.
2020-11-12 14:53:15 +01:00
Goffi
63e61fc036 plugin XEP-0353: Jingle Message Initiation implementation:
This plugin uses the new `XEP-0166_initiate` trigger to initiate a Jingle session with
messages if the peer jid has no resource specified.
On reception, if the sender is not in our roster, a confirmation is requested to user to
avoid leaking presence and IP. If user refuses the session for somebody not in roster,
nothing is sent at all (the request is just ignored).
2020-11-12 14:53:15 +01:00
Goffi
aab9a8bf91 plugin XEP-0166: new trigger point + coroutines + helper methods:
- a new `XEP-0166_initiate` async trigger point is available
- `initate` is now a coroutine
- `jingleSessionInit` in applications and transports handlers are now called using
  `utils.adDeferred`
- new `getApplication` helper method, to retrieve application from its namespace
- new `getContentData` helper method to retrieve application and its argument from content
2020-11-12 14:53:15 +01:00
Goffi
46c763cbf7 plugin file, XEP-0234: registering is now done by class + use of async:
- instead of registering a callback, a file sending manager now register itself and must
  implement some well known method (`fileSend`, `canHandleFileSend`) and optionally a
  `name` attribute
- `utils.asDeferred` is now used for callbacks, so all type of methods including
  coroutines can be used.
- feature checking is now handled by `canHandleFileSend` method instead of simple
  namespace check, this allows to use a method when namespace can't be checked (this is
  the case when a file is sent to a bare jid with jingle)
2020-11-12 14:53:15 +01:00
Goffi
afacc8d4c1 plugin XEP-0329: minor reformatting 2020-11-12 14:53:15 +01:00
Goffi
1fc6c1f66b plugin XEP-0065: some cleaning:
- reordered imports and removed useless try/except
- log warning before sending error
- avoid crash if connection is lost before session has has been received in server mode.
- fixed missing string formatting keywords
- renamed incorrect attribute and show explicitly that it's not used
2020-11-12 14:53:15 +01:00
Goffi
876ec80598 plugin XEP-0077: disconnect client when deleting self account:
where profile's XMPP account is deleted, its client must be explicitely disconnected to
avoid automatic reconnection, which would obviously fail.
2020-11-12 14:53:15 +01:00
Goffi
06503f83aa plugin XEP-0363: fixed invalid reference to slot in catched exception:
`slot` was referenced in an exception where it can't exist. This fix avoid a crash and
skip the handler when a StanzaError is catched.
2020-11-12 14:53:15 +01:00
Goffi
e5a0948b71 test: fixed use of client.host in legacy test:
those tests are not maintained anymore, but as the use of `client.host` as been fixed
elsewhere, it was the occasion to do it there too. Those legacy tests should be ported or
to the new workflow, or deleted if they are not relevant anymore.
2020-11-12 14:53:15 +01:00
Goffi
2d3d30d42b tools (async_trigger): use utils.asDeferred for async triggers:
A corouting or blocking method can now be used for async triggers.
2020-11-12 14:53:15 +01:00
Goffi
1aeeffd399 tools (xml_tools): domish.Element pretty formatting functions:
- `pFmtElt`: pretty format a `domish.Element`
- `ppElt`: use the above function to pretty print a `domish.Element`
2020-11-12 14:53:15 +01:00
Goffi
54494409d2 tools (xml_tools): added with_parent and with_children argument to elementCopy 2020-11-12 14:53:15 +01:00
Goffi
4e803712f7 plugin XEP-0060: use xml_tools.parse instead of wokkel.generic.parseXml:
`xml_tools.parse` does a better parsing, as wokkel's `parseXml` may be missing text
nodes.
2020-11-12 14:53:15 +01:00
Goffi
1167c12c6f tools(xml_tools): fixed <div> unwrapping + added parse instance:
`<div>` unwrapping could fail when a text node was a sibling of the top element (could
easily happen ith a `\n` line feed added by an editor). This is fixed by filtering on
IElement with `elements()`.

A `parse` instance has been added as it is not necessary to create a new `ElementParser`
each time that we want to parse something.
2020-11-12 14:53:15 +01:00
Goffi
d52d8af6cf plugin XEP-0047: fixed file reading and content encoding 2020-11-12 14:53:15 +01:00
Goffi
4bc90ee0bc plugin ip: don't set to anymore for IQ stanza, as we send it to our server 2020-11-12 14:53:15 +01:00
Goffi
b6d26f3a67 core (memory/params): removed legacy "Register new account" label, it's not used anymore 2020-11-12 14:53:15 +01:00
Goffi
da22ab2ce2 core (xmpp): client.roster now implements __contains__
Now a jid can be tested directly with "entity_jid in client.roster".
2020-11-12 14:53:15 +01:00
Goffi
d7bd6e56eb core: use utils.asDeferred for launchCallback so coroutines can be used 2020-11-12 14:53:15 +01:00
Goffi
a187f66d92 docker (compose): test environment variable + network alias:
`SAT_TEST_ENV_E2E` is set to `1` to indicate that e2e environment requirement are
available (notably specific accounts and hosts created). The e2e tests needing it won't be
launched if this variable is not set.

A network alias is set for the backend at `sat.test` (to have a tld available, needed for
some network libraries like OpenSSL).
2020-11-12 14:53:15 +01:00
Goffi
a9418adb36 docker (prosody_e2e): install ipcheck so jp doesn't need to contact external website 2020-11-12 14:53:15 +01:00
Goffi
0dd689e29d docker (backend_e2e): install pytest and sh 2020-11-12 14:53:15 +01:00
Goffi
697140bed7 docker (backend): set background to dark to avoid trouble with autodetection in jp 2020-11-12 14:53:15 +01:00
Goffi
459c169e63 doc, core: typos 2020-11-12 14:53:11 +01:00
Goffi
a3be4ed11d plugin app manager docker: typo 2020-10-20 09:12:38 +02:00
Goffi
0e7f9c1247 docker: dockers images, first draft:
This patch introduce new docker images, replacing the unmaintained ones which were in
sat_docs.

Images + docker-compose files are provided to use SàT backend and Libervia, but also to
integrate and configure Prosody and SàT PubSub to run end-to-end tests.
2020-10-19 09:30:45 +02:00
Goffi
a692ba8e2e tools (common/tls): removed unused import 2020-10-19 09:28:26 +02:00
Goffi
59b7820b3f core: sat.conf is now first checked in /etc/_sat.conf for system-related settings 2020-10-15 16:13:30 +02:00
Goffi
4c2c9b4f04 jp: don't guess background when stdout is not a tty 2020-10-15 14:44:42 +02:00
Goffi
7b746a50a8 jp (application/list): don't use extend in argument as in it Python 3.8+ only 2020-10-01 10:12:01 +02:00
Goffi
e91cd1cc66 plugin app manager docker: weblate SàT app file for Docker 2020-09-28 21:10:33 +02:00