diff --git a/server/api/enable-login.ts b/server/api/enable-login.ts new file mode 100644 index 0000000..a018f6e --- /dev/null +++ b/server/api/enable-login.ts @@ -0,0 +1,8 @@ +import process from "node:process" + +export default defineEventHandler(async () => { + return { + enable: true, + url: `https://github.com/login/oauth/authorize?client_id=${process.env.G_CLIENT_ID}`, + } +}) diff --git a/src/components/column/card.tsx b/src/components/column/card.tsx index 8948142..46b881b 100644 --- a/src/components/column/card.tsx +++ b/src/components/column/card.tsx @@ -53,10 +53,10 @@ function NewsCard({ id, handleListeners }: NewsCardProps) { queryKey: [id, getRefreshId(id)], queryFn: async ({ queryKey }) => { const [_id, _refetchTime] = queryKey as [SourceID, number] - let url = `/api/s?id=${_id}` + let url = `/s?id=${_id}` const headers: Record = {} if (Date.now() - _refetchTime < 1000) { - url = `/api/s?id=${_id}&latest` + url = `/s?id=${_id}&latest` const jwt = safeParseString(localStorage.getItem("jwt")) if (jwt) headers.Authorization = `Bearer ${jwt}` } else if (cache.has(_id)) { diff --git a/src/components/column/dnd.tsx b/src/components/column/dnd.tsx index 1f2bb2a..5d11213 100644 --- a/src/components/column/dnd.tsx +++ b/src/components/column/dnd.tsx @@ -25,10 +25,11 @@ import { currentSourcesAtom } from "~/atoms" export function Dnd() { const [items, setItems] = useAtom(currentSourcesAtom) useQuery({ - queryKey: ["entries", items.sort()], + // sort in place + queryKey: ["entries", [...items].sort()], queryFn: async ({ queryKey }) => { const sources = queryKey[1] - const res: EntriesSourceResponse = await myFetch("/api/s/entries", { + const res: EntriesSourceResponse = await myFetch("/s/entries", { method: "POST", body: { sources, diff --git a/src/components/header/menu.tsx b/src/components/header/menu.tsx index b969338..dc150b7 100644 --- a/src/components/header/menu.tsx +++ b/src/components/header/menu.tsx @@ -14,7 +14,7 @@ function ThemeToggle() { } export function Menu() { - const { loggedIn, login, logout, userInfo } = useLogin() + const { loggedIn, login, logout, userInfo, enableLogin } = useLogin() const [shown, show] = useState(false) const ref = useRef(null) const isHover = useHoverDirty(ref) @@ -25,7 +25,7 @@ export function Menu() { { - loggedIn && userInfo.avatar + enableLogin && loggedIn && userInfo.avatar ? (