mirror of
https://github.com/binwiederhier/ntfy.git
synced 2024-12-23 10:12:38 +01:00
Merge branch 'main' of github.com:binwiederhier/ntfy
This commit is contained in:
commit
1d6b792197
1 changed files with 9 additions and 1 deletions
|
@ -90,6 +90,14 @@ const PublishDialog = (props) => {
|
|||
setMessage(props.message);
|
||||
}, [props.message]);
|
||||
|
||||
const updateBaseUrl = (newVal) => {
|
||||
if (validUrl(newVal)) {
|
||||
setBaseUrl(newVal.replace(/\/$/, '')); // strip traililng slash after https?://
|
||||
} else {
|
||||
setBaseUrl(newVal);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
const url = new URL(topicUrl(baseUrl, topic));
|
||||
if (title.trim()) {
|
||||
|
@ -242,7 +250,7 @@ const PublishDialog = (props) => {
|
|||
label={t("publish_dialog_base_url_label")}
|
||||
placeholder={t("publish_dialog_base_url_placeholder")}
|
||||
value={baseUrl}
|
||||
onChange={ev => setBaseUrl(ev.target.value)}
|
||||
onChange={ev => updateBaseUrl(ev.target.value)}
|
||||
disabled={disabled}
|
||||
type="url"
|
||||
variant="standard"
|
||||
|
|
Loading…
Reference in a new issue