mirror of
https://github.com/revoltchat/revite.git
synced 2024-12-26 07:22:10 -05:00
Include noreferrer on embed links / window.open.
This commit is contained in:
parent
d5430a7920
commit
51f23f5aa0
4 changed files with 15 additions and 13 deletions
|
@ -19,8 +19,6 @@ import { useCallback, useContext } from "preact/hooks";
|
||||||
import { internalEmit } from "../../lib/eventEmitter";
|
import { internalEmit } from "../../lib/eventEmitter";
|
||||||
import { determineLink } from "../../lib/links";
|
import { determineLink } from "../../lib/links";
|
||||||
|
|
||||||
import { getState } from "../../redux";
|
|
||||||
|
|
||||||
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
import { useIntermediate } from "../../context/intermediate/Intermediate";
|
||||||
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
||||||
|
|
||||||
|
@ -221,6 +219,7 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
||||||
}
|
}
|
||||||
case "external": {
|
case "external": {
|
||||||
element.setAttribute("target", "_blank");
|
element.setAttribute("target", "_blank");
|
||||||
|
element.setAttribute("rel", "noreferrer");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,15 +151,15 @@ export default function Intermediate(props: Props) {
|
||||||
id: "external_link_prompt",
|
id: "external_link_prompt",
|
||||||
link: link.href,
|
link: link.href,
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
default: {
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
openScreen: (screen: Screen) => openScreen(screen),
|
openScreen: (screen: Screen) => openScreen(screen),
|
||||||
writeClipboard: (text: string) => {
|
writeClipboard: (text: string) => {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
import Modal from "../../../components/ui/Modal";
|
|
||||||
import { dispatch } from "../../../redux";
|
import { dispatch } from "../../../redux";
|
||||||
|
|
||||||
|
import Modal from "../../../components/ui/Modal";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
link: string;
|
link: string;
|
||||||
|
@ -17,7 +18,7 @@ export function ExternalLinkModal({ onClose, link }: Props) {
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
window.open(link, "_blank");
|
window.open(link, "_blank", "noreferrer");
|
||||||
onClose();
|
onClose();
|
||||||
},
|
},
|
||||||
confirmation: true,
|
confirmation: true,
|
||||||
|
@ -36,15 +37,17 @@ export function ExternalLinkModal({ onClose, link }: Props) {
|
||||||
const url = new URL(link);
|
const url = new URL(link);
|
||||||
dispatch({
|
dispatch({
|
||||||
type: "TRUSTED_LINKS_ADD_DOMAIN",
|
type: "TRUSTED_LINKS_ADD_DOMAIN",
|
||||||
domain: url.hostname
|
domain: url.hostname,
|
||||||
});
|
});
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
window.open(link, "_blank");
|
window.open(link, "_blank", "noreferrer");
|
||||||
onClose();
|
onClose();
|
||||||
},
|
},
|
||||||
plain: true,
|
plain: true,
|
||||||
children: <Text id="app.special.modals.external_links.trust_domain" />,
|
children: (
|
||||||
}
|
<Text id="app.special.modals.external_links.trust_domain" />
|
||||||
|
),
|
||||||
|
},
|
||||||
]}>
|
]}>
|
||||||
<Text id="app.special.modals.external_links.short" /> <br />
|
<Text id="app.special.modals.external_links.short" /> <br />
|
||||||
<a>{link}</a>
|
<a>{link}</a>
|
||||||
|
|
|
@ -53,7 +53,7 @@ export function Feedback() {
|
||||||
</CategoryButton>
|
</CategoryButton>
|
||||||
</a>
|
</a>
|
||||||
<Link to="/invite/Testers">
|
<Link to="/invite/Testers">
|
||||||
<a target="_blank" rel="noreferrer">
|
<a>
|
||||||
<CategoryButton
|
<CategoryButton
|
||||||
hover
|
hover
|
||||||
action="chevron"
|
action="chevron"
|
||||||
|
|
Loading…
Reference in a new issue