pretix-video-header 1.0.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. pretix_video_header-1.0.8/LICENSE +15 -0
  2. pretix_video_header-1.0.8/MANIFEST.in +7 -0
  3. pretix_video_header-1.0.8/PKG-INFO +59 -0
  4. pretix_video_header-1.0.8/README.md +45 -0
  5. pretix_video_header-1.0.8/pretix_video/__init__.py +1 -0
  6. pretix_video_header-1.0.8/pretix_video/apps.py +26 -0
  7. pretix_video_header-1.0.8/pretix_video/locale/de/LC_MESSAGES/django.po +12 -0
  8. pretix_video_header-1.0.8/pretix_video/locale/de_Informal/.gitkeep +0 -0
  9. pretix_video_header-1.0.8/pretix_video/locale/de_Informal/LC_MESSAGES/django.po +12 -0
  10. pretix_video_header-1.0.8/pretix_video/signals.py +77 -0
  11. pretix_video_header-1.0.8/pretix_video/static/pretix_video/.gitkeep +0 -0
  12. pretix_video_header-1.0.8/pretix_video/templates/pretix_video/.gitkeep +0 -0
  13. pretix_video_header-1.0.8/pretix_video/templates/pretix_video/settings.html +18 -0
  14. pretix_video_header-1.0.8/pretix_video/urls.py +11 -0
  15. pretix_video_header-1.0.8/pretix_video/views.py +36 -0
  16. pretix_video_header-1.0.8/pretix_video_header.egg-info/PKG-INFO +59 -0
  17. pretix_video_header-1.0.8/pretix_video_header.egg-info/SOURCES.txt +23 -0
  18. pretix_video_header-1.0.8/pretix_video_header.egg-info/dependency_links.txt +1 -0
  19. pretix_video_header-1.0.8/pretix_video_header.egg-info/entry_points.txt +5 -0
  20. pretix_video_header-1.0.8/pretix_video_header.egg-info/top_level.txt +1 -0
  21. pretix_video_header-1.0.8/pyproject.toml +42 -0
  22. pretix_video_header-1.0.8/setup.cfg +49 -0
  23. pretix_video_header-1.0.8/setup.py +3 -0
  24. pretix_video_header-1.0.8/tests/test_main.py +3 -0
@@ -0,0 +1,15 @@
1
+
2
+ Copyright 2025 Daniel Malik
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+
@@ -0,0 +1,7 @@
1
+ recursive-include pretix_video/static *
2
+ recursive-include pretix_video/templates *
3
+ recursive-include pretix_video/locale *
4
+ include LICENSE
5
+ exclude .gitlab-ci.yml
6
+ recursive-exclude .forgejo *
7
+ global-exclude .DS_Store
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: pretix-video-header
3
+ Version: 1.0.8
4
+ Summary: Replace the image / gif with a HTML5 video element
5
+ Author-email: Daniel Malik <mail@fronbasal.de>
6
+ Maintainer-email: Daniel Malik <mail@fronbasal.de>
7
+ License: Apache
8
+ Project-URL: homepage, https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header
9
+ Project-URL: repository, https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header
10
+ Keywords: pretix
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ ---
16
+ title: Pretix Video Header
17
+ ---
18
+
19
+ This is a plugin for [pretix](https://github.com/pretix/pretix).
20
+
21
+ Replace the image / gif with a HTML5 video element
22
+
23
+ # Development setup
24
+
25
+ 1. Make sure that you have a working [pretix development
26
+ setup](https://docs.pretix.eu/en/latest/development/setup.html).
27
+ 2. Clone this repository.
28
+ 3. Activate the virtual environment you use for pretix development.
29
+ 4. Execute `python setup.py develop` within this directory to register
30
+ this application with pretix\'s plugin registry.
31
+ 5. Execute `make` within this directory to compile translations.
32
+ 6. Restart your local pretix server. You can now use the plugin from
33
+ this repository for your events by enabling it in the \'plugins\'
34
+ tab in the settings.
35
+
36
+ This plugin has CI set up to enforce a few code style rules. To check
37
+ locally, you need these packages installed:
38
+
39
+ pip install flake8 isort black
40
+
41
+ To check your plugin for rule violations, run:
42
+
43
+ black --check .
44
+ isort -c .
45
+ flake8 .
46
+
47
+ You can auto-fix some of these issues by running:
48
+
49
+ isort .
50
+ black .
51
+
52
+ To automatically check for these issues before you commit, you can run
53
+ `.install-hooks`.
54
+
55
+ # License
56
+
57
+ Copyright 2025 Daniel Malik
58
+
59
+ Released under the terms of the Apache License 2.0
@@ -0,0 +1,45 @@
1
+ ---
2
+ title: Pretix Video Header
3
+ ---
4
+
5
+ This is a plugin for [pretix](https://github.com/pretix/pretix).
6
+
7
+ Replace the image / gif with a HTML5 video element
8
+
9
+ # Development setup
10
+
11
+ 1. Make sure that you have a working [pretix development
12
+ setup](https://docs.pretix.eu/en/latest/development/setup.html).
13
+ 2. Clone this repository.
14
+ 3. Activate the virtual environment you use for pretix development.
15
+ 4. Execute `python setup.py develop` within this directory to register
16
+ this application with pretix\'s plugin registry.
17
+ 5. Execute `make` within this directory to compile translations.
18
+ 6. Restart your local pretix server. You can now use the plugin from
19
+ this repository for your events by enabling it in the \'plugins\'
20
+ tab in the settings.
21
+
22
+ This plugin has CI set up to enforce a few code style rules. To check
23
+ locally, you need these packages installed:
24
+
25
+ pip install flake8 isort black
26
+
27
+ To check your plugin for rule violations, run:
28
+
29
+ black --check .
30
+ isort -c .
31
+ flake8 .
32
+
33
+ You can auto-fix some of these issues by running:
34
+
35
+ isort .
36
+ black .
37
+
38
+ To automatically check for these issues before you commit, you can run
39
+ `.install-hooks`.
40
+
41
+ # License
42
+
43
+ Copyright 2025 Daniel Malik
44
+
45
+ Released under the terms of the Apache License 2.0
@@ -0,0 +1 @@
1
+ __version__ = "1.0.8"
@@ -0,0 +1,26 @@
1
+ from django.utils.translation import gettext_lazy
2
+
3
+ from . import __version__
4
+
5
+ try:
6
+ from pretix.base.plugins import PluginConfig
7
+ except ImportError:
8
+ raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
9
+
10
+
11
+ class PluginApp(PluginConfig):
12
+ default = True
13
+ name = "pretix_video"
14
+ verbose_name = "Pretix Video Header"
15
+
16
+ class PretixPluginMeta:
17
+ name = gettext_lazy("Pretix Video Header")
18
+ author = "Daniel Malik"
19
+ description = gettext_lazy("Replace the image / gif with a HTML5 video element")
20
+ visible = True
21
+ version = __version__
22
+ category = "FEATURE"
23
+ compatibility = "pretix>=2.7.0"
24
+
25
+ def ready(self):
26
+ from . import signals # NOQA
@@ -0,0 +1,12 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2017-03-07 19:01+0100\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Daniel Malik\n"
8
+ "Language-Team: \n"
9
+ "Language: de\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
@@ -0,0 +1,12 @@
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: \n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2017-03-07 19:01+0100\n"
6
+ "PO-Revision-Date: \n"
7
+ "Last-Translator: Daniel Malik\n"
8
+ "Language-Team: \n"
9
+ "Language: de\n"
10
+ "MIME-Version: 1.0\n"
11
+ "Content-Type: text/plain; charset=UTF-8\n"
12
+ "Content-Transfer-Encoding: 8bit\n"
@@ -0,0 +1,77 @@
1
+ import secrets
2
+ from base64 import b64encode
3
+ from django.dispatch import receiver
4
+ from django.urls import resolve, reverse
5
+ from django.utils.translation import gettext_lazy
6
+ from pretix.base.middleware import _merge_csp, _parse_csp, _render_csp
7
+ from pretix.control.signals import nav_event_settings
8
+ from pretix.presale.signals import html_footer, process_response
9
+ from urllib3.util import parse_url
10
+
11
+
12
+ @receiver(nav_event_settings, dispatch_uid="video_nav_event_settings")
13
+ def navbar_event_settings(sender, request, **kwargs):
14
+ url = resolve(request.path_info)
15
+ return [
16
+ {
17
+ "label": gettext_lazy("Video Header"),
18
+ "url": reverse(
19
+ "plugins:pretix_video:settings",
20
+ kwargs={
21
+ "event": request.event.slug,
22
+ "organizer": request.organizer.slug,
23
+ },
24
+ ),
25
+ "active": url.namespace == "plugins:pretix_video"
26
+ and url.url_name.startswith("settings"),
27
+ }
28
+ ]
29
+
30
+
31
+ @receiver(html_footer, dispatch_uid="video_global_html_page_header")
32
+ def global_html_page_header(sender, request, **kwargs):
33
+ video_url = sender.settings.get("video_url")
34
+ if not video_url:
35
+ return
36
+
37
+ script_content = """
38
+ document.addEventListener("DOMContentLoaded",()=>{
39
+ const a = document.querySelector(".page-header.pager-header-with-logo.logo-large img.event-logo");
40
+ if(a){const b=()=>{const b=100*(a.naturalHeight/a.naturalWidth),c=a.parentElement;c.style.cssText=`display:block;position:relative;padding-bottom:${b}%;width:100%`;const d=document.createElement("video");d.poster=a.src,d.src="VIDEO_URL_TOKEN",d.setAttribute("playsinline",""),d.autoplay=!0,d.muted=!0,d.loop=!0,d.className="event-logo",d.style.cssText="position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain",a.replaceWith(d)};a.complete?b():a.addEventListener("load",b)}
41
+ });
42
+ """.replace("VIDEO_URL_TOKEN", video_url) # noqa: E501
43
+ # compress script (remove newlines)
44
+ "".join(s.strip() for s in script_content.split("\n")).replace(" = ", "=")
45
+ nonce = b64encode(secrets.token_bytes(16)).decode("utf-8")
46
+ request._video_nonce = nonce
47
+ return f'<script nonce="{nonce}">{script_content}</script>'
48
+
49
+
50
+ @receiver(process_response, dispatch_uid="video_process_response")
51
+ def process_response_video_csp(sender, request, response, **kwargs):
52
+ video_url = sender.settings.get("video_url")
53
+ if not video_url:
54
+ return response
55
+
56
+ # Get stored hash from request
57
+ nonce = getattr(request, "_video_nonce", None)
58
+
59
+ # Parse existing CSP
60
+ headers = {}
61
+ if "Content-Security-Policy" in response:
62
+ headers = _parse_csp(response.get("Content-Security-Policy", ""))
63
+
64
+ # Update media-src with video domain
65
+ video_netloc = parse_url(video_url).netloc
66
+
67
+ _merge_csp(headers, {"media-src": [video_netloc]})
68
+
69
+ # Add script hash to CSP if exists
70
+ if nonce:
71
+ _merge_csp(headers, {"script-src": [f"'nonce-{nonce}'"]})
72
+
73
+ # Apply updated CSP
74
+ if headers:
75
+ response["Content-Security-Policy"] = _render_csp(headers)
76
+
77
+ return response
@@ -0,0 +1,18 @@
1
+ {% extends "pretixcontrol/event/settings_base.html" %}
2
+ {% load i18n %}
3
+ {% load bootstrap3 %}
4
+ {% block inside %}
5
+ <h1>{% trans "Pretix Video Header" %}</h1>
6
+ <form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
7
+ {% csrf_token %}
8
+ {% bootstrap_form_errors form %}
9
+ <fieldset>
10
+ {% bootstrap_field form.video_url layout="control" %}
11
+ </fieldset>
12
+ <div class="form-group submit-group">
13
+ <button type="submit" class="btn btn-primary btn-save">
14
+ {% trans "Save" %}
15
+ </button>
16
+ </div>
17
+ </form>
18
+ {% endblock %}
@@ -0,0 +1,11 @@
1
+ from django.urls import re_path
2
+
3
+ from .views import SettingsView
4
+
5
+ urlpatterns = [
6
+ re_path(
7
+ r"^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/settings/video/$",
8
+ SettingsView.as_view(),
9
+ name="settings",
10
+ ),
11
+ ]
@@ -0,0 +1,36 @@
1
+ from django import forms
2
+ from django.urls import reverse
3
+ from django.utils.translation import gettext_lazy as _
4
+ from pretix.base.forms import SettingsForm
5
+ from pretix.base.models import Event
6
+ from pretix.control.views.event import EventSettingsFormView, EventSettingsViewMixin
7
+
8
+
9
+ class VideoSettingsForm(SettingsForm):
10
+ video_url = forms.URLField(
11
+ label=_("Video URL"),
12
+ required=True,
13
+ help_text=_(
14
+ "The URL of the video that should be displayed in the header. "
15
+ "This currently only supports direct links to video files "
16
+ "supported by the client's browser."
17
+ ),
18
+ )
19
+
20
+ # TODO: hls.js, autoplay, loop, mute, etc...
21
+
22
+
23
+ class SettingsView(EventSettingsViewMixin, EventSettingsFormView):
24
+ model = Event
25
+ form_class = VideoSettingsForm
26
+ template_name = "pretix_video/settings.html"
27
+ permission = "can_change_event_settings"
28
+
29
+ def get_success_url(self):
30
+ return reverse(
31
+ "plugins:pretix_video:settings",
32
+ kwargs={
33
+ "organizer": self.request.event.organizer.slug,
34
+ "event": self.request.event.slug,
35
+ },
36
+ )
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: pretix-video-header
3
+ Version: 1.0.8
4
+ Summary: Replace the image / gif with a HTML5 video element
5
+ Author-email: Daniel Malik <mail@fronbasal.de>
6
+ Maintainer-email: Daniel Malik <mail@fronbasal.de>
7
+ License: Apache
8
+ Project-URL: homepage, https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header
9
+ Project-URL: repository, https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header
10
+ Keywords: pretix
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ ---
16
+ title: Pretix Video Header
17
+ ---
18
+
19
+ This is a plugin for [pretix](https://github.com/pretix/pretix).
20
+
21
+ Replace the image / gif with a HTML5 video element
22
+
23
+ # Development setup
24
+
25
+ 1. Make sure that you have a working [pretix development
26
+ setup](https://docs.pretix.eu/en/latest/development/setup.html).
27
+ 2. Clone this repository.
28
+ 3. Activate the virtual environment you use for pretix development.
29
+ 4. Execute `python setup.py develop` within this directory to register
30
+ this application with pretix\'s plugin registry.
31
+ 5. Execute `make` within this directory to compile translations.
32
+ 6. Restart your local pretix server. You can now use the plugin from
33
+ this repository for your events by enabling it in the \'plugins\'
34
+ tab in the settings.
35
+
36
+ This plugin has CI set up to enforce a few code style rules. To check
37
+ locally, you need these packages installed:
38
+
39
+ pip install flake8 isort black
40
+
41
+ To check your plugin for rule violations, run:
42
+
43
+ black --check .
44
+ isort -c .
45
+ flake8 .
46
+
47
+ You can auto-fix some of these issues by running:
48
+
49
+ isort .
50
+ black .
51
+
52
+ To automatically check for these issues before you commit, you can run
53
+ `.install-hooks`.
54
+
55
+ # License
56
+
57
+ Copyright 2025 Daniel Malik
58
+
59
+ Released under the terms of the Apache License 2.0
@@ -0,0 +1,23 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.cfg
6
+ setup.py
7
+ pretix_video/__init__.py
8
+ pretix_video/apps.py
9
+ pretix_video/signals.py
10
+ pretix_video/urls.py
11
+ pretix_video/views.py
12
+ pretix_video/locale/de/LC_MESSAGES/django.po
13
+ pretix_video/locale/de_Informal/.gitkeep
14
+ pretix_video/locale/de_Informal/LC_MESSAGES/django.po
15
+ pretix_video/static/pretix_video/.gitkeep
16
+ pretix_video/templates/pretix_video/.gitkeep
17
+ pretix_video/templates/pretix_video/settings.html
18
+ pretix_video_header.egg-info/PKG-INFO
19
+ pretix_video_header.egg-info/SOURCES.txt
20
+ pretix_video_header.egg-info/dependency_links.txt
21
+ pretix_video_header.egg-info/entry_points.txt
22
+ pretix_video_header.egg-info/top_level.txt
23
+ tests/test_main.py
@@ -0,0 +1,5 @@
1
+ [distutils.commands]
2
+ build = pretix_plugin_build.build:CustomBuild
3
+
4
+ [pretix.plugin]
5
+ pretix_video = pretix_video:PretixPluginMeta
@@ -0,0 +1,42 @@
1
+ [project]
2
+ name = "pretix-video-header"
3
+ dynamic = ["version"]
4
+ description = "Replace the image / gif with a HTML5 video element"
5
+ readme = "README.md"
6
+ license = {text = "Apache"}
7
+ keywords = ["pretix"]
8
+ authors = [
9
+ {name = "Daniel Malik", email = "mail@fronbasal.de"},
10
+ ]
11
+ maintainers = [
12
+ {name = "Daniel Malik", email = "mail@fronbasal.de"},
13
+ ]
14
+
15
+ dependencies = [
16
+ ]
17
+
18
+ [project.entry-points."pretix.plugin"]
19
+ pretix_video = "pretix_video:PretixPluginMeta"
20
+
21
+ [project.entry-points."distutils.commands"]
22
+ build = "pretix_plugin_build.build:CustomBuild"
23
+
24
+ [build-system]
25
+ requires = [
26
+ "setuptools",
27
+ "pretix-plugin-build",
28
+ ]
29
+
30
+ [project.urls]
31
+ homepage = "https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header"
32
+ repository = "https://git.binarycollective.de/binary-pretix-plugins/pretix-video-header"
33
+
34
+ [tool.setuptools]
35
+ include-package-data = true
36
+
37
+ [tool.setuptools.dynamic]
38
+ version = {attr = "pretix_video.__version__"}
39
+
40
+ [tool.setuptools.packages.find]
41
+ include = ["pretix*"]
42
+ namespaces = false
@@ -0,0 +1,49 @@
1
+ [flake8]
2
+ ignore = N802,W503,E402
3
+ max-line-length = 160
4
+ exclude = migrations,.ropeproject,static,_static,build
5
+
6
+ [isort]
7
+ profile = black
8
+ combine_as_imports = true
9
+ default_section = THIRDPARTY
10
+ include_trailing_comma = true
11
+ known_third_party = pretix
12
+ known_standard_library = typing
13
+ skip = setup.py
14
+ use_parentheses = True
15
+ force_grid_wrap = 0
16
+ line_length = 88
17
+ known_first_party = pretix_video
18
+
19
+ [tool:pytest]
20
+ DJANGO_SETTINGS_MODULE = pretix.testutils.settings
21
+
22
+ [coverage:run]
23
+ source = pretix_video
24
+ omit = */migrations/*,*/urls.py,*/tests/*
25
+
26
+ [coverage:report]
27
+ exclude_lines =
28
+ pragma: no cover
29
+ def __str__
30
+ der __repr__
31
+ if settings.DEBUG
32
+ NOQA
33
+ NotImplementedError
34
+
35
+ [check-manifest]
36
+ ignore =
37
+ .update-locales.sh
38
+ .install-hooks.sh
39
+ pretixplugin.toml
40
+ Makefile
41
+ manage.py
42
+ tests/*
43
+ *.po
44
+ .gitkeep
45
+
46
+ [egg_info]
47
+ tag_build =
48
+ tag_date = 0
49
+
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup()
@@ -0,0 +1,3 @@
1
+ def test_empty():
2
+ # put your first tests here
3
+ assert 1 + 1 == 2