chore: test deploy snapshot
This commit is contained in:
11
index.html
11
index.html
@@ -29,6 +29,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
let installMetadata = null;
|
let installMetadata = null;
|
||||||
|
let staticManifestHref = null;
|
||||||
|
|
||||||
if (pathname === '/play/apps') {
|
if (pathname === '/play/apps') {
|
||||||
const appId = searchParams.get('app')?.trim() ?? '';
|
const appId = searchParams.get('app')?.trim() ?? '';
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
themeColor: '#165dff',
|
themeColor: '#165dff',
|
||||||
scope: pathname,
|
scope: pathname,
|
||||||
};
|
};
|
||||||
|
staticManifestHref = '/chat-share.webmanifest';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!installMetadata) {
|
if (!installMetadata) {
|
||||||
@@ -93,10 +95,11 @@
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const manifestBlob = new Blob([JSON.stringify(manifest, null, 2)], {
|
const manifestHref = staticManifestHref ?? URL.createObjectURL(
|
||||||
type: 'application/manifest+json',
|
new Blob([JSON.stringify(manifest, null, 2)], {
|
||||||
});
|
type: 'application/manifest+json',
|
||||||
const manifestHref = URL.createObjectURL(manifestBlob);
|
}),
|
||||||
|
);
|
||||||
let manifestLink = document.querySelector('link[rel="manifest"]');
|
let manifestLink = document.querySelector('link[rel="manifest"]');
|
||||||
|
|
||||||
if (!manifestLink) {
|
if (!manifestLink) {
|
||||||
|
|||||||
25
public/chat-share.webmanifest
Normal file
25
public/chat-share.webmanifest
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1198,7 +1198,11 @@ function buildAbsoluteShareUrl(path?: string | null) {
|
|||||||
return new URL(normalizedPath, window.location.origin).toString();
|
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();
|
const normalizedTitle = title?.trim();
|
||||||
return createInstallManifestObjectUrl({
|
return createInstallManifestObjectUrl({
|
||||||
startPath: pathname,
|
startPath: pathname,
|
||||||
@@ -3367,7 +3371,7 @@ export function ChatSharePage() {
|
|||||||
themeColor: resolveSharePlayAppInstallThemeColor(activeInstallAppId),
|
themeColor: resolveSharePlayAppInstallThemeColor(activeInstallAppId),
|
||||||
backgroundColor: '#eff5ff',
|
backgroundColor: '#eff5ff',
|
||||||
})
|
})
|
||||||
: createChatShareManifestObjectUrl(sharePathname, snapshot?.conversation.title);
|
: createChatShareManifestHref(sharePathname, snapshot?.conversation.title);
|
||||||
const restoreManifest = activeInstallAppEntry
|
const restoreManifest = activeInstallAppEntry
|
||||||
? swapInstallDocumentMetadata({
|
? swapInstallDocumentMetadata({
|
||||||
manifestHref: manifestObjectUrl,
|
manifestHref: manifestObjectUrl,
|
||||||
@@ -3378,7 +3382,7 @@ export function ChatSharePage() {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
restoreManifest();
|
restoreManifest();
|
||||||
if (manifestObjectUrl) {
|
if (manifestObjectUrl.startsWith('blob:')) {
|
||||||
window.URL.revokeObjectURL(manifestObjectUrl);
|
window.URL.revokeObjectURL(manifestObjectUrl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -154,13 +154,14 @@ export function swapInstallDocumentMetadata(options: SwapInstallDocumentMetadata
|
|||||||
|
|
||||||
|
|
||||||
type BootstrapInstallMetadataResult = {
|
type BootstrapInstallMetadataResult = {
|
||||||
manifestObjectUrl: string;
|
manifestHref: string;
|
||||||
title: string;
|
title: string;
|
||||||
themeColor: string;
|
themeColor: string;
|
||||||
} | null;
|
} | null;
|
||||||
|
|
||||||
type BootstrapInstallMetadataDefinition = {
|
type BootstrapInstallMetadataDefinition = {
|
||||||
description: string;
|
description: string;
|
||||||
|
manifestPath?: string;
|
||||||
scope?: string;
|
scope?: string;
|
||||||
shortName?: string;
|
shortName?: string;
|
||||||
themeColor: string;
|
themeColor: string;
|
||||||
@@ -234,6 +235,7 @@ function resolveBootstrapInstallMetadataDefinition(pathname: string, search: str
|
|||||||
shortName: '공유채팅',
|
shortName: '공유채팅',
|
||||||
description: '리소스 공유 채팅방을 홈 화면 앱으로 바로 엽니다.',
|
description: '리소스 공유 채팅방을 홈 화면 앱으로 바로 엽니다.',
|
||||||
themeColor: '#165dff',
|
themeColor: '#165dff',
|
||||||
|
manifestPath: '/chat-share.webmanifest',
|
||||||
scope: pathname,
|
scope: pathname,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -254,7 +256,7 @@ export function applyBootstrapInstallMetadataForCurrentRoute(): BootstrapInstall
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
manifestObjectUrl: createCurrentRouteInstallManifestObjectUrl(metadata),
|
manifestHref: metadata.manifestPath ?? createCurrentRouteInstallManifestObjectUrl(metadata),
|
||||||
title: metadata.title,
|
title: metadata.title,
|
||||||
themeColor: metadata.themeColor,
|
themeColor: metadata.themeColor,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ async function bootstrap() {
|
|||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
const bootstrapInstallMetadata = applyBootstrapInstallMetadataForCurrentRoute();
|
const bootstrapInstallMetadata = applyBootstrapInstallMetadataForCurrentRoute();
|
||||||
|
|
||||||
if (bootstrapInstallMetadata?.manifestObjectUrl) {
|
if (bootstrapInstallMetadata?.manifestHref) {
|
||||||
restoreBootstrapInstallMetadata = swapInstallDocumentMetadata({
|
restoreBootstrapInstallMetadata = swapInstallDocumentMetadata({
|
||||||
manifestHref: bootstrapInstallMetadata.manifestObjectUrl,
|
manifestHref: bootstrapInstallMetadata.manifestHref,
|
||||||
title: bootstrapInstallMetadata.title,
|
title: bootstrapInstallMetadata.title,
|
||||||
themeColor: bootstrapInstallMetadata.themeColor,
|
themeColor: bootstrapInstallMetadata.themeColor,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user