Ajax client classes are now customizable.
This commit is contained in:
parent
e2a7c54e24
commit
d825994230
3 changed files with 16 additions and 5 deletions
|
|
@ -191,9 +191,8 @@ class EvenniaPortalService(MultiService):
|
|||
webclientstr = ""
|
||||
if settings.WEBCLIENT_ENABLED:
|
||||
# create ajax client processes at /webclientdata
|
||||
from evennia.server.portal import webclient_ajax
|
||||
|
||||
ajax_webclient = webclient_ajax.AjaxWebClient()
|
||||
ajax_class = class_from_module(settings.AJAX_CLIENT_CLASS)
|
||||
ajax_webclient = ajax_class()
|
||||
ajax_webclient.sessionhandler = evennia.PORTAL_SESSION_HANDLER
|
||||
web_root.putChild(b"webclientdata", ajax_webclient)
|
||||
webclientstr = "webclient (ajax only)"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from evennia.server import session
|
|||
from evennia.utils import utils
|
||||
from evennia.utils.ansi import parse_ansi
|
||||
from evennia.utils.text2html import parse_html
|
||||
from evennia.utils.utils import to_bytes, ip_from_request
|
||||
from evennia.utils.utils import to_bytes, class_from_module, ip_from_request
|
||||
|
||||
_CLIENT_SESSIONS = utils.mod_import(settings.SESSION_ENGINE).SessionStore
|
||||
_RE_SCREENREADER_REGEX = re.compile(
|
||||
|
|
@ -70,6 +70,8 @@ class AjaxWebClient(resource.Resource):
|
|||
|
||||
"""
|
||||
|
||||
client_protocol = class_from_module(settings.AJAX_PROTOCOL_CLASS)
|
||||
|
||||
isLeaf = True
|
||||
allowedMethods = ("POST",)
|
||||
|
||||
|
|
@ -205,7 +207,7 @@ class AjaxWebClient(resource.Resource):
|
|||
request.getHost().port,
|
||||
)
|
||||
|
||||
sess = AjaxWebClientSession()
|
||||
sess = self.client_protocol()
|
||||
sess.client = self
|
||||
sess.init_session("ajax/comet", remote_addr, self.sessionhandler)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue