feat(embed): photo click opens album page in a new tab (user decision 2026-09-24)

Reverts the in-host detail modal interaction: click now window.open's the album page (/a/:token?lang=, no /p/ deep link) with noopener — same target for middle-click/right-click via the real <a> href. The loader's open-photo modal code remains but is no longer triggered.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-24 15:25:41 +08:00
parent bd4db7b458
commit c199d0630c
2 changed files with 21 additions and 57 deletions
+8 -24
View File
@@ -18,7 +18,6 @@ import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { useEmbedFeed } from '../embed/useEmbedFeed';
import { clampEmbedIntervalMs, EMBED_CAROUSEL_DEFAULT_MS } from '../embed/feed';
import { postEmbedMessage } from '../embed/postMessage';
import EmbedCarousel from './embed/EmbedCarousel.vue';
import EmbedStream from './embed/EmbedStream.vue';
@@ -118,28 +117,13 @@ const albumUrl = computed(() => {
return url.toString();
});
/** v2 照片深链构造器(真实 <a> href;受控打开同 openPhoto)。 */
function streamPhotoUrl(photoId: string): string {
const albumToken = feed.album?.publicToken;
const base = albumToken ?? '';
const url = new URL(`/a/${encodeURIComponent(base)}/p/${encodeURIComponent(photoId)}`, window.location.origin);
url.searchParams.set('lang', feed.resolvedLocale ?? 'zh-CN');
return url.toString();
}
function openPhoto(photoId: string): void {
const albumToken = feed.album?.publicToken;
if (albumToken === undefined) return;
const url = new URL(`/a/${encodeURIComponent(albumToken)}/p/${encodeURIComponent(photoId)}`, window.location.origin);
url.searchParams.set('lang', feed.resolvedLocale ?? 'zh-CN');
// 宿主内弹框(用户决策 2026-09-23):有父窗(loader 嵌入)→ postMessage
// 由宿主弹框内嵌详情页,不跳出当前网站;无父窗(直接打开/预览)→ 新标签
// noopener(sandbox allow-popups-to-escape-sandbox 配合)。
if (window.parent !== window) {
postEmbedMessage({ photoliveEmbed: true, type: 'open-photo', url: url.toString() });
return;
}
window.open(url, '_blank', 'noopener,noreferrer');
// 用户决策 2026-09-24:点击照片 → 新标签页打开观众页(相册页),不定位到
// 具体照片、不在当前页弹框——v1 与 v2 统一该语义(此前的宿主内弹框与照片
// 深链均退役;loader v2 的 open-photo 弹框逻辑保留但不再被触发)。
function openPhoto(): void {
if (albumUrl.value === null) return;
// noopener:新标签页不持有 opener(sandbox allow-popups-to-escape-sandbox 配合)。
window.open(albumUrl.value, '_blank', 'noopener,noreferrer');
}
</script>
@@ -151,7 +135,7 @@ function openPhoto(photoId: string): void {
:photos="feed.status === 'ready' ? feed.photos : []"
:album-token="feed.album?.publicToken ?? null"
:album-title="feed.album?.title ?? ''"
:photo-url="streamPhotoUrl"
:photo-url="() => albumUrl ?? '#'"
:speed="streamSpeed"
:reactions="streamReactions"
:active="feed.active"