obsidian-imgur-plugin icon indicating copy to clipboard operation
obsidian-imgur-plugin copied to clipboard

Add uploading via proxy

Open cs-mshah opened this issue 3 years ago • 7 comments

I currently have to go through my college proxy to connect to the internet. This breaks the imgur upload as the proxy is not specified. Kindly make an option to specify proxy while uploading.
A better option would be to create an option to specify exact command line arguments too.

cs-mshah avatar Aug 25 '22 08:08 cs-mshah

Hi @cs-mshah. What type of proxy do you use in college? Http, socks or something else?

Also, what did you mean by cmd line args?

A better option would be to create an option to specify exact command line arguments too.

Obsidian is an electron-based app. Electron has cmd-line args for setting proxy globally for the whole app. Could you please try this and tell me if it will work out? https://github.com/electron/electron/blob/v20.1.0/docs/api/command-line-switches.md#--proxy-serveraddressport

gavvvr avatar Aug 25 '22 10:08 gavvvr

We use Http proxy. I tried to launch obsidian using obsidian --proxy-server=address:port but the image still wasn't uploaded.

cs-mshah avatar Aug 26 '22 04:08 cs-mshah

Ok. So, you can't upload without proxy. I can add this feature.

What about displaying existing images? Do the get loaded with Obsidian in your college?

gavvvr avatar Aug 26 '22 13:08 gavvvr

Yes, existing images are visible, which means that Obsidian does respect the proxy, but it seems that while uploading to imgur, proxy isn't used.

cs-mshah avatar Aug 27 '22 05:08 cs-mshah

I am surprised with such behavior. Are you sure they get loaded and not just cached from the times when you had a direct internet connection? I am surprised, because I do not use anything special to upload images. It's just a regular fetch API provided by Chromium. If it respects proxy for loading images, why it does not respect it for uploading them? 🤔

gavvvr avatar Aug 27 '22 08:08 gavvvr

So I got some surprising results:

  • Some of the old images were not visible. I tried again after connecting with proxy and they seem to appear good as before.
  • The upload also worked this time.

I feel that there is some issue of imgur with proxy, as I searched and found that several proxies block imgur. So if there are some domains that are free from the blocks then those could be used.
There doesn't seem to be an issue after all, but the results vary.

Can you support picgo core for upload? As I already have a tested configuration which works. All it requires is a command line argument and you can upload. It supports proxy too.

cs-mshah avatar Aug 29 '22 07:08 cs-mshah

I think the reason you've seen some images behind proxy is that they were cached. Some old images you did not open for a long time were unable to load.

I tried again after connecting with proxy and they seem to appear good as before.

How did you specify the proxy settings for Obsidian?

The upload also worked this time.

Good to hear 👏

I feel that there is some issue of imgur with proxy, as I searched and found that several proxies block imgur. So if there are some domains that are free from the blocks then those could be used.

I think good VPN should work well too

Can you support picgo core for upload?

Looks like there is already a fork which supports PicGo: https://github.com/renmu123/obsidian-image-auto-upload-plugin If PicGo is a self-hosted solution, then what is the benefit of it comparing to default pasting images to the vault directory?

gavvvr avatar Aug 29 '22 09:08 gavvvr