mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #3242 from omnivore-app/fix/subscribe-api
fix/subscribe api
This commit is contained in:
commit
79baee56c6
2 changed files with 10 additions and 4 deletions
|
|
@ -40,7 +40,11 @@ import { unsubscribe } from '../../services/subscriptions'
|
|||
import { Merge } from '../../util'
|
||||
import { analytics } from '../../utils/analytics'
|
||||
import { enqueueRssFeedFetch } from '../../utils/createTask'
|
||||
import { authorized, getAbsoluteUrl } from '../../utils/helpers'
|
||||
import {
|
||||
authorized,
|
||||
getAbsoluteUrl,
|
||||
keysToCamelCase,
|
||||
} from '../../utils/helpers'
|
||||
import { parseFeed, parseOpml, RSS_PARSER_CONFIG } from '../../utils/parser'
|
||||
|
||||
type PartialSubscription = Omit<Subscription, 'newsletterEmail'>
|
||||
|
|
@ -249,7 +253,7 @@ export const subscribeResolver = authorized<
|
|||
input.isPrivate ?? null,
|
||||
MAX_RSS_SUBSCRIPTIONS,
|
||||
]
|
||||
)) as Subscription[]
|
||||
)) as any[]
|
||||
|
||||
if (results.length === 0) {
|
||||
return {
|
||||
|
|
@ -257,7 +261,8 @@ export const subscribeResolver = authorized<
|
|||
}
|
||||
}
|
||||
|
||||
const newSubscription = results[0]
|
||||
// convert to camel case
|
||||
const newSubscription = keysToCamelCase(results[0]) as Subscription
|
||||
|
||||
// create a cloud task to fetch rss feed item for the new subscription
|
||||
await enqueueRssFeedFetch({
|
||||
|
|
@ -439,7 +444,7 @@ export const scanFeedsResolver = authorized<
|
|||
const response = await axios.get(url, RSS_PARSER_CONFIG)
|
||||
const content = response.data as string
|
||||
// check if the content is html or xml
|
||||
const contentType = response.headers['content-type']
|
||||
const contentType = response.headers['Content-Type']
|
||||
const isHtml = contentType?.includes('text/html')
|
||||
if (isHtml) {
|
||||
// this is an html page, parse rss feed links
|
||||
|
|
|
|||
|
|
@ -358,6 +358,7 @@ describe('Subscriptions API', () => {
|
|||
... on SubscribeSuccess {
|
||||
subscriptions {
|
||||
id
|
||||
createdAt
|
||||
}
|
||||
}
|
||||
... on SubscribeError {
|
||||
|
|
|
|||
Loading…
Reference in a new issue