Fix isInternalUrl for subdomain support
Refactor / reduce plumbing
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
// @flow
|
||||
import Actions from './Actions';
|
||||
export { Action, Separator } from './Actions';
|
||||
export default Actions;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Alert from './Alert';
|
||||
export default Alert;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Button from './Button';
|
||||
export default Button;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import CenteredContent from './CenteredContent';
|
||||
export default CenteredContent;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Collaborators from './Collaborators';
|
||||
export default Collaborators;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import ColorPicker from './ColorPicker';
|
||||
export default ColorPicker;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import CopyToClipboard from './CopyToClipboard';
|
||||
export default CopyToClipboard;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Divider from './Divider';
|
||||
export default Divider;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import DropToImport from './DropToImport';
|
||||
export default DropToImport;
|
||||
@@ -9,7 +9,6 @@ type Props = {
|
||||
bodyPlaceholder?: string,
|
||||
defaultValue?: string,
|
||||
readOnly?: boolean,
|
||||
expandToFit?: boolean,
|
||||
history: *,
|
||||
ui: *,
|
||||
};
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Empty from './Empty';
|
||||
export default Empty;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Fade from './Fade';
|
||||
export default Fade;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import HelpText from './HelpText';
|
||||
export default HelpText;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Highlight from './Highlight';
|
||||
export default Highlight;
|
||||
@@ -1,4 +0,0 @@
|
||||
// @flow
|
||||
import Input, { LabelText, Outline } from './Input';
|
||||
export default Input;
|
||||
export { LabelText, Outline };
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Key from './key';
|
||||
export default Key;
|
||||
@@ -1,4 +0,0 @@
|
||||
// @flow
|
||||
import Labeled, { Label } from './Labeled';
|
||||
export default Labeled;
|
||||
export { Label };
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Layout from './Layout';
|
||||
export default Layout;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Modal from './Modal';
|
||||
export default Modal;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Modals from './Modals';
|
||||
export default Modals;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import PageTitle from './PageTitle';
|
||||
export default PageTitle;
|
||||
@@ -1,4 +0,0 @@
|
||||
// @flow
|
||||
import Popover from './Popover';
|
||||
export { Preset } from './Popover';
|
||||
export default Popover;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import RouteSidebarHidden from './RouteSidebarHidden';
|
||||
export default RouteSidebarHidden;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Scrollable from './Scrollable';
|
||||
export default Scrollable;
|
||||
@@ -1,15 +0,0 @@
|
||||
// @flow
|
||||
import styled from 'styled-components';
|
||||
|
||||
const Subheading = styled.h3`
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
color: #9fa6ab;
|
||||
letter-spacing: 0.04em;
|
||||
border-bottom: 1px solid #ddd;
|
||||
padding-bottom: 10px;
|
||||
margin-top: 30px;
|
||||
`;
|
||||
|
||||
export default Subheading;
|
||||
@@ -1,3 +0,0 @@
|
||||
// @flow
|
||||
import Subheading from './Subheading';
|
||||
export default Subheading;
|
||||
@@ -1,12 +1,19 @@
|
||||
// @flow
|
||||
import parseDomain from 'parse-domain';
|
||||
|
||||
export default function isInternalUrl(href: string) {
|
||||
if (href[0] === '/') return true;
|
||||
|
||||
try {
|
||||
const outline = new URL(BASE_URL);
|
||||
const parsed = new URL(href);
|
||||
return parsed.hostname === outline.hostname;
|
||||
} catch (err) {
|
||||
return false;
|
||||
const outline = parseDomain(BASE_URL);
|
||||
const parsed = parseDomain(href);
|
||||
if (
|
||||
parsed &&
|
||||
outline &&
|
||||
parsed.domain === outline.domain &&
|
||||
parsed.tld === outline.tld
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user