1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

[ticket/17010] Make webpush js not depend on twig compilation

PHPBB3-17010
This commit is contained in:
Marc Alexander
2023-11-05 12:56:01 +01:00
parent d85da61c9a
commit fa91bf791f
3 changed files with 77 additions and 41 deletions

View File

@@ -1,6 +1,8 @@
{% include('ucp_header.html') %}
{% INCLUDEJS(T_WEBPUSH_JS_PATH) %}
{% if NOTIFICATIONS_WEBPUSH_ENABLE %}
{% include('ucp_notifications_webpush.html') %}
{% endif %}
<form id="ucp" method="post" action="{{ S_UCP_ACTION }}"{{ S_FORM_ENCTYPE }}>

View File

@@ -0,0 +1,21 @@
<script>
phpbbWebpushOptions = {
serviceWorkerUrl: '{{ U_WEBPUSH_WORKER_URL }}',
subscribeUrl: '{{ U_WEBPUSH_SUBSCRIBE }}',
unsubscribeUrl: '{{ U_WEBPUSH_UNSUBSCRIBE }}',
ajaxErrorTitle: '{{ lang('AJAX_ERROR_TITLE') }}',
vapidPublicKey: '{{ VAPID_PUBLIC_KEY }}',
formTokens: {
creationTime: '{{ WEBPUSH_FORM_TOKENS.creation_time }}',
formToken: '{{ WEBPUSH_FORM_TOKENS.form_token }}',
},
subscriptions: [
{% for sub in SUBSCRIPTIONS %}
{endpoint: '{{ sub.endpoint }}', expiration: '{{ sub.expiration }}' },
{% endfor %}
],
}
</script>
{% INCLUDEJS(T_ASSETS_PATH ~ '/javascript/webpush.js') %}