fix: accept direct icon URLs
Use valid direct HTTP(S) icon URLs without repository search.
This commit is contained in:
1 parent
fcc5130068
commit
edb56f3fcd
3 files changed
+15
-5
No files matched your search
@@ -31,4 +31,4 @@ Icons that are high quality and printable ([SVG](https://wikipedia.org/wiki/Scal
|
||||
|
||||
### Using external icons
|
||||
If you don't find the icon you're looking for on Dashboard Icons or wish to use a different source, you can simply enter a URL that points to an icon.
|
||||
It is important that the URL directly points to the file without any advertisements or elements around it.
|
||||
Direct HTTP(S) image URLs are used as entered instead of being searched in the built-in repositories. It is important that the URL directly points to the file without any advertisements or elements around it.
|
||||
@@ -28,7 +28,7 @@ The name must be at least one character long and can be chosen freely.
|
||||
### Icon URL
|
||||
|
||||
This is the URL to the icon that will be displayed on the app widget.
|
||||
It can be a url to an image in the internet, one from the included icon repositories or a local file uploaded through the upload button.
|
||||
You can paste a direct HTTP(S) URL to an image, search the included icon repositories by name, or upload a local file through the upload button. Direct image URLs are used as entered and are not searched in the icon repositories.
|
||||
|
||||

|
||||
|
||||
@@ -50,4 +50,4 @@ It's useful when you want to ping the service internally for example with a cust
|
||||
|
||||
On the apps management page you find all apps that exist in your Homarr instance. You can edit and delete them.
|
||||
|
||||

|
||||

|
||||
@@ -165,8 +165,18 @@ export const IconPicker = ({
|
||||
leftSection={leftSection}
|
||||
value={inputValue}
|
||||
onChange={(event) => {
|
||||
combobox.openDropdown();
|
||||
setQuery(event.currentTarget.value);
|
||||
const nextValue = event.currentTarget.value;
|
||||
const trimmedValue = nextValue.trim();
|
||||
if (/^https?:\/\/[^\s/]+(?:\/\S*)?$/i.test(trimmedValue)) {
|
||||
startTransition(() => {
|
||||
setValue(trimmedValue);
|
||||
setQuery("");
|
||||
combobox.closeDropdown();
|
||||
});
|
||||
} else {
|
||||
combobox.openDropdown();
|
||||
setQuery(nextValue);
|
||||
}
|
||||
}}
|
||||
onClick={() => combobox.openDropdown()}
|
||||
onFocus={(event) => {
|
||||
|
||||
Reference in new issue
Block a user