mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
add api documentation page
This commit is contained in:
1464
commafeed-client/package-lock.json
generated
1464
commafeed-client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@
|
|||||||
"react-infinite-scroller": "^1.2.6",
|
"react-infinite-scroller": "^1.2.6",
|
||||||
"react-redux": "^8.0.2",
|
"react-redux": "^8.0.2",
|
||||||
"react-router-dom": "^6.3.0",
|
"react-router-dom": "^6.3.0",
|
||||||
|
"swagger-ui-react": "^4.13.2",
|
||||||
"tinycon": "^0.6.8"
|
"tinycon": "^0.6.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
"@types/react": "^18.0.17",
|
"@types/react": "^18.0.17",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-infinite-scroller": "^1.2.3",
|
"@types/react-infinite-scroller": "^1.2.3",
|
||||||
|
"@types/swagger-ui-react": "^4.11.0",
|
||||||
"@types/tinycon": "^0.6.3",
|
"@types/tinycon": "^0.6.3",
|
||||||
"@vitejs/plugin-react": "^2.0.1",
|
"@vitejs/plugin-react": "^2.0.1",
|
||||||
"eslint": "^8.22.0",
|
"eslint": "^8.22.0",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import { AdminUsersPage } from "pages/admin/AdminUsersPage"
|
|||||||
import { MetricsPage } from "pages/admin/MetricsPage"
|
import { MetricsPage } from "pages/admin/MetricsPage"
|
||||||
import { AboutPage } from "pages/app/AboutPage"
|
import { AboutPage } from "pages/app/AboutPage"
|
||||||
import { AddPage } from "pages/app/AddPage"
|
import { AddPage } from "pages/app/AddPage"
|
||||||
|
import { ApiDocumentationPage } from "pages/app/ApiDocumentationPage"
|
||||||
import { CategoryDetailsPage } from "pages/app/CategoryDetailsPage"
|
import { CategoryDetailsPage } from "pages/app/CategoryDetailsPage"
|
||||||
import { FeedDetailsPage } from "pages/app/FeedDetailsPage"
|
import { FeedDetailsPage } from "pages/app/FeedDetailsPage"
|
||||||
import { FeedEntriesPage } from "pages/app/FeedEntriesPage"
|
import { FeedEntriesPage } from "pages/app/FeedEntriesPage"
|
||||||
@@ -83,6 +84,7 @@ function AppRoutes() {
|
|||||||
<Route path="metrics" element={<MetricsPage />} />
|
<Route path="metrics" element={<MetricsPage />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="about" element={<AboutPage />} />
|
<Route path="about" element={<AboutPage />} />
|
||||||
|
<Route path="api" element={<ApiDocumentationPage />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="*" element={<Navigate to="/" replace />} />
|
<Route path="*" element={<Navigate to="/" replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ export const redirectToMetrics = createAsyncThunk("redirect/admin/metrics", (_,
|
|||||||
thunkApi.dispatch(redirectTo("/app/admin/metrics"))
|
thunkApi.dispatch(redirectTo("/app/admin/metrics"))
|
||||||
)
|
)
|
||||||
export const redirectToAbout = createAsyncThunk("redirect/about", (_, thunkApi) => thunkApi.dispatch(redirectTo("/app/about")))
|
export const redirectToAbout = createAsyncThunk("redirect/about", (_, thunkApi) => thunkApi.dispatch(redirectTo("/app/about")))
|
||||||
|
export const redirectToApiDocumentation = createAsyncThunk("redirect/api", (_, thunkApi) => thunkApi.dispatch(redirectTo("/app/api")))
|
||||||
|
|
||||||
export const redirectSlice = createSlice({
|
export const redirectSlice = createSlice({
|
||||||
name: "redirect",
|
name: "redirect",
|
||||||
|
|||||||
@@ -283,6 +283,10 @@ msgstr "Generate new API key"
|
|||||||
msgid "Generated feed url"
|
msgid "Generated feed url"
|
||||||
msgstr "Generated feed url"
|
msgstr "Generated feed url"
|
||||||
|
|
||||||
|
#: src/pages/app/AboutPage.tsx
|
||||||
|
msgid "Go to the API documentation."
|
||||||
|
msgstr "Go to the API documentation."
|
||||||
|
|
||||||
#: src/components/KeyboardShortcutsHelp.tsx
|
#: src/components/KeyboardShortcutsHelp.tsx
|
||||||
msgid "Go to the All view"
|
msgid "Go to the All view"
|
||||||
msgstr "Go to the All view"
|
msgstr "Go to the All view"
|
||||||
@@ -341,10 +345,6 @@ msgstr "Last refresh message"
|
|||||||
msgid "Link"
|
msgid "Link"
|
||||||
msgstr "Link"
|
msgstr "Link"
|
||||||
|
|
||||||
#: src/pages/app/AboutPage.tsx
|
|
||||||
msgid "Link to the API documentation."
|
|
||||||
msgstr "Link to the API documentation."
|
|
||||||
|
|
||||||
#: src/hooks/useAppLoading.ts
|
#: src/hooks/useAppLoading.ts
|
||||||
msgid "Loading profile..."
|
msgid "Loading profile..."
|
||||||
msgstr "Loading profile..."
|
msgstr "Loading profile..."
|
||||||
|
|||||||
@@ -283,6 +283,10 @@ msgstr "Générer une nouvelle clé API"
|
|||||||
msgid "Generated feed url"
|
msgid "Generated feed url"
|
||||||
msgstr "URL du flux généré"
|
msgstr "URL du flux généré"
|
||||||
|
|
||||||
|
#: src/pages/app/AboutPage.tsx
|
||||||
|
msgid "Go to the API documentation."
|
||||||
|
msgstr "Aller à la documentation de l'API."
|
||||||
|
|
||||||
#: src/components/KeyboardShortcutsHelp.tsx
|
#: src/components/KeyboardShortcutsHelp.tsx
|
||||||
msgid "Go to the All view"
|
msgid "Go to the All view"
|
||||||
msgstr "Aller à la catégorie Tout"
|
msgstr "Aller à la catégorie Tout"
|
||||||
@@ -341,10 +345,6 @@ msgstr "Dernier message de mise à jour"
|
|||||||
msgid "Link"
|
msgid "Link"
|
||||||
msgstr "Lien"
|
msgstr "Lien"
|
||||||
|
|
||||||
#: src/pages/app/AboutPage.tsx
|
|
||||||
msgid "Link to the API documentation."
|
|
||||||
msgstr "Lien vers la documentation de l'API."
|
|
||||||
|
|
||||||
#: src/hooks/useAppLoading.ts
|
#: src/hooks/useAppLoading.ts
|
||||||
msgid "Loading profile..."
|
msgid "Loading profile..."
|
||||||
msgstr "Chargement du profil ..."
|
msgstr "Chargement du profil ..."
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import relativeTime from "dayjs/plugin/relativeTime"
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import ReactDOM from "react-dom/client"
|
import ReactDOM from "react-dom/client"
|
||||||
import { Provider } from "react-redux"
|
import { Provider } from "react-redux"
|
||||||
|
import "swagger-ui-react/swagger-ui.css"
|
||||||
import { App } from "./App"
|
import { App } from "./App"
|
||||||
|
|
||||||
dayjs.extend(relativeTime)
|
dayjs.extend(relativeTime)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { t, Trans } from "@lingui/macro"
|
import { t, Trans } from "@lingui/macro"
|
||||||
import { Anchor, Box, Center, Container, Group, List, NativeSelect, SimpleGrid, Title } from "@mantine/core"
|
import { Anchor, Box, Center, Container, Group, List, NativeSelect, SimpleGrid, Title } from "@mantine/core"
|
||||||
import { Constants } from "app/constants"
|
import { Constants } from "app/constants"
|
||||||
import { useAppSelector } from "app/store"
|
import { redirectToApiDocumentation } from "app/slices/redirect"
|
||||||
|
import { useAppDispatch, useAppSelector } from "app/store"
|
||||||
import { CategorySelect } from "components/content/add/CategorySelect"
|
import { CategorySelect } from "components/content/add/CategorySelect"
|
||||||
import { KeyboardShortcutsHelp } from "components/KeyboardShortcutsHelp"
|
import { KeyboardShortcutsHelp } from "components/KeyboardShortcutsHelp"
|
||||||
import React, { useState } from "react"
|
import React, { useState } from "react"
|
||||||
@@ -49,6 +50,7 @@ function NextUnreadBookmarklet() {
|
|||||||
export function AboutPage() {
|
export function AboutPage() {
|
||||||
const version = useAppSelector(state => state.server.serverInfos?.version)
|
const version = useAppSelector(state => state.server.serverInfos?.version)
|
||||||
const revision = useAppSelector(state => state.server.serverInfos?.gitCommit)
|
const revision = useAppSelector(state => state.server.serverInfos?.gitCommit)
|
||||||
|
const dispatch = useAppDispatch()
|
||||||
return (
|
return (
|
||||||
<Container size="xl">
|
<Container size="xl">
|
||||||
<SimpleGrid cols={2} breakpoints={[{ maxWidth: Constants.layout.mobileBreakpoint, cols: 1 }]}>
|
<SimpleGrid cols={2} breakpoints={[{ maxWidth: Constants.layout.mobileBreakpoint, cols: 1 }]}>
|
||||||
@@ -149,8 +151,8 @@ export function AboutPage() {
|
|||||||
</List>
|
</List>
|
||||||
</Section>
|
</Section>
|
||||||
<Section title={t`REST API`} icon={<TbRocket size={24} />}>
|
<Section title={t`REST API`} icon={<TbRocket size={24} />}>
|
||||||
<Anchor href="api/" target="_blank" rel="noreferrer">
|
<Anchor onClick={() => dispatch(redirectToApiDocumentation())}>
|
||||||
<Trans>Link to the API documentation.</Trans>
|
<Trans>Go to the API documentation.</Trans>
|
||||||
</Anchor>
|
</Anchor>
|
||||||
</Section>
|
</Section>
|
||||||
</SimpleGrid>
|
</SimpleGrid>
|
||||||
|
|||||||
12
commafeed-client/src/pages/app/ApiDocumentationPage.tsx
Normal file
12
commafeed-client/src/pages/app/ApiDocumentationPage.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import { Loader } from "components/Loader"
|
||||||
|
import React, { Suspense } from "react"
|
||||||
|
|
||||||
|
export function ApiDocumentationPage() {
|
||||||
|
// swagger-ui is very large, load only on-demand
|
||||||
|
const SwaggerUI = React.lazy(() => import("swagger-ui-react"))
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<Loader />}>
|
||||||
|
<SwaggerUI url="swagger/swagger.json" />
|
||||||
|
</Suspense>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ export default defineConfig({
|
|||||||
plugins: ["macros"],
|
plugins: ["macros"],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
eslint(),
|
eslint({ exclude: ["**/node_modules/**"] }),
|
||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
visualizer(),
|
visualizer(),
|
||||||
],
|
],
|
||||||
@@ -22,9 +22,11 @@ export default defineConfig({
|
|||||||
port: 8082,
|
port: 8082,
|
||||||
proxy: {
|
proxy: {
|
||||||
"/rest": "http://localhost:8083",
|
"/rest": "http://localhost:8083",
|
||||||
|
"/swagger": "http://localhost:8083",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
|
chunkSizeWarningLimit: 1000,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
manualChunks: id => {
|
manualChunks: id => {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
<location>com.commafeed.frontend.model</location>
|
<location>com.commafeed.frontend.model</location>
|
||||||
<location>com.commafeed.frontend.model.request</location>
|
<location>com.commafeed.frontend.model.request</location>
|
||||||
</locations>
|
</locations>
|
||||||
<swaggerDirectory>target/swagger</swaggerDirectory>
|
<swaggerDirectory>${project.build.directory}/classes/assets/swagger</swaggerDirectory>
|
||||||
<basePath>/rest</basePath>
|
<basePath>/rest</basePath>
|
||||||
<info>
|
<info>
|
||||||
<title>CommaFeed</title>
|
<title>CommaFeed</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user