Service Workerが正しく登録できないのを修正
This commit is contained in:
@@ -50,6 +50,7 @@
|
||||
- 証明書取得失敗時のアラート履歴作成
|
||||
- Webhook 通知送信処理
|
||||
- Push 通知送信処理
|
||||
- `/push-sw.js` の明示的な静的配信
|
||||
- 二重送信を防ぐ `dedupe_key` 利用
|
||||
- 並列数を制限した監視ジョブ
|
||||
- 監視ジョブの一回実行スクリプト
|
||||
@@ -338,6 +339,7 @@ API 動作確認:
|
||||
- API 経由で Push 購読情報登録成功。
|
||||
- `pnpm monitor:once` 成功。
|
||||
- API セキュリティ境界と証明書監視処理のテスト成功。
|
||||
- `/push-sw.js` が SPA fallback ではなく Service Worker JavaScript として返ることをテストで確認。
|
||||
- サイト登録時の証明書期限初期取得と取得失敗時の登録拒否テスト成功。
|
||||
- 権限付き実行で OpenSSL による実サイトの証明書期限取得成功。
|
||||
- サンドボックス内の外部接続拒否時に証明書取得失敗アラート作成を確認。
|
||||
|
||||
@@ -24,6 +24,7 @@ export function createApp() {
|
||||
app.route('/api/notification-methods', notificationMethodRoutes);
|
||||
|
||||
app.use('/assets/*', serveStatic({ root: './dist' }));
|
||||
app.get('/push-sw.js', serveStatic({ path: './public/push-sw.js' }));
|
||||
app.get('*', serveStatic({ path: './dist/index.html' }));
|
||||
|
||||
app.onError((error, c) => {
|
||||
|
||||
17
tests/staticAssets.test.js
Normal file
17
tests/staticAssets.test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createApp } from '../src/server/app.js';
|
||||
|
||||
describe('static assets', () => {
|
||||
it('serves the push service worker as JavaScript instead of the app shell', async () => {
|
||||
const app = createApp();
|
||||
|
||||
const response = await app.request('/push-sw.js');
|
||||
const body = await response.text();
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
expect(response.headers.get('content-type')).toContain('javascript');
|
||||
expect(body).toContain("self.addEventListener('push'");
|
||||
expect(body).toContain('showNotification');
|
||||
expect(body).not.toContain('<div id="root">');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user