MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / InstallDirect

Method InstallDirect

internal/pluginstore/install.go:146–178  ·  view source on GitHub ↗
(ctx context.Context, plugin Plugin, plan InstallPlan, options InstallOptions)

Source from the content-addressed store, hash-verified

144}
145
146func (c Client) InstallDirect(ctx context.Context, plugin Plugin, plan InstallPlan, options InstallOptions) (InstallResult, error) {
147 plugin.ID = strings.TrimSpace(plugin.ID)
148 plugin.Version = normalizeVersion(plugin.Version)
149 if !validPluginID(plugin.ID) {
150 return InstallResult{}, fmt.Errorf("invalid plugin id %q", plugin.ID)
151 }
152 if !validPluginVersion(plugin.Version) {
153 return InstallResult{}, fmt.Errorf("invalid plugin version %q", plugin.Version)
154 }
155 plan = NormalizeInstallPlan(plan)
156 plan.Type = InstallTypeDirect
157 if errValidate := ValidateInstallPlan(plan); errValidate != nil {
158 return InstallResult{}, errValidate
159 }
160 options = normalizeInstallOptions(options)
161 artifact, errSelect := SelectArtifact(plan, options.GOOS, options.GOARCH)
162 if errSelect != nil {
163 return InstallResult{}, errSelect
164 }
165 archiveData, errDownload := c.DownloadArtifact(ctx, artifact)
166 if errDownload != nil {
167 return InstallResult{}, fmt.Errorf("download artifact: %w", errDownload)
168 }
169 if errVerify := VerifyArtifactChecksum(artifact, archiveData); errVerify != nil {
170 return InstallResult{}, errVerify
171 }
172 result, errInstall := InstallArchive(archiveData, plugin, options)
173 if errInstall != nil {
174 return InstallResult{}, errInstall
175 }
176 result.InstallType = InstallTypeDirect
177 return result, nil
178}
179
180func (c Client) directPluginFromManifest(ctx context.Context, manifest Manifest) (Plugin, error) {
181 plugin := manifest.Plugin()

Callers 2

InstallMethod · 0.95
InstallManifestMethod · 0.95

Calls 10

DownloadArtifactMethod · 0.95
normalizeVersionFunction · 0.85
NormalizeInstallPlanFunction · 0.85
ValidateInstallPlanFunction · 0.85
normalizeInstallOptionsFunction · 0.85
SelectArtifactFunction · 0.85
VerifyArtifactChecksumFunction · 0.85
InstallArchiveFunction · 0.85
validPluginIDFunction · 0.70
validPluginVersionFunction · 0.70

Tested by

no test coverage detected