diff --git a/plugins/koinsight.koplugin/settings.lua b/plugins/koinsight.koplugin/settings.lua index 01643794..5c1febdf 100644 --- a/plugins/koinsight.koplugin/settings.lua +++ b/plugins/koinsight.koplugin/settings.lua @@ -219,9 +219,28 @@ function KoInsightSettings:editServerSettings() text = _("Apply"), callback = function() local myfields = self.settings_dialog:getFields() - self:setServerURL(myfields[1]) + local server_url = myfields[1] + + if server_url == "" then + UIManager:show(InfoMessage:new({ + text = _("Please enter a server URL."), + })) + return + end + + if not server_url:match("^https?://") then + UIManager:show(InfoMessage:new({ + text = _("The server URL must start with 'http://' or 'https://'.\n\n"), + })) + return + end + + self:setServerURL(server_url) UIManager:close(self.settings_dialog) - UIManager:show(InfoMessage:new({ text = _("KoInsight settings saved."), timeout = 2 })) + UIManager:show(InfoMessage:new({ + text = _("KoInsight settings saved."), + timeout = 2, + })) end, }, },