mirror of
https://github.com/binwiederhier/ntfy.git
synced 2025-09-13 15:21:23 +02:00
Remove now unused splitTopicUrl function
This commit is contained in:
parent
83bb9951b0
commit
3f96fad7ce
2 changed files with 2 additions and 20 deletions
|
@ -23,28 +23,10 @@ export const shortUrl = (url) => url.replaceAll(/https?:\/\//g, "");
|
|||
export const expandUrl = (url) => [`https://${url}`, `http://${url}`];
|
||||
export const expandSecureUrl = (url) => `https://${url}`;
|
||||
|
||||
export const splitTopicUrl = (url) => {
|
||||
if (!validTopicUrl(url)) {
|
||||
throw new Error("Invalid topic URL");
|
||||
}
|
||||
const parts = url.split("/");
|
||||
if (parts.length < 2) {
|
||||
throw new Error("Invalid topic URL");
|
||||
}
|
||||
return {
|
||||
baseUrl: parts.slice(0, parts.length-1).join("/"),
|
||||
topic: parts[parts.length-1]
|
||||
};
|
||||
};
|
||||
|
||||
export const validUrl = (url) => {
|
||||
return url.match(/^https?:\/\//);
|
||||
}
|
||||
|
||||
export const validTopicUrl = (url) => {
|
||||
return url.match(/^https?:\/\/.+\/.*[^/]/); // At least one other slash
|
||||
}
|
||||
|
||||
export const validTopic = (topic) => {
|
||||
if (disallowedTopic(topic)) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue