mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2026-02-10 11:40:28 +08:00
22 lines
934 B
TypeScript
22 lines
934 B
TypeScript
import * as chromeRequest from '../utils/chromeRequest'
|
|
import { subStorePort } from '../resolve/server'
|
|
import { getAppConfig } from '../config'
|
|
|
|
export async function subStoreSubs(): Promise<ISubStoreSub[]> {
|
|
const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig()
|
|
const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}`
|
|
const res = await chromeRequest.get<{ data: ISubStoreSub[] }>(`${baseUrl}/api/subs`, {
|
|
responseType: 'json'
|
|
})
|
|
return res.data.data
|
|
}
|
|
|
|
export async function subStoreCollections(): Promise<ISubStoreSub[]> {
|
|
const { useCustomSubStore = false, customSubStoreUrl = '' } = await getAppConfig()
|
|
const baseUrl = useCustomSubStore ? customSubStoreUrl : `http://127.0.0.1:${subStorePort}`
|
|
const res = await chromeRequest.get<{ data: ISubStoreSub[] }>(`${baseUrl}/api/collections`, {
|
|
responseType: 'json'
|
|
})
|
|
return res.data.data
|
|
}
|