diff options
Diffstat (limited to 'shared/core-utils')
-rw-r--r-- | shared/core-utils/common/version.ts | 17 | ||||
-rw-r--r-- | shared/core-utils/plugins/hooks.ts | 8 | ||||
-rw-r--r-- | shared/core-utils/renderer/html.ts | 6 | ||||
-rw-r--r-- | shared/core-utils/users/user-role.ts | 3 |
4 files changed, 18 insertions, 16 deletions
diff --git a/shared/core-utils/common/version.ts b/shared/core-utils/common/version.ts index 8a64f8c4d..305287233 100644 --- a/shared/core-utils/common/version.ts +++ b/shared/core-utils/common/version.ts | |||
@@ -1,18 +1,9 @@ | |||
1 | // Thanks https://stackoverflow.com/a/16187766 | 1 | // Thanks https://gist.github.com/iwill/a83038623ba4fef6abb9efca87ae9ccb |
2 | function compareSemVer (a: string, b: string) { | 2 | function compareSemVer (a: string, b: string) { |
3 | const regExStrip0 = /(\.0+)+$/ | 3 | if (a.startsWith(b + '-')) return -1 |
4 | const segmentsA = a.replace(regExStrip0, '').split('.') | 4 | if (b.startsWith(a + '-')) return 1 |
5 | const segmentsB = b.replace(regExStrip0, '').split('.') | ||
6 | 5 | ||
7 | const l = Math.min(segmentsA.length, segmentsB.length) | 6 | return a.localeCompare(b, undefined, { numeric: true, sensitivity: 'case', caseFirst: 'upper' }) |
8 | |||
9 | for (let i = 0; i < l; i++) { | ||
10 | const diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10) | ||
11 | |||
12 | if (diff) return diff | ||
13 | } | ||
14 | |||
15 | return segmentsA.length - segmentsB.length | ||
16 | } | 7 | } |
17 | 8 | ||
18 | export { | 9 | export { |
diff --git a/shared/core-utils/plugins/hooks.ts b/shared/core-utils/plugins/hooks.ts index 3784969b5..96bcc945e 100644 --- a/shared/core-utils/plugins/hooks.ts +++ b/shared/core-utils/plugins/hooks.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | import { RegisteredExternalAuthConfig } from '@shared/models' | ||
1 | import { HookType } from '../../models/plugins/hook-type.enum' | 2 | import { HookType } from '../../models/plugins/hook-type.enum' |
2 | import { isCatchable, isPromise } from '../common/promises' | 3 | import { isCatchable, isPromise } from '../common/promises' |
3 | 4 | ||
@@ -49,7 +50,12 @@ async function internalRunHook <T> (options: { | |||
49 | return result | 50 | return result |
50 | } | 51 | } |
51 | 52 | ||
53 | function getExternalAuthHref (apiUrl: string, auth: RegisteredExternalAuthConfig) { | ||
54 | return apiUrl + `/plugins/${auth.name}/${auth.version}/auth/${auth.authName}` | ||
55 | } | ||
56 | |||
52 | export { | 57 | export { |
53 | getHookType, | 58 | getHookType, |
54 | internalRunHook | 59 | internalRunHook, |
60 | getExternalAuthHref | ||
55 | } | 61 | } |
diff --git a/shared/core-utils/renderer/html.ts b/shared/core-utils/renderer/html.ts index 502308979..877f2ec55 100644 --- a/shared/core-utils/renderer/html.ts +++ b/shared/core-utils/renderer/html.ts | |||
@@ -38,7 +38,11 @@ export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[] | |||
38 | ...additionalAllowedTags, | 38 | ...additionalAllowedTags, |
39 | 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' | 39 | 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' |
40 | ], | 40 | ], |
41 | allowedSchemes: base.allowedSchemes, | 41 | allowedSchemes: [ |
42 | ...base.allowedSchemes, | ||
43 | |||
44 | 'mailto' | ||
45 | ], | ||
42 | allowedAttributes: { | 46 | allowedAttributes: { |
43 | ...base.allowedAttributes, | 47 | ...base.allowedAttributes, |
44 | 48 | ||
diff --git a/shared/core-utils/users/user-role.ts b/shared/core-utils/users/user-role.ts index cc757d779..5f3b9a10f 100644 --- a/shared/core-utils/users/user-role.ts +++ b/shared/core-utils/users/user-role.ts | |||
@@ -23,7 +23,8 @@ const userRoleRights: { [ id in UserRole ]: UserRight[] } = { | |||
23 | UserRight.MANAGE_ACCOUNTS_BLOCKLIST, | 23 | UserRight.MANAGE_ACCOUNTS_BLOCKLIST, |
24 | UserRight.MANAGE_SERVERS_BLOCKLIST, | 24 | UserRight.MANAGE_SERVERS_BLOCKLIST, |
25 | UserRight.MANAGE_USERS, | 25 | UserRight.MANAGE_USERS, |
26 | UserRight.SEE_ALL_COMMENTS | 26 | UserRight.SEE_ALL_COMMENTS, |
27 | UserRight.MANAGE_REGISTRATIONS | ||
27 | ], | 28 | ], |
28 | 29 | ||
29 | [UserRole.USER]: [] | 30 | [UserRole.USER]: [] |