remove outdated packages from megalodon
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import axios, { AxiosRequestConfig } from 'axios'
|
||||
import proxyAgent, { ProxyConfig } from './proxy_config'
|
||||
import { NodeinfoError } from './megalodon'
|
||||
|
||||
const NODEINFO_10 = 'http://nodeinfo.diaspora.software/ns/schema/1.0'
|
||||
@@ -45,21 +44,14 @@ type Metadata = {
|
||||
* Now support Mastodon, Pleroma and Pixelfed. Throws an error when no known platform can be detected.
|
||||
*
|
||||
* @param url Base URL of SNS.
|
||||
* @param proxyConfig Proxy setting, or set false if don't use proxy.
|
||||
* @return SNS name.
|
||||
*/
|
||||
export const detector = async (
|
||||
url: string,
|
||||
proxyConfig: ProxyConfig | false = false
|
||||
): Promise<'mastodon' | 'pleroma' | 'misskey' | 'friendica'> => {
|
||||
let options: AxiosRequestConfig = {
|
||||
timeout: 20000
|
||||
}
|
||||
if (proxyConfig) {
|
||||
options = Object.assign(options, {
|
||||
httpsAgent: proxyAgent(proxyConfig)
|
||||
})
|
||||
}
|
||||
|
||||
const res = await axios.get<Links>(url + '/.well-known/nodeinfo', options)
|
||||
const link = res.data.links.find(l => l.rel === NODEINFO_20 || l.rel === NODEINFO_21)
|
||||
|
||||
Reference in New Issue
Block a user