@samitouri / QOSami-HFS / commits / 46198c39

plugins: HFS.isShowSupported

Massimo Melina committed May 15, 2025 at 16:01 UTC 46198c390536c2b7fb0dde9fa7fd0edecba5c974
2 files changed +12 -3
dev-plugins.md
+10 -2
@@ -424,7 +424,8 @@ In frontend you will have access to the `HFS` object of the global scope, which
424 Returns falsy if entry is not supported.
425 - `copyTextToClipboard(text: string)` self-explanatory.
426 - `urlParams: object` you'll find each parameter in the URL mapped in this object as string.
427 -- `fileShowComponents: { Video, Audio }` exposes standard components used by file-show. Can be useful if you need extend them, inside `fileShow` event.
427 +- `fileShowComponents: { Video, Audio }` exposes standard components used by file-show. Can be useful if you need extend them, inside `fileShow` event.
428 +- `isShowSupported(entry: DirEntry): boolean` true if the entry is supported by Show.
429
430 The following properties are accessible only immediately at top-level; don't call it later in a callback.
431 - `getPluginConfig()` returns object of all config keys that are declared frontend-accessible by this plugin.
@@ -533,6 +534,12 @@ This is a list of available frontend-events, with respective object parameter an
534 or if you like lodash, you can simply `HFS._.remove(menu, { id: 'show' })`
535 - `fileShow`
536 - you receive an entry of the list, and optionally produce React Component for visualization.
537 + Your component will be rendered with the following props:
538 + - `src`: string, uri of the entry
539 + - `className`: string, must be reported in your component
540 + - `onLoad`
541 + - `onError`
542 + - `onPlay`
543 - parameter `{ entry: DirEntry }` (refer above for DirEntry object)
544 - output `ReactComponent`
545 - `showPlay`
@@ -996,4 +1003,5 @@ If you want to override a text regardless of the language, use the special langu
1003 - config.getError
1004 - 12.5 (v0.57.2)
1005 - changed parameters for events log, error_log, failedLogin, accountRenamed
999 - - HFS.fileShow return value
\ No newline at end of file
1006 + - HFS.fileShow return value
1007 + - HFS.isShowSupported
\ No newline at end of file
frontend/src/misc.ts
+2 -1
@@ -15,7 +15,7 @@ import { reloadList } from './useFetchList'
15 import { logout } from './login'
16 import { subscribeKey } from 'valtio/utils'
17 import { uploadState } from './uploadQueue'
18 -import { fileShow, Video, Audio } from './show'
18 +import { fileShow, Video, Audio, getShowComponent } from './show'
19 import { debounceAsync } from '../../src/debounceAsync'
20 export * from '@hfs/shared'
21 import i18n from './i18n'
@@ -99,6 +99,7 @@ Object.assign(getHFS(), {
99 h, React, state, t, _, dialogLib, apiCall, useApi, reloadList, logout, Icon, hIcon, iconBtn, useBatch, fileShow,
100 toast, domOn, getNotifications, debounceAsync, useSnapState, DirEntry, Btn,
101 fileShowComponents: { Video, Audio },
102 + isShowSupported: getShowComponent,
103 misc: { ...cross, ...shared, ...thisModule },
104 emit: hfsEvent,
105 onEvent: onHfsEvent,