plugins: HFS.useApi
Massimo Melina committed
Jun 27, 2023 at 16:01 UTC
90ad8fee82ab29617d96b9a260e41f547e25ccf1
3 files changed
+6
-5
dev-plugins.md
+3
-2
@@ -169,6 +169,7 @@ Once your script is loaded into the frontend (via `frontend_js`), you will have
169
The HFS objects contains many properties:
170
- `onEvent` this is the main API function inside the frontend. Refer to dedicated section below.
171
- `apiCall`
172
+- `useApi`
173
- `reloadList`
174
- `logout`
175
- `state` [object with many values in it](https://github.com/rejetto/hfs/blob/main/frontend/src/state.ts)
@@ -320,10 +321,10 @@ Where `h` is just `import { createElement as h } from 'react'`.
321
322
## API version history
323
323
-- 8.22 (v0.46.0)
324
+- 8.23 (v0.46.0)
325
- entry.getNext, getPrevious, getNextFiltered, getPreviousFiltered, getDefaultIcon
326
- platform-dependent distribution
326
- - HFS.watchState, emit
327
+ - HFS.watchState, emit, useApi
328
- api.storageDir, customApiCall
329
- exports.depend
330
- new event: fileShow
frontend/src/misc.ts
+2
-2
@@ -9,7 +9,7 @@ import { state } from './state'
9
import { t } from './i18n'
10
import * as dialogLib from './dialog'
11
import _ from 'lodash'
12
-import { apiCall, setDefaultApiCallOptions } from '@hfs/shared/api'
12
+import { apiCall, setDefaultApiCallOptions, useApi } from '@hfs/shared/api'
13
import { reloadList } from './useFetchList'
14
import { logout } from './login'
15
import { subscribeKey } from 'valtio/utils'
@@ -60,7 +60,7 @@ export function hfsEvent(name: string, params?:Dict) {
60
return output
61
}
62
63
-const tools = { h, React, state, t, _, dialogLib, apiCall, reloadList, logout, Icon, hIcon,
63
+const tools = { h, React, state, t, _, dialogLib, apiCall, useApi, reloadList, logout, Icon, hIcon,
64
watchState(k: string, cb: (v: any) => void) {
65
const up = k.split('upload.')[1]
66
return subscribeKey(up ? uploadState : state as any, up || k, cb, true)
src/const.ts
+1
-1
@@ -16,7 +16,7 @@ const pkg = JSON.parse(fs.readFileSync(PKG_PATH,'utf8'))
16
export const VERSION = pkg.version
17
export const DAY = 86_400_000
18
19
-export const API_VERSION = 8.22
19
+export const API_VERSION = 8.23
20
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
21
22
export const HFS_REPO = 'rejetto/hfs'