view libervia/pages/u/page_meta.py @ 1344:472267dcd4d8

browser (alt_media_player): native player support + poster + flags + restricted area: - alt_media_player will now use native player when possible. This allows to use its controls and behaviour instead of native ones. - a poster can be specified when instanciated manually - video is not preloaded anymore - handle events propagation to plays nicely when used in slideshow - a "restricted area" mode can be used to let click propagation on video border, and thus catch only play/pause in the center. This is notably useful when used in the slideshow, as border can be used to show/hide slideshow controls - player can be reset, in which case the play button overlay is put back, and video is put at its beginning - once video is played at least once, a `in_use` class is added to the element, play button overlay is removed then. This fix a bug when the overlay was still appearing when using bottom play button. - VideoPlayer has been renamed to MediaPlayer
author Goffi <goffi@goffi.org>
date Mon, 24 Aug 2020 23:04:35 +0200
parents f511f8fbbf8a
children 6fc41f000d24
line wrap: on
line source

#!/usr/bin/env python3


from libervia.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.nextPath(request)
    except IndexError:
        self.pageError(request)

    data = self.getRData(request)

    target_profile = yield self.host.bridgeCall("profileNameGet", prof_requested)
    request.template_data["target_profile"] = target_profile
    target_jid = yield self.host.bridgeCall(
        "asyncGetParamA", "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.getSubPageURL(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)})


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

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