diff options
Diffstat (limited to 'apps/web/app/reader/_components/add-feed-dialog.tsx')
| -rw-r--r-- | apps/web/app/reader/_components/add-feed-dialog.tsx | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/apps/web/app/reader/_components/add-feed-dialog.tsx b/apps/web/app/reader/_components/add-feed-dialog.tsx index ff3e916..4ffbd39 100644 --- a/apps/web/app/reader/_components/add-feed-dialog.tsx +++ b/apps/web/app/reader/_components/add-feed-dialog.tsx @@ -3,6 +3,7 @@ import { useState, useEffect, useRef } from "react" import { useSubscribeToFeed } from "@/lib/queries/use-subscribe-to-feed" import { useSubscriptions } from "@/lib/queries/use-subscriptions" +import { useUserProfile } from "@/lib/queries/use-user-profile" import { useUserInterfaceStore } from "@/lib/stores/user-interface-store" export function AddFeedDialog() { @@ -13,13 +14,21 @@ export function AddFeedDialog() { const [selectedFolderIdentifier, setSelectedFolderIdentifier] = useState< string | null >(null) + const [authenticationType, setAuthenticationType] = useState("none") + const [feedCredential, setFeedCredential] = useState("") const subscribeToFeed = useSubscribeToFeed() const { data: subscriptionsData } = useSubscriptions() + const { data: userProfile } = useUserProfile() + + const supportsAuthenticatedFeeds = + userProfile?.tier === "pro" || userProfile?.tier === "developer" function handleClose() { setFeedUrl("") setCustomTitle("") setSelectedFolderIdentifier(null) + setAuthenticationType("none") + setFeedCredential("") setOpen(false) } @@ -31,6 +40,10 @@ export function AddFeedDialog() { feedUrl, folderIdentifier: selectedFolderIdentifier, customTitle: customTitle || null, + feedCredential: + authenticationType !== "none" ? feedCredential : null, + feedAuthenticationType: + authenticationType !== "none" ? authenticationType : null, }, { onSuccess: () => { @@ -124,6 +137,42 @@ export function AddFeedDialog() { ))} </select> </div> + {supportsAuthenticatedFeeds && ( + <div className="space-y-2"> + <label + htmlFor="auth-type" + className="text-text-secondary" + > + authentication (optional) + </label> + <select + id="auth-type" + value={authenticationType} + onChange={(event) => setAuthenticationType(event.target.value)} + className="w-full border border-border bg-background-primary px-3 py-2 text-text-primary outline-none" + > + <option value="none">none</option> + <option value="bearer">bearer token</option> + <option value="basic">basic (user:pass)</option> + <option value="query_param">query parameter</option> + </select> + {authenticationType !== "none" && ( + <input + type="password" + value={feedCredential} + onChange={(event) => setFeedCredential(event.target.value)} + placeholder={ + authenticationType === "query_param" + ? "api_key=your_token" + : authenticationType === "basic" + ? "username:password" + : "your token" + } + className="w-full border border-border bg-background-primary px-3 py-2 text-text-primary outline-none placeholder:text-text-dim focus:border-text-dim" + /> + )} + </div> + )} <div className="flex gap-2"> <button type="button" |