plugins: HFS.fileShow
Massimo Melina committed
Sep 9, 2023 at 12:10 UTC
e2f3f69462c905b1c3244013943fbba6e7d7a463
2 files changed
+9
-7
dev-plugins.md
+7
-6
@@ -83,8 +83,8 @@ used must be strictly JSON (thus, no single quotes, only double quotes for strin
83
```
84
You'll find more examples by studying plugins like `vhosting` or `antibrute`.
85
This API is based on [Koa](https://koajs.com), because that's what HFS is using.
86
- To know what the Context object contains please refer to [Koa's documentation](https://github.com/koajs/koa/blob/master/docs/api/context.md).
87
- You don't get the `next` parameter as in standard Koa's middlewares because this is different, but we are now explaining how to achieve the same results.
86
+ To know what the Context object contains please refer to [Koa documentation](https://github.com/koajs/koa/blob/master/docs/api/context.md).
87
+ You don't get the `next` parameter as in standard Koa middlewares because this is different, but we are now explaining how to achieve the same results.
88
To interrupt other middlewares on this http request, return `true`.
89
If you want to execute something in the "upstream" of middlewares, return a function.
90
@@ -341,12 +341,12 @@ Most React developers are used to JSX, which is not (currently) supported here.
341
If you want, you can try solutions to JSX support, like transpiling.
342
Anyway, React is not JSX, and can be easily used without.
343
344
-Any time you in JSX you do
344
+Any time in JSX you do
345
```jsx
346
<button onClick={() => console.log('hi')}>Say hi</button>
347
```
348
349
-This is just transalted to
349
+This is just translated to
350
```js
351
h('button', { onClick: () => console.log('hi') }, 'Say hi')
352
```
@@ -355,8 +355,9 @@ Where `h` is just `import { createElement as h } from 'react'`.
355
356
## API version history
357
358
-- 8.4 (v0.48.0)
359
- - HFS.Const (HFS.const is now deprecated)
358
+- 8.4 (v0.48.0)
359
+ - HFS.fileShow
360
+ - api.Const (api.const is now deprecated)
361
- 8.3 (v0.47.0)
362
- HFS.useBatch
363
- FileMenuEntry.id, .subLabel
frontend/src/misc.ts
+2
-1
@@ -14,6 +14,7 @@ import { reloadList } from './useFetchList'
14
import { logout } from './login'
15
import { subscribeKey } from 'valtio/utils'
16
import { uploadState } from './upload'
17
+import { fileShow } from './show'
18
export * from '@hfs/shared'
19
20
export const ERRORS: Record<number, string> = {
@@ -61,7 +62,7 @@ export function hfsEvent(name: string, params?:Dict) {
62
return output
63
}
64
64
-const tools = { h, React, state, t, _, dialogLib, apiCall, useApi, reloadList, logout, Icon, hIcon, useBatch,
65
+const tools = { h, React, state, t, _, dialogLib, apiCall, useApi, reloadList, logout, Icon, hIcon, useBatch, fileShow,
66
watchState(k: string, cb: (v: any) => void) {
67
const up = k.split('upload.')[1]
68
return subscribeKey(up ? uploadState : state as any, up || k, cb, true)