diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-07 16:09:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-07 16:25:29 +0100 |
commit | 2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f (patch) | |
tree | 998a0af6923475c85eb8e97ca1d30afb42655263 /shared/utils/server/stats.ts | |
parent | 4b49385892b25aea5aa9e605fbcb66074bcb49b0 (diff) | |
parent | 35adc403b7eed6d1309bbce901268a76dd01b6ef (diff) | |
download | PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.gz PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.zst PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.zip |
Merge branch 'move-utils-to-shared' of https://github.com/buoyantair/PeerTube into buoyantair-move-utils-to-shared
Diffstat (limited to 'shared/utils/server/stats.ts')
-rw-r--r-- | shared/utils/server/stats.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/shared/utils/server/stats.ts b/shared/utils/server/stats.ts new file mode 100644 index 000000000..6f079ad18 --- /dev/null +++ b/shared/utils/server/stats.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | import { makeGetRequest } from '../requests/requests' | ||
2 | |||
3 | function getStats (url: string, useCache = false) { | ||
4 | const path = '/api/v1/server/stats' | ||
5 | |||
6 | const query = { | ||
7 | t: useCache ? undefined : new Date().getTime() | ||
8 | } | ||
9 | |||
10 | return makeGetRequest({ | ||
11 | url, | ||
12 | path, | ||
13 | query, | ||
14 | statusCodeExpected: 200 | ||
15 | }) | ||
16 | } | ||
17 | |||
18 | // --------------------------------------------------------------------------- | ||
19 | |||
20 | export { | ||
21 | getStats | ||
22 | } | ||