Mercurial > libervia-pubsub
comparison sat_pubsub/backend.py @ 460:607616f9ef5b
backend: new `server_jid` option:
Server domain must be known to validate requests, this can be done explicitely by using the
`server_jid` option. If this option is not set, the server domain is found:
- by using the `from` name of the initial delegation advertising message
- or it fallbacks to using the part after initial `.` (`pubsub.example.org` would give
`example.org`)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 15 Oct 2021 09:32:07 +0200 |
parents | cebcb7f56889 |
children | c9238fca1fb3 |
comparison
equal
deleted
inserted
replaced
459:cebcb7f56889 | 460:607616f9ef5b |
---|---|
222 def __init__(self, storage, config): | 222 def __init__(self, storage, config): |
223 utility.EventDispatcher.__init__(self) | 223 utility.EventDispatcher.__init__(self) |
224 self.storage = storage | 224 self.storage = storage |
225 self.config = config | 225 self.config = config |
226 self.admins = config['admins_jids_list'] | 226 self.admins = config['admins_jids_list'] |
227 self.jid = config["jid"] | |
228 if config["server_jid"] is None: | |
229 self.server_jid = jid.JID(str(self.jid).split(".", 1)[1]) | |
230 else: | |
231 self.server_jid = jid.JID(config["server_jid"]) | |
227 d = self.storage.getFTSLanguages() | 232 d = self.storage.getFTSLanguages() |
228 d.addCallbacks(self._getFTSLanguagesCb, self._getFTSLanguagesEb) | 233 d.addCallbacks(self._getFTSLanguagesCb, self._getFTSLanguagesEb) |
229 | 234 |
230 def _getFTSLanguagesCb(self, languages): | 235 def _getFTSLanguagesCb(self, languages): |
231 # we skip the first one which is always "generic", as we already have it | 236 # we skip the first one which is always "generic", as we already have it |