mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-07 01:15:28 +00:00
Merge pull request #132 from flaree/handle-subdomains
This commit is contained in:
@@ -32,6 +32,13 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ALLOWED_ORIGINS = [
|
||||||
|
location.hostname,
|
||||||
|
'app.revolt.chat',
|
||||||
|
'nightly.revolt.chat',
|
||||||
|
'local.revolt.chat',
|
||||||
|
];
|
||||||
|
|
||||||
// Handler for code block copy.
|
// Handler for code block copy.
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
window.copycode = function (element: HTMLDivElement) {
|
window.copycode = function (element: HTMLDivElement) {
|
||||||
@@ -172,7 +179,7 @@ export default function Renderer({ content, disallowBigEmoji }: MarkdownProps) {
|
|||||||
try {
|
try {
|
||||||
const url = new URL(href, location.href);
|
const url = new URL(href, location.href);
|
||||||
|
|
||||||
if (url.hostname === location.hostname) {
|
if (ALLOWED_ORIGINS.includes(url.hostname)) {
|
||||||
internal = true;
|
internal = true;
|
||||||
element.addEventListener(
|
element.addEventListener(
|
||||||
"click",
|
"click",
|
||||||
|
|||||||
Reference in New Issue
Block a user