add duplicate button and fix http protocol parsing in case user inputs protocol

This commit is contained in:
fuomag9
2026-01-20 01:01:16 +01:00
parent ce741c98c6
commit d874cb9a69
3 changed files with 54 additions and 10 deletions

View File

@@ -42,7 +42,16 @@ export function UpstreamInput({
const handleAddressChange = (index: number, newAddress: string) => {
const updated = [...entries];
updated[index].address = newAddress;
// Strip protocol if user pasted a full URL
if (newAddress.startsWith("https://")) {
updated[index].protocol = "https://";
updated[index].address = newAddress.slice(8);
} else if (newAddress.startsWith("http://")) {
updated[index].protocol = "http://";
updated[index].address = newAddress.slice(7);
} else {
updated[index].address = newAddress;
}
setEntries(updated);
};