From 99cb09c6576f9412a2e7b5fed7916394873547d2 Mon Sep 17 00:00:00 2001 From: the1812 Date: Sun, 28 Aug 2022 14:39:18 +0800 Subject: [PATCH] Support original username (fix #1208) --- registry/lib/components/utils/image-exporter/feed.ts | 4 +++- .../lib/components/utils/image-exporter/{desc.md => index.md} | 1 + registry/lib/components/utils/image-exporter/index.ts | 4 ---- 3 files changed, 4 insertions(+), 5 deletions(-) rename registry/lib/components/utils/image-exporter/{desc.md => index.md} (71%) diff --git a/registry/lib/components/utils/image-exporter/feed.ts b/registry/lib/components/utils/image-exporter/feed.ts index f6c81b8e9a..954e56b786 100644 --- a/registry/lib/components/utils/image-exporter/feed.ts +++ b/registry/lib/components/utils/image-exporter/feed.ts @@ -1,4 +1,4 @@ -import { FeedsCard, addMenuItem, forEachFeedsCard } from '@/components/feeds/api' +import { FeedsCard, addMenuItem, forEachFeedsCard, RepostFeedsCard } from '@/components/feeds/api' import { ComponentEntry } from '@/components/types' import { getBlob } from '@/core/ajax' import { DownloadPackage } from '@/core/download' @@ -42,6 +42,7 @@ export const setupFeedImageExporter: ComponentEntry = async ({ settings: { optio const titleData = { user: card.username, id: card.id, + originalUser: (card as RepostFeedsCard).repostUsername ?? card.username, n: (index + 1).toString(), } pack.add(`${formatTitle(feedFormat, false, titleData)}${imageUrls[index].extension}`, blob) @@ -50,6 +51,7 @@ export const setupFeedImageExporter: ComponentEntry = async ({ settings: { optio const packTitleData = { user: card.username, id: card.id, + originalUser: (card as RepostFeedsCard).repostUsername ?? card.username, n: '', } await pack.emit(`${formatTitle(feedFormat, false, packTitleData)}.zip`) diff --git a/registry/lib/components/utils/image-exporter/desc.md b/registry/lib/components/utils/image-exporter/index.md similarity index 71% rename from registry/lib/components/utils/image-exporter/desc.md rename to registry/lib/components/utils/image-exporter/index.md index f9e3aa9213..8505dd017d 100644 --- a/registry/lib/components/utils/image-exporter/desc.md +++ b/registry/lib/components/utils/image-exporter/index.md @@ -2,6 +2,7 @@ 动态文件名变量: - `user`: 用户名 +- `originalUser`: 被转发用户名, 如果不是转发类型的动态则等于 `user` - `id`: 动态 ID - `n`: 第 n 张图 diff --git a/registry/lib/components/utils/image-exporter/index.ts b/registry/lib/components/utils/image-exporter/index.ts index fa8efb8ae1..f27224db50 100644 --- a/registry/lib/components/utils/image-exporter/index.ts +++ b/registry/lib/components/utils/image-exporter/index.ts @@ -2,14 +2,10 @@ import { ComponentMetadata } from '@/components/types' import { matchUrlPattern } from '@/core/utils' import { columnUrls, feedsUrls } from '@/core/utils/urls' import { setupFeedImageExporter } from './feed' -import desc from './desc.md' export const component: ComponentMetadata = { name: 'imageExporter', displayName: '图片批量导出', - description: { - 'zh-CN': desc, - }, tags: [ componentsTags.feeds, componentsTags.utils,