view libervia/web/pages/u/page_meta.py @ 1553:83c2a6faa2ae

browser (calls): screen sharing implementation: - the new screen sharing button toggle screen sharing state - the button reflect the screen sharing state (green crossed when not sharing, red uncrossed otherwise) - the screen sharing stream replaces the camera one, and vice versa. No re-negociation is needed. - stopping the sharing through browser's dialog is supported - the screen sharing button is only visibile if supported by the platform rel 432
author Goffi <goffi@goffi.org>
date Mon, 14 Aug 2023 16:49:02 +0200
parents eb00d593801d
children
line wrap: on
line source

#!/usr/bin/env python3


from libervia.web.server.constants import Const as C
from twisted.internet import defer
from twisted.words.protocols.jabber import jid

"""page used to target a user profile, e.g. for public blog"""

name = "user"
access = C.PAGES_ACCESS_PUBLIC  # can be a callable
template = "blog/articles.html"
url_cache = True


@defer.inlineCallbacks
def parse_url(self, request):
    try:
        prof_requested = self.next_path(request)
    except IndexError:
        self.page_error(request)

    data = self.get_r_data(request)

    target_profile = yield self.host.bridge_call("profile_name_get", prof_requested)
    request.template_data["target_profile"] = target_profile
    target_jid = yield self.host.bridge_call(
        "param_get_a_async", "JabberID", "Connection", "value", profile_key=target_profile
    )
    target_jid = jid.JID(target_jid)
    data["service"] = target_jid

    # if URL is parsed here, we'll have atom.xml available and we need to
    # add the link to the page
    atom_url = self.get_sub_page_url(request, 'user_blog_feed_atom')
    request.template_data['atom_url'] = atom_url
    request.template_data.setdefault('links', []).append({
        "href": atom_url,
        "type": "application/atom+xml",
        "rel": "alternate",
        "title": "{target_profile}'s blog".format(target_profile=target_profile)})

def add_breadcrumb(self, request, breadcrumbs):
    # we don't want a breadcrumb here
    pass


@defer.inlineCallbacks
def prepare_render(self, request):
    data = self.get_r_data(request)
    self.check_cache(
        request, C.CACHE_PUBSUB, service=data["service"], node=None, short="microblog"
    )
    self.page_redirect("blog_view", request)

def on_data_post(self, request):
    return self.get_page_by_name("blog_view").on_data_post(self, request)