feat: Hide Outline branding on custom domain share links

closes #1629
This commit is contained in:
Tom Moor 2020-11-08 23:01:57 -08:00
parent 4e7a1cd121
commit 4c56ed40f1
2 changed files with 13 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import KeyboardShortcutsButton from "./KeyboardShortcutsButton";
import MarkAsViewed from "./MarkAsViewed"; import MarkAsViewed from "./MarkAsViewed";
import References from "./References"; import References from "./References";
import { type LocationWithState } from "types"; import { type LocationWithState } from "types";
import { isCustomDomain } from "utils/domains";
import { emojiToUrl } from "utils/emoji"; import { emojiToUrl } from "utils/emoji";
import { import {
collectionUrl, collectionUrl,
@ -458,7 +459,8 @@ class DocumentScene extends React.Component<Props> {
</MaxWidth> </MaxWidth>
</Container> </Container>
</Background> </Background>
{isShare ? <Branding /> : <KeyboardShortcutsButton />} {isShare && !isCustomDomain() && <Branding />}
{!isShare && <KeyboardShortcutsButton />}
</ErrorBoundary> </ErrorBoundary>
); );
} }

View File

@ -1,7 +1,16 @@
// @flow // @flow
import { stripSubdomain } from "shared/utils/domains"; import { parseDomain, stripSubdomain } from "shared/utils/domains";
import env from "env"; import env from "env";
export function getCookieDomain(domain: string) { export function getCookieDomain(domain: string) {
return env.SUBDOMAINS_ENABLED ? stripSubdomain(domain) : domain; return env.SUBDOMAINS_ENABLED ? stripSubdomain(domain) : domain;
} }
export function isCustomDomain() {
const parsed = parseDomain(window.location.origin);
const main = parseDomain(env.URL);
return (
parsed && main && (main.domain !== parsed.domain || main.tld !== parsed.tld)
);
}