plugins: HFS.fileShow new return value
Massimo Melina committed
May 14, 2025 at 22:52 UTC
573e99d428498b8654c1a515b208dd4add79417f
3 files changed
+11
-5
dev-plugins.md
+6
-4
@@ -17,7 +17,7 @@ The simplest way to develop is to create your folder inside the .hfs/plugins fol
17
Each time you make a change, you'll see it reflected in the running server.
18
This is probably the easiest form to start with.
19
20
-A neater way is to keep it both in the for of github repo and installed plugin.
20
+A neater way is to keep it both in the form of github repo and installed plugin.
21
If you want to do so, have a folder with your github repo in it, *outside* your `.hfs` folder.
22
As you'll see in the [[Publish your plug-in]] section, you should keep your files inside the `dist` subfolder.
23
Then you'll need to link it inside the plugins folder.
@@ -420,7 +420,8 @@ In frontend you will have access to the `HFS` object of the global scope, which
420
Returns true if the specified name is the one of the logged in account.
421
- `DirEntry: class_constructor(n :string, otherProps?: DirEntry)` this is the class of the objects inside `HFS.state.list`;
422
in case you need to add to the list, do it by instantiating this class. E.g. `new HFS.DirEntry(name)`
423
-- `fileShow(entry: DirEntry, options?: { startPlaying: true )` open file-show on the specified entry.
423
+- `fileShow(entry: DirEntry, options?: { startPlaying: true ): boolean` open file-show on the specified entry.
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.
@@ -993,5 +994,6 @@ If you want to override a text regardless of the language, use the special langu
994
- frontend events: async for fileMenu and html-producers
995
- config.type: date_time, net_mask
996
- config.getError
996
-- 12.4 (v0.57.2)
997
- - changed parameters for events log, error_log, failedLogin, accountRenamed
\ No newline at end of file
997
+- 12.5 (v0.57.2)
998
+ - changed parameters for events log, error_log, failedLogin, accountRenamed
999
+ - HFS.fileShow return value
\ No newline at end of file
frontend/src/show.ts
+4
@@ -20,7 +20,10 @@ enum ZoomMode {
20
contain, // leave this as last
21
}
22
23
+// return falsy if entry is not supported
24
export function fileShow(entry: DirEntry, { startPlaying=false, startShuffle=false } = {}) {
25
+ if (!getShowComponent(entry))
26
+ return
27
let escOnce = false
28
let onClose: any
29
let firstUri: string
@@ -370,6 +373,7 @@ export function fileShow(entry: DirEntry, { startPlaying=false, startShuffle=fal
373
}
374
}
375
})
376
+ return true
377
}
378
379
export function getShowComponent(entry: DirEntry) {
src/const.ts
+1
-1
@@ -9,7 +9,7 @@ import { formatTimestamp } from './cross'
9
import { argv } from './argv'
10
export * from './cross-const'
11
12
-export const API_VERSION = 12.4
12
+export const API_VERSION = 12.5
13
export const COMPATIBLE_API_VERSION = 1 // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
14
15
// you can add arguments with this file, currently used for the update process on mac/linux