diff --git a/src/components/About.tsx b/src/components/About.tsx index 58f8610..59ab191 100644 --- a/src/components/About.tsx +++ b/src/components/About.tsx @@ -4,6 +4,7 @@ import { Button, Card, Icon, List, Modal } from 'semantic-ui-react' import Credits from './Credits' import DescriptionItem from './DescriptionItem' import { DescriptionTypes, Ticker } from '../lib/types' +import { getAtomFeedUrl, getRssFeedUrl } from '../lib/api' interface Props { ticker: Ticker @@ -49,6 +50,13 @@ const About: FC = props => { type={DescriptionTypes.Telegram} /> )} + + + + Atom |{' '} + RSS + + ) diff --git a/src/lib/api.ts b/src/lib/api.ts index f0bd49e..c314833 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,6 +1,6 @@ import { Message, Settings, Ticker } from './types' -const apiUrl = process.env.REACT_APP_API_URL +export const ApiUrl = process.env.REACT_APP_API_URL type InitResponseData = { settings: Settings @@ -32,7 +32,7 @@ async function get(path: string): Promise { } export async function getInit(): Promise { - return get(`${apiUrl}/init`) + return get(`${ApiUrl}/init`) } export type TimelineOpts = { @@ -44,12 +44,20 @@ export async function getTimeline( opts: TimelineOpts ): Promise { if (opts.after != null) { - return get(`${apiUrl}/timeline?after=${opts.after}`) + return get(`${ApiUrl}/timeline?after=${opts.after}`) } if (opts.before != null) { - return get(`${apiUrl}/timeline?before=${opts.before}`) + return get(`${ApiUrl}/timeline?before=${opts.before}`) } - return get(`${apiUrl}/timeline`) + return get(`${ApiUrl}/timeline`) +} + +export function getAtomFeedUrl(): string { + return `${ApiUrl}/feed?origin=${window.location.hostname}&format=atom` +} + +export function getRssFeedUrl(): string { + return `${ApiUrl}/feed?origin=${window.location.hostname}&format=rss` }