Client push-token acquisition is now fully configured; a real browser session (logged-in user granting notification permission) is needed to mint the first token. Backend delivery still needs the service-account JSON. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
80 lines
3.1 KiB
HTML
80 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<!--
|
|
If you are serving your web app in a path other than the root, change the
|
|
href value below to reflect the base path you are serving from.
|
|
|
|
The path provided below has to start and end with a slash "/" in order for
|
|
it to work correctly.
|
|
|
|
For more details:
|
|
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
|
|
|
|
This is a placeholder for base href that will be replaced by the value of
|
|
the `--base-href` argument provided to `flutter build`.
|
|
-->
|
|
<base href="$FLUTTER_BASE_HREF">
|
|
|
|
<meta charset="UTF-8">
|
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
|
<meta name="description" content="Konfi-Castle App">
|
|
|
|
<!-- iOS meta tags & icons -->
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="apple-mobile-web-app-title" content="KC-App">
|
|
<link rel="apple-touch-icon" href="icons/Icon-192.png">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/png" href="favicon.png"/>
|
|
|
|
<title>KC-App</title>
|
|
<link rel="manifest" href="manifest.json">
|
|
|
|
<!-- Firebase Cloud Messaging (web push). `vapidKey` is the *public* half of
|
|
the Web Push certificate key pair; the private half stays in Firebase.
|
|
Backend sending still needs a service-account JSON + PUSH_PROVIDER=fcm. -->
|
|
<script src="https://www.gstatic.com/firebasejs/10.13.2/firebase-app-compat.js"></script>
|
|
<script src="https://www.gstatic.com/firebasejs/10.13.2/firebase-messaging-compat.js"></script>
|
|
<script>
|
|
window.KC_FIREBASE = {
|
|
apiKey: "AIzaSyDxBpdmW8lUHSuix--3AsWJScGQy9o3G_M",
|
|
authDomain: "konfi-castle-app.firebaseapp.com",
|
|
projectId: "konfi-castle-app",
|
|
storageBucket: "konfi-castle-app.firebasestorage.app",
|
|
messagingSenderId: "307226979593",
|
|
appId: "1:307226979593:web:66898b2c78b2d110ef77d8",
|
|
measurementId: "G-NK8K5VV40D",
|
|
vapidKey: "BEAHrnIzkTBGSEws1J_HRvsTtc6nqvmW4MvFMTfljmjuunqo4yiJoUcq8_jKIt_hbm4diOt0czG28l-dpvGK8T8"
|
|
};
|
|
window.kcGetPushToken = async function () {
|
|
try {
|
|
var cfg = window.KC_FIREBASE;
|
|
if (!cfg.vapidKey || cfg.vapidKey === "REPLACE_ME" || !("Notification" in window)) return null;
|
|
if (!firebase.apps.length) firebase.initializeApp(cfg);
|
|
var permission = await Notification.requestPermission();
|
|
if (permission !== "granted") return null;
|
|
var registration = await navigator.serviceWorker.register("firebase-messaging-sw.js");
|
|
var messaging = firebase.messaging();
|
|
return await messaging.getToken({ vapidKey: cfg.vapidKey, serviceWorkerRegistration: registration });
|
|
} catch (e) {
|
|
console.warn("[push] init failed", e);
|
|
return null;
|
|
}
|
|
};
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<!--
|
|
You can customize the "flutter_bootstrap.js" script.
|
|
This is useful to provide a custom configuration to the Flutter loader
|
|
or to give the user feedback during the initialization process.
|
|
|
|
For more details:
|
|
* https://docs.flutter.dev/platform-integration/web/initialization
|
|
-->
|
|
<script src="flutter_bootstrap.js" async></script>
|
|
</body>
|
|
</html>
|