diff options
author | Chocobozzz <chocobozzz@cpy.re> | 2021-05-27 15:59:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-27 15:59:55 +0200 |
commit | 2539932e16129992a2c0889b4ff527c265a8e2c7 (patch) | |
tree | fb5048e63e02a2485eb96d27455f43e4b22e8ae0 /shared/core-utils/miscs | |
parent | eb34ec30e0b57286fc6f85160490d2e973a3b0b1 (diff) | |
download | PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.gz PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.tar.zst PeerTube-2539932e16129992a2c0889b4ff527c265a8e2c7.zip |
Instance homepage support (#4007)
* Prepare homepage parsers
* Add ability to update instance hompage
* Add ability to set homepage as landing page
* Add homepage preview in admin
* Dynamically update left menu for homepage
* Inject home content in homepage
* Add videos list and channel miniature custom markup
* Remove unused elements in markup service
Diffstat (limited to 'shared/core-utils/miscs')
-rw-r--r-- | shared/core-utils/miscs/miscs.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/shared/core-utils/miscs/miscs.ts b/shared/core-utils/miscs/miscs.ts index 71703faac..4780ca922 100644 --- a/shared/core-utils/miscs/miscs.ts +++ b/shared/core-utils/miscs/miscs.ts | |||
@@ -28,9 +28,24 @@ function isCatchable (value: any) { | |||
28 | return value && typeof value.catch === 'function' | 28 | return value && typeof value.catch === 'function' |
29 | } | 29 | } |
30 | 30 | ||
31 | function sortObjectComparator (key: string, order: 'asc' | 'desc') { | ||
32 | return (a: any, b: any) => { | ||
33 | if (a[key] < b[key]) { | ||
34 | return order === 'asc' ? -1 : 1 | ||
35 | } | ||
36 | |||
37 | if (a[key] > b[key]) { | ||
38 | return order === 'asc' ? 1 : -1 | ||
39 | } | ||
40 | |||
41 | return 0 | ||
42 | } | ||
43 | } | ||
44 | |||
31 | export { | 45 | export { |
32 | randomInt, | 46 | randomInt, |
33 | compareSemVer, | 47 | compareSemVer, |
34 | isPromise, | 48 | isPromise, |
35 | isCatchable | 49 | isCatchable, |
50 | sortObjectComparator | ||
36 | } | 51 | } |