Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rmapi: Update to 0.0.13 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

endocrimes
Copy link

This commit updates rmapi to 0.0.13.

This gives a few benefits (like having authentication errors) but most usefully includes additional support for $XDG_CONFIG_DIR for storing tokens rather than requiring them to be stored in $HOME.

This commit updates rmapi to 0.0.13. This gives a few benefits (like
having authentication errors) but most usefully includes additional support for
XDG_CONFIG_DIR for storing tokens rather than requiring them to be stored in $HOME.
@@ -32,10 +32,11 @@ func New() (Remarkable, error) {
log.InitLog()

for i := 0; i < rmAuthRetries; i++ {
rm = api.CreateApiCtx(api.AuthHttpCtx())
var err error
rm, err = api.CreateApiCtx(api.AuthHttpCtx(false, false))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AuthHttpCtx here added two arguments:

  • the first being reAuth which forces a reauth regardless of an existing token. I've gone for false here because that seems unnecessary?
  • the second being nonInteractive which would result in failure if there isn't a valid authentication token already. It might be useful to include a flag for running on servers here but I've avoided doing it for now.

@@ -99,7 +100,7 @@ func (r Remarkable) SyncFileAndRename(file, title string) error {
r.api.Filetree.AddDocument(*document)

// Move the file to the title.
docName := util.DocPathToName(filepath.Base(file))
docName, _ := util.DocPathToName(filepath.Base(file))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra value is the file extension - which we don't need here.

@david-caro
Copy link

This fixes #6 right?

I tried using this PR but ended up with SIGSEV:

INFO[0000] authenticating with remarkable cloud
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x8bf9f9]

goroutine 1 [running]:
github.com/jessfraz/morningpaper2remarkable/remarkable.New(0xc0001a8000, 0xc000221db0, 0x1)
	/home/dcaro/Work/repos/per_user/jessfraz/morningpaper2remarkable/remarkable/remarkable.go:43 +0x119
main.main.func1(0xb0dbe0, 0xc000245f20, 0x1, 0x1)
	/home/dcaro/Work/repos/per_user/jessfraz/morningpaper2remarkable/main.go:70 +0x8b
github.com/genuinetools/pkg/cli.(*Program).run(0xc000372b80, 0xb0dbe0, 0xc000245f20, 0xc0001a2000, 0x2, 0x2, 0xc000221f20, 0x40fb58)
	/home/dcaro/Work/gows/pkg/mod/github.com/genuinetools/pkg@v0.0.0-20181022210355-2fcf164d37cb/cli/cli.go:173 +0x64e
github.com/genuinetools/pkg/cli.(*Program).Run(0xc000372b80)
	/home/dcaro/Work/gows/pkg/mod/github.com/genuinetools/pkg@v0.0.0-20181022210355-2fcf164d37cb/cli/cli.go:89 +0x65
main.main()
	/home/dcaro/Work/repos/per_user/jessfraz/morningpaper2remarkable/main.go:116 +0x454

@endocrimes
Copy link
Author

@david-caro huh interesting - I haven't rebuilt this since I opened the PR, but it was working at the time. I'll take a look at fixing it tomorrow. Looks like some case returns err == nil and rm == nil potentially.

@david-caro
Copy link

@david-caro huh interesting - I haven't rebuilt this since I opened the PR, but it was working at the time. I'll take a look at fixing it tomorrow. Looks like some case returns err == nil and rm == nil potentially.

It seems I'm getting unauthorized error, it only shows when debug is enabled:

DEBU[0000] retrying remarkable auth...                   error="failed to fetch document tree 401 Unauthorized Error"

@david-caro
Copy link

I bumped rmapi to 0.0.15 and it worked now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants