feat: Add CDN support (#1817)

* chore: CSP

* chore: Optionally use CDN for serving images
This commit is contained in:
Tom Moor
2021-01-16 11:12:10 -08:00
committed by GitHub
parent 1fd2ec31fd
commit 522df125aa
16 changed files with 77 additions and 28 deletions

View File

@@ -1,7 +1,8 @@
// @flow
import { parseDomain } from "../../shared/utils/domains";
import env from "env";
export default function isInternalUrl(href: string) {
export function isInternalUrl(href: string) {
if (href[0] === "/") return true;
const outline = parseDomain(window.location.href);
@@ -19,3 +20,11 @@ export default function isInternalUrl(href: string) {
return false;
}
export function cdnPath(path: string): string {
return `${env.CDN_URL}${path}`;
}
export function imagePath(path: string): string {
return cdnPath(`/images/${path}`);
}