diff --git a/src/renderer/src/lib/path-parser.ts b/src/renderer/src/lib/path-parser.ts index 4b3ff1d26..65944cfb0 100644 --- a/src/renderer/src/lib/path-parser.ts +++ b/src/renderer/src/lib/path-parser.ts @@ -44,6 +44,11 @@ export const regexpPathToPath = ( }, options?: Omit, ): string => { + for (const param in params) { + if (params[param] === "") { + delete params[param] + } + } const transformedPath = transformUriPath(regexpPath) const paramsKeys = pathToRegexp(transformedPath).keys diff --git a/src/renderer/src/modules/discover/content-components.tsx b/src/renderer/src/modules/discover/content-components.tsx index 99f3bcb6b..2c81ea476 100644 --- a/src/renderer/src/modules/discover/content-components.tsx +++ b/src/renderer/src/modules/discover/content-components.tsx @@ -38,12 +38,9 @@ const FeedMaintainers = ({ maintainers }: { maintainers?: string[] }) => { } return ( -
-

- The maintainers of this feed are as follows. If you have any questions - or suggestions, you can contact them. -

- +
) } -export const FeedDescription = ({ description }: { description?: string }) => { +const FeedDescription = ({ description }: { description?: string }) => { if (!description) { - return

This feed does not have a description.

+ return null } return ( @@ -109,19 +106,8 @@ export const DiscoverFeedForm = ({ [keys], ) - const defaultValue = useMemo(() => { - const ret = {} - if (!route.parameters) return ret - for (const key in route.parameters) { - const params = normalizeRSSHubParameters(route.parameters[key]) - if (!params) continue - ret[key] = params.default - } - return ret - }, [route.parameters]) const form = useForm>({ resolver: zodResolver(dynamicFormSchema), - defaultValues: defaultValue, mode: "all", }) as UseFormReturn @@ -174,6 +160,11 @@ export const DiscoverFeedForm = ({ }, [formElRef]) return (
+ { form.setValue(keyItem.name, value) }} - defaultValue={parameters?.default || void 0} > - + {parameters.options.map((option) => ( - + {option.label} + {parameters.default === option.value && " (default)"} ))} @@ -215,7 +206,6 @@ export const DiscoverFeedForm = ({ )} {!!parameters && ( @@ -227,11 +217,7 @@ export const DiscoverFeedForm = ({ ) })} - + @@ -263,7 +249,7 @@ const PreviewUrl: FC<{ const renderedPath = `${routePrefix}${fullPath}` return ( -
+
         {renderedPath}
       
diff --git a/src/renderer/src/modules/discover/recommendation-content.tsx b/src/renderer/src/modules/discover/recommendation-content.tsx index 815769e29..c3ce6478b 100644 --- a/src/renderer/src/modules/discover/recommendation-content.tsx +++ b/src/renderer/src/modules/discover/recommendation-content.tsx @@ -1,4 +1,4 @@ -import { DiscoverFeedForm, FeedDescription } from "./content-components" +import { DiscoverFeedForm } from "./content-components" import type { RSSHubRoute } from "./types" export const RecommendationContent = ({ @@ -9,8 +9,6 @@ export const RecommendationContent = ({ routePrefix: string }) => (
- -
)