diff --git a/.env.example b/.env.example index 7d8cee44f..f0cde1cd6 100644 --- a/.env.example +++ b/.env.example @@ -4,3 +4,4 @@ VITE_IMGPROXY_URL=http://localhost:2873 VITE_SENTRY_DSN= VITE_BUILD_TYPE=production VITE_POSTHOG_KEY= +VITE_INBOXES_EMAIL=__devdev@follow.re diff --git a/apps/renderer/src/components/feed-icon.tsx b/apps/renderer/src/components/feed-icon.tsx index 86e5db468..4f504e50d 100644 --- a/apps/renderer/src/components/feed-icon.tsx +++ b/apps/renderer/src/components/feed-icon.tsx @@ -196,6 +196,10 @@ export function FeedIcon({ ) break } + case feed?.type === "inbox": { + ImageElement = + break + } case !!feed?.title && !!feed.title[0]: { ImageElement = fallbackIcon break diff --git a/apps/renderer/src/components/feed-summary.tsx b/apps/renderer/src/components/feed-summary.tsx index da15ca149..ad21f2f6f 100644 --- a/apps/renderer/src/components/feed-summary.tsx +++ b/apps/renderer/src/components/feed-summary.tsx @@ -1,4 +1,5 @@ import { WEB_URL } from "@follow/shared/constants" +import { env } from "@follow/shared/env" import { FeedIcon } from "~/components/feed-icon" import { cn } from "~/lib/utils" @@ -16,15 +17,35 @@ export function FollowSummary({ docs?: string className?: string }) { - const isList = feed.type === "list" + let siteLink + let feedLink + let feedTitle = feed.title + let feedText + switch (feed.type) { + case "feed": { + siteLink = feed.siteUrl || void 0 + feedLink = feed.url || docs + feedText = feed.url || docs + break + } + case "list": { + siteLink = `${WEB_URL}/list/${feed.id}` + feedLink = siteLink + feedText = `/list/${feed.id}` + break + } + case "inbox": { + siteLink = void 0 + feedLink = siteLink + feedText = `${feed.id}${env.VITE_INBOXES_EMAIL}` + feedTitle = feed.title || `${feed.id}'s Inbox` + break + } + } + return (
- +
- {feed.title} + {feedTitle}
@@ -43,15 +64,8 @@ export function FollowSummary({
- - - {`${!isList ? feed.url || docs : `list:${feed.id}`}`} - + + {feedText}
diff --git a/apps/renderer/src/components/ui/markdown/renderers/MarkdownLink.tsx b/apps/renderer/src/components/ui/markdown/renderers/MarkdownLink.tsx index 51a4a58f0..08c005db6 100644 --- a/apps/renderer/src/components/ui/markdown/renderers/MarkdownLink.tsx +++ b/apps/renderer/src/components/ui/markdown/renderers/MarkdownLink.tsx @@ -1,4 +1,3 @@ - import { FeedViewType } from "~/lib/enum" import { useEntryContentContext } from "~/modules/entry-content/hooks" diff --git a/apps/renderer/src/constants/app.tsx b/apps/renderer/src/constants/app.tsx index f9bf576bc..6a3ff78db 100644 --- a/apps/renderer/src/constants/app.tsx +++ b/apps/renderer/src/constants/app.tsx @@ -10,6 +10,8 @@ export const I18N_LOCALE_KEY = getStorageNS("I18N_LOCALE") export const ROUTE_FEED_PENDING = "all" export const ROUTE_ENTRY_PENDING = "pending" export const ROUTE_FEED_IN_FOLDER = "folder-" +export const ROUTE_FEED_IN_LIST = "list-" +export const ROUTE_FEED_IN_INBOX = "inbox-" export const DAILY_CLAIM_AMOUNT = "20" export const INVITATION_PRICE = "100" diff --git a/apps/renderer/src/database/db.ts b/apps/renderer/src/database/db.ts index 8a8ec56a5..bbfcf6d03 100644 --- a/apps/renderer/src/database/db.ts +++ b/apps/renderer/src/database/db.ts @@ -2,10 +2,19 @@ import type { Transaction } from "dexie" import Dexie from "dexie" import { LOCAL_DB_NAME } from "./constants" -import { dbSchemaV1, dbSchemaV2, dbSchemaV3, dbSchemaV4, dbSchemaV5, dbSchemaV6 } from "./db_schema" +import { + dbSchemaV1, + dbSchemaV2, + dbSchemaV3, + dbSchemaV4, + dbSchemaV5, + dbSchemaV6, + dbSchemaV7, +} from "./db_schema" import type { DB_Cleaner } from "./schemas/cleaner" import type { DB_Entry, DB_EntryRelated } from "./schemas/entry" import type { DB_Feed, DB_FeedUnread } from "./schemas/feed" +import type { DB_Inbox } from "./schemas/inbox" import type { DB_List } from "./schemas/list" import type { DB_Subscription } from "./schemas/subscription" @@ -17,6 +26,7 @@ export interface LocalDBSchemaMap { feedUnreads: DB_FeedUnread cleaner: DB_Cleaner lists: DB_List + inboxes: DB_Inbox } // Define a local DB @@ -27,6 +37,7 @@ export class BrowserDB extends Dexie { public entryRelated: BrowserDBTable<"entryRelated"> public feedUnreads: BrowserDBTable<"feedUnreads"> public lists: BrowserDBTable<"lists"> + public inboxes: BrowserDBTable<"inboxes"> public cleaner: BrowserDBTable<"cleaner"> constructor() { @@ -37,6 +48,7 @@ export class BrowserDB extends Dexie { this.version(4).stores(dbSchemaV4) this.version(5).stores(dbSchemaV5) this.version(6).stores(dbSchemaV6) + this.version(7).stores(dbSchemaV7) this.entries = this.table("entries") this.feeds = this.table("feeds") @@ -45,6 +57,7 @@ export class BrowserDB extends Dexie { this.feedUnreads = this.table("feedUnreads") this.cleaner = this.table("cleaner") this.lists = this.table("lists") + this.inboxes = this.table("inboxes") } async upgradeToV2(trans: Transaction) { diff --git a/apps/renderer/src/database/db_schema.ts b/apps/renderer/src/database/db_schema.ts index d49860381..079089555 100644 --- a/apps/renderer/src/database/db_schema.ts +++ b/apps/renderer/src/database/db_schema.ts @@ -33,3 +33,8 @@ export const dbSchemaV6 = { ...dbSchemaV5, lists: "&id, title", } + +export const dbSchemaV7 = { + ...dbSchemaV6, + inboxes: "&id", +} diff --git a/apps/renderer/src/database/schemas/inbox.ts b/apps/renderer/src/database/schemas/inbox.ts new file mode 100644 index 000000000..bf51acce1 --- /dev/null +++ b/apps/renderer/src/database/schemas/inbox.ts @@ -0,0 +1,4 @@ +export type DB_Inbox = { + id: string + title: string +} diff --git a/apps/renderer/src/hooks/biz/useFeedActions.tsx b/apps/renderer/src/hooks/biz/useFeedActions.tsx index 448b41474..d78c0293d 100644 --- a/apps/renderer/src/hooks/biz/useFeedActions.tsx +++ b/apps/renderer/src/hooks/biz/useFeedActions.tsx @@ -1,4 +1,5 @@ import { WEB_URL } from "@follow/shared/constants" +import { env } from "@follow/shared/env" import { useMemo } from "react" import { useTranslation } from "react-i18next" @@ -8,12 +9,15 @@ import type { FeedViewType } from "~/lib/enum" import type { NativeMenuItem } from "~/lib/native-menu" import { useFeedClaimModal } from "~/modules/claim" import { FeedForm } from "~/modules/discover/feed-form" +import { InboxForm } from "~/modules/discover/inbox-form" +import { ListForm } from "~/modules/discover/list-form" import { getFeedById, useAddFeedToFeedList, useFeedById, useRemoveFeedFromFeedList, } from "~/store/feed" +import { useInboxById } from "~/store/inbox" import { useListById, useListByView } from "~/store/list" import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription" @@ -250,7 +254,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie click: () => { present({ title: t("sidebar.feed_actions.edit_list"), - content: ({ dismiss }) => , + content: ({ dismiss }) => , }) }, }, @@ -266,7 +270,7 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie shortcut: "Meta+G", disabled: getRouteParams().feedId === listId, click: () => { - navigateEntry({ feedId: listId }) + navigateEntry({ listId }) }, }, { @@ -313,3 +317,44 @@ export const useListActions = ({ listId, view }: { listId: string; view: FeedVie return { items } } + +export const useInboxActions = ({ inboxId }: { inboxId: string }) => { + const { t } = useTranslation() + const inbox = useInboxById(inboxId) + const { present } = useModalStack() + + const items = useMemo(() => { + if (!inbox) return [] + + const items: NativeMenuItem[] = [ + { + type: "text" as const, + label: t("sidebar.feed_actions.edit"), + shortcut: "E", + click: () => { + present({ + title: t("sidebar.feed_actions.edit_inbox"), + content: ({ dismiss }) => , + }) + }, + }, + { + type: "separator" as const, + disabled: false, + }, + { + type: "text" as const, + label: t("sidebar.feed_actions.copy_email_address"), + shortcut: "Meta+Shift+C", + disabled: false, + click: () => { + navigator.clipboard.writeText(`${inboxId}${env.VITE_INBOXES_EMAIL}`) + }, + }, + ] + + return items + }, [inbox, t, inboxId, present]) + + return { items } +} diff --git a/apps/renderer/src/hooks/biz/useFeedFormModal.tsx b/apps/renderer/src/hooks/biz/useFeedFormModal.tsx index c962a190b..512db28c1 100644 --- a/apps/renderer/src/hooks/biz/useFeedFormModal.tsx +++ b/apps/renderer/src/hooks/biz/useFeedFormModal.tsx @@ -4,6 +4,7 @@ import { useCallback } from "react" import { useWhoami } from "~/atoms/user" import { useModalStack } from "~/components/ui/modal" import { FeedForm } from "~/modules/discover/feed-form" +import { ListForm } from "~/modules/discover/list-form" import { useI18n } from "../common" @@ -25,14 +26,12 @@ export const usePresentFeedFormModal = () => { const isList = !!("listId" in params) present({ title: isList ? t("sidebar.feed_actions.edit_list") : t("sidebar.feed_actions.edit_feed"), - content: ({ dismiss }) => ( - - ), + content: ({ dismiss }) => + isList ? ( + + ) : ( + + ), }) } else { window.location.href = `${DEEPLINK_SCHEME}add?id=${"feedId" in params ? params.feedId : params.listId}` diff --git a/apps/renderer/src/hooks/biz/useNavigateEntry.ts b/apps/renderer/src/hooks/biz/useNavigateEntry.ts index 694ea88bf..dc9dffc67 100644 --- a/apps/renderer/src/hooks/biz/useNavigateEntry.ts +++ b/apps/renderer/src/hooks/biz/useNavigateEntry.ts @@ -3,7 +3,13 @@ import { isUndefined } from "lodash-es" import { getReadonlyRoute, getStableRouterNavigate } from "~/atoms/route" import { setSidebarActiveView } from "~/atoms/sidebar" import { resetShowSourceContent } from "~/atoms/source-content" -import { ROUTE_ENTRY_PENDING, ROUTE_FEED_IN_FOLDER, ROUTE_FEED_PENDING } from "~/constants" +import { + ROUTE_ENTRY_PENDING, + ROUTE_FEED_IN_FOLDER, + ROUTE_FEED_IN_INBOX, + ROUTE_FEED_IN_LIST, + ROUTE_FEED_PENDING, +} from "~/constants" import { FeedViewType } from "~/lib/enum" type NavigateEntryOptions = Partial<{ @@ -11,6 +17,8 @@ type NavigateEntryOptions = Partial<{ entryId: string | null view: FeedViewType folderName: string + inboxId: string + listId: string }> /** * @description a hook to navigate to `feedId`, `entryId`, add search for `view`, `level` @@ -19,7 +27,7 @@ type NavigateEntryOptions = Partial<{ export const useNavigateEntry = () => navigateEntry export const navigateEntry = (options: NavigateEntryOptions) => { - const { entryId, feedId, view, folderName } = options || {} + const { entryId, feedId, view, folderName, inboxId, listId } = options || {} const { params, searchParams } = getReadonlyRoute() let finalFeedId = feedId || params.feedId || ROUTE_FEED_PENDING @@ -31,6 +39,14 @@ export const navigateEntry = (options: NavigateEntryOptions) => { finalFeedId = `${ROUTE_FEED_IN_FOLDER}${folderName}` } + if (inboxId) { + finalFeedId = `${ROUTE_FEED_IN_INBOX}${inboxId}` + } + + if (listId) { + finalFeedId = `${ROUTE_FEED_IN_LIST}${listId}` + } + finalFeedId = encodeURIComponent(finalFeedId) const nextSearchParams = new URLSearchParams(searchParams) diff --git a/apps/renderer/src/hooks/biz/useRouteParams.ts b/apps/renderer/src/hooks/biz/useRouteParams.ts index ab428ae66..dc9ab5479 100644 --- a/apps/renderer/src/hooks/biz/useRouteParams.ts +++ b/apps/renderer/src/hooks/biz/useRouteParams.ts @@ -6,6 +6,8 @@ import { FEED_COLLECTION_LIST, ROUTE_ENTRY_PENDING, ROUTE_FEED_IN_FOLDER, + ROUTE_FEED_IN_INBOX, + ROUTE_FEED_IN_LIST, ROUTE_FEED_PENDING, } from "~/constants" import { FeedViewType } from "~/lib/enum" @@ -42,8 +44,9 @@ export interface BizRouteParams { isCollection: boolean isAllFeeds: boolean isPendingEntry: boolean - folderName?: string + inboxId?: string + listId?: string } const parseRouteParams = (params: Params, search: URLSearchParams): BizRouteParams => { @@ -64,6 +67,12 @@ const parseRouteParams = (params: Params, search: URLSearchParams): BizRout folderName: params.feedId?.startsWith(ROUTE_FEED_IN_FOLDER) ? params.feedId.slice(ROUTE_FEED_IN_FOLDER.length) : undefined, + inboxId: params.feedId?.startsWith(ROUTE_FEED_IN_INBOX) + ? params.feedId.slice(ROUTE_FEED_IN_INBOX.length) + : undefined, + listId: params.feedId?.startsWith(ROUTE_FEED_IN_LIST) + ? params.feedId.slice(ROUTE_FEED_IN_LIST.length) + : undefined, } } diff --git a/apps/renderer/src/lib/utils.ts b/apps/renderer/src/lib/utils.ts index d68b00ca4..90db88790 100644 --- a/apps/renderer/src/lib/utils.ts +++ b/apps/renderer/src/lib/utils.ts @@ -18,20 +18,38 @@ export function clamp(value, min, max) { return Math.max(Math.min(max, value), min) } -export function getEntriesParams({ id, view }: { id?: number | string; view?: number }) { +export function getEntriesParams({ + feedId, + inboxId, + listId, + view, +}: { + feedId?: number | string + inboxId?: number | string + listId?: number | string + view?: number +}) { const params: { feedId?: string feedIdList?: string[] isCollection?: boolean withContent?: boolean + inboxId?: string + listId?: string } = {} - if (id === FEED_COLLECTION_LIST) { - params.isCollection = true - } else if (id && id !== ROUTE_FEED_PENDING) { - if (id.toString().includes(",")) { - params.feedIdList = `${id}`.split(",") - } else { - params.feedId = `${id}` + if (inboxId) { + params.inboxId = `${inboxId}` + } else if (listId) { + params.listId = `${listId}` + } else if (feedId) { + if (feedId === FEED_COLLECTION_LIST) { + params.isCollection = true + } else if (feedId !== ROUTE_FEED_PENDING) { + if (feedId.toString().includes(",")) { + params.feedIdList = `${feedId}`.split(",") + } else { + params.feedId = `${feedId}` + } } } if (view === FeedViewType.SocialMedia) { diff --git a/apps/renderer/src/models/types.ts b/apps/renderer/src/models/types.ts index 8e22ddc5b..6d694a779 100644 --- a/apps/renderer/src/models/types.ts +++ b/apps/renderer/src/models/types.ts @@ -27,8 +27,11 @@ export type FeedModel = ExtractBizResponse["data"][ export type ListModelPoplutedFeeds = ExtractBizResponse["data"]["list"] export type ListModel = Omit -export type FeedOrListRespModel = FeedModel | ListModelPoplutedFeeds -export type FeedOrListModel = FeedModel | ListModel + +export type InboxModel = ExtractBizResponse["data"] + +export type FeedOrListRespModel = FeedModel | ListModelPoplutedFeeds | InboxModel +export type FeedOrListModel = FeedModel | ListModel | InboxModel export type EntryResponse = Exclude< Extract, { code: 0 }>["data"], @@ -36,7 +39,8 @@ export type EntryResponse = Exclude< > export type EntriesResponse = Array< - Exclude>["data"], undefined> + | Exclude>["data"], undefined> + | Exclude>["data"], undefined> >[number] export type CombinedEntryModel = EntriesResponse[number] & { diff --git a/apps/renderer/src/modules/discover/feed-form.tsx b/apps/renderer/src/modules/discover/feed-form.tsx index 4547a03bc..a1f14303c 100644 --- a/apps/renderer/src/modules/discover/feed-form.tsx +++ b/apps/renderer/src/modules/discover/feed-form.tsx @@ -31,6 +31,7 @@ import { FeedViewType } from "~/lib/enum" import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser" import { getNewIssueUrl } from "~/lib/issues" import { cn } from "~/lib/utils" +import type { FeedModel } from "~/models" import { feed as feedQuery, useFeed } from "~/queries/feed" import { subscription as subscriptionQuery } from "~/queries/subscriptions" import { useFeedByIdOrUrl } from "~/store/feed" @@ -47,18 +48,15 @@ const formSchema = z.object({ }) const defaultValue = { view: FeedViewType.Articles.toString() } as z.infer + export const FeedForm: Component<{ url?: string id?: string - isList?: boolean - defaultValues?: z.infer - asWidget?: boolean - onSuccess?: () => void -}> = ({ id: _id, defaultValues = defaultValue, url, asWidget, onSuccess, isList }) => { - const queryParams = { id: _id, url, isList } +}> = ({ id: _id, defaultValues = defaultValue, url, asWidget, onSuccess }) => { + const queryParams = { id: _id, url } const feedQuery = useFeed(queryParams) @@ -66,7 +64,7 @@ export const FeedForm: Component<{ const feed = useFeedByIdOrUrl({ id, url, - }) + }) as FeedModel const hasSub = useSubscriptionByFeedId(feed?.id || "") const isSubscribed = !!feedQuery.data?.subscription || hasSub @@ -96,6 +94,7 @@ export const FeedForm: Component<{ asWidget, onSuccess, subscriptionData: feedQuery.data?.subscription, + feed, }} /> ) : feedQuery.isLoading ? ( @@ -162,13 +161,12 @@ export const FeedForm: Component<{ const FeedInnerForm = ({ defaultValues, id, - url, asWidget, onSuccess, subscriptionData, + feed, }: { defaultValues?: z.infer - url?: string id?: string asWidget?: boolean onSuccess?: () => void @@ -178,21 +176,15 @@ const FeedInnerForm = ({ isPrivate?: boolean title?: string | null } + feed: FeedModel }) => { const subscription = useSubscriptionByFeedId(id || "") || subscriptionData const isSubscribed = !!subscription const buttonRef = useRef(null) - const feed = useFeedByIdOrUrl({ id, url })! - const isList = feed?.type === "list" const form = useForm>({ resolver: zodResolver(formSchema), - defaultValues: isList - ? { - ...defaultValues, - view: feed.view.toString(), - } - : defaultValues, + defaultValues, }) const { setClickOutSideToDismiss, dismiss } = useCurrentModal() @@ -213,12 +205,12 @@ const FeedInnerForm = ({ const followMutation = useMutation({ mutationFn: async (values: z.infer) => { const body = { - ...(isList ? { listId: feed.id } : { url: feed.url }), + url: feed.url, view: Number.parseInt(values.view), category: values.category, isPrivate: values.isPrivate, title: values.title, - ...(isSubscribed && !isList && { feedId: feed.id }), + feedId: feed.id, } const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post @@ -289,11 +281,7 @@ const FeedInnerForm = ({ {t("feed_form.view")} - + )} @@ -314,36 +302,34 @@ const FeedInnerForm = ({ )} /> - {!isList && ( - ( - + ( + +
+ {t("feed_form.category")} + {t("feed_form.category_description")} +
+
- {t("feed_form.category")} - {t("feed_form.category_description")} + { + if (suggestion) { + field.onChange(suggestion.value) + } + }} + />
- -
- { - if (suggestion) { - field.onChange(suggestion.value) - } - }} - /> -
-
- -
- )} - /> - )} + + +
+ )} + /> )} /> - {isList && !!feed.fee && !isSubscribed && ( -
- - {t("feed_form.fee")}{" "} -
- {feed.fee} - -
-
- {t("feed_form.fee_description")} -
- )}
{isSubscribed && (
diff --git a/apps/renderer/src/modules/discover/form.tsx b/apps/renderer/src/modules/discover/form.tsx index 68e18bd31..d17d23ba3 100644 --- a/apps/renderer/src/modules/discover/form.tsx +++ b/apps/renderer/src/modules/discover/form.tsx @@ -30,6 +30,7 @@ import type { FeedViewType } from "~/lib/enum" import { FollowSummary } from "../../components/feed-summary" import { FeedForm } from "./feed-form" +import { ListForm } from "./list-form" const formSchema = z.object({ keyword: z.string().min(1), @@ -63,7 +64,7 @@ const info: Record< } type DiscoverSearchData = Awaited>["data"] -export function DiscoverForm({ type }: { type: string }) { +export function DiscoverForm({ type = "search" }: { type?: string }) { const { prefix, default: defaultValue } = info[type] const form = useForm>({ resolver: zodResolver(formSchema), @@ -320,21 +321,33 @@ const SearchCard: FC<{ onClick={() => { present({ title: "Add Feed", - content: ({ dismiss }) => ( - { - onSuccess(item) - dismiss() - }} - /> - ), + content: ({ dismiss }) => + item.list?.id ? ( + { + onSuccess(item) + dismiss() + }} + /> + ) : ( + { + onSuccess(item) + dismiss() + }} + /> + ), }) }} > diff --git a/apps/renderer/src/modules/discover/inbox-form.tsx b/apps/renderer/src/modules/discover/inbox-form.tsx new file mode 100644 index 000000000..993abe0ee --- /dev/null +++ b/apps/renderer/src/modules/discover/inbox-form.tsx @@ -0,0 +1,202 @@ +import { env } from "@follow/shared/env" +import { zodResolver } from "@hookform/resolvers/zod" +import { useMutation } from "@tanstack/react-query" +import { useForm } from "react-hook-form" +import { useTranslation } from "react-i18next" +import { toast } from "sonner" +import { z } from "zod" + +import { FollowSummary } from "~/components/feed-summary" +import { Logo } from "~/components/icons/logo" +import { Button } from "~/components/ui/button" +import { Card, CardHeader } from "~/components/ui/card" +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" +import { apiClient } from "~/lib/api-fetch" +import { FeedViewType } from "~/lib/enum" +import { cn } from "~/lib/utils" +import type { InboxModel } from "~/models" +import { useInbox } from "~/queries/inboxes" +import { useInboxById } from "~/store/inbox" +import { subscriptionActions } from "~/store/subscription" + +export const InboxForm: Component<{ + id?: string + asWidget?: boolean + onSuccess?: () => void +}> = ({ id: _id, asWidget, onSuccess }) => { + const queryParams = { id: _id } + + const feedQuery = useInbox(queryParams) + + const id = feedQuery.data?.id || _id + const inbox = useInboxById(id) + + const isSubscribed = true + + const { t } = useTranslation() + + return ( +
+ {!asWidget && ( +
+ + {isSubscribed ? t("feed_form.update_follow") : t("feed_form.add_follow")} +
+ )} + +
+ ) +} + +const inboxHandleSchema = z + .string() + .min(3) + .max(32) + .regex(/^[a-z0-9_-]+$/) + +const formSchema = z.object({ + handle: inboxHandleSchema, + title: z.string(), +}) + +const InboxInnerForm = ({ + onSuccess, + inbox, +}: { + onSuccess?: () => void + inbox?: Nullable +}) => { + const { t } = useTranslation() + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + handle: inbox?.id, + title: inbox?.title || "", + }, + }) + + const mutationCreate = useMutation({ + mutationFn: async ({ handle, title }: { handle: string; title: string }) => { + await apiClient.inboxes.$post({ + json: { + handle, + title, + }, + }) + onSuccess?.() + }, + onSuccess: (_) => { + subscriptionActions.fetchByView(FeedViewType.Articles) + toast.success(t("discover.inbox_create_success")) + }, + onError: () => { + toast.error(t("discover.inbox_create_error")) + }, + }) + + const mutationChange = useMutation({ + mutationFn: async ({ handle, title }: { handle: string; title: string }) => { + await apiClient.inboxes.$put({ + json: { + handle, + title, + }, + }) + onSuccess?.() + }, + onSuccess: () => { + subscriptionActions.fetchByView(FeedViewType.Articles) + toast.success(t("discover.inbox_update_success")) + }, + onError: () => { + toast.error(t("discover.inbox_update_error")) + }, + }) + + function onSubmit(values: z.infer) { + if (inbox) { + mutationChange.mutate({ handle: values.handle, title: values.title }) + } else { + mutationCreate.mutate({ handle: values.handle, title: values.title }) + } + } + + return ( +
+ {inbox && ( + + + + + + )} + <> +
+ + {!inbox && ( + ( + + {t("discover.inbox_handle")} + +
+ + {env.VITE_INBOXES_EMAIL} +
+
+ +
+ )} + /> + )} + ( + + {t("discover.inbox_title")} + + + + + + )} + /> +
+ +
+ + + +
+ ) +} diff --git a/apps/renderer/src/modules/discover/inbox-list-form.tsx b/apps/renderer/src/modules/discover/inbox-list-form.tsx new file mode 100644 index 000000000..9a5f11562 --- /dev/null +++ b/apps/renderer/src/modules/discover/inbox-list-form.tsx @@ -0,0 +1,157 @@ +import { env } from "@follow/shared/env" +import { useMutation } from "@tanstack/react-query" +import { useTranslation } from "react-i18next" +import { toast } from "sonner" + +import { Button } from "~/components/ui/button" +import { CopyButton } from "~/components/ui/code-highlighter" +import { useModalStack } from "~/components/ui/modal" +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeader, + TableRow, +} from "~/components/ui/table" +import { apiClient } from "~/lib/api-fetch" +import { FeedViewType } from "~/lib/enum" +import { inboxActions, useInboxByView } from "~/store/inbox" + +import { InboxForm } from "./inbox-form" + +export function DiscoverInboxList() { + const { t } = useTranslation() + const inboxes = useInboxByView(FeedViewType.Articles) + + const { present } = useModalStack() + + return ( + <> +
+ {t("discover.inbox.description")} + + {t("discover.inbox.webhooks_docs")} + +
+ + + + {t("discover.inbox.handle")} + {t("discover.inbox.email")} + {t("discover.inbox.title")} + {t("discover.inbox.secret")} + {t("discover.inbox.actions")} + + + + {inboxes.map((inbox) => ( + + {inbox.id} + +
+ + {inbox.id} + {env.VITE_INBOXES_EMAIL} + + +
+
+ {inbox.title} + +
+ **** + +
+
+ + + + +
+ ))} +
+
+
+ +
+ + ) +} + +const ConfirmDestroyModalContent = ({ id, dismiss }: { id: string; dismiss: () => void }) => { + const { t } = useTranslation() + + const mutationDestroy = useMutation({ + mutationFn: async (id: string) => { + await apiClient.inboxes.$delete({ + json: { + handle: id, + }, + }) + }, + onSuccess: (_, handle) => { + inboxActions.clearByInboxId(handle) + toast.success(t("discover.inbox_destroy_success")) + dismiss() + }, + onError: () => { + toast.error(t("discover.inbox_destroy_error")) + }, + }) + + return ( +
+
{t("discover.inbox_destroy_warning")}
+
+ +
+
+ ) +} diff --git a/apps/renderer/src/modules/discover/list-form.tsx b/apps/renderer/src/modules/discover/list-form.tsx new file mode 100644 index 000000000..2b2e185ac --- /dev/null +++ b/apps/renderer/src/modules/discover/list-form.tsx @@ -0,0 +1,356 @@ +import { zodResolver } from "@hookform/resolvers/zod" +import { useMutation } from "@tanstack/react-query" +import { useEffect, useRef } from "react" +import { useForm } from "react-hook-form" +import { useTranslation } from "react-i18next" +import { toast } from "sonner" +import { z } from "zod" + +import { FollowSummary } from "~/components/feed-summary" +import { Logo } from "~/components/icons/logo" +import { Button } from "~/components/ui/button" +import { Card, CardHeader } from "~/components/ui/card" +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "~/components/ui/form" +import { Input } from "~/components/ui/input" +import { LoadingCircle } from "~/components/ui/loading" +import { useCurrentModal } from "~/components/ui/modal" +import { Switch } from "~/components/ui/switch" +import { useI18n } from "~/hooks/common" +import { apiClient } from "~/lib/api-fetch" +import { tipcClient } from "~/lib/client" +import { FeedViewType } from "~/lib/enum" +import { getFetchErrorMessage, toastFetchError } from "~/lib/error-parser" +import { getNewIssueUrl } from "~/lib/issues" +import { cn } from "~/lib/utils" +import type { ListModel } from "~/models" +import { lists as listsQuery, useList } from "~/queries/lists" +import { subscription as subscriptionQuery } from "~/queries/subscriptions" +import { useListById } from "~/store/list" +import { useSubscriptionByFeedId } from "~/store/subscription" +import { feedUnreadActions } from "~/store/unread" + +import { ViewSelectorRadioGroup } from "../shared/ViewSelectorRadioGroup" + +const formSchema = z.object({ + view: z.string(), + category: z.string().nullable().optional(), + isPrivate: z.boolean().optional(), + title: z.string().optional(), +}) + +const defaultValue = { view: FeedViewType.Articles.toString() } as z.infer + +export const ListForm: Component<{ + id?: string + + defaultValues?: z.infer + + asWidget?: boolean + + onSuccess?: () => void +}> = ({ id: _id, defaultValues = defaultValue, asWidget, onSuccess }) => { + const queryParams = { id: _id } + + const feedQuery = useList(queryParams) + + const id = feedQuery.data?.list.id || _id + const list = useListById(id) + + const hasSub = useSubscriptionByFeedId(list?.id || "") + const isSubscribed = !!feedQuery.data?.subscription || hasSub + + const { t } = useTranslation() + + return ( +
+ {!asWidget && ( +
+ + {isSubscribed ? t("feed_form.update_follow") : t("feed_form.add_follow")} +
+ )} + + {list ? ( + + ) : feedQuery.isLoading ? ( +
+ +
+ ) : feedQuery.error ? ( +
+ +

{t("feed_form.error_fetching_feed")}

+

+ {getFetchErrorMessage(feedQuery.error)} +

+ +
+ + + +
+
+ ) : ( +
+ +

{t("feed_form.feed_not_found")}

+

{id}

+
+ )} +
+ ) +} + +const ListInnerForm = ({ + defaultValues, + id, + asWidget, + onSuccess, + subscriptionData, + list, +}: { + defaultValues?: z.infer + id?: string + asWidget?: boolean + onSuccess?: () => void + subscriptionData?: { + view?: number + category?: string | null + isPrivate?: boolean + title?: string | null + } + list: ListModel +}) => { + const subscription = useSubscriptionByFeedId(id || "") || subscriptionData + const isSubscribed = !!subscription + const buttonRef = useRef(null) + + const form = useForm>({ + resolver: zodResolver(formSchema), + defaultValues: { + ...defaultValues, + view: list.view.toString(), + }, + }) + + const { setClickOutSideToDismiss, dismiss } = useCurrentModal() + + useEffect(() => { + setClickOutSideToDismiss(!form.formState.isDirty) + }, [form.formState.isDirty]) + + useEffect(() => { + if (subscription) { + form.setValue("view", `${subscription?.view}`) + form.setValue("isPrivate", subscription?.isPrivate || false) + form.setValue("title", subscription?.title || "") + } + }, [subscription]) + + const followMutation = useMutation({ + mutationFn: async (values: z.infer) => { + const body = { + listId: list.id, + view: Number.parseInt(values.view), + category: values.category, + isPrivate: values.isPrivate, + title: values.title, + } + const $method = isSubscribed ? apiClient.subscriptions.$patch : apiClient.subscriptions.$post + + return $method({ + json: body, + }) + }, + onSuccess: (_, variables) => { + if (isSubscribed && variables.view !== `${subscription?.view}`) { + subscriptionQuery.byView(subscription?.view).invalidate() + tipcClient?.invalidateQuery(subscriptionQuery.byView(subscription?.view).key) + feedUnreadActions.fetchUnreadByView(subscription?.view) + } + subscriptionQuery.byView(Number.parseInt(variables.view)).invalidate() + tipcClient?.invalidateQuery(subscriptionQuery.byView(Number.parseInt(variables.view)).key) + feedUnreadActions.fetchUnreadByView(Number.parseInt(variables.view)) + + const listId = list.id + if (listId) { + listsQuery.byId({ id: listId }).invalidate() + tipcClient?.invalidateQuery(listsQuery.byId({ id: listId }).key) + } + toast(isSubscribed ? t("feed_form.updated") : t("feed_form.followed"), { + duration: 1000, + }) + + if (!asWidget && !isSubscribed) { + window.close() + } + + onSuccess?.() + }, + async onError(err) { + toastFetchError(err) + }, + }) + + function onSubmit(values: z.infer) { + followMutation.mutate(values) + } + + const t = useI18n() + + return ( +
+ + + + + +
+ + ( + + {t("feed_form.view")} + + + + + )} + /> + ( + +
+ {t("feed_form.title")} + {t("feed_form.title_description")} +
+ + + + +
+ )} + /> + ( + +
+
+ {t("feed_form.private_follow")} + {t("feed_form.private_follow_description")} +
+ + + +
+
+ )} + /> + {!!list.fee && !isSubscribed && ( +
+ + {t("feed_form.fee")}{" "} +
+ {list.fee} + +
+
+ {t("feed_form.fee_description")} +
+ )} +
+ {isSubscribed && ( + + )} + +
+ + +
+ ) +} diff --git a/apps/renderer/src/modules/entry-column/hooks.ts b/apps/renderer/src/modules/entry-column/hooks.ts index 6c634833e..333894a57 100644 --- a/apps/renderer/src/modules/entry-column/hooks.ts +++ b/apps/renderer/src/modules/entry-column/hooks.ts @@ -8,7 +8,7 @@ import { useRouteParams, useRouteParamsSelector } from "~/hooks/biz/useRoutePara import { useAuthQuery } from "~/hooks/common" import { entries, useEntries } from "~/queries/entries" import { entryActions, useEntryIdsByFeedIdOrView } from "~/store/entry" -import { isListSubscription, useFolderFeedsByFeedId } from "~/store/subscription" +import { useFolderFeedsByFeedId } from "~/store/subscription" import { feedUnreadActions } from "~/store/unread" export const useEntryMarkReadHandler = (entriesIds: string[]) => { @@ -59,8 +59,7 @@ export const useEntriesByView = ({ const routeParams = useRouteParams() const unreadOnly = useGeneralSettingKey("unreadOnly") - const { feedId, view, isAllFeeds, isCollection } = routeParams - const isList = isListSubscription(feedId) + const { feedId, view, isAllFeeds, isCollection, listId, inboxId } = routeParams const folderIds = useFolderFeedsByFeedId({ feedId, @@ -68,11 +67,12 @@ export const useEntriesByView = ({ }) const entriesOptions = { - id: folderIds?.join(",") || feedId, + feedId: folderIds?.join(",") || feedId, + inboxId, + listId, view, ...(unreadOnly === true && { read: false }), isArchived, - isList, } const query = useEntries(entriesOptions) @@ -169,10 +169,10 @@ export const useEntriesByView = ({ () => isCollection ? sortEntriesIdByStarAt(mergedEntries[view]) - : isList + : listId ? sortEntriesIdByEntryInsertedAt(mergedEntries[view]) : sortEntriesIdByEntryPublishedAt(mergedEntries[view]), - [isCollection, isList, mergedEntries, view], + [isCollection, listId, mergedEntries, view], ) const groupByDate = useGeneralSettingKey("groupByDate") @@ -192,7 +192,7 @@ export const useEntriesByView = ({ continue } const date = new Date( - isList ? entry.entries.insertedAt : entry.entries.publishedAt, + listId ? entry.entries.insertedAt : entry.entries.publishedAt, ).toDateString() if (date !== lastDate) { counts.push(1) diff --git a/apps/renderer/src/modules/entry-column/index.tsx b/apps/renderer/src/modules/entry-column/index.tsx index db4c39b98..ef73b887a 100644 --- a/apps/renderer/src/modules/entry-column/index.tsx +++ b/apps/renderer/src/modules/entry-column/index.tsx @@ -99,7 +99,7 @@ function EntryColumnImpl() { !isCollection && routeFeedId !== ROUTE_FEED_PENDING && entries.totalCount < 40 && - feed?.type !== "list" + feed?.type === "feed" const scrollRef = useRef(null) const virtuosoOptions = { diff --git a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx index 3ad946667..5685f5c02 100644 --- a/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx +++ b/apps/renderer/src/modules/entry-column/templates/list-item-template.tsx @@ -46,7 +46,9 @@ export function ListItem({ const handlePrefetchEntry = useDebounceCallback( () => { - Queries.entries.byId(entryId).prefetch() + feed?.type === "inbox" + ? Queries.entries.byInboxId(entryId).prefetch() + : Queries.entries.byId(entryId).prefetch() }, 300, { leading: false }, diff --git a/apps/renderer/src/modules/feed-column/item.tsx b/apps/renderer/src/modules/feed-column/item.tsx index e2ca8ab0a..6daec9ddc 100644 --- a/apps/renderer/src/modules/feed-column/item.tsx +++ b/apps/renderer/src/modules/feed-column/item.tsx @@ -9,7 +9,7 @@ import { FeedIcon } from "~/components/feed-icon" import { OouiUserAnonymous } from "~/components/icons/OouiUserAnonymous" import { Tooltip, TooltipContent, TooltipPortal, TooltipTrigger } from "~/components/ui/tooltip" import { EllipsisHorizontalTextWithTooltip } from "~/components/ui/typography" -import { useFeedActions, useListActions } from "~/hooks/biz/useFeedActions" +import { useFeedActions, useInboxActions, useListActions } from "~/hooks/biz/useFeedActions" import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry" import { useRouteParamsSelector } from "~/hooks/biz/useRouteParams" import { useAnyPointDown } from "~/hooks/common" @@ -19,6 +19,7 @@ import { getNewIssueUrl } from "~/lib/issues" import { showNativeMenu } from "~/lib/native-menu" import { cn } from "~/lib/utils" import { getPreferredTitle, useFeedById } from "~/store/feed" +import { useInboxById } from "~/store/inbox" import { useListById } from "~/store/list" import { subscriptionActions, useSubscriptionByFeedId } from "~/store/subscription" import { useFeedUnreadStore } from "~/store/unread" @@ -173,7 +174,7 @@ const ListItemImpl: Component<{ }> = ({ view, listId, className }) => { const list = useListById(listId) - const isActive = useRouteParamsSelector((routerParams) => routerParams.feedId === listId) + const isActive = useRouteParamsSelector((routerParams) => routerParams.listId === listId) const { items } = useListActions({ listId, view }) const listUnread = useFeedUnreadStore((state) => state.data[listId] || 0) @@ -189,7 +190,7 @@ const ListItemImpl: Component<{ e.stopPropagation() navigate({ - feedId: listId, + listId, entryId: null, view, }) @@ -220,7 +221,7 @@ const ListItemImpl: Component<{
- {list.title} + {getPreferredTitle(list)} {subscription.isPrivate && ( @@ -240,3 +241,60 @@ const ListItemImpl: Component<{ } export const ListItem = memo(ListItemImpl) + +const InboxItemImpl: Component<{ + inboxId: string + view: FeedViewType +}> = ({ view, inboxId, className }) => { + const inbox = useInboxById(inboxId) + + const isActive = useRouteParamsSelector((routerParams) => routerParams.inboxId === inboxId) + const { items } = useInboxActions({ inboxId }) + + const inboxUnread = useFeedUnreadStore((state) => state.data[inboxId] || 0) + + const [isContextMenuOpen, setIsContextMenuOpen] = useState(false) + useAnyPointDown(() => { + setIsContextMenuOpen(false) + }) + const navigate = useNavigateEntry() + const handleNavigate = useCallback( + (e: React.MouseEvent) => { + e.stopPropagation() + + navigate({ + inboxId, + entryId: null, + view, + }) + }, + [inboxId, navigate, view], + ) + if (!inbox) return null + return ( +
{ + setIsContextMenuOpen(true) + showNativeMenu(items, e) + }} + > +
+ + + {getPreferredTitle(inbox)} + +
+ +
+ ) +} + +export const InboxItem = memo(InboxItemImpl) diff --git a/apps/renderer/src/modules/feed-column/list.tsx b/apps/renderer/src/modules/feed-column/list.tsx index dc8ca8786..32423c082 100644 --- a/apps/renderer/src/modules/feed-column/list.tsx +++ b/apps/renderer/src/modules/feed-column/list.tsx @@ -22,7 +22,7 @@ import { import { useFeedUnreadStore } from "~/store/unread" import { getFeedListSort, setFeedListSortBy, setFeedListSortOrder, useFeedListSort } from "./atom" -import { SortableFeedList, SortByAlphabeticalList } from "./sort-by" +import { SortableFeedList, SortByAlphabeticalInbox, SortByAlphabeticalList } from "./sort-by" import { UnreadNumber } from "./unread-number" const useFeedsGroupedData = (view: FeedViewType) => { @@ -57,12 +57,32 @@ const useListsGroupedData = (view: FeedViewType) => { return useMemo(() => { if (!data || data.length === 0) return {} + const lists = data.filter((s) => "listId" in s) + const groupFolder = {} as Record - for (const subscription of data) { - if (!subscription.category && !subscription.defaultCategory) { - groupFolder[subscription.feedId] = [subscription.feedId] - } + for (const subscription of lists) { + groupFolder[subscription.feedId] = [subscription.feedId] + } + + return groupFolder + }, [data]) +} + +const useInboxesGroupedData = (view: FeedViewType) => { + const { data: remoteData } = useAuthQuery(Queries.subscription.byView(view)) + + const data = useSubscriptionByView(view) || remoteData + + return useMemo(() => { + if (!data || data.length === 0) return {} + + const inboxes = data.filter((s) => "inboxId" in s) + + const groupFolder = {} as Record + + for (const subscription of inboxes) { + groupFolder[subscription.feedId] = [subscription.feedId] } return groupFolder @@ -78,6 +98,7 @@ const useUpdateUnreadCount = () => { function FeedListImpl({ className, view }: { className?: string; view: number }) { const feedsData = useFeedsGroupedData(view) const listsData = useListsGroupedData(view) + const inboxesData = useInboxesGroupedData(view) const categoryOpenStateData = useCategoryOpenStateByView(view) const expansion = Object.values(categoryOpenStateData).every((value) => value === true) useUpdateUnreadCount() @@ -93,7 +114,10 @@ function FeedListImpl({ className, view }: { className?: string; view: number }) return unread }) - const hasData = Object.keys(feedsData).length > 0 || Object.keys(listsData).length > 0 + const hasData = + Object.keys(feedsData).length > 0 || + Object.keys(listsData).length > 0 || + Object.keys(inboxesData).length > 0 const feedId = useRouteFeedId() const navigateEntry = useNavigateEntry() @@ -104,6 +128,8 @@ function FeedListImpl({ className, view }: { className?: string; view: number }) useAuthQuery(Queries.lists.list()) const hasListData = Object.keys(listsData).length > 0 + const hasInboxData = Object.keys(inboxesData).length > 0 + return (
@@ -164,11 +190,18 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
{t("words.lists")}
- )} - {hasListData && hasData && ( + {hasInboxData && ( + <> +
+ {t("words.inbox")} +
+ + + )} + {(hasListData || hasInboxData) && (
{
) } + +export const SortByAlphabeticalInboxList = ({ view }: ListListProps) => { + const isDesc = useFeedListSortSelector((s) => s.order === "desc") + + const inboxes = useInboxByView(view) + + const sortedInboxes = useMemo(() => { + const res = inboxes.sort((a, b) => { + return sortByAlphabet(a.title ?? "", b.title ?? "") + }) + + return isDesc ? res.reverse() : res + }, [isDesc, inboxes]) + + return ( +
+ {sortedInboxes.map((inbox) => ( + + ))} +
+ ) +} diff --git a/apps/renderer/src/modules/feed-column/sort-by/index.tsx b/apps/renderer/src/modules/feed-column/sort-by/index.tsx index 171070b1c..26575ec26 100644 --- a/apps/renderer/src/modules/feed-column/sort-by/index.tsx +++ b/apps/renderer/src/modules/feed-column/sort-by/index.tsx @@ -1,5 +1,9 @@ import { useFeedListSortSelector } from "../atom" -import { SortByAlphabeticalFeedList, SortByAlphabeticalListList } from "./SortByAlphabeticalList" +import { + SortByAlphabeticalFeedList, + SortByAlphabeticalInboxList, + SortByAlphabeticalListList, +} from "./SortByAlphabeticalList" import { SortByUnreadFeedList } from "./SortByUnreadList" import type { FeedListProps, ListListProps } from "./types" @@ -25,3 +29,13 @@ export const SortByAlphabeticalList = (props: ListListProps) => { } } } + +export const SortByAlphabeticalInbox = (props: ListListProps) => { + const by = useFeedListSortSelector((s) => s.by) + + switch (by) { + default: { + return + } + } +} diff --git a/apps/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx b/apps/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx index 891e7c37d..1b6511252 100644 --- a/apps/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx +++ b/apps/renderer/src/pages/(main)/(layer)/(subview)/discover/index.tsx @@ -5,6 +5,7 @@ import { useSearchParams } from "react-router-dom" import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs" import { DiscoverForm } from "~/modules/discover/form" import { DiscoverImport } from "~/modules/discover/import" +import { DiscoverInboxList } from "~/modules/discover/inbox-list-form" import { Recommendations } from "~/modules/discover/recommendations" import { DiscoverRSS3 } from "~/modules/discover/rss3-form" import { DiscoverUser } from "~/modules/discover/user-form" @@ -28,6 +29,10 @@ const tabs: { name: "words.rsshub", value: "rsshub", }, + { + name: "words.inbox", + value: "inbox", + }, { name: "words.rss3", value: "rss3", @@ -36,11 +41,6 @@ const tabs: { name: "words.user", value: "user", }, - { - name: "words.email", - value: "email", - disabled: true, - }, { name: "words.import", value: "import", @@ -84,9 +84,10 @@ export function Component() { ) } -const TabComponent: Record> = { +const TabComponent: Record> = { import: DiscoverImport, rss3: DiscoverRSS3, + inbox: DiscoverInboxList, user: DiscoverUser, default: DiscoverForm, } diff --git a/apps/renderer/src/providers/extension-expose-provider.tsx b/apps/renderer/src/providers/extension-expose-provider.tsx index 48a35b321..ee071d38f 100644 --- a/apps/renderer/src/providers/extension-expose-provider.tsx +++ b/apps/renderer/src/providers/extension-expose-provider.tsx @@ -8,6 +8,7 @@ import { getGeneralSettings } from "~/atoms/settings/general" import { getUISettings } from "~/atoms/settings/ui" import { useModalStack } from "~/components/ui/modal" import { FeedForm } from "~/modules/discover/feed-form" +import { ListForm } from "~/modules/discover/list-form" import { usePresentUserProfileModal } from "~/modules/profile/hooks" export const ExtensionExposeProvider = () => { @@ -38,15 +39,12 @@ export const ExtensionExposeProvider = () => { title: options?.isList ? t("sidebar.feed_actions.edit_list") : t("sidebar.feed_actions.edit_feed"), - content: ({ dismiss }) => ( - - ), + content: ({ dismiss }) => + options?.isList ? ( + + ) : ( + + ), }) }, diff --git a/apps/renderer/src/queries/entries.ts b/apps/renderer/src/queries/entries.ts index 21854f238..de09647ec 100644 --- a/apps/renderer/src/queries/entries.ts +++ b/apps/renderer/src/queries/entries.ts @@ -7,23 +7,29 @@ import { entryHistoryActions } from "~/store/entry-history/action" export const entries = { entries: ({ - id, + feedId, + inboxId, + listId, view, read, limit, isArchived, }: { - id?: number | string + feedId?: number | string + inboxId?: number | string + listId?: number | string view?: number read?: boolean limit?: number isArchived?: boolean }) => defineQuery( - ["entries", id, view, read, limit], + ["entries", inboxId || listId || feedId, view, read, limit], async ({ pageParam }) => entryActions.fetchEntries({ - id, + feedId, + inboxId, + listId, view, read, limit, @@ -31,7 +37,7 @@ export const entries = { isArchived, }), { - rootKey: ["entries", id], + rootKey: ["entries", inboxId || listId || feedId], structuralSharing: false, }, ), @@ -39,6 +45,10 @@ export const entries = { defineQuery(["entry", id], async () => entryActions.fetchEntryById(id), { rootKey: ["entries"], }), + byInboxId: (id: string) => + defineQuery(["entry", id], async () => entryActions.fetchInboxEntryById(id), { + rootKey: ["entries"], + }), preview: (id: string) => defineQuery( ["entries-preview", id], @@ -57,22 +67,28 @@ export const entries = { ), checkNew: ({ - id, + feedId, + inboxId, + listId, view, read, fetchedTime, }: { - id?: number | string + feedId?: number | string + inboxId?: number | string + listId?: number | string view?: number read?: boolean fetchedTime: number }) => defineQuery( - ["entry-checkNew", id, view, read, fetchedTime], + ["entry-checkNew", inboxId || listId || feedId, view, read, fetchedTime], async () => { const query = { ...getEntriesParams({ - id, + feedId, + inboxId, + listId, view, }), read, @@ -95,7 +111,7 @@ export const entries = { }, { - rootKey: ["entry-checkNew", id], + rootKey: ["entry-checkNew", inboxId || listId || feedId], }, ), @@ -110,22 +126,24 @@ export const entries = { } export const useEntries = ({ - id, + feedId, + inboxId, + listId, view, read, isArchived, - isList, }: { - id?: number | string + feedId?: number | string + inboxId?: number | string + listId?: number | string view?: number read?: boolean isArchived?: boolean - isList?: boolean }) => - useAuthInfiniteQuery(entries.entries({ id, view, read, isArchived }), { - enabled: id !== undefined, + useAuthInfiniteQuery(entries.entries({ feedId, inboxId, listId, view, read, isArchived }), { + enabled: feedId !== undefined || inboxId !== undefined || listId !== undefined, getNextPageParam: (lastPage) => - isList + inboxId ? lastPage.data?.at(-1)?.entries.insertedAt : lastPage.data?.at(-1)?.entries.publishedAt, initialPageParam: undefined, diff --git a/apps/renderer/src/queries/feed.ts b/apps/renderer/src/queries/feed.ts index 3419c3ef7..a1a4f27bf 100644 --- a/apps/renderer/src/queries/feed.ts +++ b/apps/renderer/src/queries/feed.ts @@ -12,14 +12,13 @@ import { feedActions } from "~/store/feed" import { entries } from "./entries" export const feed = { - byId: ({ id, url, isList }: FeedQueryParams) => + byId: ({ id, url }: FeedQueryParams) => defineQuery( ["feed", id, url], async () => feedActions.fetchFeedById({ id, url, - isList, }), { rootKey: ["feed"], @@ -41,12 +40,11 @@ export const feed = { }), } -export const useFeed = ({ id, url, isList }: FeedQueryParams) => +export const useFeed = ({ id, url }: FeedQueryParams) => useAuthQuery( feed.byId({ id, url, - isList, }), { enabled: @@ -78,7 +76,7 @@ export const useRefreshFeedMutation = (feedId?: string) => if (!feedId) return entries .entries({ - id: feedId!, + feedId: feedId!, }) .invalidateRoot() }, diff --git a/apps/renderer/src/queries/inboxes.ts b/apps/renderer/src/queries/inboxes.ts new file mode 100644 index 000000000..d715fa612 --- /dev/null +++ b/apps/renderer/src/queries/inboxes.ts @@ -0,0 +1,15 @@ +import { useAuthQuery } from "~/hooks/common" +import { defineQuery } from "~/lib/defineQuery" +import { inboxActions } from "~/store/inbox" + +export const inboxes = { + byId: ({ id }: { id: string }) => + defineQuery(["lists", id], async () => inboxActions.fetchInboxById(id), { + rootKey: ["lists"], + }), +} + +export const useInbox = ({ id }: { id?: string }) => + useAuthQuery(inboxes.byId({ id: id! }), { + enabled: !!id, + }) diff --git a/apps/renderer/src/queries/lists.ts b/apps/renderer/src/queries/lists.ts index 24da78477..b7475a4b7 100644 --- a/apps/renderer/src/queries/lists.ts +++ b/apps/renderer/src/queries/lists.ts @@ -13,7 +13,7 @@ export const lists = { }), } -export const useList = ({ id }: { id: string }) => - useAuthQuery(lists.byId({ id }), { +export const useList = ({ id }: { id?: string }) => + useAuthQuery(lists.byId({ id: id! }), { enabled: !!id, }) diff --git a/apps/renderer/src/services/inbox.ts b/apps/renderer/src/services/inbox.ts new file mode 100644 index 000000000..bb5038fb2 --- /dev/null +++ b/apps/renderer/src/services/inbox.ts @@ -0,0 +1,33 @@ +import { browserDB } from "~/database" +import type { InboxModel } from "~/models/types" + +import { BaseService } from "./base" +import { CleanerService } from "./cleaner" + +class ServiceStatic extends BaseService<{ id: string }> { + constructor() { + super(browserDB.inboxes) + } + + override async upsertMany(data: InboxModel[]) { + CleanerService.reset(data.map((d) => ({ type: "feed", id: d.id! }))) + + return this.table.bulkPut(data) + } + + override async findAll() { + return super.findAll() as unknown as InboxModel[] + } + + override async upsert(data: InboxModel): Promise { + if (!data.id) return null + CleanerService.reset([{ type: "feed", id: data.id }]) + return this.table.put(data) + } + + async bulkDelete(ids: string[]) { + return this.table.bulkDelete(ids) + } +} + +export const InboxService = new ServiceStatic() diff --git a/apps/renderer/src/services/subscription.ts b/apps/renderer/src/services/subscription.ts index af0952eb7..87f9bc0ce 100644 --- a/apps/renderer/src/services/subscription.ts +++ b/apps/renderer/src/services/subscription.ts @@ -27,7 +27,7 @@ class SubscriptionServiceStatic extends BaseService { override async upsertMany(data: SubscriptionFlatModel[]) { return this.table.bulkPut( - data.map(({ feeds, ...d }: any) => ({ + data.map(({ feeds, lists, inboxes, ...d }: any) => ({ ...d, id: this.uniqueId(d.userId, d.feedId), })), diff --git a/apps/renderer/src/store/entry/store.ts b/apps/renderer/src/store/entry/store.ts index 5ad529df2..06fb4f74a 100644 --- a/apps/renderer/src/store/entry/store.ts +++ b/apps/renderer/src/store/entry/store.ts @@ -10,6 +10,7 @@ import { EntryService } from "~/services" import { feedActions } from "../feed" import { imageActions } from "../image" +import { inboxActions } from "../inbox" import { feedUnreadActions } from "../unread" import { createZustandStore, doMutationAndTransaction } from "../utils/helper" import { internal_batchMarkRead } from "./helper" @@ -67,34 +68,65 @@ class EntryActions { return data } + async fetchInboxEntryById(entryId: string) { + const { data } = await apiClient.entries.inbox.$get({ + query: { + id: entryId, + }, + }) + if (data) { + this.upsertMany([ + // patch data, should omit `read` because the network race condition or server cache + omit(data, "read") as any, + ]) + inboxActions.upsertMany([data.feeds]) + } + + return data + } + async fetchEntries({ - id, + feedId, + inboxId, + listId, view, read, limit, pageParam, isArchived, }: { - id?: number | string + feedId?: number | string + inboxId?: number | string + listId?: number | string view?: number read?: boolean limit?: number pageParam?: string isArchived?: boolean }) { - const data = await apiClient.entries.$post({ - json: { - publishedAfter: pageParam, - read, - limit, - isArchived, - // withContent: true, - ...getEntriesParams({ - id, - view, - }), - }, - }) + const data = inboxId + ? await apiClient.entries.inbox.$post({ + json: { + publishedAfter: pageParam, + limit, + inboxId: `${inboxId}`, + }, + }) + : await apiClient.entries.$post({ + json: { + publishedAfter: pageParam, + read, + limit, + isArchived, + // withContent: true, + ...getEntriesParams({ + feedId, + inboxId, + listId, + view, + }), + }, + }) if (data.data) { this.upsertMany(data.data) @@ -226,7 +258,7 @@ class EntryActions { // Push entryFeedMap entryFeedMap[item.entries.id] = item.feeds.id // Push entryCollection - if (item.collections) { + if ("collections" in item) { entryCollection[item.entries.id] = item.collections } @@ -294,7 +326,7 @@ class EntryActions { ) // Push entryCollection - if (item.collections) { + if ("collections" in item) { entryCollection[item.entries.id] = item.collections } } diff --git a/apps/renderer/src/store/feed/store.ts b/apps/renderer/src/store/feed/store.ts index 3858cd224..9c62fdc15 100644 --- a/apps/renderer/src/store/feed/store.ts +++ b/apps/renderer/src/store/feed/store.ts @@ -133,6 +133,10 @@ export const getPreferredTitle = (feed?: FeedOrListRespModel | null) => { return feed?.title } + if (feed.type === "inbox") { + return feed.title || `${feed.id.slice(0, 1).toUpperCase()}${feed.id.slice(1)}'s Inbox` + } + const subscription = getSubscriptionByFeedId(feed.id) return subscription?.title || feed.title } diff --git a/apps/renderer/src/store/feed/types.ts b/apps/renderer/src/store/feed/types.ts index 1822b2e36..90f6d8cca 100644 --- a/apps/renderer/src/store/feed/types.ts +++ b/apps/renderer/src/store/feed/types.ts @@ -5,4 +5,4 @@ type FeedId = string export interface FeedState { feeds: Record } -export type FeedQueryParams = { id?: string; url?: string; isList?: boolean } +export type FeedQueryParams = { id?: string; url?: string } diff --git a/apps/renderer/src/store/inbox/hooks.ts b/apps/renderer/src/store/inbox/hooks.ts new file mode 100644 index 000000000..8120801ee --- /dev/null +++ b/apps/renderer/src/store/inbox/hooks.ts @@ -0,0 +1,11 @@ +import type { FeedViewType } from "~/lib/enum" +import type { InboxModel } from "~/models" + +import { useInboxStore } from "./store" + +export const useInboxById = (inboxId: Nullable): InboxModel | null => + useInboxStore((state) => (inboxId ? state.inboxes[inboxId] : null)) + +export const useInboxByView = (view: FeedViewType) => { + return useInboxStore((state) => (view === 0 ? Object.values(state.inboxes) : [])) +} diff --git a/apps/renderer/src/store/inbox/index.ts b/apps/renderer/src/store/inbox/index.ts new file mode 100644 index 000000000..a92fe14dc --- /dev/null +++ b/apps/renderer/src/store/inbox/index.ts @@ -0,0 +1,3 @@ +export * from "./hooks" +export * from "./store" +export * from "./types" diff --git a/apps/renderer/src/store/inbox/store.ts b/apps/renderer/src/store/inbox/store.ts new file mode 100644 index 000000000..f0a8b34ea --- /dev/null +++ b/apps/renderer/src/store/inbox/store.ts @@ -0,0 +1,52 @@ +import { runTransactionInScope } from "~/database" +import { apiClient } from "~/lib/api-fetch" +import type { InboxModel } from "~/models" +import { InboxService } from "~/services/inbox" + +import { createImmerSetter, createZustandStore } from "../utils/helper" +import type { InboxState } from "./types" + +export const useInboxStore = createZustandStore("inbox")(() => ({ + inboxes: {}, +})) + +const set = createImmerSetter(useInboxStore) + +class InboxActionStatic { + upsertMany(inboxs: InboxModel[]) { + if (inboxs.length === 0) return + set((state) => { + for (const inbox of inboxs) { + state.inboxes[inbox.id] = inbox + } + return state + }) + + runTransactionInScope(() => InboxService.upsertMany(inboxs)) + } + + async fetchInboxById(id: string) { + const res = await apiClient.inboxes.$get({ + query: { + handle: id, + }, + }) + this.upsertMany([res.data]) + + return res.data + } + + clear() { + set((state) => { + state.inboxes = {} + }) + } + + clearByInboxId(id: string) { + set((state) => { + delete state.inboxes[id] + }) + } +} + +export const inboxActions = new InboxActionStatic() diff --git a/apps/renderer/src/store/inbox/types.ts b/apps/renderer/src/store/inbox/types.ts new file mode 100644 index 000000000..2154082d0 --- /dev/null +++ b/apps/renderer/src/store/inbox/types.ts @@ -0,0 +1,7 @@ +import type { InboxModel } from "~/models" + +type InboxId = string + +export interface InboxState { + inboxes: Record +} diff --git a/apps/renderer/src/store/subscription/store.ts b/apps/renderer/src/store/subscription/store.ts index 988ba2055..9ba78a2c3 100644 --- a/apps/renderer/src/store/subscription/store.ts +++ b/apps/renderer/src/store/subscription/store.ts @@ -7,12 +7,13 @@ import { runTransactionInScope } from "~/database" import { apiClient } from "~/lib/api-fetch" import { FeedViewType } from "~/lib/enum" import { capitalizeFirstLetter } from "~/lib/utils" -import type { FeedModel, ListModelPoplutedFeeds, SubscriptionModel } from "~/models" +import type { FeedModel, InboxModel, ListModelPoplutedFeeds, SubscriptionModel } from "~/models" import { SubscriptionService } from "~/services" import { entryActions } from "../entry" import { feedActions, getFeedById } from "../feed" -import { listActions } from "../list/store" +import { inboxActions } from "../inbox" +import { listActions } from "../list" import { feedUnreadActions } from "../unread" import { createZustandStore, doMutationAndTransaction } from "../utils/helper" @@ -120,16 +121,20 @@ class SubscriptionActions { const feeds = [] as FeedModel[] const lists = [] as ListModelPoplutedFeeds[] + const inboxes = [] as InboxModel[] for (const subscription of res.data) { if ("feeds" in subscription) { feeds.push(subscription.feeds) - } else { + } else if ("lists" in subscription) { lists.push(subscription.lists) + } else if ("inboxes" in subscription) { + inboxes.push(subscription.inboxes) } } this.updateCategoryOpenState(transformedData.filter((s) => s.category || s.defaultCategory)) feedActions.upsertMany(feeds) listActions.upsertMany(lists) + inboxActions.upsertMany(inboxes) return res.data } @@ -141,7 +146,11 @@ class SubscriptionActions { set((state) => produce(state, (state) => { subscriptions.forEach((subscription) => { - state.data[subscription.feedId] = omit(subscription, "feeds") + state.data[subscription.feedId] = omit(subscription, [ + "feeds", + "lists", + "inboxes", + ]) as SubscriptionFlatModel state.feedIdByView[subscription.view].push(subscription.feedId) return state }) diff --git a/icons/mgc/inbox_cute_fi.svg b/icons/mgc/inbox_cute_fi.svg new file mode 100644 index 000000000..0450ef3f1 --- /dev/null +++ b/icons/mgc/inbox_cute_fi.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/locales/app/ar-DZ.json b/locales/app/ar-DZ.json index 7f8417649..1a6c47c52 100644 --- a/locales/app/ar-DZ.json +++ b/locales/app/ar-DZ.json @@ -188,7 +188,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "استكشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "العناصر", "words.language": "اللغة", diff --git a/locales/app/ar-IQ.json b/locales/app/ar-IQ.json index 7fee8b035..ec3e70307 100644 --- a/locales/app/ar-IQ.json +++ b/locales/app/ar-IQ.json @@ -192,7 +192,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "اكتشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "عناصر", "words.language": "اللغة", diff --git a/locales/app/ar-KW.json b/locales/app/ar-KW.json index 1e6151319..601b2d8ee 100644 --- a/locales/app/ar-KW.json +++ b/locales/app/ar-KW.json @@ -192,7 +192,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "استكشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "عناصر", "words.language": "اللغة", diff --git a/locales/app/ar-MA.json b/locales/app/ar-MA.json index db0ec7180..8787e3590 100644 --- a/locales/app/ar-MA.json +++ b/locales/app/ar-MA.json @@ -188,7 +188,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "استكشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "عناصر", "words.language": "اللغة", diff --git a/locales/app/ar-SA.json b/locales/app/ar-SA.json index b7ab184d0..78793ad86 100644 --- a/locales/app/ar-SA.json +++ b/locales/app/ar-SA.json @@ -188,7 +188,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "استكشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "عناصر", "words.language": "اللغة", diff --git a/locales/app/ar-TN.json b/locales/app/ar-TN.json index 0867f3181..bfef62487 100644 --- a/locales/app/ar-TN.json +++ b/locales/app/ar-TN.json @@ -192,7 +192,6 @@ "words.add": "إضافة", "words.confirm": "تأكيد", "words.discover": "استكشاف", - "words.email": "البريد الإلكتروني", "words.import": "استيراد", "words.items": "عناصر", "words.language": "اللغة", diff --git a/locales/app/de.json b/locales/app/de.json index be19d1219..2aea303b8 100644 --- a/locales/app/de.json +++ b/locales/app/de.json @@ -192,7 +192,6 @@ "words.add": "Hinzufügen", "words.confirm": "Bestätigen", "words.discover": "Entdecken", - "words.email": "E-Mail", "words.import": "Importieren", "words.items": "Elemente", "words.language": "Sprache", diff --git a/locales/app/en.json b/locales/app/en.json index 64272ca93..9757eb883 100644 --- a/locales/app/en.json +++ b/locales/app/en.json @@ -21,6 +21,27 @@ "discover.import.parsedErrorItems": "Parsed Error Items", "discover.import.result": " feeds were successfully imported, were already subscribed to, and failed to import.", "discover.import.successfulItems": "Successful Items", + "discover.inbox.actions": "Actions", + "discover.inbox.description": "You can receive information via email and webhooks through the inbox.", + "discover.inbox.email": "Email", + "discover.inbox.handle": "Handle", + "discover.inbox.secret": "Secret", + "discover.inbox.title": "Title", + "discover.inbox.webhooks_docs": "Webhooks docs.", + "discover.inbox_create": "New Inbox", + "discover.inbox_create_description": "You don't have an inbox yet. Create an inbox to receive information via inbox.", + "discover.inbox_create_error": "Failed to create inbox.", + "discover.inbox_create_success": "Inbox created successfully.", + "discover.inbox_destroy": "Destroy", + "discover.inbox_destroy_confirm": "Confirm destroy the inbox?", + "discover.inbox_destroy_error": "Failed to destroy inbox.", + "discover.inbox_destroy_success": "Inbox destroyed successfully.", + "discover.inbox_destroy_warning": "Warning: once destroyed, the email will no longer be available, and all content will be permanently deleted and unrecoverable.", + "discover.inbox_handle": "Handle", + "discover.inbox_title": "Title", + "discover.inbox_update": "Update", + "discover.inbox_update_error": "Failed to change inbox.", + "discover.inbox_update_success": "Inbox updated successfully.", "discover.popular": "Popular", "discover.preview": "Preview", "discover.rss_hub_route": "RSSHub Route", @@ -168,18 +189,21 @@ "sidebar.category_remove_dialog.title": "Remove Category", "sidebar.feed_actions.claim": "Claim", "sidebar.feed_actions.claim_feed": "Claim Feed", + "sidebar.feed_actions.copy_email_address": "Copy email address", "sidebar.feed_actions.copy_feed_id": "Copy feed ID", "sidebar.feed_actions.copy_feed_url": "Copy feed URL", "sidebar.feed_actions.copy_list_id": "Copy list ID", "sidebar.feed_actions.copy_list_url": "Copy list URL", "sidebar.feed_actions.edit": "Edit", "sidebar.feed_actions.edit_feed": "Edit feed", + "sidebar.feed_actions.edit_inbox": "Edit inbox", "sidebar.feed_actions.edit_list": "Edit list", "sidebar.feed_actions.feed_owned_by_you": "This feed is owned by you", "sidebar.feed_actions.list_owned_by_you": "This list is owned by you", "sidebar.feed_actions.mark_all_as_read": "Mark all as read", "sidebar.feed_actions.navigate_to_feed": "Navigate to feed", "sidebar.feed_actions.navigate_to_list": "Navigate to list", + "sidebar.feed_actions.new_inbox": "New inbox", "sidebar.feed_actions.open_feed_in_browser": "Open feed in {{which}}", "sidebar.feed_actions.open_list_in_browser": "Open list in {{which}}", "sidebar.feed_actions.open_site_in_browser": "Open site in {{which}}", @@ -227,9 +251,9 @@ "words.browser": "Browser", "words.confirm": "Confirm", "words.discover": "Discover", - "words.email": "Email", "words.feeds": "Feeds", "words.import": "Import", + "words.inbox": "Inbox", "words.items": "Items", "words.language": "Language", "words.lists": "Lists", diff --git a/locales/app/es.json b/locales/app/es.json index d17a3ff23..279e715c0 100644 --- a/locales/app/es.json +++ b/locales/app/es.json @@ -121,7 +121,6 @@ "words.add": "Añadir", "words.confirm": "Confirmar", "words.discover": "Descubrir", - "words.email": "Correo electrónico", "words.import": "Importar", "words.items": "Contenido", "words.language": "Idioma", diff --git a/locales/app/fi.json b/locales/app/fi.json index 797ee04eb..def250507 100644 --- a/locales/app/fi.json +++ b/locales/app/fi.json @@ -188,7 +188,6 @@ "words.add": "Lisää", "words.confirm": "Vahvista", "words.discover": "Löydä", - "words.email": "Sähköposti", "words.import": "Tuo", "words.items": "Kohteet", "words.language": "Kieli", diff --git a/locales/app/fr.json b/locales/app/fr.json index 5093ee53c..a5275aa9f 100644 --- a/locales/app/fr.json +++ b/locales/app/fr.json @@ -188,7 +188,6 @@ "words.add": "Ajouter", "words.confirm": "Confirmer", "words.discover": "Découvrir", - "words.email": "Email", "words.import": "Importer", "words.items": "Éléments", "words.language": "Langue", diff --git a/locales/app/it.json b/locales/app/it.json index eb4f0f315..8e573688a 100644 --- a/locales/app/it.json +++ b/locales/app/it.json @@ -188,7 +188,6 @@ "words.add": "Aggiungi", "words.confirm": "Conferma", "words.discover": "Scopri", - "words.email": "Email", "words.import": "Importa", "words.items": "Elementi", "words.language": "Lingua", diff --git a/locales/app/ja.json b/locales/app/ja.json index 51b0dde27..69bf0291c 100644 --- a/locales/app/ja.json +++ b/locales/app/ja.json @@ -188,7 +188,6 @@ "words.add": "追加", "words.confirm": "確認", "words.discover": "発見", - "words.email": "メール", "words.import": "インポート", "words.items": "アイテム", "words.language": "言語", diff --git a/locales/app/ko.json b/locales/app/ko.json index a7823c011..579834208 100644 --- a/locales/app/ko.json +++ b/locales/app/ko.json @@ -220,7 +220,6 @@ "words.add": "추가", "words.confirm": "확인", "words.discover": "찾아보기", - "words.email": "이메일", "words.feeds": "피드", "words.import": "가져오기", "words.items": "항목", diff --git a/locales/app/pt.json b/locales/app/pt.json index 191a45783..3f6045d74 100644 --- a/locales/app/pt.json +++ b/locales/app/pt.json @@ -188,7 +188,6 @@ "words.add": "追加", "words.confirm": "確認", "words.discover": "発見", - "words.email": "メール", "words.import": "インポート", "words.items": "アイテム", "words.language": "言語", diff --git a/locales/app/ru.json b/locales/app/ru.json index 91c439e34..14b712523 100644 --- a/locales/app/ru.json +++ b/locales/app/ru.json @@ -188,7 +188,6 @@ "words.add": "Добавить", "words.confirm": "Подтвердить", "words.discover": "Открыть", - "words.email": "Электронная почта", "words.import": "Импорт", "words.items": "Элементы", "words.language": "Язык", diff --git a/locales/app/tr.json b/locales/app/tr.json index fca76847e..afe71a445 100644 --- a/locales/app/tr.json +++ b/locales/app/tr.json @@ -221,7 +221,6 @@ "words.add": "Ekle", "words.confirm": "Onayla", "words.discover": "Keşfet", - "words.email": "E-posta", "words.feeds": "Beslemeler", "words.import": "İçe Aktar", "words.items": "Öğeler", diff --git a/locales/app/zh-CN.json b/locales/app/zh-CN.json index 881bd3355..dccfe62aa 100644 --- a/locales/app/zh-CN.json +++ b/locales/app/zh-CN.json @@ -227,7 +227,6 @@ "words.browser": "浏览器", "words.confirm": "确认", "words.discover": "发现", - "words.email": "邮箱", "words.feeds": "订阅源", "words.import": "导入", "words.items": "内容", diff --git a/locales/app/zh-HK.json b/locales/app/zh-HK.json index 9762faff1..05021d1b6 100644 --- a/locales/app/zh-HK.json +++ b/locales/app/zh-HK.json @@ -226,7 +226,6 @@ "words.browser": "瀏覽器", "words.confirm": "確認", "words.discover": "探索", - "words.email": "電子郵件", "words.feeds": "訂閱源", "words.import": "匯入", "words.items": "項目", diff --git a/locales/app/zh-TW.json b/locales/app/zh-TW.json index 371ec804d..238cc7244 100644 --- a/locales/app/zh-TW.json +++ b/locales/app/zh-TW.json @@ -226,7 +226,6 @@ "words.browser": "瀏覽器", "words.confirm": "確認", "words.discover": "發現", - "words.email": "Email", "words.feeds": "摘要", "words.import": "匯入", "words.items": "內容", diff --git a/locales/errors/en.json b/locales/errors/en.json index 2645c057f..7075c8ff0 100644 --- a/locales/errors/en.json +++ b/locales/errors/en.json @@ -32,5 +32,8 @@ "8002": "List limit exceeded", "8003": "Feed already added to list", "9000": "Achievement not completed", - "9001": "Achievement already received" + "9001": "Achievement already received", + "10000": "Inbox not found", + "10001": "Inbox already exists", + "10002": "Inbox limit exceeded" } diff --git a/packages/shared/src/env.ts b/packages/shared/src/env.ts index 40d2af372..c114b890d 100644 --- a/packages/shared/src/env.ts +++ b/packages/shared/src/env.ts @@ -10,6 +10,7 @@ export const env = createEnv({ VITE_IMGPROXY_URL: z.string().url(), VITE_SENTRY_DSN: z.string().optional(), VITE_POSTHOG_KEY: z.string().optional(), + VITE_INBOXES_EMAIL: z.string().default("@follow.re"), }, emptyStringAsUndefined: true, diff --git a/packages/shared/src/hono.ts b/packages/shared/src/hono.ts index 9199002b4..2d28b4485 100644 --- a/packages/shared/src/hono.ts +++ b/packages/shared/src/hono.ts @@ -673,6 +673,111 @@ type ExtraModel = { content_html?: string; }[]; }; +declare const CommonEntryFields: { + id: drizzle_orm.HasRuntimeDefault>>>>; + title: drizzle_orm_pg_core.PgTextBuilder<{ + name: "title"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + url: drizzle_orm_pg_core.PgTextBuilder<{ + name: "url"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + content: drizzle_orm_pg_core.PgTextBuilder<{ + name: "content"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + description: drizzle_orm_pg_core.PgTextBuilder<{ + name: "description"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + guid: drizzle_orm.NotNull>; + author: drizzle_orm_pg_core.PgTextBuilder<{ + name: "author"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + authorUrl: drizzle_orm_pg_core.PgTextBuilder<{ + name: "author_url"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + authorAvatar: drizzle_orm_pg_core.PgTextBuilder<{ + name: "author_avatar"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + insertedAt: drizzle_orm.NotNull>; + publishedAt: drizzle_orm.NotNull>; + media: drizzle_orm.$Type, MediaModel[]>; + categories: drizzle_orm_pg_core.PgArrayBuilder<{ + name: "categories"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + enumValues: [string, ...string[]]; + generated: drizzle_orm.GeneratedColumnConfig; + }, { + name: "categories"; + dataType: "string"; + columnType: "PgText"; + data: string; + enumValues: [string, ...string[]]; + driverParam: string; + generated: undefined; + }>; + attachments: drizzle_orm.$Type, AttachmentsModel[]>; + extra: drizzle_orm.$Type, ExtraModel>; +}; declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ name: "entries"; schema: undefined; @@ -693,22 +798,6 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; generated: undefined; }, {}, {}>; - feedId: drizzle_orm_pg_core.PgColumn<{ - name: "feed_id"; - tableName: "entries"; - dataType: "string"; - columnType: "PgText"; - data: string; - driverParam: string; - notNull: true; - hasDefault: false; - isPrimaryKey: false; - isAutoincrement: false; - hasRuntimeDefault: false; - enumValues: [string, ...string[]]; - baseColumn: never; - generated: undefined; - }, {}, {}>; title: drizzle_orm_pg_core.PgColumn<{ name: "title"; tableName: "entries"; @@ -948,12 +1037,95 @@ declare const entries: drizzle_orm_pg_core.PgTableWithColumns<{ baseColumn: never; generated: undefined; }, {}, {}>; + feedId: drizzle_orm_pg_core.PgColumn<{ + name: "feed_id"; + tableName: "entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; }; dialect: "pg"; }>; +declare const attachmentsZodSchema: z.ZodNullable; + mime_type: z.ZodOptional; + size_in_bytes: z.ZodOptional; + title: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; +}, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; +}>, "many">>>; +declare const mediaZodSchema: z.ZodNullable; + width: z.ZodOptional; + height: z.ZodOptional; + preview_image_url: z.ZodOptional; + blurhash: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; +}, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; +}>, "many">>>; +declare const extraZodSchema: z.ZodNullable; + }, "strip", z.ZodTypeAny, { + type: string; + url: string; + content_html?: string | undefined; + }, { + type: string; + url: string; + content_html?: string | undefined; + }>, "many">>>; +}, "strip", z.ZodTypeAny, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; +}, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; +}>>>; declare const entriesOpenAPISchema: z.ZodObject; url: z.ZodNullable; content: z.ZodNullable; @@ -980,6 +1152,7 @@ declare const entriesOpenAPISchema: z.ZodObject>; + feedId: z.ZodString; }, "media" | "attachments" | "extra">, { attachments: z.ZodNullable; }>; +declare const inboxesEntries: drizzle_orm_pg_core.PgTableWithColumns<{ + name: "inboxes_entries"; + schema: undefined; + columns: { + id: drizzle_orm_pg_core.PgColumn<{ + name: "id"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: true; + isPrimaryKey: true; + isAutoincrement: false; + hasRuntimeDefault: true; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + title: drizzle_orm_pg_core.PgColumn<{ + name: "title"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + url: drizzle_orm_pg_core.PgColumn<{ + name: "url"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + content: drizzle_orm_pg_core.PgColumn<{ + name: "content"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + description: drizzle_orm_pg_core.PgColumn<{ + name: "description"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + guid: drizzle_orm_pg_core.PgColumn<{ + name: "guid"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + author: drizzle_orm_pg_core.PgColumn<{ + name: "author"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + authorUrl: drizzle_orm_pg_core.PgColumn<{ + name: "author_url"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + authorAvatar: drizzle_orm_pg_core.PgColumn<{ + name: "author_avatar"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + insertedAt: drizzle_orm_pg_core.PgColumn<{ + name: "inserted_at"; + tableName: "inboxes_entries"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + generated: undefined; + }, {}, {}>; + publishedAt: drizzle_orm_pg_core.PgColumn<{ + name: "published_at"; + tableName: "inboxes_entries"; + dataType: "date"; + columnType: "PgTimestamp"; + data: Date; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + generated: undefined; + }, {}, {}>; + media: drizzle_orm_pg_core.PgColumn<{ + name: "media"; + tableName: "inboxes_entries"; + dataType: "json"; + columnType: "PgJsonb"; + data: MediaModel[]; + driverParam: unknown; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + generated: undefined; + }, {}, {}>; + categories: drizzle_orm_pg_core.PgColumn<{ + name: "categories"; + tableName: "inboxes_entries"; + dataType: "array"; + columnType: "PgArray"; + data: string[]; + driverParam: string | string[]; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: drizzle_orm.Column<{ + name: "categories"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, object, object>; + generated: undefined; + }, {}, {}>; + attachments: drizzle_orm_pg_core.PgColumn<{ + name: "attachments"; + tableName: "inboxes_entries"; + dataType: "json"; + columnType: "PgJsonb"; + data: AttachmentsModel[]; + driverParam: unknown; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + generated: undefined; + }, {}, {}>; + extra: drizzle_orm_pg_core.PgColumn<{ + name: "extra"; + tableName: "inboxes_entries"; + dataType: "json"; + columnType: "PgJsonb"; + data: ExtraModel; + driverParam: unknown; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: undefined; + baseColumn: never; + generated: undefined; + }, {}, {}>; + inboxHandle: drizzle_orm_pg_core.PgColumn<{ + name: "inbox_handle"; + tableName: "inboxes_entries"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + }; + dialect: "pg"; +}>; +declare const inboxesEntriesOpenAPISchema: z.ZodObject; + url: z.ZodNullable; + content: z.ZodNullable; + description: z.ZodNullable; + guid: z.ZodString; + author: z.ZodNullable; + authorUrl: z.ZodNullable; + authorAvatar: z.ZodNullable; + insertedAt: z.ZodString; + publishedAt: z.ZodString; + media: z.ZodNullable>; + categories: z.ZodNullable>; + attachments: z.ZodNullable>; + extra: z.ZodNullable>; + inboxHandle: z.ZodString; +}, "media" | "attachments" | "extra">, { + attachments: z.ZodNullable; + mime_type: z.ZodOptional; + size_in_bytes: z.ZodOptional; + title: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }>, "many">>>; + media: z.ZodNullable; + width: z.ZodOptional; + height: z.ZodOptional; + preview_image_url: z.ZodOptional; + blurhash: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }>, "many">>>; + extra: z.ZodNullable; + }, "strip", z.ZodTypeAny, { + type: string; + url: string; + content_html?: string | undefined; + }, { + type: string; + url: string; + content_html?: string | undefined; + }>, "many">>>; + }, "strip", z.ZodTypeAny, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + }, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + }>>>; +}>, "strip", z.ZodTypeAny, { + description: string | null; + title: string | null; + content: string | null; + id: string; + author: string | null; + url: string | null; + guid: string; + categories: string[] | null; + authorUrl: string | null; + authorAvatar: string | null; + insertedAt: string; + publishedAt: string; + inboxHandle: string; + media?: { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }[] | null | undefined; + attachments?: { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }[] | null | undefined; + extra?: { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + } | null | undefined; +}, { + description: string | null; + title: string | null; + content: string | null; + id: string; + author: string | null; + url: string | null; + guid: string; + categories: string[] | null; + authorUrl: string | null; + authorAvatar: string | null; + insertedAt: string; + publishedAt: string; + inboxHandle: string; + media?: { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }[] | null | undefined; + attachments?: { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }[] | null | undefined; + extra?: { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + } | null | undefined; +}>; +declare const inboxesEntriesInsertOpenAPISchema: z.ZodObject>; + title: z.ZodOptional>; + content: z.ZodOptional>; + id: z.ZodOptional; + author: z.ZodOptional>; + url: z.ZodOptional>; + guid: z.ZodString; + media: z.ZodOptional>>; + categories: z.ZodOptional>>; + attachments: z.ZodOptional>>; + extra: z.ZodOptional>>; + authorUrl: z.ZodOptional>; + authorAvatar: z.ZodOptional>; + insertedAt: z.ZodString; + publishedAt: z.ZodString; + inboxHandle: z.ZodString; +}, "id" | "media" | "attachments" | "extra" | "insertedAt" | "publishedAt" | "inboxHandle">, { + attachments: z.ZodNullable; + mime_type: z.ZodOptional; + size_in_bytes: z.ZodOptional; + title: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }, { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }>, "many">>>; + media: z.ZodNullable; + width: z.ZodOptional; + height: z.ZodOptional; + preview_image_url: z.ZodOptional; + blurhash: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }, { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }>, "many">>>; + extra: z.ZodNullable; + }, "strip", z.ZodTypeAny, { + type: string; + url: string; + content_html?: string | undefined; + }, { + type: string; + url: string; + content_html?: string | undefined; + }>, "many">>>; + }, "strip", z.ZodTypeAny, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + }, { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + }>>>; + publishedAt: z.ZodString; +}>, "strip", z.ZodTypeAny, { + guid: string; + publishedAt: string; + description?: string | null | undefined; + title?: string | null | undefined; + content?: string | null | undefined; + author?: string | null | undefined; + url?: string | null | undefined; + media?: { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }[] | null | undefined; + categories?: string[] | null | undefined; + attachments?: { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }[] | null | undefined; + extra?: { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + } | null | undefined; + authorUrl?: string | null | undefined; + authorAvatar?: string | null | undefined; +}, { + guid: string; + publishedAt: string; + description?: string | null | undefined; + title?: string | null | undefined; + content?: string | null | undefined; + author?: string | null | undefined; + url?: string | null | undefined; + media?: { + type: "photo" | "video"; + url: string; + width?: number | undefined; + height?: number | undefined; + preview_image_url?: string | undefined; + blurhash?: string | undefined; + }[] | null | undefined; + categories?: string[] | null | undefined; + attachments?: { + url: string; + title?: string | undefined; + duration_in_seconds?: number | undefined; + mime_type?: string | undefined; + size_in_bytes?: number | undefined; + }[] | null | undefined; + extra?: { + links?: { + type: string; + url: string; + content_html?: string | undefined; + }[] | null | undefined; + } | null | undefined; + authorUrl?: string | null | undefined; + authorAvatar?: string | null | undefined; +}>; +declare const inboxesEntriesRelations: drizzle_orm.Relations<"inboxes_entries", { + inboxes: drizzle_orm.One<"inboxes", true>; +}>; +type inboxesEntriesModel = InferInsertModel & { + attachments?: AttachmentsModel[] | null; + media?: MediaModel[] | null; +}; + +declare const inboxes: drizzle_orm_pg_core.PgTableWithColumns<{ + name: "inboxes"; + schema: undefined; + columns: { + userId: drizzle_orm_pg_core.PgColumn<{ + name: "user_id"; + tableName: "inboxes"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + handle: drizzle_orm_pg_core.PgColumn<{ + name: "handle"; + tableName: "inboxes"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + secret: drizzle_orm_pg_core.PgColumn<{ + name: "secret"; + tableName: "inboxes"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: true; + hasDefault: true; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: true; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + title: drizzle_orm_pg_core.PgColumn<{ + name: "title"; + tableName: "inboxes"; + dataType: "string"; + columnType: "PgText"; + data: string; + driverParam: string; + notNull: false; + hasDefault: false; + isPrimaryKey: false; + isAutoincrement: false; + hasRuntimeDefault: false; + enumValues: [string, ...string[]]; + baseColumn: never; + generated: undefined; + }, {}, {}>; + }; + dialect: "pg"; +}>; +declare const inboxesOpenAPISchema: z.ZodObject<{ + userId: z.ZodString; + handle: z.ZodString; + secret: z.ZodString; + title: z.ZodNullable; +}, z.UnknownKeysParam, z.ZodTypeAny, { + title: string | null; + handle: string; + userId: string; + secret: string; +}, { + title: string | null; + handle: string; + userId: string; + secret: string; +}>; +declare const inboxesRelations: drizzle_orm.Relations<"inboxes", { + users: drizzle_orm.One<"user", true>; + entries: drizzle_orm.Many<"inboxes_entries">; +}>; +declare const inboxHandleSchema: z.ZodString; + declare const invitations: drizzle_orm_pg_core.PgTableWithColumns<{ name: "invitations"; schema: undefined; @@ -2826,6 +3715,7 @@ declare const usersRelations: drizzle_orm.Relations<"user", { actions: drizzle_orm.One<"actions", true>; wallets: drizzle_orm.One<"wallets", true>; feeds: drizzle_orm.Many<"feeds">; + inboxes: drizzle_orm.One<"inboxes", true>; }>; declare const wallets: drizzle_orm_pg_core.PgTableWithColumns<{ @@ -3224,6 +4114,146 @@ declare const feedPowerTokensRelations: drizzle_orm.Relations<"feedPowerTokens", }>; declare const _routes: hono_hono_base.HonoBase; type AppType = typeof _routes; -export { type ActionsModel, type AppType, type AttachmentsModel, type EntriesModel, type EntryReadHistoriesModel, type ExtraModel, type FeedModel, type MediaModel, type SettingsModel, accounts, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, collections, collectionsOpenAPISchema, collectionsRelations, entries, entriesOpenAPISchema, entriesRelations, entryReadHistories, entryReadHistoriesOpenAPISchema, entryReadHistoriesRelations, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, listsTimeline, listsTimelineOpenAPISchema, listsTimelineRelations, sessions, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, users, usersOpenApiSchema, usersRelations, verificationTokens, wallets, walletsOpenAPISchema, walletsRelations }; +export { type ActionsModel, type AppType, type AttachmentsModel, CommonEntryFields, type EntriesModel, type EntryReadHistoriesModel, type ExtraModel, type FeedModel, type MediaModel, type SettingsModel, accounts, achievements, achievementsOpenAPISchema, actions, actionsItemOpenAPISchema, actionsOpenAPISchema, actionsRelations, attachmentsZodSchema, collections, collectionsOpenAPISchema, collectionsRelations, entries, entriesOpenAPISchema, entriesRelations, entryReadHistories, entryReadHistoriesOpenAPISchema, entryReadHistoriesRelations, extraZodSchema, feedPowerTokens, feedPowerTokensOpenAPISchema, feedPowerTokensRelations, feeds, feedsOpenAPISchema, feedsRelations, inboxHandleSchema, inboxes, inboxesEntries, inboxesEntriesInsertOpenAPISchema, type inboxesEntriesModel, inboxesEntriesOpenAPISchema, inboxesEntriesRelations, inboxesOpenAPISchema, inboxesRelations, invitations, invitationsOpenAPISchema, invitationsRelations, languageSchema, lists, listsOpenAPISchema, listsRelations, listsSubscriptions, listsSubscriptionsOpenAPISchema, listsSubscriptionsRelations, listsTimeline, listsTimelineOpenAPISchema, listsTimelineRelations, mediaZodSchema, sessions, settings, subscriptions, subscriptionsOpenAPISchema, subscriptionsRelations, timeline, timelineOpenAPISchema, timelineRelations, transactionType, transactions, transactionsOpenAPISchema, transactionsRelations, users, usersOpenApiSchema, usersRelations, verificationTokens, wallets, walletsOpenAPISchema, walletsRelations };