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

[Bug] Pyload Widget #517

Closed
Nonoss117 opened this issue Nov 10, 2022 · 18 comments
Closed

[Bug] Pyload Widget #517

Nonoss117 opened this issue Nov 10, 2022 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@Nonoss117
Copy link
Contributor

Nonoss117 commented Nov 10, 2022

Description

I use pyload-ng docker.

I get an API error with Pyload widget.
image

I created a user with "LIST" permissions (I also tried with an admin user)

my services.yaml:

    - Pyload-ng:
        icon: pyload.png
        href: http://192.168.1.100:8100/
        server: nas-docker
        container: pyload-ng
        description: Téléchargements
        widget:
            type: pyload
            fields: ["speed", "active", "queue", "total"]
            url: http://192.168.1.100:8100
            username: monitor
            password: My.password

My log file :
homepage-main.log

Is there something wrong with my parameters ?
Or the widget is only ok for pyload and not for pyload-ng ?

Steps to reproduce

same configuration, with docker pyload-ng

homepage version

main (eff2f1a, 10 nov. 2022)

Installation method

Docker

Configuration

Unraid + linuxserver/docker-pyload-ng

Other

No response

@Nonoss117 Nonoss117 added the bug Something isn't working label Nov 10, 2022
@shamoon
Copy link
Collaborator

shamoon commented Nov 10, 2022

I think they’re the same. Can you send the output of your curl command eg https://gethomepage.dev/en/more/troubleshooting/

@Nonoss117
Copy link
Contributor Author

Nonoss117 commented Nov 10, 2022

Ah it's a challenge for me lol.
Is it the right command ?
curl -L -k http://192.168.1.100:8100/api/

in a shell window ?

Edit : just in case the command is ok, result attached
Curl Command.txt

@shamoon
Copy link
Collaborator

shamoon commented Nov 10, 2022

No, its not so easy for pyload, first:

curl -L -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "username=USERNAME&password=PASSWORD" http://192.168.1.100:8100/api/login

which should return a session ID, then:

curl -L -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "session=SESSIONID" http://192.168.1.100:8100/api/statusServer

@Nonoss117
Copy link
Contributor Author

Thank's for your help shamoon.
This is the result :
`root@Nas:~# curl -L -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "username=monitor&password=xxxxxx" http://192.168.1.100:8100/api/login
{"_flashes":[["message","Logged in successfully"]],"_permanent":true,"authenticated":true,"id":3,"name":"monitor","perms":16,"role":1,"template":"default"}

root@Nas:~# ^C

root@Nas:~# curl -L -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "session=3" http://192.168.1.100:8100/api/statusServer
{"error":"Unauthorized"}`

I tried with my admin account, same : {"error":"Unauthorized"}

@shamoon
Copy link
Collaborator

shamoon commented Nov 10, 2022

Hmm, that is odd its a pretty different output. Im not overly familiar with the project (besides testing) but are you using https://github.com/pyload/pyload --> https://github.com/linuxserver/docker-pyload i.e. lscr.io/linuxserver/pyload ?

@shamoon
Copy link
Collaborator

shamoon commented Nov 10, 2022

Oh weird, theres https://github.com/linuxserver/docker-pyload and https://github.com/linuxserver/docker-pyload-ng . Im not sure what the difference is

According to the official docs, thats not what the login endpoint should return https://github.com/pyload/pyload/wiki/How-to-access-the-API

@Nonoss117
Copy link
Contributor Author

If I make no error, pyload-ng is a rewrite of pyload using python 3 instead of python 2 for pyload.
There must be some difference about the API. I don't know.

Yes, I confirm, I use https://github.com/linuxserver/docker-pyload-ng
I'd like to help more, but I'm really a noob

Don't waste your time, may be one day, a plyload-ng widget will appear ? :-)

@shamoon
Copy link
Collaborator

shamoon commented Nov 10, 2022

Ah, thanks for the explanation. Its a little confusing to figure that out online. Anyway I figured out that the -ng API returns the session in a cookie and requires it as such, totally different than non-ng.

I believe this is fixed now and the widget should work for both, please let me know!

@shamoon shamoon self-assigned this Nov 10, 2022
@Nonoss117
Copy link
Contributor Author

Yeah, works fine now

image

Thank you @shamoon :-)

@Nonoss117
Copy link
Contributor Author

@shamoon
Hm, no luck. Now there's an api error.

I updated homepage to nightly (3c0b185, 11 nov. 2022), refreshed the page, made some tests. Everything was ok (see my screen capture above).
But now, after a few time, same a before, API error.
I didn't change anything. It's a mystery for me.

@Nonoss117
Copy link
Contributor Author

In complement.
I restart homepage docker container.
The widget is ok.
1 hour after the restart, the API error is back again.

@shamoon
Copy link
Collaborator

shamoon commented Nov 11, 2022

Hmm, Ive left it running longer than that and havent seen this. The session token shouldn't expire that fast (though I realized I do need to make it expire eventually at least for -ng).

Can you look in the browser network tab and report the output of /api/services/proxy?type=pyload&group=...&service=...&endpoint=status

@Nonoss117
Copy link
Contributor Author

The report of the command :
active 0
captcha false
download true
pause false
queue 0
reconnect false
speed 0
total 0

The strange thing is that after a few times, the API returns ok. But I wasn't behind my screen.

The API is ok for this report

@Nonoss117
Copy link
Contributor Author

Ah this is the report with API error :

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received an instance of Object

@Nonoss117
Copy link
Contributor Author

It's crazy, lol
During 1 hour : API ok
Then during 1 hour : API error
Then API ok ....
and so on

without doing anything

@shamoon
Copy link
Collaborator

shamoon commented Nov 11, 2022

Its a weird API tbh, it does things like return status 200 (normal) even on login failure. I just pushed another change (takes a bit of time to build) that might at least make the error output for you more helpful. But also I would suggest re-creating the container and see if that helps with the intermittent thing.

If you are still getting it with the newer version, please check the logs (docker) and the same network call output as above again.

@Nonoss117
Copy link
Contributor Author

With your last widget update, no more API error.
Everything seems to be ok.

Thanks shamoon 👍

Copy link
Contributor

github-actions bot commented Feb 6, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants