追加: 全ページサムネイル一覧表示画面の新設とヘッダー遷移ボタンの追加
- ギャラリー全ページのサムネイルをグリッドカード形式で閲覧できる新画面(RenderThumbnailGridPage)を新設 - ビューアーヘッダーに「サムネイル一覧」ボタンを追加し、ワンクリックで全ページ一覧画面へ遷移可能に - サムネイル画面のカードクリック時に該当ページ番号(?page=N)付きでビューアーを直接開くシームレスな画面連携を実装 - Program.csにて /?url=...&view=thumbnails および /thumbnails?url=... のルーティングを追加
This commit is contained in:
1 parent
60c2648add
commit
b9a316254b
2 files changed
+458
-4
No files matched your search
@@ -1490,6 +1490,10 @@ public static class UnifiedHtmlRenderer
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
|
<a href="/?url={{Uri.EscapeDataString(gallery.SourceUrl)}}&view=thumbnails" class="btn-header" title="全ページのサムネイルを一覧表示">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="7" height="7"></rect><rect x="14" y="3" width="7" height="7"></rect><rect x="14" y="14" width="7" height="7"></rect><rect x="3" y="14" width="7" height="7"></rect></svg>
|
||||||
|
<span>サムネイル一覧</span>
|
||||||
|
</a>
|
||||||
<a href="{{safeUrl}}" target="_blank" rel="noopener noreferrer" class="btn-header" style="font-size: 0.8rem;">
|
<a href="{{safeUrl}}" target="_blank" rel="noopener noreferrer" class="btn-header" style="font-size: 0.8rem;">
|
||||||
<span>元サイトを開く ↗</span>
|
<span>元サイトを開く ↗</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -2032,8 +2036,14 @@ public static class UnifiedHtmlRenderer
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 初期化:1ページ目を設定し、順次バックグラウンドダウンロードを開始
|
// 初期化:URLパラメータやハッシュで指定されたページ、または1ページ目を設定
|
||||||
setPage(1, false);
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
let startPage = parseInt(urlParams.get('page')) || 1;
|
||||||
|
if (window.location.hash.startsWith('#page-')) {
|
||||||
|
const hashPage = parseInt(window.location.hash.replace('#page-', ''));
|
||||||
|
if (!isNaN(hashPage)) startPage = hashPage;
|
||||||
|
}
|
||||||
|
setPage(startPage, false);
|
||||||
downloader.start();
|
downloader.start();
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
@@ -2043,6 +2053,424 @@ public static class UnifiedHtmlRenderer
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region サムネイル一覧画面生成 (RenderThumbnailGridPage)
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ギャラリー全ページのサムネイルを一覧表示するグリッド画面を生成します。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gallery">ギャラリー詳細情報</param>
|
||||||
|
/// <returns>サムネイル一覧画面の完全なHTML</returns>
|
||||||
|
public static string RenderThumbnailGridPage(UnifiedGalleryItem gallery)
|
||||||
|
{
|
||||||
|
var safeTitle = Encoder.Encode(gallery.Title);
|
||||||
|
var safeCategory = !string.IsNullOrEmpty(gallery.Category) ? Encoder.Encode(gallery.Category) : null;
|
||||||
|
var safeCircle = !string.IsNullOrEmpty(gallery.Circle) ? Encoder.Encode(gallery.Circle) : null;
|
||||||
|
var safeAuthor = !string.IsNullOrEmpty(gallery.Author) ? Encoder.Encode(gallery.Author) : null;
|
||||||
|
var safeSite = Encoder.Encode(gallery.SourceSite);
|
||||||
|
var safeUrl = Encoder.Encode(gallery.SourceUrl);
|
||||||
|
var encodedSourceUrl = Uri.EscapeDataString(gallery.SourceUrl);
|
||||||
|
var totalPages = gallery.TotalPages;
|
||||||
|
|
||||||
|
var metaBadges = new List<string>
|
||||||
|
{
|
||||||
|
$"<span class=\"badge-pill highlight\">全 {totalPages} ページ</span>"
|
||||||
|
};
|
||||||
|
if (!string.IsNullOrEmpty(safeCategory)) metaBadges.Add($"<span class=\"badge-pill\">{safeCategory}</span>");
|
||||||
|
if (!string.IsNullOrEmpty(safeAuthor)) metaBadges.Add($"<span class=\"badge-pill\">👤 {safeAuthor}</span>");
|
||||||
|
if (!string.IsNullOrEmpty(safeCircle)) metaBadges.Add($"<span class=\"badge-pill\">🏛️ {safeCircle}</span>");
|
||||||
|
if (!string.IsNullOrEmpty(safeSite)) metaBadges.Add($"<span class=\"badge-pill\">🌐 {safeSite}</span>");
|
||||||
|
var metaBadgesHtml = string.Join("\n ", metaBadges);
|
||||||
|
|
||||||
|
var tagsHtml = string.Empty;
|
||||||
|
if (gallery.Tags.Count > 0)
|
||||||
|
{
|
||||||
|
var tagItems = string.Join("\n", gallery.Tags.Select(t => $"<span class=\"tag-pill\">#{Encoder.Encode(t)}</span>"));
|
||||||
|
tagsHtml = $"<div class=\"info-tags-container\">{tagItems}</div>";
|
||||||
|
}
|
||||||
|
|
||||||
|
var gridItemsHtml = string.Join("\n", gallery.Images.Select(img =>
|
||||||
|
{
|
||||||
|
var thumbUrl = Encoder.Encode(img.ThumbnailUrl ?? img.ImageUrl);
|
||||||
|
var pageNum = img.PageNumber;
|
||||||
|
return $$"""
|
||||||
|
<a href="/?url={{encodedSourceUrl}}&page={{pageNum}}" class="thumb-grid-card" title="{{safeTitle}} - {{pageNum}}ページを開く">
|
||||||
|
<div class="thumb-card-aspect">
|
||||||
|
<img src="{{thumbUrl}}" loading="lazy" alt="ページ {{pageNum}}" decoding="async" />
|
||||||
|
<span class="card-page-badge">{{pageNum}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="thumb-card-info">
|
||||||
|
<span class="thumb-card-num">P. {{pageNum}}</span>
|
||||||
|
<span class="thumb-card-action">開く ↗</span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
""";
|
||||||
|
}));
|
||||||
|
|
||||||
|
return $$"""
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ja">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>サムネイル一覧: {{safeTitle}} (全{{totalPages}}ページ) - WebImageViewer</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@400;500;700&family=Outfit:wght@600;700;800&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
{{CommonStyle}}
|
||||||
|
|
||||||
|
.thumb-page-header {
|
||||||
|
background: linear-gradient(180deg, rgba(22, 28, 46, 0.85) 0%, rgba(15, 20, 34, 0.65) 100%);
|
||||||
|
border-bottom: 1px solid var(--border-subtle);
|
||||||
|
padding: 28px 24px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-content-inner {
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-title-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gallery-main-title {
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.4;
|
||||||
|
color: #fff;
|
||||||
|
max-width: 900px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-badges {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-pill {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
padding: 4px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.82rem;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.badge-pill.highlight {
|
||||||
|
background: rgba(99, 102, 241, 0.15);
|
||||||
|
border-color: rgba(99, 102, 241, 0.4);
|
||||||
|
color: #a5b4fc;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-tags-container {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-pill {
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
color: var(--text-subtle);
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-btn-bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action-btn {
|
||||||
|
background: var(--accent-gradient-gallery);
|
||||||
|
color: #fff;
|
||||||
|
padding: 10px 22px;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action-btn:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
|
||||||
|
filter: brightness(1.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-action-btn {
|
||||||
|
background: rgba(255, 255, 255, 0.08);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
color: var(--text-main);
|
||||||
|
padding: 10px 18px;
|
||||||
|
border-radius: 9px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-action-btn:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
border-color: rgba(255, 255, 255, 0.25);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* サムネイルグリッドレイアウト */
|
||||||
|
.grid-wrapper {
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 32px 24px 80px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-header-meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumbs-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-grid-card {
|
||||||
|
background: var(--bg-surface);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
text-decoration: none;
|
||||||
|
color: var(--text-main);
|
||||||
|
transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-grid-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
border-color: var(--accent-primary);
|
||||||
|
box-shadow: 0 10px 28px rgba(99, 102, 241, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-card-aspect {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 140%;
|
||||||
|
background: rgba(0, 0, 0, 0.45);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-card-aspect img {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-grid-card:hover .thumb-card-aspect img {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-page-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
right: 8px;
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
backdrop-filter: blur(6px);
|
||||||
|
-webkit-backdrop-filter: blur(6px);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Outfit', monospace;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-card-info {
|
||||||
|
padding: 8px 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: rgba(0, 0, 0, 0.3);
|
||||||
|
border-top: 1px solid var(--border-subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-card-num {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #fff;
|
||||||
|
font-family: 'Outfit', monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb-card-action {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
color: var(--accent-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ページトップへ戻るボタン */
|
||||||
|
.back-to-top-btn {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 24px;
|
||||||
|
right: 24px;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--bg-surface-elevated);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-top-btn.visible {
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-to-top-btn:hover {
|
||||||
|
background: var(--accent-primary);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.thumbs-grid {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.gallery-main-title {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
}
|
||||||
|
.grid-wrapper {
|
||||||
|
padding: 16px 12px 60px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header class="unified-header">
|
||||||
|
<a href="/" class="header-brand">
|
||||||
|
<div class="brand-logo">W</div>
|
||||||
|
<span class="brand-title">WebImageViewer</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<!-- ヘッダー内 統一URLジャンプ検索バー -->
|
||||||
|
<div class="header-search">
|
||||||
|
<form class="header-search-form" onsubmit="event.preventDefault(); const val=document.getElementById('headerSearchInput').value.trim(); if(val) window.location.href='/?url='+encodeURIComponent(val);">
|
||||||
|
<input type="text" id="headerSearchInput" class="header-search-input" placeholder="別のURLを入力して閲覧・再生..." />
|
||||||
|
<button type="submit" class="header-search-btn">開く</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="header-actions">
|
||||||
|
<a href="/?url={{encodedSourceUrl}}" class="btn-header" style="background: var(--accent-gradient-gallery); color: #fff; border-color: transparent;">
|
||||||
|
<span>📖 ビューアーを開く</span>
|
||||||
|
</a>
|
||||||
|
<a href="{{safeUrl}}" target="_blank" rel="noopener noreferrer" class="btn-header" style="font-size: 0.8rem;">
|
||||||
|
<span>元サイトを開く ↗</span>
|
||||||
|
</a>
|
||||||
|
<a href="/" class="btn-header">
|
||||||
|
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
|
||||||
|
<span>ホーム</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="thumb-page-header">
|
||||||
|
<div class="header-content-inner">
|
||||||
|
<div class="gallery-title-row">
|
||||||
|
<h1 class="gallery-main-title">{{safeTitle}}</h1>
|
||||||
|
<div class="meta-badges">
|
||||||
|
{{metaBadgesHtml}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{tagsHtml}}
|
||||||
|
|
||||||
|
<div class="action-btn-bar">
|
||||||
|
<a href="/?url={{encodedSourceUrl}}" class="primary-action-btn">
|
||||||
|
<span>📖 ビューアーで閲覧を開始する</span>
|
||||||
|
</a>
|
||||||
|
<a href="/api/download-zip?url={{encodedSourceUrl}}" class="secondary-action-btn" title="全画像をZIP形式でまとめてダウンロード">
|
||||||
|
<span>📦 ZIP一括ダウンロード</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main class="grid-wrapper">
|
||||||
|
<div class="grid-header-meta">
|
||||||
|
<span>ページをクリックすると、ビューアーでそのページが開きます</span>
|
||||||
|
<span>全 {{totalPages}} 枚</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="thumbs-grid">
|
||||||
|
{{gridItemsHtml}}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<button id="backToTop" class="back-to-top-btn" title="上に戻る">▲</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const backToTop = document.getElementById('backToTop');
|
||||||
|
window.addEventListener('scroll', () => {
|
||||||
|
if (window.scrollY > 300) {
|
||||||
|
backToTop.classList.add('visible');
|
||||||
|
} else {
|
||||||
|
backToTop.classList.remove('visible');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
backToTop.addEventListener('click', () => {
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region エラー画面生成 (RenderErrorPage)
|
#region エラー画面生成 (RenderErrorPage)
|
||||||
|
|
||||||
public static string RenderErrorPage(string message, int statusCode = 404)
|
public static string RenderErrorPage(string message, int statusCode = 404)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ app.UseForwardedHeaders();
|
|||||||
// ==========================================
|
// ==========================================
|
||||||
// 統一アクセス方式 (/?url=[各ページURL])
|
// 統一アクセス方式 (/?url=[各ページURL])
|
||||||
// ==========================================
|
// ==========================================
|
||||||
app.MapGet("/", async (string? url, string? play, string? stream, UnifiedViewerService viewerService, CancellationToken ct) =>
|
app.MapGet("/", async (string? url, string? play, string? stream, string? view, UnifiedViewerService viewerService, CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
// URLパラメータが未指定(かつplay/streamも未指定)の場合は統一トップページを表示
|
// URLパラメータが未指定(かつplay/streamも未指定)の場合は統一トップページを表示
|
||||||
if (string.IsNullOrWhiteSpace(url) && string.IsNullOrWhiteSpace(play) && string.IsNullOrWhiteSpace(stream))
|
if (string.IsNullOrWhiteSpace(url) && string.IsNullOrWhiteSpace(play) && string.IsNullOrWhiteSpace(stream))
|
||||||
@@ -71,9 +71,13 @@ app.MapGet("/", async (string? url, string? play, string? stream, UnifiedViewerS
|
|||||||
return Results.Content(UnifiedHtmlRenderer.RenderVideoViewer(result.Video), "text/html; charset=utf-8");
|
return Results.Content(UnifiedHtmlRenderer.RenderVideoViewer(result.Video), "text/html; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 画像の場合はギャラリービューアー画面を同一URLのままレンダリング
|
// 画像の場合はギャラリービューアー画面またはサムネイル一覧画面をレンダリング
|
||||||
if (result.Type == MediaType.Gallery && result.Gallery != null)
|
if (result.Type == MediaType.Gallery && result.Gallery != null)
|
||||||
{
|
{
|
||||||
|
if (string.Equals(view, "thumbnails", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return Results.Content(UnifiedHtmlRenderer.RenderThumbnailGridPage(result.Gallery), "text/html; charset=utf-8");
|
||||||
|
}
|
||||||
return Results.Content(UnifiedHtmlRenderer.RenderGalleryViewer(result.Gallery), "text/html; charset=utf-8");
|
return Results.Content(UnifiedHtmlRenderer.RenderGalleryViewer(result.Gallery), "text/html; charset=utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +87,28 @@ app.MapGet("/", async (string? url, string? play, string? stream, UnifiedViewerS
|
|||||||
statusCode: 404);
|
statusCode: 404);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ==========================================
|
||||||
|
// 全ページサムネイル一覧画面エンドポイント
|
||||||
|
// ==========================================
|
||||||
|
app.MapGet("/thumbnails", async (string? url, UnifiedViewerService viewerService, CancellationToken ct) =>
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
|
{
|
||||||
|
return Results.Redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await viewerService.ResolveAsync(url, null, null, ct);
|
||||||
|
if (!result.IsSuccess || result.Gallery == null)
|
||||||
|
{
|
||||||
|
return Results.Content(
|
||||||
|
UnifiedHtmlRenderer.RenderErrorPage(result.ErrorMessage ?? "ギャラリーを読み込めませんでした。", result.StatusCode),
|
||||||
|
"text/html; charset=utf-8",
|
||||||
|
statusCode: result.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Results.Content(UnifiedHtmlRenderer.RenderThumbnailGridPage(result.Gallery), "text/html; charset=utf-8");
|
||||||
|
});
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
// 画像プロキシAPI (Referer制限回避・高速キャッシュ配信)
|
// 画像プロキシAPI (Referer制限回避・高速キャッシュ配信)
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|||||||
Reference in new issue
Block a user