MCPcopy Create free account
hub / github.com/devld/go-drive / InstallDriveScript

Function InstallDriveScript

drive/script/script_utils.go:143–167  ·  view source on GitHub ↗
(ctx context.Context, config common.Config, s AvailableDriveScript)

Source from the content-addressed store, hash-verified

141}
142
143func InstallDriveScript(ctx context.Context, config common.Config, s AvailableDriveScript) error {
144 if s.Name == "" || s.DriveURL == "" {
145 return err.NewBadRequestError("invalid installation request")
146 }
147
148 drivesDir, e := config.GetDir(config.DrivesDir, true)
149 if e != nil {
150 return e
151 }
152 e = downloadFile(ctx, s.DriveURL, filepath.Join(drivesDir, s.Name+".js"))
153 if e != nil {
154 return e
155 }
156 if s.DriveUploaderURL != "" {
157 driveUploadersDir, e := config.GetDir(config.DriveUploadersDir, true)
158 if e != nil {
159 return e
160 }
161 e = downloadFile(ctx, s.DriveUploaderURL, filepath.Join(driveUploadersDir, s.Name+".js"))
162 if e != nil {
163 return e
164 }
165 }
166 return nil
167}
168
169func UninstallDriveScript(config common.Config, name string) error {
170 if name == "" {

Callers 1

installDriveMethod · 0.92

Calls 2

downloadFileFunction · 0.85
GetDirMethod · 0.80

Tested by

no test coverage detected