Skip to content

Commit

Permalink
refs #1515 Fix detector and enable misskey test
Browse files Browse the repository at this point in the history
  • Loading branch information
h3poteto committed Dec 29, 2022
1 parent 2e2d2df commit 58ea5ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion megalodon/src/megalodon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Mastodon from './mastodon'
import Entity from './entity'
import axios, { AxiosRequestConfig } from 'axios'
import Misskey from './misskey'
import { DEFAULT_UA } from './default'

export interface WebSocketInterface {
start(): void
Expand Down Expand Up @@ -1279,7 +1280,13 @@ type Instance = {
* @return SNS name.
*/
export const detector = async (url: string, proxyConfig: ProxyConfig | false = false): Promise<'mastodon' | 'pleroma' | 'misskey'> => {
let options: AxiosRequestConfig = {}
let options: AxiosRequestConfig = {
headers: {
'User-Agent': DEFAULT_UA,
// To avoid: https://github.com/axios/axios/issues/5346
'Accept-Encoding': 'gzip,deflate,compress'
}
}
if (proxyConfig) {
options = Object.assign(options, {
httpsAgent: proxyAgent(proxyConfig)
Expand Down
4 changes: 2 additions & 2 deletions megalodon/test/integration/megalodon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ describe('detector', () => {
})
})

describe.skip('misskey', () => {
const url = 'https://sushi.ski'
describe('misskey', () => {
const url = 'https://misskey.io'
it('should be misskey', async () => {
const misskey = await detector(url)
expect(misskey).toEqual('misskey')
Expand Down

0 comments on commit 58ea5ab

Please sign in to comment.