fix gist url

This commit is contained in:
pompurin404 2024-09-22 20:40:28 +08:00
parent 4c238e1bdf
commit 784db36c48
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -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')
} }

View File

@ -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)