Files
Reims-Go/internal/plugin/market_exports.go
T
千川白浪 9006e6d9a7
CI / verify (push) Canceled after 0s
CI / rolling-release (push) Canceled after 0s
refactor: 抽离 HostAPIService 并将 internal/plugin 拆分为四层无环子包 (#202)
2026-12-05 06:05:41 -07:00

46 lines
1.3 KiB
Go

package plugin
import "github.com/Nwflower/reims-go/internal/plugin/uiassets"
// MaxPluginArchiveBytes is the maximum accepted size of a plugin archive.
const MaxPluginArchiveBytes = maxPluginArchiveBytes
// IsValidReverseDomainID reports whether id matches the reverse-domain plugin ID format.
func IsValidReverseDomainID(id string) bool {
return reReverseDomainID.MatchString(id)
}
// CheckHostCompatibility checks whether a plugin's platform list and engine
// constraints are compatible with the running host version.
func CheckHostCompatibility(platforms []string, engines Engines, hostVersion string) (bool, string) {
return checkHostCompatibility(platforms, engines, hostVersion)
}
// FileSHA256Hex returns the lowercase hex SHA-256 digest of the file at path.
func FileSHA256Hex(path string) (string, error) {
return fileSHA256Hex(path)
}
// SafeJoin joins rel under root and blocks lexical and symlink traversal.
func SafeJoin(root, rel string) (string, error) {
return uiassets.SafeJoin(root, rel)
}
// TrustSortRank orders trust levels with higher numbers being more trusted.
func TrustSortRank(t TrustLevel) int {
switch t {
case TrustOfficial:
return 3
case TrustVerified:
return 2
case TrustCommunity:
return 1
default:
return 0
}
}
func trustSortRank(t TrustLevel) int {
return TrustSortRank(t)
}