commit
9c5fef1a4d
412 files changed
+94582
No files matched your search
@@ -0,0 +1,947 @@
|
||||
const state = {
|
||||
view: "home",
|
||||
query: "",
|
||||
tag: "",
|
||||
type: "",
|
||||
artistId: "",
|
||||
offset: 0,
|
||||
limit: 48,
|
||||
total: 0,
|
||||
xPreviewId: "",
|
||||
xPreviewUsername: "",
|
||||
xPreviewAuthor: "",
|
||||
xhsPreviewId: "",
|
||||
};
|
||||
|
||||
const els = {
|
||||
search: document.querySelector("#searchInput"),
|
||||
type: document.querySelector("#typeFilter"),
|
||||
status: document.querySelector("#statusLine"),
|
||||
grid: document.querySelector("#artworkGrid"),
|
||||
tags: document.querySelector("#tagList"),
|
||||
artists: document.querySelector("#artistList"),
|
||||
followed: document.querySelector("#followedList"),
|
||||
xFollowed: document.querySelector("#xFollowedList"),
|
||||
title: document.querySelector("#viewTitle"),
|
||||
subtitle: document.querySelector("#viewSubtitle"),
|
||||
pageInfo: document.querySelector("#pageInfo"),
|
||||
dialog: document.querySelector("#detailDialog"),
|
||||
detail: document.querySelector("#detailContent"),
|
||||
pixivCookieFile: document.querySelector("#pixivCookieFile"),
|
||||
pixivSessionStatus: document.querySelector("#pixivSessionStatus"),
|
||||
refreshSessionButton: document.querySelector("#refreshSessionButton"),
|
||||
xCookieFile: document.querySelector("#xCookieFile"),
|
||||
xUsername: document.querySelector("#xUsernameInput"),
|
||||
xMediaType: document.querySelector("#xMediaType"),
|
||||
xMaxItems: document.querySelector("#xMaxItems"),
|
||||
xMediaGrid: document.querySelector("#xMediaGrid"),
|
||||
xMediaSummary: document.querySelector("#xMediaSummary"),
|
||||
xSelectAll: document.querySelector("#xSelectAll"),
|
||||
xFollowUsername: document.querySelector("#xFollowUsername"),
|
||||
xFollowName: document.querySelector("#xFollowName"),
|
||||
xLocalGrid: document.querySelector("#xLocalGrid"),
|
||||
xLocalSummary: document.querySelector("#xLocalSummary"),
|
||||
xLocalSelectAll: document.querySelector("#xLocalSelectAll"),
|
||||
xhsNavButton: document.querySelector("#xiaohongshuNavButton"),
|
||||
xhsTarget: document.querySelector("#xhsTargetInput"),
|
||||
xhsLimit: document.querySelector("#xhsLimitInput"),
|
||||
xhsGrid: document.querySelector("#xhsGrid"),
|
||||
xhsSummary: document.querySelector("#xhsSummary"),
|
||||
xhsSelectAll: document.querySelector("#xhsSelectAll"),
|
||||
originFollowSyncDialog: document.querySelector("#originFollowSyncDialog"),
|
||||
originFollowSyncResult: document.querySelector("#originFollowSyncResult"),
|
||||
};
|
||||
|
||||
function setStatus(text) {
|
||||
els.status.textContent = text;
|
||||
}
|
||||
|
||||
function isPlaceholderPixivName(name, artistId) {
|
||||
const value = String(name || "").trim();
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
const idText = String(artistId || "").trim();
|
||||
return Boolean(idText) && value.toLowerCase() === `artist_${idText}`.toLowerCase();
|
||||
}
|
||||
|
||||
function pixivArtistStoredName(item) {
|
||||
const artistId = item?.artist_id ?? item?.artistId ?? item?.creator_id ?? "";
|
||||
const name = String(item?.name || item?.artist_name || item?.creator_name || "").trim();
|
||||
return isPlaceholderPixivName(name, artistId) ? "" : name;
|
||||
}
|
||||
|
||||
function pixivArtistDisplayName(item) {
|
||||
const artistId = item?.artist_id ?? item?.artistId ?? item?.creator_id ?? "";
|
||||
const name = pixivArtistStoredName(item);
|
||||
if (name) {
|
||||
return name;
|
||||
}
|
||||
const account = String(item?.account || item?.artist_account || item?.creator_handle || "").trim().replace(/^@/, "");
|
||||
if (account) {
|
||||
return `@${account}`;
|
||||
}
|
||||
return artistId ? `Pixiv ID ${artistId}` : "Pixiv 作者";
|
||||
}
|
||||
|
||||
window.addEventListener("unhandledrejection", (event) => {
|
||||
setStatus(event.reason?.message || "操作失败,请查看后端日志。");
|
||||
});
|
||||
|
||||
async function api(path, options = {}) {
|
||||
const response = await fetch(path, {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
...options,
|
||||
});
|
||||
const payload = await response.json();
|
||||
if (!response.ok || payload.error) {
|
||||
throw new Error(payload.error || `HTTP ${response.status}`);
|
||||
}
|
||||
return payload;
|
||||
}
|
||||
|
||||
async function loadSessionStatus() {
|
||||
if (!els.pixivSessionStatus) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
const payload = await api("/api/session/status");
|
||||
const pixiv = payload.pixiv || {};
|
||||
const cookieText = pixiv.has_cookie
|
||||
? `已共享桌面端 Pixiv 会话${pixiv.saved_at ? `(${pixiv.saved_at})` : ""}`
|
||||
: "未检测到桌面端 Pixiv 会话,请先在 EXE 登录或导入 Cookie。";
|
||||
els.pixivSessionStatus.textContent = cookieText;
|
||||
return payload;
|
||||
} catch (error) {
|
||||
els.pixivSessionStatus.textContent = `会话状态读取失败:${error.message || error}`;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function artworkUrl(item, pageIndex = 0, kind = "thumbnail") {
|
||||
return `/media/${kind}/${item.artwork_id}/${pageIndex}`;
|
||||
}
|
||||
|
||||
function renderArtworkGrid(payload) {
|
||||
state.total = payload.total || 0;
|
||||
els.grid.innerHTML = "";
|
||||
if (!payload.items.length) {
|
||||
els.grid.innerHTML = `<div class="empty">还没有作品。可以先下载作品,或点击“扫描旧目录”导入已有文件。</div>`;
|
||||
} else {
|
||||
els.grid.append(...payload.items.map(renderArtworkCard));
|
||||
}
|
||||
const currentPage = Math.floor(state.offset / state.limit) + 1;
|
||||
const totalPages = Math.max(1, Math.ceil(state.total / state.limit));
|
||||
els.pageInfo.textContent = `${currentPage} / ${totalPages}`;
|
||||
}
|
||||
|
||||
function renderArtworkCard(item) {
|
||||
const card = document.createElement("article");
|
||||
card.className = "artwork-card";
|
||||
const thumb = item.thumbnail_path
|
||||
? `<img loading="lazy" src="${artworkUrl(item)}" alt="${escapeHtml(item.title || String(item.artwork_id))}">`
|
||||
: `<div class="thumb-placeholder">${item.type === "novel" ? "小说" : "暂无缩略图"}</div>`;
|
||||
card.innerHTML = `
|
||||
<button class="thumb-button" data-open="${item.artwork_id}">${thumb}</button>
|
||||
<div class="artwork-meta">
|
||||
<div class="artwork-title">${escapeHtml(item.title || String(item.artwork_id))}</div>
|
||||
<div class="artwork-sub">${escapeHtml(item.artist_name || "未知作者")} · ${escapeHtml(item.type || "")}</div>
|
||||
<div class="card-actions">
|
||||
<button class="small-button ${item.is_favorite ? "active" : ""}" data-fav="${item.artwork_id}" data-on="${item.is_favorite ? 1 : 0}">
|
||||
${item.is_favorite ? "已收藏" : "收藏"}
|
||||
</button>
|
||||
${item.artist_id ? `<button class="small-button" data-artist="${item.artist_id}">作者</button>` : ""}
|
||||
${item.artist_id ? `<button class="small-button ${Number(item.is_followed || 0) ? "active" : ""}" data-follow="${item.artist_id}" data-name="${escapeHtml(pixivArtistStoredName(item))}" data-followed="${Number(item.is_followed || 0)}">${Number(item.is_followed || 0) ? "取消关注" : "关注作者"}</button>` : ""}
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
const artworkSub = card.querySelector(".artwork-sub");
|
||||
if (artworkSub) {
|
||||
artworkSub.textContent = `${pixivArtistDisplayName(item)} · ${item.type || ""}`;
|
||||
}
|
||||
const artworkFollow = card.querySelector("[data-follow]");
|
||||
if (artworkFollow) {
|
||||
artworkFollow.dataset.name = pixivArtistStoredName(item);
|
||||
}
|
||||
return card;
|
||||
}
|
||||
|
||||
async function loadArtworks() {
|
||||
const params = new URLSearchParams({
|
||||
limit: state.limit,
|
||||
offset: state.offset,
|
||||
ensure_thumbnails: "true",
|
||||
});
|
||||
if (state.query) params.set("q", state.query);
|
||||
if (state.tag) params.set("tag", state.tag);
|
||||
if (state.type) params.set("type", state.type);
|
||||
if (state.artistId) params.set("artist_id", state.artistId);
|
||||
setStatus("正在加载图库...");
|
||||
const payload = await api(`/api/artworks?${params}`);
|
||||
renderArtworkGrid(payload);
|
||||
setStatus(`已加载 ${payload.items.length} / ${payload.total} 个作品`);
|
||||
}
|
||||
|
||||
async function loadFavorites() {
|
||||
setStatus("正在加载收藏...");
|
||||
const params = new URLSearchParams({ limit: state.limit, offset: state.offset });
|
||||
const payload = await api(`/api/favorites?${params}`);
|
||||
renderArtworkGrid(payload);
|
||||
setStatus(`收藏 ${payload.total} 个作品`);
|
||||
}
|
||||
|
||||
async function loadTags() {
|
||||
const tags = await api("/api/tags?limit=80");
|
||||
els.tags.innerHTML = "";
|
||||
if (!tags.length) {
|
||||
els.tags.innerHTML = `<span class="tag-chip">暂无标签</span>`;
|
||||
return;
|
||||
}
|
||||
for (const tag of tags) {
|
||||
const button = document.createElement("button");
|
||||
button.className = `tag-chip ${state.tag === tag.name ? "active" : ""}`;
|
||||
button.textContent = `${tag.name} ${tag.artwork_count}`;
|
||||
button.dataset.tag = tag.name;
|
||||
els.tags.append(button);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadArtists() {
|
||||
setStatus("正在加载作者...");
|
||||
const artists = await api("/api/artists?limit=200");
|
||||
els.artists.innerHTML = "";
|
||||
if (!artists.length) {
|
||||
els.artists.innerHTML = `<div class="empty">暂无作者数据。</div>`;
|
||||
} else {
|
||||
els.artists.append(...artists.map(renderArtistRow));
|
||||
}
|
||||
setStatus(`已加载 ${artists.length} 位作者`);
|
||||
}
|
||||
|
||||
async function loadFollowed() {
|
||||
const followed = await api("/api/followed-artists");
|
||||
els.followed.innerHTML = "";
|
||||
if (!followed.length) {
|
||||
els.followed.innerHTML = `<div class="empty">还没有关注作者。</div>`;
|
||||
} else {
|
||||
els.followed.append(...followed.map(renderArtistRow));
|
||||
}
|
||||
}
|
||||
|
||||
async function loadXFollowed() {
|
||||
const followed = await api("/api/x/follows");
|
||||
els.xFollowed.innerHTML = "";
|
||||
if (!followed.length) {
|
||||
els.xFollowed.innerHTML = `<div class="empty">还没有 X 关注作者。</div>`;
|
||||
} else {
|
||||
els.xFollowed.append(...followed.map(renderXFollowRow));
|
||||
}
|
||||
}
|
||||
|
||||
function renderArtistRow(artist) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "artist-row";
|
||||
const isFollowed = Number(artist.enabled ?? artist.is_followed ?? 0);
|
||||
row.innerHTML = `
|
||||
<div>
|
||||
<strong>${escapeHtml(artist.name || `artist_${artist.artist_id}`)}</strong>
|
||||
<span>ID ${artist.artist_id} · ${artist.artwork_count || 0} 个作品${artist.last_synced_at ? ` · 上次同步 ${artist.last_synced_at}` : ""}</span>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<button class="small-button" data-artist="${artist.artist_id}">详情</button>
|
||||
<button class="small-button ${isFollowed ? "active" : ""}" data-follow="${artist.artist_id}" data-name="${escapeHtml(artist.name || "")}" data-followed="${isFollowed ? 1 : 0}">${isFollowed ? "取消关注" : "关注"}</button>
|
||||
</div>
|
||||
`;
|
||||
const artistTitle = row.querySelector("strong");
|
||||
if (artistTitle) {
|
||||
artistTitle.textContent = pixivArtistDisplayName(artist);
|
||||
}
|
||||
const artistFollow = row.querySelector("[data-follow]");
|
||||
if (artistFollow) {
|
||||
artistFollow.dataset.name = pixivArtistStoredName(artist);
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
function renderXFollowRow(artist) {
|
||||
const row = document.createElement("div");
|
||||
row.className = "artist-row";
|
||||
const handle = artist.username || artist.creator_handle || "";
|
||||
const isFollowed = Number(artist.enabled ?? 1);
|
||||
const latest = artist.latest_published_at ? ` · 最新 ${artist.latest_published_at}` : "";
|
||||
const checked = artist.last_checked_at ? ` · 检查 ${artist.last_checked_at}` : "";
|
||||
const error = artist.last_error ? ` · ${escapeHtml(artist.last_error)}` : "";
|
||||
row.innerHTML = `
|
||||
<div>
|
||||
<strong>${escapeHtml(artist.creator_name || handle || "x_author")}</strong>
|
||||
<span>@${escapeHtml(handle)}${latest}${checked}${error}</span>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<button class="small-button" data-open-x="${escapeHtml(handle)}">去预览</button>
|
||||
<button class="small-button ${isFollowed ? "active" : ""}" data-follow-x="${escapeHtml(handle)}" data-name="${escapeHtml(artist.creator_name || "")}" data-followed-x="${isFollowed ? 1 : 0}">${isFollowed ? "取消关注" : "关注"}</button>
|
||||
</div>
|
||||
`;
|
||||
return row;
|
||||
}
|
||||
|
||||
async function openArtwork(artworkId) {
|
||||
const payload = await api(`/api/artworks/${artworkId}`);
|
||||
const artwork = payload.artwork;
|
||||
const files = payload.files || [];
|
||||
const tags = payload.tags || [];
|
||||
const firstFile = files[0];
|
||||
const image = firstFile
|
||||
? `<img src="/media/source/${artwork.artwork_id}/${firstFile.page_index}" alt="${escapeHtml(artwork.title)}">`
|
||||
: `<div class="thumb-placeholder">没有本地文件</div>`;
|
||||
els.detail.innerHTML = `
|
||||
<div class="detail-layout">
|
||||
<div class="detail-media">${image}</div>
|
||||
<div class="detail-info">
|
||||
<h2>${escapeHtml(artwork.title || String(artwork.artwork_id))}</h2>
|
||||
<p>${escapeHtml(artwork.artist_name || "未知作者")} · ${escapeHtml(artwork.type)}</p>
|
||||
<div class="card-actions">
|
||||
<button class="small-button ${artwork.is_favorite ? "active" : ""}" data-fav="${artwork.artwork_id}" data-on="${artwork.is_favorite ? 1 : 0}">
|
||||
${artwork.is_favorite ? "已收藏" : "收藏"}
|
||||
</button>
|
||||
${artwork.artist_id ? `<button class="small-button ${Number(artwork.is_followed || 0) ? "active" : ""}" data-follow="${artwork.artist_id}" data-name="${escapeHtml(artwork.artist_name || "")}" data-followed="${Number(artwork.is_followed || 0)}">${Number(artwork.is_followed || 0) ? "取消关注" : "关注作者"}</button>` : ""}
|
||||
</div>
|
||||
<div class="detail-tags">
|
||||
${tags.map((tag) => `<button class="tag-chip" data-tag="${escapeHtml(tag.name)}">${escapeHtml(tag.name)}</button>`).join("")}
|
||||
</div>
|
||||
<p>${escapeHtml(stripHtml(artwork.caption || ""))}</p>
|
||||
<p>页数 ${files.length || artwork.page_count || 0} · 收藏 ${artwork.bookmark_count || 0} · 浏览 ${artwork.view_count || 0}</p>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
const detailArtist = els.detail.querySelector(".detail-info p");
|
||||
if (detailArtist) {
|
||||
detailArtist.textContent = `${pixivArtistDisplayName(artwork)} · ${artwork.type}`;
|
||||
}
|
||||
const detailFollow = els.detail.querySelector("[data-follow]");
|
||||
if (detailFollow) {
|
||||
detailFollow.dataset.name = pixivArtistStoredName(artwork);
|
||||
}
|
||||
els.dialog.showModal();
|
||||
}
|
||||
|
||||
async function showArtist(artistId) {
|
||||
setActiveView("gallery");
|
||||
state.artistId = String(artistId);
|
||||
state.tag = "";
|
||||
state.offset = 0;
|
||||
const detail = await api(`/api/artists/${artistId}?limit=1`);
|
||||
els.title.textContent = detail.artist.name || `作者 ${artistId}`;
|
||||
els.subtitle.textContent = `作者 ID ${artistId} · ${detail.artist.artwork_count || 0} 个本地作品`;
|
||||
await loadArtworks();
|
||||
els.title.textContent = pixivArtistDisplayName(detail.artist);
|
||||
}
|
||||
|
||||
async function toggleFavorite(artworkId, currentOn) {
|
||||
await api("/api/favorites", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ artwork_id: Number(artworkId), favorite: !Number(currentOn) }),
|
||||
});
|
||||
await reloadCurrent();
|
||||
}
|
||||
|
||||
async function followArtist(artistId, name = "") {
|
||||
await setPixivFollow(artistId, name, true);
|
||||
}
|
||||
|
||||
async function setPixivFollow(artistId, name = "", followed = true) {
|
||||
await api("/api/followed-artists", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ artist_id: String(artistId).trim(), name, followed }),
|
||||
});
|
||||
setStatus(followed ? `已关注作者 ${artistId}` : `已取消关注作者 ${artistId}`);
|
||||
await Promise.all([loadFollowed(), reloadCurrent()]);
|
||||
}
|
||||
|
||||
async function followXAuthor(username, name = "") {
|
||||
await setXFollow(username, name, true);
|
||||
}
|
||||
|
||||
async function setXFollow(username, name = "", followed = true) {
|
||||
const handle = username.trim().replace(/^@/, "");
|
||||
if (!handle) {
|
||||
return;
|
||||
}
|
||||
await api("/api/x/follows", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ username: handle, name, followed }),
|
||||
});
|
||||
setStatus(followed ? `已关注 X 作者 @${handle}` : `已取消关注 X 作者 @${handle}`);
|
||||
await loadXFollowed();
|
||||
}
|
||||
|
||||
async function scanLegacy() {
|
||||
setStatus("正在扫描旧下载目录...");
|
||||
const result = await api("/api/import/legacy", { method: "POST", body: JSON.stringify({ root: "Sakura_Downloads" }) });
|
||||
setStatus(`扫描完成:导入 ${result.imported_files} 个文件,${result.imported_artworks} 个作品`);
|
||||
await Promise.all([loadTags(), reloadCurrent()]);
|
||||
}
|
||||
|
||||
async function syncFollowed() {
|
||||
setStatus("正在同步关注作者...");
|
||||
try {
|
||||
const result = await api("/api/sync/followed", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ download: true, max_new: 20 }),
|
||||
});
|
||||
const downloaded = result.artists.reduce((sum, item) => sum + (item.downloaded || 0), 0);
|
||||
setStatus(`同步完成:下载 ${downloaded} 个新作品`);
|
||||
await Promise.all([loadFollowed(), loadTags(), reloadCurrent()]);
|
||||
} catch (error) {
|
||||
setStatus(error.message || "同步关注作者失败");
|
||||
}
|
||||
}
|
||||
|
||||
async function syncXFollowed() {
|
||||
setStatus("正在同步 X 关注...");
|
||||
const result = await api("/api/x/follows/sync", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ download: true, max_new: 20 }),
|
||||
});
|
||||
const total = (result.authors || []).reduce((sum, item) => sum + (item.new_posts || 0), 0);
|
||||
setStatus(`X 同步完成:发现 ${total} 个新动态`);
|
||||
await loadXFollowed();
|
||||
}
|
||||
|
||||
function openOriginFollowSyncDialog() {
|
||||
els.originFollowSyncResult.textContent = "请选择要同步的平台。";
|
||||
els.originFollowSyncDialog.showModal();
|
||||
}
|
||||
|
||||
async function syncOriginFollows(platform) {
|
||||
const label = platform === "pixiv" ? "Pixiv" : "X";
|
||||
const button = platform === "pixiv" ? document.querySelector("#syncOriginPixivButton") : document.querySelector("#syncOriginXButton");
|
||||
if (button?.disabled) {
|
||||
return;
|
||||
}
|
||||
if (button) {
|
||||
button.disabled = true;
|
||||
}
|
||||
setStatus(`正在同步 ${label} 原站关注...`);
|
||||
els.originFollowSyncResult.textContent = `正在同步 ${label} 原站关注,请稍候...`;
|
||||
try {
|
||||
if (platform === "pixiv") {
|
||||
const session = await loadSessionStatus();
|
||||
if (session && !session.pixiv?.has_cookie) {
|
||||
throw new Error("未检测到桌面端 Pixiv 会话,请先在 EXE 登录或导入 Cookie。");
|
||||
}
|
||||
}
|
||||
const result = await api("/api/origin-follows/sync", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ platform }),
|
||||
});
|
||||
const lines = [
|
||||
`${label} 原站关注同步完成`,
|
||||
`同步页数:${result.pages || 0}`,
|
||||
`新增:${result.created || 0} 位`,
|
||||
`更新:${result.updated || 0} 位`,
|
||||
`跳过:${result.skipped || 0} 位`,
|
||||
`失败:${result.failed || 0} 位`,
|
||||
];
|
||||
if (Array.isArray(result.progress) && result.progress.length) {
|
||||
lines.push("", "进度:");
|
||||
for (const item of result.progress.slice(-20)) {
|
||||
lines.push(item.message || `正在同步第 ${item.page || "?"} 页`);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(result.errors) && result.errors.length) {
|
||||
lines.push("", "失败原因:");
|
||||
for (const item of result.errors.slice(0, 10)) {
|
||||
lines.push(`${item.id || "-"}:${item.reason || ""}`);
|
||||
}
|
||||
}
|
||||
els.originFollowSyncResult.textContent = lines.join("\n");
|
||||
setStatus(`${label} 原站关注同步完成:新增 ${result.created || 0},更新 ${result.updated || 0},跳过 ${result.skipped || 0},失败 ${result.failed || 0}`);
|
||||
if (platform === "pixiv") {
|
||||
await loadFollowed();
|
||||
} else {
|
||||
await loadXFollowed();
|
||||
}
|
||||
} catch (error) {
|
||||
const message = error.message || `${label} 原站关注同步失败`;
|
||||
els.originFollowSyncResult.textContent = message;
|
||||
setStatus(message);
|
||||
} finally {
|
||||
if (button) {
|
||||
button.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function followCurrentX() {
|
||||
const username = els.xUsername.value.trim();
|
||||
if (!username) {
|
||||
setStatus("请先输入 X 作者名。");
|
||||
return;
|
||||
}
|
||||
const handle = username.replace(/^@/, "");
|
||||
const creatorName = state.xPreviewUsername === handle ? state.xPreviewAuthor : "";
|
||||
await followXAuthor(username, creatorName || handle);
|
||||
}
|
||||
|
||||
async function buildThumbnails() {
|
||||
setStatus("正在生成缩略图...");
|
||||
const result = await api("/api/thumbnails/build?limit=500");
|
||||
setStatus(`缩略图完成:处理 ${result.items.length} 个文件`);
|
||||
await reloadCurrent();
|
||||
}
|
||||
|
||||
async function loadPluginPages() {
|
||||
const payload = await api("/api/plugins/pages");
|
||||
const pages = payload.items || [];
|
||||
const hasXhs = pages.some((item) => item.view === "xiaohongshu");
|
||||
els.xhsNavButton.classList.toggle("hidden", !hasXhs);
|
||||
}
|
||||
|
||||
async function importCookieFile(platform, fileInput) {
|
||||
const file = fileInput.files?.[0];
|
||||
if (!file) {
|
||||
setStatus("请先选择 cookies.txt 或 json 文件。");
|
||||
return;
|
||||
}
|
||||
setStatus(`正在导入 ${platform} Cookie...`);
|
||||
const text = await file.text();
|
||||
const result = await api("/api/cookies/import", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ platform, text }),
|
||||
});
|
||||
setStatus(`Cookie 导入完成:${result.summary || `${result.count || 0} 个 Cookie`}`);
|
||||
}
|
||||
|
||||
async function previewXMedia(event) {
|
||||
event.preventDefault();
|
||||
const username = els.xUsername.value.trim();
|
||||
if (!username) {
|
||||
setStatus("请输入 X 作者名称。");
|
||||
return;
|
||||
}
|
||||
els.xMediaGrid.innerHTML = `<div class="empty">正在解析 X 媒体页,首次启动 Playwright 可能需要一些时间。</div>`;
|
||||
els.xMediaSummary.textContent = "解析中...";
|
||||
const submitButton = event.submitter || document.querySelector("#xMediaForm button[type='submit']");
|
||||
if (submitButton) {
|
||||
submitButton.disabled = true;
|
||||
}
|
||||
setStatus(`正在解析 X 作者 @${username.replace(/^@/, "")}...`);
|
||||
try {
|
||||
const payload = await api("/api/x/media/preview", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
username,
|
||||
media_type: els.xMediaType.value,
|
||||
max_items: Number(els.xMaxItems.value || 120),
|
||||
}),
|
||||
});
|
||||
state.xPreviewId = payload.preview_id;
|
||||
renderXMedia(payload);
|
||||
setStatus(`X 解析完成:${payload.count} 个媒体项`);
|
||||
} catch (error) {
|
||||
state.xPreviewId = "";
|
||||
els.xMediaSummary.textContent = "解析失败";
|
||||
els.xMediaGrid.innerHTML = `<div class="empty">${escapeHtml(error.message || "X 解析失败")}</div>`;
|
||||
setStatus(error.message || "X 解析失败");
|
||||
} finally {
|
||||
if (submitButton) {
|
||||
submitButton.disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function renderXMedia(payload) {
|
||||
els.xMediaGrid.innerHTML = "";
|
||||
els.xMediaSummary.textContent = `${payload.username} · ${payload.count} 个媒体项`;
|
||||
if (!payload.items.length) {
|
||||
els.xMediaGrid.innerHTML = `<div class="empty">没有解析到媒体。可能需要先导入 X Cookie,或该作者媒体页为空。</div>`;
|
||||
return;
|
||||
}
|
||||
els.xMediaGrid.append(...payload.items.map(renderXMediaCard));
|
||||
els.xSelectAll.checked = true;
|
||||
}
|
||||
|
||||
function renderXMediaCard(item) {
|
||||
const card = document.createElement("article");
|
||||
card.className = "x-media-card";
|
||||
const preview = item.thumbnail || item.files?.[0]?.url || "";
|
||||
const media = item.kind === "video"
|
||||
? `<div class="video-tile">VIDEO</div>`
|
||||
: `<img loading="lazy" referrerpolicy="no-referrer" src="${escapeHtml(preview)}" alt="${escapeHtml(item.title || item.id)}">`;
|
||||
card.innerHTML = `
|
||||
<label class="x-check">
|
||||
<input type="checkbox" data-x-id="${escapeHtml(item.id)}" checked />
|
||||
<span>${item.kind === "video" ? "视频" : "图片"}</span>
|
||||
</label>
|
||||
<div class="x-thumb">${media}</div>
|
||||
<div class="artwork-meta">
|
||||
<div class="artwork-title">${escapeHtml(item.title || item.id)}</div>
|
||||
<div class="artwork-sub">@${escapeHtml(item.author_id || "")} · ${item.file_count || 1} 个文件</div>
|
||||
</div>
|
||||
`;
|
||||
return card;
|
||||
}
|
||||
|
||||
async function downloadXSelected() {
|
||||
if (!state.xPreviewId) {
|
||||
setStatus("请先解析 X 作者媒体。");
|
||||
return;
|
||||
}
|
||||
const selected = [...document.querySelectorAll("[data-x-id]:checked")].map((item) => item.dataset.xId);
|
||||
if (!selected.length) {
|
||||
setStatus("没有选中的媒体。");
|
||||
return;
|
||||
}
|
||||
setStatus(`正在下载 ${selected.length} 个 X 媒体项...`);
|
||||
const result = await api("/api/x/media/download", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ preview_id: state.xPreviewId, selected_ids: selected }),
|
||||
});
|
||||
setStatus(`X 下载完成:保存 ${result.downloaded_files} 个文件,失败 ${result.failed_items} 项`);
|
||||
await loadXLocalMedia();
|
||||
}
|
||||
|
||||
async function loadXLocalMedia() {
|
||||
const payload = await api("/api/x/local-media?limit=160");
|
||||
els.xLocalGrid.innerHTML = "";
|
||||
els.xLocalSummary.textContent = `本地 ${payload.total || 0} 个文件`;
|
||||
if (!payload.items.length) {
|
||||
els.xLocalGrid.innerHTML = `<div class="empty">还没有本地 X 图片或视频。</div>`;
|
||||
return;
|
||||
}
|
||||
els.xLocalGrid.append(...payload.items.map(renderXLocalCard));
|
||||
}
|
||||
|
||||
function renderXLocalCard(item) {
|
||||
const card = document.createElement("article");
|
||||
card.className = "x-media-card";
|
||||
const media = item.kind === "video"
|
||||
? `<video src="${escapeHtml(item.url)}" muted preload="metadata" controls></video>`
|
||||
: `<img loading="lazy" src="${escapeHtml(item.url)}" alt="${escapeHtml(item.name)}">`;
|
||||
card.innerHTML = `
|
||||
<label class="x-check">
|
||||
<input type="checkbox" data-x-local-id="${escapeHtml(item.id)}" />
|
||||
<span>${item.kind === "video" ? "视频" : "图片"}</span>
|
||||
</label>
|
||||
<div class="x-thumb">${media}</div>
|
||||
<div class="artwork-meta">
|
||||
<div class="artwork-title">${escapeHtml(item.name)}</div>
|
||||
<div class="artwork-sub">${escapeHtml(item.relative_path)} · ${formatBytes(item.size)}</div>
|
||||
</div>
|
||||
`;
|
||||
return card;
|
||||
}
|
||||
|
||||
async function deleteXLocalSelected() {
|
||||
const selected = [...document.querySelectorAll("[data-x-local-id]:checked")].map((item) => item.dataset.xLocalId);
|
||||
if (!selected.length) {
|
||||
setStatus("没有选中的本地 X 文件。");
|
||||
return;
|
||||
}
|
||||
setStatus(`正在删除 ${selected.length} 个本地 X 文件...`);
|
||||
const result = await api("/api/x/local-media/delete", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ ids: selected }),
|
||||
});
|
||||
setStatus(`删除完成:${result.deleted.length} 个,失败 ${result.failed.length} 个`);
|
||||
els.xLocalSelectAll.checked = false;
|
||||
await loadXLocalMedia();
|
||||
}
|
||||
|
||||
async function previewXhs(event) {
|
||||
event.preventDefault();
|
||||
const target = els.xhsTarget.value.trim();
|
||||
if (!target) {
|
||||
setStatus("请输入小红书关键词或笔记链接。");
|
||||
return;
|
||||
}
|
||||
els.xhsGrid.innerHTML = `<div class="empty">正在解析小红书内容...</div>`;
|
||||
els.xhsSummary.textContent = "解析中...";
|
||||
const payload = await api("/api/xiaohongshu/preview", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ target, limit: Number(els.xhsLimit.value || 20) }),
|
||||
});
|
||||
state.xhsPreviewId = payload.preview_id;
|
||||
renderXhs(payload);
|
||||
setStatus(`小红书解析完成:${payload.count} 个项目`);
|
||||
}
|
||||
|
||||
function renderXhs(payload) {
|
||||
els.xhsGrid.innerHTML = "";
|
||||
els.xhsSummary.textContent = `${payload.count} 个项目`;
|
||||
if (!payload.items.length) {
|
||||
els.xhsGrid.innerHTML = `<div class="empty">没有解析到内容,可能需要先登录或换一个关键词。</div>`;
|
||||
return;
|
||||
}
|
||||
els.xhsGrid.append(...payload.items.map(renderXhsCard));
|
||||
els.xhsSelectAll.checked = true;
|
||||
}
|
||||
|
||||
function renderXhsCard(item) {
|
||||
const card = document.createElement("article");
|
||||
card.className = "x-media-card";
|
||||
const preview = item.thumbnail || item.metadata?.cover_url || "";
|
||||
const media = preview
|
||||
? `<img loading="lazy" referrerpolicy="no-referrer" src="${escapeHtml(preview)}" alt="${escapeHtml(item.title || item.id)}">`
|
||||
: `<div class="thumb-placeholder">暂无预览</div>`;
|
||||
card.innerHTML = `
|
||||
<label class="x-check">
|
||||
<input type="checkbox" data-xhs-id="${escapeHtml(item.id)}" checked />
|
||||
<span>笔记</span>
|
||||
</label>
|
||||
<div class="x-thumb">${media}</div>
|
||||
<div class="artwork-meta">
|
||||
<div class="artwork-title">${escapeHtml(item.title || item.id)}</div>
|
||||
<div class="artwork-sub">${escapeHtml(item.author || "")} · ${item.file_count || 0} 个文件</div>
|
||||
</div>
|
||||
`;
|
||||
return card;
|
||||
}
|
||||
|
||||
async function downloadXhsSelected() {
|
||||
if (!state.xhsPreviewId) {
|
||||
setStatus("请先解析小红书内容。");
|
||||
return;
|
||||
}
|
||||
const selected = [...document.querySelectorAll("[data-xhs-id]:checked")].map((item) => item.dataset.xhsId);
|
||||
if (!selected.length) {
|
||||
setStatus("没有选中的小红书项目。");
|
||||
return;
|
||||
}
|
||||
setStatus(`正在下载 ${selected.length} 个小红书项目...`);
|
||||
const result = await api("/api/xiaohongshu/download", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ preview_id: state.xhsPreviewId, selected_ids: selected }),
|
||||
});
|
||||
setStatus(`小红书下载完成:保存 ${result.downloaded_files} 个文件,失败 ${result.failed_items} 项`);
|
||||
}
|
||||
|
||||
function setActiveView(view) {
|
||||
state.view = view;
|
||||
document.querySelectorAll(".nav-button").forEach((button) => {
|
||||
button.classList.toggle("active", button.dataset.view === view);
|
||||
});
|
||||
document.querySelectorAll(".view").forEach((section) => section.classList.remove("active"));
|
||||
if (view === "home") {
|
||||
document.querySelector("#homeView").classList.add("active");
|
||||
} else if (view === "artists") {
|
||||
document.querySelector("#artistsView").classList.add("active");
|
||||
} else if (view === "sync") {
|
||||
document.querySelector("#syncView").classList.add("active");
|
||||
} else if (view === "xMedia") {
|
||||
document.querySelector("#xMediaView").classList.add("active");
|
||||
} else if (view === "xiaohongshu") {
|
||||
document.querySelector("#xiaohongshuView").classList.add("active");
|
||||
} else {
|
||||
document.querySelector("#galleryView").classList.add("active");
|
||||
}
|
||||
}
|
||||
|
||||
async function reloadCurrent() {
|
||||
if (state.view === "home") {
|
||||
setStatus("首页已就绪。选择一个入口开始整理或同步内容。");
|
||||
} else if (state.view === "favorites") {
|
||||
els.title.textContent = "本地收藏";
|
||||
els.subtitle.textContent = "你标记收藏的作品";
|
||||
await loadFavorites();
|
||||
} else if (state.view === "artists") {
|
||||
await loadArtists();
|
||||
} else if (state.view === "sync") {
|
||||
await Promise.all([loadFollowed(), loadXFollowed()]);
|
||||
} else if (state.view === "xMedia") {
|
||||
await loadXLocalMedia();
|
||||
setStatus("X 作者媒体页已就绪。");
|
||||
} else if (state.view === "xiaohongshu") {
|
||||
setStatus("小红书插件页已就绪。");
|
||||
} else {
|
||||
if (!state.artistId) {
|
||||
els.title.textContent = state.tag ? `标签:${state.tag}` : "全部作品";
|
||||
els.subtitle.textContent = state.query ? `搜索:${state.query}` : "本地已入库作品";
|
||||
}
|
||||
await loadArtworks();
|
||||
}
|
||||
}
|
||||
|
||||
function clearFilters() {
|
||||
state.query = "";
|
||||
state.tag = "";
|
||||
state.type = "";
|
||||
state.artistId = "";
|
||||
state.offset = 0;
|
||||
els.search.value = "";
|
||||
els.type.value = "";
|
||||
}
|
||||
|
||||
function escapeHtml(value) {
|
||||
return String(value ?? "").replace(/[&<>"']/g, (char) => ({
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': """,
|
||||
"'": "'",
|
||||
})[char]);
|
||||
}
|
||||
|
||||
function stripHtml(value) {
|
||||
const tmp = document.createElement("div");
|
||||
tmp.innerHTML = value;
|
||||
return tmp.textContent || tmp.innerText || "";
|
||||
}
|
||||
|
||||
function formatBytes(value) {
|
||||
const size = Number(value || 0);
|
||||
if (size < 1024) return `${size} B`;
|
||||
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`;
|
||||
return `${(size / 1024 / 1024).toFixed(1)} MB`;
|
||||
}
|
||||
|
||||
document.querySelectorAll(".nav-button").forEach((button) => {
|
||||
button.addEventListener("click", async () => {
|
||||
setActiveView(button.dataset.view);
|
||||
state.offset = 0;
|
||||
if (state.view !== "gallery") {
|
||||
state.artistId = "";
|
||||
}
|
||||
await reloadCurrent();
|
||||
});
|
||||
});
|
||||
|
||||
els.search.addEventListener("input", debounce(async () => {
|
||||
state.query = els.search.value.trim();
|
||||
state.offset = 0;
|
||||
setActiveView("gallery");
|
||||
await reloadCurrent();
|
||||
}, 280));
|
||||
|
||||
els.type.addEventListener("change", async () => {
|
||||
state.type = els.type.value;
|
||||
state.offset = 0;
|
||||
setActiveView("gallery");
|
||||
await reloadCurrent();
|
||||
});
|
||||
|
||||
document.addEventListener("click", async (event) => {
|
||||
const target = event.target.closest("button");
|
||||
if (!target) return;
|
||||
if (target.dataset.viewAction) {
|
||||
setActiveView(target.dataset.viewAction);
|
||||
state.offset = 0;
|
||||
await reloadCurrent();
|
||||
return;
|
||||
}
|
||||
if (target.dataset.open) await openArtwork(target.dataset.open);
|
||||
if (target.dataset.fav) await toggleFavorite(target.dataset.fav, target.dataset.on);
|
||||
if (target.dataset.artist) await showArtist(target.dataset.artist);
|
||||
if (target.dataset.tag) {
|
||||
state.tag = target.dataset.tag;
|
||||
state.artistId = "";
|
||||
state.offset = 0;
|
||||
setActiveView("gallery");
|
||||
await loadTags();
|
||||
await reloadCurrent();
|
||||
}
|
||||
if (target.dataset.follow) {
|
||||
const nextFollowed = target.dataset.followed === "1" ? false : true;
|
||||
await setPixivFollow(target.dataset.follow, target.dataset.name || "", nextFollowed);
|
||||
}
|
||||
if (target.dataset.followX) {
|
||||
const nextFollowed = target.dataset.followedX === "1" ? false : true;
|
||||
await setXFollow(target.dataset.followX, target.dataset.name || "", nextFollowed);
|
||||
}
|
||||
if (target.dataset.openX) {
|
||||
els.xUsername.value = `@${target.dataset.openX}`;
|
||||
setActiveView("xMedia");
|
||||
setStatus(`已填入 @${target.dataset.openX},可以直接解析最新媒体。`);
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#clearFiltersButton").addEventListener("click", async () => {
|
||||
clearFilters();
|
||||
await loadTags();
|
||||
await reloadCurrent();
|
||||
});
|
||||
|
||||
document.querySelector("#prevPageButton").addEventListener("click", async () => {
|
||||
state.offset = Math.max(0, state.offset - state.limit);
|
||||
await reloadCurrent();
|
||||
});
|
||||
|
||||
document.querySelector("#nextPageButton").addEventListener("click", async () => {
|
||||
if (state.offset + state.limit < state.total) {
|
||||
state.offset += state.limit;
|
||||
await reloadCurrent();
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#scanButton").addEventListener("click", scanLegacy);
|
||||
document.querySelector("#homeScanButton")?.addEventListener("click", scanLegacy);
|
||||
document.querySelector("#originFollowSyncButton").addEventListener("click", openOriginFollowSyncDialog);
|
||||
document.querySelector("#closeOriginFollowSyncDialogButton").addEventListener("click", () => els.originFollowSyncDialog.close());
|
||||
document.querySelector("#syncOriginPixivButton").addEventListener("click", () => syncOriginFollows("pixiv"));
|
||||
document.querySelector("#syncOriginXButton").addEventListener("click", () => syncOriginFollows("x"));
|
||||
document.querySelector("#syncButton").addEventListener("click", syncFollowed);
|
||||
document.querySelector("#syncXButton").addEventListener("click", syncXFollowed);
|
||||
document.querySelector("#buildThumbsButton").addEventListener("click", buildThumbnails);
|
||||
document.querySelector("#homeThumbButton")?.addEventListener("click", buildThumbnails);
|
||||
document.querySelector("#closeDialogButton").addEventListener("click", () => els.dialog.close());
|
||||
document.querySelector("#importPixivCookieButton")?.addEventListener("click", () => importCookieFile("pixiv", els.pixivCookieFile));
|
||||
els.refreshSessionButton?.addEventListener("click", loadSessionStatus);
|
||||
document.querySelector("#importXCookieButton").addEventListener("click", () => importCookieFile("x", els.xCookieFile));
|
||||
document.querySelector("#xMediaForm").addEventListener("submit", previewXMedia);
|
||||
document.querySelector("#followCurrentXButton").addEventListener("click", followCurrentX);
|
||||
document.querySelector("#downloadXSelectedButton").addEventListener("click", downloadXSelected);
|
||||
document.querySelector("#refreshXLocalButton").addEventListener("click", loadXLocalMedia);
|
||||
document.querySelector("#deleteXLocalButton").addEventListener("click", deleteXLocalSelected);
|
||||
document.querySelector("#xhsForm").addEventListener("submit", previewXhs);
|
||||
document.querySelector("#downloadXhsSelectedButton").addEventListener("click", downloadXhsSelected);
|
||||
els.xSelectAll.addEventListener("change", () => {
|
||||
document.querySelectorAll("[data-x-id]").forEach((item) => {
|
||||
item.checked = els.xSelectAll.checked;
|
||||
});
|
||||
});
|
||||
els.xLocalSelectAll.addEventListener("change", () => {
|
||||
document.querySelectorAll("[data-x-local-id]").forEach((item) => {
|
||||
item.checked = els.xLocalSelectAll.checked;
|
||||
});
|
||||
});
|
||||
els.xhsSelectAll.addEventListener("change", () => {
|
||||
document.querySelectorAll("[data-xhs-id]").forEach((item) => {
|
||||
item.checked = els.xhsSelectAll.checked;
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector("#followForm").addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const id = document.querySelector("#followArtistId").value.trim();
|
||||
const name = document.querySelector("#followArtistName").value.trim();
|
||||
if (!id) return;
|
||||
await followArtist(id, name);
|
||||
event.target.reset();
|
||||
});
|
||||
|
||||
document.querySelector("#xFollowForm").addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
const username = els.xFollowUsername.value.trim();
|
||||
const name = els.xFollowName.value.trim();
|
||||
if (!username) return;
|
||||
await followXAuthor(username, name);
|
||||
event.target.reset();
|
||||
});
|
||||
|
||||
function debounce(fn, delay) {
|
||||
let timer = 0;
|
||||
return (...args) => {
|
||||
clearTimeout(timer);
|
||||
timer = setTimeout(() => fn(...args), delay);
|
||||
};
|
||||
}
|
||||
|
||||
async function boot() {
|
||||
try {
|
||||
await Promise.all([loadPluginPages(), loadSessionStatus(), loadTags(), loadArtworks(), loadFollowed(), loadXFollowed()]);
|
||||
} catch (error) {
|
||||
setStatus(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
boot();
|
||||
@@ -0,0 +1,284 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Sakura 本地媒体库</title>
|
||||
<link rel="stylesheet" href="/assets/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<aside class="sidebar">
|
||||
<div class="brand">
|
||||
<div class="brand-mark">SK</div>
|
||||
<div>
|
||||
<h1>Sakura</h1>
|
||||
<p>本地媒体库</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav class="nav">
|
||||
<button class="nav-button active" data-view="home">首页</button>
|
||||
<button class="nav-button" data-view="gallery">图库</button>
|
||||
<button class="nav-button" data-view="favorites">收藏</button>
|
||||
<button class="nav-button" data-view="artists">作者</button>
|
||||
<button class="nav-button" data-view="sync">关注同步</button>
|
||||
</nav>
|
||||
|
||||
<section class="panel plugin-panel">
|
||||
<h2>插件页面</h2>
|
||||
<div id="pluginNav" class="nav compact-nav">
|
||||
<button class="nav-button" data-view="xMedia">X 作者媒体</button>
|
||||
<button id="xiaohongshuNavButton" class="nav-button hidden" data-view="xiaohongshu">小红书</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<h2>标签</h2>
|
||||
<div id="tagList" class="tag-list"></div>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<main class="main">
|
||||
<header class="toolbar">
|
||||
<div class="search-wrap">
|
||||
<input id="searchInput" type="search" placeholder="搜索标题、作者、简介或标签" />
|
||||
<select id="typeFilter" aria-label="类型筛选">
|
||||
<option value="">全部类型</option>
|
||||
<option value="illust">插画</option>
|
||||
<option value="manga">漫画</option>
|
||||
<option value="novel">小说</option>
|
||||
<option value="video">视频</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<button id="buildThumbsButton" class="ghost-button">生成缩略图</button>
|
||||
<button id="scanButton" class="primary-button">扫描旧目录</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section id="statusLine" class="status-line">准备就绪</section>
|
||||
|
||||
<section id="homeView" class="view active">
|
||||
<div class="welcome-card">
|
||||
<div>
|
||||
<p class="eyebrow">本地优先</p>
|
||||
<h2>今天想看什么?</h2>
|
||||
<p>插画、漫画、小说和视频都保存在本机。你可以直接浏览、搜索和收藏。</p>
|
||||
</div>
|
||||
<button class="primary-button" data-view-action="gallery">打开图库</button>
|
||||
</div>
|
||||
|
||||
<div class="quick-grid">
|
||||
<button class="quick-card" data-view-action="gallery">
|
||||
<strong>查看本地图库</strong>
|
||||
<span>按标题、作者、类型和标签筛选已经入库的作品。</span>
|
||||
</button>
|
||||
<button class="quick-card" data-view-action="sync">
|
||||
<strong>同步关注作者</strong>
|
||||
<span>读取 Pixiv / X 关注列表,把新作品下载到本地媒体库。</span>
|
||||
</button>
|
||||
<button class="quick-card" id="homeScanButton" type="button">
|
||||
<strong>导入旧下载目录</strong>
|
||||
<span>把 Sakura_Downloads 里的旧文件重新扫描进图库。</span>
|
||||
</button>
|
||||
<button class="quick-card" id="homeThumbButton" type="button">
|
||||
<strong>修复缩略图</strong>
|
||||
<span>图片不显示时,重新生成缺失的预览图。</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="help-steps">
|
||||
<article>
|
||||
<b>1</b>
|
||||
<div>
|
||||
<strong>在 EXE 主界面导入 Cookie</strong>
|
||||
<span>Pixiv、X、小红书等登录态会保存到本地运行目录。</span>
|
||||
</div>
|
||||
</article>
|
||||
<article>
|
||||
<b>2</b>
|
||||
<div>
|
||||
<strong>选择平台和目标后开始抓取</strong>
|
||||
<span>作者、单作品、关键词、插件链接都可以从主界面发起。</span>
|
||||
</div>
|
||||
</article>
|
||||
<article>
|
||||
<b>3</b>
|
||||
<div>
|
||||
<strong>回到图库整理内容</strong>
|
||||
<span>收藏、关注作者、生成缩略图和查看详情都在这里完成。</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="galleryView" class="view">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2 id="viewTitle">全部作品</h2>
|
||||
<p id="viewSubtitle">本地已入库作品</p>
|
||||
</div>
|
||||
<button id="clearFiltersButton" class="ghost-button">清除筛选</button>
|
||||
</div>
|
||||
<div id="artworkGrid" class="artwork-grid"></div>
|
||||
<div class="pager">
|
||||
<button id="prevPageButton" class="ghost-button">上一页</button>
|
||||
<span id="pageInfo">0 / 0</span>
|
||||
<button id="nextPageButton" class="ghost-button">下一页</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="artistsView" class="view">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2>作者</h2>
|
||||
<p>按本地作品数量排序</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="artistList" class="artist-list"></div>
|
||||
</section>
|
||||
|
||||
<section id="syncView" class="view">
|
||||
<div class="import-strip">
|
||||
<div>
|
||||
<strong>同步原站关注</strong>
|
||||
<span>读取当前 Pixiv / X 登录账号的关注列表,保存到本地。</span>
|
||||
</div>
|
||||
<button id="originFollowSyncButton" class="primary-button" type="button">同步原站关注</button>
|
||||
</div>
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2>关注同步</h2>
|
||||
<p>使用已保存 Cookie 同步关注作者的新作品</p>
|
||||
</div>
|
||||
<button id="syncButton" class="primary-button">同步关注作者</button>
|
||||
</div>
|
||||
<div class="import-strip session-strip">
|
||||
<div>
|
||||
<strong>Pixiv 登录态</strong>
|
||||
<span id="pixivSessionStatus">正在读取桌面端已保存的 Pixiv 会话...</span>
|
||||
</div>
|
||||
<button id="refreshSessionButton" class="ghost-button" type="button">刷新会话状态</button>
|
||||
</div>
|
||||
<form id="followForm" class="follow-form">
|
||||
<input id="followArtistId" inputmode="text" placeholder="作者 ID、作者名或主页链接" />
|
||||
<input id="followArtistName" placeholder="备注名称,可选" />
|
||||
<button class="ghost-button" type="submit">添加关注</button>
|
||||
</form>
|
||||
<div id="followedList" class="artist-list"></div>
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2>X 关注</h2>
|
||||
<p>按时间线检查 X 作者的最新媒体推文,并保存到本地媒体库。</p>
|
||||
</div>
|
||||
<button id="syncXButton" class="primary-button" type="button">同步 X 关注</button>
|
||||
</div>
|
||||
<form id="xFollowForm" class="follow-form">
|
||||
<input id="xFollowUsername" placeholder="X 用户名,例如 @nasa" />
|
||||
<input id="xFollowName" placeholder="备注名称,可选" />
|
||||
<button class="ghost-button" type="submit">添加 X 关注</button>
|
||||
</form>
|
||||
<div id="xFollowedList" class="artist-list"></div>
|
||||
</section>
|
||||
|
||||
<section id="xMediaView" class="view">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2>X 作者媒体</h2>
|
||||
<p>输入作者名称,解析媒体页中的图片或视频,勾选后下载到本地。</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="import-strip">
|
||||
<div>
|
||||
<strong>X Cookie</strong>
|
||||
<span>导入 Get cookies.txt 导出的 txt/json,会写入 runtime/x_cookies.json。</span>
|
||||
</div>
|
||||
<label class="file-button">
|
||||
选择 txt
|
||||
<input id="xCookieFile" type="file" accept=".txt,.json" />
|
||||
</label>
|
||||
<button id="importXCookieButton" class="ghost-button" type="button">导入 X Cookie</button>
|
||||
</div>
|
||||
|
||||
<form id="xMediaForm" class="x-media-form">
|
||||
<input id="xUsernameInput" placeholder="作者名称,例如 nasa 或 @nasa" autocomplete="off" />
|
||||
<select id="xMediaType">
|
||||
<option value="all">图片和视频</option>
|
||||
<option value="image">只看图片</option>
|
||||
<option value="video">只看视频</option>
|
||||
</select>
|
||||
<input id="xMaxItems" type="number" min="1" max="500" value="120" />
|
||||
<button class="primary-button" type="submit">解析媒体</button>
|
||||
</form>
|
||||
|
||||
<div class="x-actions">
|
||||
<label><input id="xSelectAll" type="checkbox" checked /> 全选</label>
|
||||
<button id="followCurrentXButton" class="ghost-button" type="button">关注当前作者</button>
|
||||
<button id="downloadXSelectedButton" class="primary-button" type="button">下载选中</button>
|
||||
<span id="xMediaSummary">尚未解析</span>
|
||||
</div>
|
||||
|
||||
<div id="xMediaGrid" class="x-media-grid"></div>
|
||||
|
||||
<div class="section-head x-local-head">
|
||||
<div>
|
||||
<h2>本地 X 媒体</h2>
|
||||
<p>查看已下载的 X 图片和视频,可删除本地文件。</p>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<button id="refreshXLocalButton" class="ghost-button" type="button">刷新</button>
|
||||
<button id="deleteXLocalButton" class="ghost-button danger-button" type="button">删除选中</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x-actions">
|
||||
<label><input id="xLocalSelectAll" type="checkbox" /> 全选本地文件</label>
|
||||
<span id="xLocalSummary">等待加载</span>
|
||||
</div>
|
||||
<div id="xLocalGrid" class="x-media-grid"></div>
|
||||
</section>
|
||||
|
||||
<section id="xiaohongshuView" class="view">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h2>小红书</h2>
|
||||
<p>输入关键词或笔记链接,先预览再勾选下载。</p>
|
||||
</div>
|
||||
</div>
|
||||
<form id="xhsForm" class="x-media-form">
|
||||
<input id="xhsTargetInput" placeholder="关键词,或 xiaohongshu.com/explore/... 链接" autocomplete="off" />
|
||||
<input id="xhsLimitInput" type="number" min="1" max="50" value="20" />
|
||||
<button class="primary-button" type="submit">解析预览</button>
|
||||
</form>
|
||||
<div class="x-actions">
|
||||
<label><input id="xhsSelectAll" type="checkbox" checked /> 全选</label>
|
||||
<button id="downloadXhsSelectedButton" class="primary-button" type="button">下载选中</button>
|
||||
<span id="xhsSummary">等待解析</span>
|
||||
</div>
|
||||
<div id="xhsGrid" class="x-media-grid"></div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<dialog id="originFollowSyncDialog" class="detail-dialog">
|
||||
<div class="dialog-head">
|
||||
<div>
|
||||
<strong>同步原站关注</strong>
|
||||
<span>选择平台后,会读取当前登录账号的关注列表并保存到本地。</span>
|
||||
</div>
|
||||
<button id="closeOriginFollowSyncDialogButton" class="ghost-button" type="button">关闭</button>
|
||||
</div>
|
||||
<div class="dialog-actions">
|
||||
<button id="syncOriginPixivButton" class="primary-button" type="button">Pixiv</button>
|
||||
<button id="syncOriginXButton" class="primary-button" type="button">X</button>
|
||||
</div>
|
||||
<pre id="originFollowSyncResult" class="sync-result"></pre>
|
||||
</dialog>
|
||||
|
||||
<dialog id="detailDialog" class="detail-dialog">
|
||||
<button id="closeDialogButton" class="close-button" aria-label="关闭">×</button>
|
||||
<div id="detailContent"></div>
|
||||
</dialog>
|
||||
|
||||
<script src="/assets/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,756 @@
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--bg: #f6f7f9;
|
||||
--surface: #ffffff;
|
||||
--surface-soft: #faf5f7;
|
||||
--line: #e5dce1;
|
||||
--text: #242229;
|
||||
--muted: #706b73;
|
||||
--primary: #cc5f91;
|
||||
--primary-strong: #af477a;
|
||||
--accent: #277d78;
|
||||
--ok: #3f9b72;
|
||||
--shadow: 0 10px 28px rgba(48, 39, 44, 0.09);
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
grid-template-columns: 248px minmax(0, 1fr);
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
min-height: 100vh;
|
||||
border-right: 1px solid var(--line);
|
||||
background: #ffffff;
|
||||
padding: 22px 18px;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
border-radius: 8px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.brand h1,
|
||||
.brand p,
|
||||
.panel h2,
|
||||
.section-head h2,
|
||||
.section-head p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.brand h1 {
|
||||
font-size: 19px;
|
||||
font-weight: 750;
|
||||
}
|
||||
|
||||
.brand p,
|
||||
.section-head p {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.nav {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.nav-button,
|
||||
.ghost-button,
|
||||
.primary-button {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 10px;
|
||||
min-height: 40px;
|
||||
padding: 0 14px;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.nav-button {
|
||||
text-align: left;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.nav-button.active,
|
||||
.primary-button {
|
||||
background: var(--primary);
|
||||
border-color: var(--primary);
|
||||
color: white;
|
||||
box-shadow: 0 8px 18px rgba(204, 95, 145, 0.2);
|
||||
}
|
||||
|
||||
.primary-button:hover {
|
||||
background: var(--primary-strong);
|
||||
}
|
||||
|
||||
.ghost-button:hover,
|
||||
.nav-button:hover {
|
||||
border-color: var(--primary);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.danger-button:hover {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.panel {
|
||||
border-top: 1px solid var(--line);
|
||||
padding-top: 18px;
|
||||
}
|
||||
|
||||
.plugin-panel {
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.panel h2 {
|
||||
font-size: 14px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.compact-nav {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.tag-chip {
|
||||
border: 1px solid var(--line);
|
||||
background: #fff7fb;
|
||||
border-radius: 999px;
|
||||
padding: 6px 10px;
|
||||
color: var(--muted);
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.tag-chip.active {
|
||||
color: white;
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.main {
|
||||
min-width: 0;
|
||||
padding: 24px 30px 40px;
|
||||
}
|
||||
|
||||
.welcome-card {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: #ffffff;
|
||||
box-shadow: var(--shadow);
|
||||
padding: 28px 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.welcome-card h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 28px;
|
||||
line-height: 1.22;
|
||||
}
|
||||
|
||||
.welcome-card p {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
max-width: 660px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: var(--primary) !important;
|
||||
font-size: 13px;
|
||||
font-weight: 750;
|
||||
margin-bottom: 6px !important;
|
||||
}
|
||||
|
||||
.quick-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.quick-card {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
min-height: 132px;
|
||||
padding: 18px;
|
||||
text-align: left;
|
||||
box-shadow: 0 8px 22px rgba(130, 66, 98, 0.08);
|
||||
}
|
||||
|
||||
.quick-card:hover {
|
||||
border-color: var(--primary);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.quick-card strong,
|
||||
.quick-card span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.quick-card strong {
|
||||
font-size: 17px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.quick-card span {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.help-steps {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.help-steps article {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.86);
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.help-steps b {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 999px;
|
||||
background: #ffe3ef;
|
||||
color: var(--primary);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.help-steps strong,
|
||||
.help-steps span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.help-steps span {
|
||||
color: var(--muted);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.search-wrap {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 420px) 150px;
|
||||
gap: 10px;
|
||||
width: min(100%, 610px);
|
||||
}
|
||||
|
||||
.search-wrap input,
|
||||
.search-wrap select,
|
||||
.follow-form input,
|
||||
.x-media-form input,
|
||||
.x-media-form select {
|
||||
height: 42px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
padding: 0 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.toolbar-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.status-line {
|
||||
min-height: 32px;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
background: rgba(255, 255, 255, 0.72);
|
||||
border: 1px solid rgba(240, 213, 226, 0.8);
|
||||
border-radius: 8px;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.view {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.view.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.section-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.section-head h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.artwork-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.artwork-card {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
background: var(--surface);
|
||||
overflow: hidden;
|
||||
box-shadow: 0 8px 22px rgba(130, 66, 98, 0.08);
|
||||
}
|
||||
|
||||
.thumb-button {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
background: #dde5ec;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.thumb-button img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.thumb-placeholder {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--muted);
|
||||
padding: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.artwork-meta {
|
||||
padding: 10px;
|
||||
display: grid;
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.artwork-title {
|
||||
font-weight: 650;
|
||||
line-height: 1.35;
|
||||
min-height: 38px;
|
||||
}
|
||||
|
||||
.artwork-sub {
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.small-button {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 7px;
|
||||
background: var(--surface-soft);
|
||||
min-height: 30px;
|
||||
padding: 0 9px;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.small-button.active {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.pager {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
margin: 22px 0 0;
|
||||
}
|
||||
|
||||
.artist-list {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.artist-row {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
background: var(--surface);
|
||||
min-height: 66px;
|
||||
padding: 12px 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.artist-row strong {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.artist-row span {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.follow-form {
|
||||
display: grid;
|
||||
grid-template-columns: 160px minmax(180px, 320px) 110px;
|
||||
gap: 10px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.import-strip {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
background: var(--surface);
|
||||
padding: 12px;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 1fr) auto auto;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.import-strip strong,
|
||||
.import-strip span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.import-strip span,
|
||||
.x-actions {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.file-button {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
min-height: 38px;
|
||||
padding: 0 14px;
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
background: var(--surface-soft);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.file-button input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.x-media-form {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(220px, 1fr) 150px 120px;
|
||||
gap: 10px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
#xMediaForm {
|
||||
grid-template-columns: minmax(220px, 1fr) 150px 110px 120px;
|
||||
}
|
||||
|
||||
.x-actions {
|
||||
min-height: 38px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.x-actions label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.x-media-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.x-media-card {
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
background: var(--surface);
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.x-local-head {
|
||||
border-top: 1px solid var(--line);
|
||||
padding-top: 22px;
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.x-check {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
left: 8px;
|
||||
top: 8px;
|
||||
min-height: 30px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
padding: 4px 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.x-thumb {
|
||||
width: 100%;
|
||||
aspect-ratio: 1 / 1;
|
||||
background: #101820;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.x-thumb img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.x-thumb video {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
background: #101820;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.video-tile {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: white;
|
||||
background: #223140;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.detail-dialog {
|
||||
width: min(980px, calc(100vw - 36px));
|
||||
max-height: calc(100vh - 36px);
|
||||
border: 0;
|
||||
border-radius: 14px;
|
||||
padding: 0;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.detail-dialog::backdrop {
|
||||
background: rgba(9, 18, 28, 0.5);
|
||||
}
|
||||
|
||||
.dialog-head {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 20px 20px 0;
|
||||
}
|
||||
|
||||
.dialog-head strong,
|
||||
.dialog-head span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dialog-head span {
|
||||
color: var(--muted);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.dialog-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 18px 20px 0;
|
||||
}
|
||||
|
||||
.sync-result {
|
||||
background: #fff7fa;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 8px;
|
||||
color: var(--text);
|
||||
margin: 18px 20px 20px;
|
||||
max-height: 260px;
|
||||
overflow: auto;
|
||||
padding: 12px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
top: 12px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 50%;
|
||||
background: var(--surface);
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.detail-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(260px, 52%) minmax(260px, 1fr);
|
||||
min-height: 520px;
|
||||
}
|
||||
|
||||
.detail-media {
|
||||
background: #101820;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.detail-media img {
|
||||
max-width: 100%;
|
||||
max-height: 72vh;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.detail-info {
|
||||
padding: 28px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.detail-info h2 {
|
||||
margin: 0 0 8px;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.detail-info p {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.detail-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin: 16px 0;
|
||||
}
|
||||
|
||||
.empty {
|
||||
border: 1px dashed var(--line);
|
||||
border-radius: 14px;
|
||||
padding: 34px;
|
||||
background: var(--surface);
|
||||
color: var(--muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
body {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: static;
|
||||
min-height: auto;
|
||||
}
|
||||
|
||||
.quick-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.welcome-card {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.toolbar,
|
||||
.section-head,
|
||||
.artist-row {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.search-wrap,
|
||||
.follow-form,
|
||||
.import-strip,
|
||||
.x-media-form {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.toolbar-actions {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.detail-layout {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user