@@ -31,6 +31,8 @@ import { useCommandShortcuts } from "~/modules/command/hooks/use-command-binding
3131import type { FollowCommandId } from "~/modules/command/types"
3232import { useToolbarOrderMap } from "~/modules/customize-toolbar/hooks"
3333
34+ import { useRouteParams } from "./useRouteParams"
35+
3436export const enableEntryReadability = async ( { id, url } : { id : string ; url : string } ) => {
3537 const status = getReadabilityStatus ( ) [ id ]
3638 const isTurnOn = status !== ReadabilityStatus . INITIAL && ! ! status
@@ -126,6 +128,7 @@ const entrySelector = (state: EntryModel) => {
126128 const { summary, translation, readability } = state . settings || { }
127129
128130 const media = state . media || [ ]
131+ const attachments = state . attachments || [ ]
129132 const images = media . filter ( ( a ) => a . type === "photo" )
130133 const imagesLength = images . length
131134
@@ -141,6 +144,7 @@ const entrySelector = (state: EntryModel) => {
141144 hasContent,
142145 doesContentContainsHTMLTags,
143146 imagesLength,
147+ hasBitTorrent : attachments . some ( ( a ) => a . mime_type === "application/x-bittorrent" ) ,
144148 }
145149}
146150export const HIDE_ACTIONS_IN_ENTRY_CONTEXT_MENU = [
@@ -165,6 +169,7 @@ export const useEntryActions = ({
165169 compact ?: boolean
166170} ) => {
167171 const entry = useEntry ( entryId , entrySelector )
172+ const { isCollection } = useRouteParams ( )
168173 const isInCollection = useIsEntryStarred ( entryId )
169174 const isEntryInReadability = useEntryIsInReadability ( entryId )
170175
@@ -236,6 +241,12 @@ export const useEntryActions = ({
236241 onClick : runCmdFn ( COMMAND_ID . integration . saveToZotero , [ { entryId } ] ) ,
237242 entryId,
238243 } ) ,
244+ new EntryActionMenuItem ( {
245+ id : COMMAND_ID . integration . saveToQBittorrent ,
246+ onClick : runCmdFn ( COMMAND_ID . integration . saveToQBittorrent , [ { entryId } ] ) ,
247+ hide : ! IN_ELECTRON || ! entry . hasBitTorrent ,
248+ entryId,
249+ } ) ,
239250 new EntryActionMenuItem ( {
240251 id : COMMAND_ID . entry . tip ,
241252 onClick : runCmdFn ( COMMAND_ID . entry . tip , [
@@ -326,21 +337,21 @@ export const useEntryActions = ({
326337 new EntryActionMenuItem ( {
327338 id : COMMAND_ID . entry . readAbove ,
328339 onClick : runCmdFn ( COMMAND_ID . entry . readAbove , [ { publishedAt : entry . publishedAt } ] ) ,
329- hide : ! ! isInCollection ,
340+ hide : ! ! isCollection ,
330341 entryId,
331342 } ) ,
332343 new EntryActionMenuItem ( {
333344 id : COMMAND_ID . entry . read ,
334345 onClick : runCmdFn ( COMMAND_ID . entry . read , [ { entryId } ] ) ,
335- hide : ! ! isInCollection ,
346+ hide : ! ! isCollection ,
336347 active : ! ! entry . read ,
337348 shortcut : shortcuts [ COMMAND_ID . entry . read ] ,
338349 entryId,
339350 } ) ,
340351 new EntryActionMenuItem ( {
341352 id : COMMAND_ID . entry . readBelow ,
342353 onClick : runCmdFn ( COMMAND_ID . entry . readBelow , [ { publishedAt : entry . publishedAt } ] ) ,
343- hide : ! ! isInCollection ,
354+ hide : ! ! isCollection ,
344355 entryId,
345356 } ) ,
346357 MENU_ITEM_SEPARATOR ,
@@ -392,20 +403,22 @@ export const useEntryActions = ({
392403 hasEntry ,
393404 runCmdFn ,
394405 entryId ,
395- feed ?. id ,
396- feed ?. ownerUserId ,
397- feed ?. siteUrl ,
398- isInbox ,
399- shortcuts ,
400- view ,
401- isInCollection ,
406+ entry ?. hasBitTorrent ,
402407 entry ?. url ,
403408 entry ?. imagesLength ,
404409 entry ?. publishedAt ,
405410 entry ?. read ,
406411 entry ?. hasContent ,
407412 entry ?. readability ,
408413 entry ?. doesContentContainsHTMLTags ,
414+ feed ?. id ,
415+ feed ?. ownerUserId ,
416+ feed ?. siteUrl ,
417+ isInbox ,
418+ shortcuts ,
419+ view ,
420+ isCollection ,
421+ isInCollection ,
409422 isShowSourceContent ,
410423 isShowAISummaryAuto ,
411424 isShowAISummaryOnce ,
0 commit comments