imageshare
imageshare copied to clipboard
Imgur and ImgBB support
The older PHP-based ImageShare supported up to three different upload options, depending on the device and server configuration:
- ImgBB "anonymous" uploads with a server-provided API key - This uploaded photos to the ImageShare ImgBB account with a two-minute automatic deletion timer.
- ImgBB uploads with a user-provided API key - This stored photos in the user's own account, but didn't work on the Nintendo 3DS Browser and other browsers that couldn't store cookies properly.
- Imgur anonymous uploads with a server-provided API key - This worked the best, but Imgur blocked API access to the main ImageShare server, so it only worked for other people setting up their own servers.
The new version of ImageShare (#28) switched to temporary built-in image hosting as the mechanism for sharing images and videos. This was done primarily because Imgur already cut off API access for the main server, and ImgBB starting to throttle API access on free accounts.
If there is sufficient demand, or someone is willing to do PRs, Imgur and ImgBB could be implemented again as alternative upload methods. There are a few factors to consider for alternative upload methods:
- The upload form would have to be customized for each service. For example, ImageShare currently accepts all image and video files, but Imgur only supports a few specific video and audio formats.
- Error handling for each service would have to be implemented, with messages displayed to the user.
- Images should be deleted from the ImageShare server after they are uploaded to the third-party service.
Third-party hosting support adds a lot more complexity to ImageShare, and it can't be reliably used by the main server anymore, which is why it was left out of the rewritten version.
I just stumbled across this project! Currently looking into adding Imgur to the project. I think I may have found a way to send the images to them without having to use much authentication. If you don't mind me asking, what was their reason for removing the imageshare server?
Also, how many uploads do you usually get per day? I want to make sure that I won't add something that could get ratelimited to hell and back XD
Imgur never told me anything, they just blocked the main site at some point. I'm guessing they just have a unspecified rate limit for anonymous uploads (uploads using an API key and secret) and the main site exceeded that some point. Fresh API keys and changing the server IP didn't fix it.
The main site gets ~10-30 uploads per day, 503 total uploads in the past 30 days. The main site would probably continue using built-in uploads by default, especially for devices like the 3DS Browser that can't really store cookies or load login forms.
Sweet, thanks for that info! I should be able to have a new api access point (all it requires is the client id,) and with there not being much uploads per day, you shouldn't have to worry about any issues with them blocking you again.
I would like to keep the already built in implementation, while also adding support for imgur and potentially ImgBB. Possibly just by adding another button under the upload that says something like Upload to Imgur. It shouldn't require much power from the 3ds to render it all too! I will test it on my Old 3DS to make sure.
Rate limiting documentation for future refrence
1,250 uploads per day or approximately 12,500 requests per day. If the daily limit is hit five times in a month, then the app will be blocked for the rest of the month.
I wonder if it would be smart to create a rate limit for uploading to imgur, just to make sure that we don't get blocked for the month. I just don't know how I could add that without making the upload handler even more complex. It won't affect the clients, but It is a little more difficult server side to keep track of it.
Everytime a request is sent, we get a x-post-rate-limit-remaining header response. We could parse it and block uploading to imgur until the next day. But making sure that its blocked until the next day will be the hard part. I can create a temp file that holds a unix timestamp, but I feel like there is a cleaner way. We can't rely on something like the current file deletion, since if the server is stoped or restarted, the timer just ceases to exist. It fine since you recreate the folder anyways, but It shouldn't be relied on for something like timestamps.
If you have any ideas, feel free to share :3
I have loved Link Cleaner and Corbin for a while but somehow never ventured into this project until today. Pretty nifty little niche thing.
@nanospearing, I wondered the same thing about uploading remotely to another service, you mentioned you are experimenting with Imgur -- what if I host my own and want to upload to my VGY account?
https://vgy.me/api
I've used that for ages for random uploads that I post online, don't use it too too much but I think I remember it even being an option in "ShareX" when I used to use that before Windows got a snipping tool that is good.
@nanospearing, I wondered the same thing about uploading remotely to another service, you mentioned you are experimenting with Imgur -- what if I host my own and want to upload to my VGY account?
https://vgy.me/api
It should definitely be possible! After I finish the imgur implementation, I can create a seperate branch that would also implement the VGY. Might take me a bit to get there, but I will look into it :)
Yeah the client ID/secret upload method is what ImageShare previously used for Imgur and got blocked at some point. I'm not sure if it was ever lifted, but I know the same client ID/secret continued to work on my own local setup. I can look into what happened there and maybe move the main server's region to bypass any old blocks, but I can't guarantee Imgur will be enabled on the main server. Either way, having it as an option alongside the default upload sounds good, it might need to be a different form since the supported formats are different.
The code for v2.4 shows how the old Imgur and ImgBB integration worked, it included a link to delete the uploaded image on the client device, and passed the game title to Imgur as the post title: https://github.com/corbindavenport/imageshare/releases/tag/v24.06
As for storing data, I think a text file in a persistent volume/shared folder is fine, I'm not aware of a better solution with Docker Compose.
@corbindavenport Do you by any chance have discord? I don't want to keep spaming the github, and I usally respond faster on that platform :3
Yep there's a channel for ImageShare in my Discord: https://discord.gg/59wfy5cNHw
Imgur support is now available in the ImageShare v3.1 update, but it's not enabled on the main public server because Imgur is blocking API requests. I tried setting up a new VPS in another region and it's still blocked. I might get it working in the future, but for now, Imgur support is limited to self-hosted setups.
I'll leave this issue open for discussion about the Imgur implementation or adding ImgurBB support, but I don't consider the latter to be worth the effort in testing until there's sufficient demand.