Skip to content
This repository has been archived by the owner on Jul 2, 2022. It is now read-only.

"Unauthorized" using Yanius ShareX server #12

Closed
Makeshift opened this issue Dec 18, 2017 · 6 comments
Closed

"Unauthorized" using Yanius ShareX server #12

Makeshift opened this issue Dec 18, 2017 · 6 comments

Comments

@Makeshift
Copy link

When trying to use Sharenix to upload an image to Yanius, it returns 401 Unauthorized. I've copied the config straight from ShareX and tried regenerating my api key.
My config:

{
    "DefaultFileUploader": "Yanius",
    "DefaultImageUploader": "Yanius",
    "DefaultUrlShortener": "waa.ai",
    "XineramaHead": 0,

    "Services": [
        {
           "Name": "Yanius",
           "RequestType": "POST",
           "RequestURL": "http://<myurl>/api/upload",
           "FileFormName": "file",
           "Arguments": {
              "apikey": "<mycorrectyaniusapikey>"
           },
           "ResponseType": "Text",
           "URL": "$json:url$"
        },
<I snipped the rest of the default services>
}

Is there an option in sharenix to show more debug data? This is what it gives out (With API and URl data removed) when I run xfce4-screenshooter -r -o "sharenix -n":

Debug: Using 3 xinerama heads
Debug: 0	X: 1920	Y: 0	Width: 1920	Height: 1200
Debug: 1	X: 3840	Y: 0	Width: 1920	Height: 1200
Debug: 2	X: 0	Y: 0	Width: 1920	Height: 1200
Debug: Locking position 0
Debug: starting gtk.Main()
Debug: http://<myurl>/api/upload map[apikey:<mycorrectapikey>] map[]
Debug: Goroutine is exiting
Debug: exited gtk.Main()
Debug: Unlocking position 0
Debug: Notification dismissed
Debug: Parsing response...
Debug: {"message":"Unauthorized"}
Debug: jsonblob: {"message":"Unauthorized"}
Debug: syntax: url
Debug: paths: [0xc4201a22a0]
Debug: result is <nil> err is <nil>
Debug: Copying url to clipboard...
URL: (jsonpath not found)
Debug: Using 3 xinerama heads
Debug: 0	X: 1920	Y: 0	Width: 1920	Height: 1200
Debug: 1	X: 3840	Y: 0	Width: 1920	Height: 1200
Debug: 2	X: 0	Y: 0	Width: 1920	Height: 1200
Debug: Locking position 0
Debug: starting gtk.Main()
Debug: Notification expired after 30s
Debug: exited gtk.Main()
Debug: Unlocking position 0
Request failed: (jsonpath not found)

I'm not really sure why it's giving me unauthorized. This curl example works:
curl http://<myurl>/api/upload -F "apikey=<apikey>" (Although it whines about missing a file, but that's because I didn't provide one).

What is Sharenix doing differently from the curl example?

@Francesco149
Copy link
Owner

it might be that sharenix url-encodes parameters even for POST, i'll test later and let you know

@Makeshift
Copy link
Author

Cool, thank you :)

@Francesco149
Copy link
Owner

looks like i close the request writer before appending the extra params, which are probably never actually added to the request, haha!

this should be an easy fix, sec...

@Francesco149
Copy link
Owner

well this is interesting, I'm using a http dumper to check and sharenix still sends the apikey field for me, even with that writer closed. but it might just be undefined behaviour, either way I'm gonna see if that fixes it

@Francesco149
Copy link
Owner

yeah, it works. just tested with a local instance of yanius

@Makeshift
Copy link
Author

Brilliant, I'll give it a shot, thanks very much

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

No branches or pull requests

2 participants