Skip to content

Commit

Permalink
remove ALL uncommented code
Browse files Browse the repository at this point in the history
  • Loading branch information
lostb1t committed Aug 7, 2024
1 parent 2d6f22c commit 30b4c9f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
4 changes: 1 addition & 3 deletions backend/icloud/api/drive.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func (d *DriveService) GetItemsByDriveID(ctx context.Context, ids []string, incl
path = "/retrieveItemDetailsInFolders"
}

// body, _ := IntoReader(values)
opts := rest.Opts{
Method: "POST",
Path: path,
Expand Down Expand Up @@ -185,7 +184,7 @@ func (d *DriveService) GetItemsInFolder(ctx context.Context, id string, limit in
RootURL: d.docsEndpoint,
Parameters: values,
}
//var items []*DriveItem

items := struct {
Items []*DriveItemRaw `json:"drive_item"`
}{}
Expand Down Expand Up @@ -356,7 +355,6 @@ func (d *DriveService) RenameItemByItemID(ctx context.Context, id, etag, name st

// RenameItemByDriveID renames a DriveItem by its drive ID.
func (d *DriveService) RenameItemByDriveID(ctx context.Context, id, etag, name string, force bool) (*DriveItem, *http.Response, error) {
// split := strings.Split(name, ".")
values := map[string]any{
"items": []map[string]any{{
"drivewsid": id,
Expand Down
2 changes: 0 additions & 2 deletions backend/icloud/api/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ func (s *Session) SignIn(ctx context.Context, appleID, password string) error {

// AuthWithToken authenticates the session
func (s *Session) AuthWithToken(ctx context.Context) error {
//fmt.Printf("%s", srv);

values := map[string]any{
"accountCountryCode": s.AccountCountry,
"dsWebAuthToken": s.SessionToken,
Expand Down
23 changes: 1 addition & 22 deletions backend/icloud/icloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,12 @@ func (f *Fs) listAll(ctx context.Context, dirID string) (items []*api.DriveItem,
return nil, err
}

// var driveItems []*api.DriveItemRaw
for _, i := range itemsRaw {
item := i.IntoDriveItem()
item.Name = f.opt.Enc.ToStandardName(item.Name)
item.Extension = f.opt.Enc.ToStandardName(item.Extension)
items = append(items, item)
}
//fs.PrettyPrint(items, "ERR", fs.LogLevelInfo)

return items, nil
}
Expand Down Expand Up @@ -346,14 +344,12 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e

// Mkdir implements fs.Fs.
func (f *Fs) Mkdir(ctx context.Context, dir string) error {
// _, err := f.dirCache.FindDir(ctx, dir, true)
_, _, err := f.FindDir(ctx, dir, true)
return err
}

// Name implements fs.Fs.
func (f *Fs) Name() string {
// fs.Debugf("Name:", f.name)
return f.name
}

Expand Down Expand Up @@ -640,7 +636,7 @@ func (f *Fs) move(ctx context.Context, ID, srcDirectoryID, srcLeaf, srcEtag, dst
var resp *http.Response
var item *api.DriveItem
var err error
//fmt.Println("MOVE")

// move
if srcDirectoryID != dstDirectoryID {
if err = f.pacer.Call(func() (bool, error) {
Expand Down Expand Up @@ -686,8 +682,6 @@ func (f *Fs) Move(ctx context.Context, src fs.Object, remote string) (fs.Object,
return nil, err
}

//fmt.Println("MOVE", srcObj.Remote(), srcLeaf, remote, dstLeaf, f.root)

item, err := f.move(ctx, srcObj.id, srcDirectoryID, srcLeaf, srcObj.etag, dstDirectoryID, dstLeaf)
if err != nil {
return src, err
Expand Down Expand Up @@ -738,8 +732,6 @@ var retryErrorCodes = []int{
}

func shouldRetry(ctx context.Context, resp *http.Response, err error) (bool, error) {
//PrettyPrint
//fs.PrettyPrint(resp, "resp", fs.LogLevelDebug)
if fserrors.ContextError(ctx, &err) {
return false, err
}
Expand All @@ -751,10 +743,8 @@ func ignoreResultUnknown(ctx context.Context, resp *http.Response, err error) (b
if requestError, ok := err.(*api.RequestError); ok {
if requestError.Status == "unknown" {
fs.Debugf(requestError, " ignoring.")
//time.Sleep(1 * time.Second)
return false, nil
}
//fs.Debugf(requestError, "Response returned not ok state.")
}
return shouldRetry(ctx, resp, err)
}
Expand All @@ -763,20 +753,14 @@ func retryResultUnknown(ctx context.Context, resp *http.Response, err error) (bo
if requestError, ok := err.(*api.RequestError); ok {
if requestError.Status == "unknown" {
fs.Debugf(requestError, " retrying.")
//time.Sleep(1 * time.Second)
return true, err
}
//fs.Debugf(requestError, "Response returned not ok state.")
}
return shouldRetry(ctx, resp, err)
}

// NewFs constructs an Fs from the path, container:path
func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, error) {

// pacer is not used in NewFs()
//_mapper = m

// Parse config into Options struct
opt := new(Options)
err := configstruct.Set(m, opt)
Expand Down Expand Up @@ -806,8 +790,6 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
opt.AppleID,
opt.Password,
opt.TrustToken,
//nil,
//nil,
cookies,
callback,
)
Expand Down Expand Up @@ -867,7 +849,6 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
return nil, err
}

// f.features.Fill(ctx, &tempF)
f.dirCache = tempF.dirCache
f.root = tempF.root
// return an error with an fs which points to the parent
Expand Down Expand Up @@ -935,7 +916,6 @@ func (f *Fs) readMetaData(ctx context.Context, path string) (item *api.DriveItem
}

if !found {
//fmt.Println("nout found", path, ID, leaf)
return nil, fs.ErrorObjectNotFound
}

Expand Down Expand Up @@ -1146,7 +1126,6 @@ var (
_ fs.DirMover = (*Fs)(nil)
_ fs.DirCacheFlusher = (*Fs)(nil)
_ fs.Copier = (*Fs)(nil)
// _ fs.CleanUpper = (*Fs)(nil)
_ fs.Object = &Object{}
_ fs.IDer = (*Object)(nil)
)

0 comments on commit 30b4c9f

Please sign in to comment.