Updates clearing url steps
This commit is contained in:
@@ -16,5 +16,27 @@ export function clearUrl(url: string): string {
|
|||||||
|
|
||||||
clearedUrl = clearedUrl.replace(/\/+$/, "");
|
clearedUrl = clearedUrl.replace(/\/+$/, "");
|
||||||
|
|
||||||
|
const { hostname } = new URL(clearedUrl);
|
||||||
|
const cleanHostname = hostname.substring(
|
||||||
|
hostname.indexOf(".") + 1,
|
||||||
|
hostname.lastIndexOf("."),
|
||||||
|
);
|
||||||
|
|
||||||
|
let hostnameReplaceStr = "";
|
||||||
|
|
||||||
|
if (cleanHostname === "fixupx" || cleanHostname.endsWith("twitter")) {
|
||||||
|
hostnameReplaceStr = "x";
|
||||||
|
} else if (cleanHostname.endsWith("vm.tiktok")) {
|
||||||
|
hostnameReplaceStr = "vm.tiktok";
|
||||||
|
} else if (cleanHostname.endsWith("tiktok")) {
|
||||||
|
hostnameReplaceStr = "tiktok";
|
||||||
|
} else if (cleanHostname.endsWith("instagram")) {
|
||||||
|
hostnameReplaceStr = "instagram";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hostnameReplaceStr) {
|
||||||
|
clearedUrl = clearedUrl.replace(cleanHostname, hostnameReplaceStr);
|
||||||
|
}
|
||||||
|
|
||||||
return clearedUrl;
|
return clearedUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user