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

ShareX Support #187

Closed
A7U opened this issue Jun 28, 2020 · 23 comments · Fixed by #463
Closed

ShareX Support #187

A7U opened this issue Jun 28, 2020 · 23 comments · Fixed by #463
Milestone

Comments

@A7U
Copy link

A7U commented Jun 28, 2020

Does this support ShareX? If not, can you add that? Thanks!

@eikek
Copy link
Owner

eikek commented Jun 28, 2020

Thanks for your input! I have to admit I don't know what sharex is... Do you mean this windows screenshot tool ShareX?

@A7U
Copy link
Author

A7U commented Jun 28, 2020

Yea indeed.

@eikek
Copy link
Owner

eikek commented Jun 28, 2020

Ok, thanks! I certainly would like to support this, but I first have to see how it works. From a first quick look it seems that people can define their "custom uploads" via a JSON file. So it would be a documentation update in sharry with an example for ShareX, I guess(?). Since I don't have Windows I'm not sure how to go about it.

@A7U
Copy link
Author

A7U commented Jun 28, 2020

Mhm, the response is in JSON. If you need beta testers I might be available. Msg me on discord: A7U#2459 or on Telegram: @A7Ubn

@eikek
Copy link
Owner

eikek commented Jun 28, 2020

I may completely miss the point here…IIUC, there is a sxcu file necessary, that defines where and how sharex does the upload request. Since sharry is not available globally, users would need to create their own files. Maybe it is already possible using an alias url and the alias/upload endpoint. I came up with this, but cannot fiddle with it, so maybe one with windows and sharex could give it a try:

{
  "Version": "1.3.1",
  "DestinationType": "ImageUploader, TextUploader, FileUploader",
  "RequestMethod": "POST",
  "RequestURL": "https://your.sharry/api/v2/alias/upload",
  "Body": "MultipartFormData",
  "Headers": {
    "Sharry-Alias": "some-alias-id"
  },
  "FileFormName": "file[]",
  "URL": "https://your.sharry/app/upload/$json:id"
}

You would need to create an alias page and add the id into the headers section.

@A7U
Copy link
Author

A7U commented Jun 28, 2020

Hmm, I'll see what I can do tomorrow on my PC. Thanks for trying btw

@eikek
Copy link
Owner

eikek commented Jun 28, 2020

You're welcome. Thank you, too for trying; and no need to hurry.

@A7U
Copy link
Author

A7U commented Jul 3, 2020

Sorry for the late reply. I've downloaded release but can't find /api/v2/alias/upload or /app/upload

@eikek
Copy link
Owner

eikek commented Jul 3, 2020

No worries! Just take as much time as you want! The /api/v2/alias/upload would be the endpoint to upload a file without logging in. But it requires to create a so called "alias page". You need to signup and login and then you find in the menu a link where you can create alias pages. This essentially creates some kind of api key. This key is required to upload files to yourself. I tried it with my installation:

$ curl -F file=@IMG_7777.JPG -H 'Sharry-Alias: G...id' https://box.daheim.site/api/v2/alias/upload
{"success":true,"message":"Share created.","id":"some-share-id-yNSpaAvXb7h"}

I thought that this could be used to upload files from sharex. I hope this makes sense?

@A7U
Copy link
Author

A7U commented Jul 3, 2020

Mhm this does make sense. But I'm still unsure how I can install sharry on my site.

@eikek
Copy link
Owner

eikek commented Jul 4, 2020

Ah sorry, I assumed (without reason) you had it running already. If you use docker, it would be the easiest way I think. Or download the zip and start the script in bin. Here are some instructions.

But I can also send you the credentials to my site if you don't want to bother with this?

@A7U
Copy link
Author

A7U commented Jul 12, 2020

Really sorry for the late reply once again, yes can you please provide me with the credentials? Since I'm really, really busy working on projects. Thanks once again

@eikek
Copy link
Owner

eikek commented Jul 13, 2020

No need to be sorry! It's not urgent or anything. Just do it (if you want) whenever you have time and thank you for that! I don't know how to transfer the credentials, since I'm not on telegram or discord. I tried with telegram, but I couldn't figure out how to add your username – it always wants me to add phonenumbers…. Maybe via mail? You can mail me at "eikek [at] posteo.de" and I can mail you an account on my site that you could use to try things out.

@A7U
Copy link
Author

A7U commented Jul 23, 2020

a7uishot@protonmail.com

@A7U
Copy link
Author

A7U commented Jul 29, 2020

Can't find anything related to sharex

@eikek
Copy link
Owner

eikek commented Jul 29, 2020

I'm not sure if I understand. What did you expect to find and where did you look? I'm sorry that I'm not of any help with sharex. My thoughts were like this:

  • log in and create a "alias page". this allows anyone (who knows that link) to upload files; i.e. there is no login necessary
  • try to configure sharex that it uploads to this url (the url will be presented to you)

I hoped that maybe the config in this comment could work. There you'd need to replace the some-alias-id with the real alias id that has been generated for you.

Maybe you could try this config and playwith it? Not sure if that makes sense ….

@A7U
Copy link
Author

A7U commented Aug 2, 2020

Oh I see, okay I'll try that when I have time

@Pfuenzle
Copy link

Pfuenzle commented Mar 23, 2021

Seems like this issue has stalled a bit, so I did some testing
I tried to config your posted a few comments ago, and image, file and text uploads are working as intended, except the return URL. When sharing a image/file with sharry, it normaly copies the URL of the share to clipboard, when using your config it only returns "https://<url>/app/upload/"
This is caused by a missing $ at the end of $json:id$,
so the working config is
{ "Version": "1.3.1", "DestinationType": "ImageUploader, TextUploader, FileUploader", "RequestMethod": "POST", "RequestURL": "https://your.sharry/api/v2/alias/upload", "Body": "MultipartFormData", "Headers": { "Sharry-Alias": "some-alias-id" }, "FileFormName": "file[]", "URL": "https://your.sharry/app/upload/$json:id$" }

I have some questions though, when creating a share with sharry, its default settings are 30 views, same validity time as the alies and it is unpublished.
Would it be possible to either set the publish status and views in the upload request or during the creation of the alias?
I mostly share files with friends that dont have an account, so setting my default for sharry to publish (and possibly views >30) would be great.

Also, from what I read in the docs, you can display an image in the description with "![image]({{filename.filename.url}})" Is it possible to give a description parameter when using an alias, so pictures can be instantly displayed when opening a shared URL?

Another "issue" (although I dont know if it is a limitation by sharry or sharex) is, that when selecting multiple files to be uploaded, a new share for every file is created, instead of one with all files in them.
Thanks`

@eikek
Copy link
Owner

eikek commented Mar 23, 2021

@Pfuenzle Thank you very much. I think this is good info to put somewhere in the docs.

To your questions: In summary, I think they are a valid new issue :)

  1. Most settings can be given with the upload request (fyi some pointers here unfortunately, the meta structure is not properly generated by the openapi tools, here is the plain text description). You need to add a part of type application/json and name meta to contain this data: maxviews, validity, description and password is currently possible. However, publishing is not possible yet. It would currently require a second request. I think it's a good idea to be able to define all of this for each alias.
  2. This is possible currently only with the upload request as described above.
  3. That seems to me a sharex thing, but not sure: one post request creates a new share. if sharex sends all files in one request, than there should be one share with all files in them.

@eikek
Copy link
Owner

eikek commented May 16, 2021

@Pfuenzle I'm just thinking about to allow uploads via aliases to be published immediately as you asked for. But I think I forgot (sorry) or don't understand the use case. Why do you need this? If you share files with friends, you don't use the alias uploads but the normal upload, since you have an account. The alias pages are for uploads where you are the receiver. So I can't see why it is then desired to have it published automatically - you'd still need to login to find out the share url anyways.

Edit: so to think further, I'm thinking about to even remove the validity setting for an alias, too.

@eikek eikek mentioned this issue May 22, 2021
@eikek eikek added this to the Sharry 1.8.0 milestone May 22, 2021
@mergify mergify bot closed this as completed in #463 May 22, 2021
@eikek
Copy link
Owner

eikek commented May 22, 2021

I added the snippet that has been confirmed to work to the docs. Think this can be closed then. For the other concerns, it would be nice to have separate issues to discuss it. thanks!

@Jafner
Copy link

Jafner commented Mar 8, 2022

Has something changed that might cause this configuration to stop working?
Unless I've inputted something wrong, I seem to be getting 403 errors when simply trying to push an upload to the /api/v2/alias/upload path.

image

Do I need to add some kind of authentication headers?

@Jafner
Copy link

Jafner commented Mar 8, 2022

I'm a fool. I put Sharry-Alias under form data, not the headers section.
Using the "Import from clipboard" feature worked for me.

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 a pull request may close this issue.

4 participants