feat: PWA FCM 클라이언트 실통합 + 어댑터 키 주입 런처
- firebase SDK 통합: initPush getToken 활성화(동적 import) + isSupported 가드 - public/firebase-messaging-sw.js 백그라운드 수신 SW(웹 config 쿼리스트링 전달) - run-api-with-adapters.sh: adapter.env.local 로드 후 ga-api bootRun - 키 파일(adapter.env.local / .env.local)은 git-ignored 템플릿으로 별도 제공 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
/* FCM 백그라운드 메시지 수신 서비스워커 (vite-plugin-pwa SW 와 별개).
|
||||
* Firebase 웹 config 는 정적 파일에 박지 않고, initPush 등록 시 쿼리스트링으로 전달받는다. */
|
||||
importScripts('https://www.gstatic.com/firebasejs/12.14.0/firebase-app-compat.js');
|
||||
importScripts('https://www.gstatic.com/firebasejs/12.14.0/firebase-messaging-compat.js');
|
||||
|
||||
const p = new URL(self.location).searchParams;
|
||||
firebase.initializeApp({
|
||||
apiKey: p.get('apiKey'),
|
||||
projectId: p.get('projectId'),
|
||||
appId: p.get('appId'),
|
||||
messagingSenderId: p.get('messagingSenderId'),
|
||||
});
|
||||
|
||||
firebase.messaging().onBackgroundMessage((payload) => {
|
||||
const n = payload.notification || {};
|
||||
self.registration.showNotification(n.title || '알림', {
|
||||
body: n.body || '',
|
||||
icon: '/pwa-192x192.png',
|
||||
data: payload.data || {},
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user