Skip to content

Commit

Permalink
Support original username (fix #1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Aug 28, 2022
1 parent 3de3b9e commit 99cb09c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion registry/lib/components/utils/image-exporter/feed.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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)
Expand All @@ -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`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

动态文件名变量:
- `user`: 用户名
- `originalUser`: 被转发用户名, 如果不是转发类型的动态则等于 `user`
- `id`: 动态 ID
- `n`: 第 n 张图

Expand Down
4 changes: 0 additions & 4 deletions registry/lib/components/utils/image-exporter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 99cb09c

Please sign in to comment.