mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix gist url
This commit is contained in:
parent
4c238e1bdf
commit
784db36c48
@ -5,7 +5,7 @@ import { getRuntimeConfigStr } from '../core/factory'
|
|||||||
interface GistInfo {
|
interface GistInfo {
|
||||||
id: string
|
id: string
|
||||||
description: string
|
description: string
|
||||||
files: Record<string, { filename: string; raw_url: string }>
|
html_url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
async function listGists(token: string): Promise<GistInfo[]> {
|
async function listGists(token: string): Promise<GistInfo[]> {
|
||||||
@ -78,7 +78,7 @@ export async function getGistUrl(): Promise<string> {
|
|||||||
const gists = await listGists(githubToken)
|
const gists = await listGists(githubToken)
|
||||||
const gist = gists.find((gist) => gist.description === 'Auto Synced Mihomo Party Runtime Config')
|
const gist = gists.find((gist) => gist.description === 'Auto Synced Mihomo Party Runtime Config')
|
||||||
if (gist) {
|
if (gist) {
|
||||||
return gist.files['mihomo-party.yaml'].raw_url
|
return gist.html_url
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Gist not found')
|
throw new Error('Gist not found')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,7 +80,7 @@ const MihomoConfig: React.FC = () => {
|
|||||||
try {
|
try {
|
||||||
const url = await getGistUrl()
|
const url = await getGistUrl()
|
||||||
if (url !== '') {
|
if (url !== '') {
|
||||||
await navigator.clipboard.writeText(url)
|
await navigator.clipboard.writeText(`${url}/raw/mihomo-party.yaml`)
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
alert(e)
|
alert(e)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user