mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
🐛 Allow anything in the input for the form.
If it works, it works. Fixes #256
This commit is contained in:
@@ -123,13 +123,9 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
|||||||
validate: {
|
validate: {
|
||||||
apiKey: () => null,
|
apiKey: () => null,
|
||||||
// Validate icon with a regex
|
// Validate icon with a regex
|
||||||
icon: (value: string) => {
|
icon: (value: string) =>
|
||||||
// Regex to match everything that ends with and icon extension
|
// Disable matching to allow any values
|
||||||
if (!value.match(/\.(png|jpg|jpeg|gif|svg)$/)) {
|
null,
|
||||||
return 'Please enter a valid icon URL';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
// Validate url with a regex http/https
|
// Validate url with a regex http/https
|
||||||
url: (value: string) => {
|
url: (value: string) => {
|
||||||
try {
|
try {
|
||||||
@@ -298,64 +294,64 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{form.values.type === 'qBittorrent' && (
|
{form.values.type === 'qBittorrent' && (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
required
|
required
|
||||||
label="Username"
|
label="Username"
|
||||||
placeholder="admin"
|
placeholder="admin"
|
||||||
value={form.values.username}
|
value={form.values.username}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('username', event.currentTarget.value);
|
form.setFieldValue('username', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.username && 'Invalid username'}
|
error={form.errors.username && 'Invalid username'}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
required
|
required
|
||||||
label="Password"
|
label="Password"
|
||||||
placeholder="adminadmin"
|
placeholder="adminadmin"
|
||||||
value={form.values.password}
|
value={form.values.password}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('password', event.currentTarget.value);
|
form.setFieldValue('password', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.password && 'Invalid password'}
|
error={form.errors.password && 'Invalid password'}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{form.values.type === 'Deluge' && (
|
{form.values.type === 'Deluge' && (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
label="Password"
|
label="Password"
|
||||||
placeholder="password"
|
placeholder="password"
|
||||||
value={form.values.password}
|
value={form.values.password}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('password', event.currentTarget.value);
|
form.setFieldValue('password', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.password && 'Invalid password'}
|
error={form.errors.password && 'Invalid password'}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{form.values.type === 'Transmission' && (
|
{form.values.type === 'Transmission' && (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
label="Username"
|
label="Username"
|
||||||
placeholder="admin"
|
placeholder="admin"
|
||||||
value={form.values.username}
|
value={form.values.username}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('username', event.currentTarget.value);
|
form.setFieldValue('username', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.username && 'Invalid username'}
|
error={form.errors.username && 'Invalid username'}
|
||||||
/>
|
/>
|
||||||
<TextInput
|
<TextInput
|
||||||
label="Password"
|
label="Password"
|
||||||
placeholder="adminadmin"
|
placeholder="adminadmin"
|
||||||
value={form.values.password}
|
value={form.values.password}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
form.setFieldValue('password', event.currentTarget.value);
|
form.setFieldValue('password', event.currentTarget.value);
|
||||||
}}
|
}}
|
||||||
error={form.errors.password && 'Invalid password'}
|
error={form.errors.password && 'Invalid password'}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Group>
|
</Group>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Tabs.Tab>
|
</Tabs.Tab>
|
||||||
|
|||||||
Reference in New Issue
Block a user