fix: enhance plugin installation and update handling

This commit is contained in:
twwu
2024-11-06 09:50:05 +08:00
parent 61a70e7a71
commit 0d08b6cf51
5 changed files with 26 additions and 8 deletions

View File

@ -1,6 +1,6 @@
'use client'
import React, { useCallback, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import Modal from '@/app/components/base/modal'
import type { Item } from '@/app/components/base/select'
import type { InstallState } from '@/app/components/plugins/types'
@ -134,6 +134,11 @@ const InstallFromGitHub: React.FC<InstallFromGitHubProps> = ({ updatePayload, on
})
}
useEffect(() => {
if (state.step === InstallStepFromGitHub.selectPackage)
handleUrlSubmit()
}, [])
return (
<Modal
isShow={true}

View File

@ -48,6 +48,6 @@ export const pluginManifestInMarketToPluginProps = (pluginManifest: PluginManife
}
export const parseGitHubUrl = (url: string): GitHubUrlInfo => {
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/?$/)
const match = url.match(/^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/?$/)
return match ? { isValid: true, owner: match[1], repo: match[2] } : { isValid: false }
}