From 4984d74d395e77e712d5446c63ef08ff561183e3 Mon Sep 17 00:00:00 2001 From: how2ice Date: Wed, 27 May 2026 11:57:01 +0900 Subject: [PATCH] chore: test deploy snapshot --- index.html | 11 +++++++---- public/chat-share.webmanifest | 25 +++++++++++++++++++++++++ src/app/main/pages/ChatSharePage.tsx | 10 +++++++--- src/app/main/pwa/installManifest.ts | 6 ++++-- src/main.tsx | 4 ++-- 5 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 public/chat-share.webmanifest diff --git a/index.html b/index.html index 2e6e5f4..59d32b0 100755 --- a/index.html +++ b/index.html @@ -29,6 +29,7 @@ }; let installMetadata = null; + let staticManifestHref = null; if (pathname === '/play/apps') { const appId = searchParams.get('app')?.trim() ?? ''; @@ -59,6 +60,7 @@ themeColor: '#165dff', scope: pathname, }; + staticManifestHref = '/chat-share.webmanifest'; } if (!installMetadata) { @@ -93,10 +95,11 @@ ], }; - const manifestBlob = new Blob([JSON.stringify(manifest, null, 2)], { - type: 'application/manifest+json', - }); - const manifestHref = URL.createObjectURL(manifestBlob); + const manifestHref = staticManifestHref ?? URL.createObjectURL( + new Blob([JSON.stringify(manifest, null, 2)], { + type: 'application/manifest+json', + }), + ); let manifestLink = document.querySelector('link[rel="manifest"]'); if (!manifestLink) { diff --git a/public/chat-share.webmanifest b/public/chat-share.webmanifest new file mode 100644 index 0000000..f6d49dc --- /dev/null +++ b/public/chat-share.webmanifest @@ -0,0 +1,25 @@ +{ + "id": "/chat/share/", + "name": "리소스 공유 채팅방", + "short_name": "공유채팅", + "description": "리소스 공유 채팅방을 홈 화면 앱으로 바로 엽니다.", + "theme_color": "#165dff", + "background_color": "#f4f7fb", + "display": "standalone", + "lang": "ko", + "scope": "/chat/share/", + "start_url": "/chat/share/", + "icons": [ + { + "src": "/pwa-192x192.svg", + "sizes": "192x192", + "type": "image/svg+xml" + }, + { + "src": "/pwa-512x512.svg", + "sizes": "512x512", + "type": "image/svg+xml", + "purpose": "any maskable" + } + ] +} diff --git a/src/app/main/pages/ChatSharePage.tsx b/src/app/main/pages/ChatSharePage.tsx index 44564c6..5fc1074 100644 --- a/src/app/main/pages/ChatSharePage.tsx +++ b/src/app/main/pages/ChatSharePage.tsx @@ -1198,7 +1198,11 @@ function buildAbsoluteShareUrl(path?: string | null) { return new URL(normalizedPath, window.location.origin).toString(); } -function createChatShareManifestObjectUrl(pathname: string, title?: string | null) { +function createChatShareManifestHref(pathname: string, title?: string | null) { + if (isAppleMobileDevice()) { + return '/chat-share.webmanifest'; + } + const normalizedTitle = title?.trim(); return createInstallManifestObjectUrl({ startPath: pathname, @@ -3367,7 +3371,7 @@ export function ChatSharePage() { themeColor: resolveSharePlayAppInstallThemeColor(activeInstallAppId), backgroundColor: '#eff5ff', }) - : createChatShareManifestObjectUrl(sharePathname, snapshot?.conversation.title); + : createChatShareManifestHref(sharePathname, snapshot?.conversation.title); const restoreManifest = activeInstallAppEntry ? swapInstallDocumentMetadata({ manifestHref: manifestObjectUrl, @@ -3378,7 +3382,7 @@ export function ChatSharePage() { return () => { restoreManifest(); - if (manifestObjectUrl) { + if (manifestObjectUrl.startsWith('blob:')) { window.URL.revokeObjectURL(manifestObjectUrl); } }; diff --git a/src/app/main/pwa/installManifest.ts b/src/app/main/pwa/installManifest.ts index 7b5d971..07f2a97 100644 --- a/src/app/main/pwa/installManifest.ts +++ b/src/app/main/pwa/installManifest.ts @@ -154,13 +154,14 @@ export function swapInstallDocumentMetadata(options: SwapInstallDocumentMetadata type BootstrapInstallMetadataResult = { - manifestObjectUrl: string; + manifestHref: string; title: string; themeColor: string; } | null; type BootstrapInstallMetadataDefinition = { description: string; + manifestPath?: string; scope?: string; shortName?: string; themeColor: string; @@ -234,6 +235,7 @@ function resolveBootstrapInstallMetadataDefinition(pathname: string, search: str shortName: '공유채팅', description: '리소스 공유 채팅방을 홈 화면 앱으로 바로 엽니다.', themeColor: '#165dff', + manifestPath: '/chat-share.webmanifest', scope: pathname, }; } @@ -254,7 +256,7 @@ export function applyBootstrapInstallMetadataForCurrentRoute(): BootstrapInstall } return { - manifestObjectUrl: createCurrentRouteInstallManifestObjectUrl(metadata), + manifestHref: metadata.manifestPath ?? createCurrentRouteInstallManifestObjectUrl(metadata), title: metadata.title, themeColor: metadata.themeColor, }; diff --git a/src/main.tsx b/src/main.tsx index be1b01c..40df0dd 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -19,9 +19,9 @@ async function bootstrap() { if (typeof window !== 'undefined') { const bootstrapInstallMetadata = applyBootstrapInstallMetadataForCurrentRoute(); - if (bootstrapInstallMetadata?.manifestObjectUrl) { + if (bootstrapInstallMetadata?.manifestHref) { restoreBootstrapInstallMetadata = swapInstallDocumentMetadata({ - manifestHref: bootstrapInstallMetadata.manifestObjectUrl, + manifestHref: bootstrapInstallMetadata.manifestHref, title: bootstrapInstallMetadata.title, themeColor: bootstrapInstallMetadata.themeColor, });