Display user badges
This commit is contained in:
parent
927c22ef73
commit
f647c4e053
95 changed files with 2891 additions and 424 deletions
12
ts/badges/isBadgeImageFileUrlValid.ts
Normal file
12
ts/badges/isBadgeImageFileUrlValid.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { maybeParseUrl } from '../util/url';
|
||||
|
||||
export function isBadgeImageFileUrlValid(
|
||||
url: string,
|
||||
updatesUrl: string
|
||||
): boolean {
|
||||
const expectedPrefix = new URL('/static/badges', updatesUrl).href;
|
||||
return url.startsWith(expectedPrefix) && Boolean(maybeParseUrl(url));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue