Author Topic: GH Imgur Fixer  (Read 4931 times)

0 Members and 1 Guest are viewing this topic.

Offline homerowco

  • Thread Starter
  • Posts: 29
GH Imgur Fixer
« on: Tue, 26 June 2018, 10:53:59 »
Extensions:

Chrome (unlisted):
https://chrome.google.com/webstore/detail/gh-imgur-fix/ckkmbgkaejlabflnopigihodicamibjn

Firefox (all platforms - experimental tag):
https://addons.mozilla.org/en-US/firefox/addon/gh-imgur-fix/

Safari (hosted on Github - unpublished - proxy method):
https://github.com/homerowco/GHimgurFix/raw/master/ext/safari/dist/craycopy.safariextz



Source:

Source Repo:
https://github.com/homerowco/GHimgurFix

Stack:
Simple PHP proxy script that runs on a AWS Elastic Beanstalk which is proxied by Cloudflare to cache everything going through assuring a 100% CDN cache rate.
The Chrome extension is a content match injection on *geekhack.org* that replaces all imgur images and links (zoom) with the same source but adds the proxy domain in front of it.
It's currently running on craycopy.com (random old domain) and since it's all cached via Cloudflare it's not really costing me much besides the $5/mo for the nano EB instance.


Update: The extensions are now serverless and modify the request header on demand! Much better, much faster.

Want to change something? Pull request! :)



Example:

Broken:
More
Code: [Select]
https://i.imgur.com/Tiur5Eg.jpg

Fixed (old proxy):
More
Code: [Select]
https://craycopy.com/i/https://i.imgur.com/Tiur5Eg.jpg




JS Alternatives:

Update: I tried to modify the request headers via jquery/native and it's not possible. All modern browsers refuse the editing of request headers. The proxy url rewrite method is still the only working one for directly inside the website implementation without installing the extensions.

jQuery (avail. on GH):
Code: [Select]
$(function(){
var f='://i.imgur.com/',r='https://craycopy.com/';
$.each([['img.bbc_img[','src'],['a.highslide[','href']],function(k,v){
$(v[0]+v[1]+'*="'+f+'"]').each(function(){var t=$(this),s=t.attr(v[1]);-1===s.indexOf(r)&&t.attr(v[1],r+'i/'+s)});
});
});

Vanilla:
Code: [Select]
(function(){
var f='://i.imgur.com/',r='https://craycopy.com/',a=[['img.bbc_img[','src'],['a.highslide[','href']],g,h,x;
for(g in a){for(h of document.querySelectorAll(a[g][0]+a[g][1]+'*="'+f+'"]'))(x=h[a[g][1]])&&-1===x.indexOf(r)&&(h[a[g][1]]=r+'i/'+x)}
})();
« Last Edit: Thu, 28 June 2018, 16:29:06 by homerowco »

Offline homerowco

  • Thread Starter
  • Posts: 29
Re: GH Imgur Fixer
« Reply #1 on: Tue, 26 June 2018, 18:26:43 »
UPDATE:

General:
 - Safari support was added via proxy bypass because Safari does not support header rewrites
 - added zoom in link support to Safari extension


v0.1.1:
 - slight modification to support Mozilla Firefox on all Platforms

v0.1.0:
 - no more server needed!
(thanks to webRequest modification of the headers and user Antarctidad for pointing me in the right direct!)

v0.0.6:
 - cleanup and manual minification of code

v0.0.5:
 - merged link and img tag check into one loop

v0.0.3/4:
 - added stricter element selector

v0.0.2:
 - fixes zoom in view to work as well!
« Last Edit: Thu, 28 June 2018, 16:27:37 by homerowco »

Offline voodoo5

  • Posts: 59
  • Location: Canada
Re: GH Imgur Fixer
« Reply #2 on: Wed, 27 June 2018, 07:56:22 »
Thanks.

Is GH aware of the problem / working on a fix?

Offline dgneo

  • Supervillain
  • Posts: 1948
Re: GH Imgur Fixer
« Reply #3 on: Wed, 27 June 2018, 08:31:30 »
never heard of him

Offline homerowco

  • Thread Starter
  • Posts: 29
Re: GH Imgur Fixer
« Reply #4 on: Wed, 27 June 2018, 10:00:42 »
Thanks.

Is GH aware of the problem / working on a fix?

Can't be fixed directly - imgur basically blocked geekhack it seems.
My fix rewrites the urls and then proxies images creating a technical fix for it.

The extension works on chrome until someone makes a version for safari/firefox (does chrome work on firefox?) or tells me how to do it haha.

Other than that the GH admins could put the above provided JS directly into the page to also "fix" it :)

Offline janglad

  • Posts: 336
  • Location: Belgium
  • Clavier.xyz
    • Clavier.xyz
Re: GH Imgur Fixer
« Reply #5 on: Thu, 28 June 2018, 07:58:19 »
Thanks for this!!  :thumb:

Offline Coreda

  • Posts: 660
Re: GH Imgur Fixer
« Reply #6 on: Thu, 28 June 2018, 08:05:14 »
Can't be fixed directly - imgur basically blocked geekhack it seems.

I think what the gh admin will have to do if they want to actually resolve the blacklisting is enforce a rule to stop using Imgur for images in the classifieds and for signatures, as that seems to be the cause.

Apart from that appreciate someone has made a short term fix :thumb:

Offline homerowco

  • Thread Starter
  • Posts: 29
Re: GH Imgur Fixer
« Reply #7 on: Thu, 28 June 2018, 08:26:49 »
Added Firefox extension for all platforms (seems like this will even work on Android) and replaced the proxy rewrite code with native web request modifications!

It just became much faster and better and no need for additional requests, plus its now also on a lot more browsers :)

Check original post above for details!

Offline ojrask

  • Posts: 326
  • juuh elikkäs
Re: GH Imgur Fixer
« Reply #8 on: Thu, 28 June 2018, 13:48:56 »
Ooh, I thought my adblocking settings were fugged and it prevented the images from loading. Really sucky as there are years of images in here which are now broken.
Current:
    Ducky DK9008P [MX Blues] | WASD V2 TKL [MX Blues] | r63 (Satan 60% DIY) [Gateron Browns] | BananaSplit 60% [Gateron Greens] | UK78 [67g Zealios] | Infinity ErgoDox [MX Clears] | Pearl 40% [78g Zealios] | G81-3000
Coming up:
    DZ60/SKB60-WKL [100g MX Silent Blacks] | G81-3000 [Box Navies] Handwire
IC/GB:
    GMK Strogg | G81/80-3000 MX metal plate

Offline homerowco

  • Thread Starter
  • Posts: 29
Re: GH Imgur Fixer
« Reply #9 on: Thu, 28 June 2018, 15:54:28 »
I got Safari to work - the old method via proxy CDN because Safari does not allow devs to adjust the outgoing request headers.
Better than nothing ;)

Offline Puddsy

  • nice
  • * Exalted Elder
  • Posts: 9275
  • Location: North of the Mason-Dixon
  • "Do you shovel to survive, or survive to shovel?"
Re: GH Imgur Fixer
« Reply #10 on: Thu, 28 June 2018, 22:02:57 »
I've forwarded this to someone who works for Imgur (not support). Stay tuned.
« Last Edit: Thu, 28 June 2018, 22:06:05 by Puddsy »
QFR | MJ2 TKL | "Schumiboard" | "Bulgogiboard" (Keycon 104) | MIRA SE "2Y10M" | TGR Alice "Pink + White" | MEME "Sound Meme" | Keycult No 1 "The Brass Behemoth" | Southpaw Fullsize (when it ships) | Daily driver: TGR Alice


Offline SpAmRaY

  • NOT a Moderator
  • * Certified Spammer
  • Posts: 14416
  • Location: ¯\(°_o)/¯
  • because reasons.......
Re: GH Imgur Fixer
« Reply #11 on: Thu, 28 June 2018, 22:09:48 »
I've forwarded this to someone who works for Imgur (not support). Stay tuned.
Nice

Sent from my SM-G930V using Tapatalk


Offline Puddsy

  • nice
  • * Exalted Elder
  • Posts: 9275
  • Location: North of the Mason-Dixon
  • "Do you shovel to survive, or survive to shovel?"
Re: GH Imgur Fixer
« Reply #12 on: Thu, 28 June 2018, 22:13:12 »
I've forwarded this to someone who works for Imgur (not support). Stay tuned.
Nice

Sent from my SM-G930V using Tapatalk

damn right
QFR | MJ2 TKL | "Schumiboard" | "Bulgogiboard" (Keycon 104) | MIRA SE "2Y10M" | TGR Alice "Pink + White" | MEME "Sound Meme" | Keycult No 1 "The Brass Behemoth" | Southpaw Fullsize (when it ships) | Daily driver: TGR Alice


Offline homerowco

  • Thread Starter
  • Posts: 29
Re: GH Imgur Fixer
« Reply #13 on: Fri, 29 June 2018, 05:08:53 »
I've forwarded this to someone who works for Imgur (not support). Stay tuned.

make sure not to mention that extension lol...

just ask them how to get geekhack.org unblocked.

Offline dgneo

  • Supervillain
  • Posts: 1948
Re: GH Imgur Fixer
« Reply #14 on: Fri, 29 June 2018, 05:31:02 »
never heard of him

Offline Puddsy

  • nice
  • * Exalted Elder
  • Posts: 9275
  • Location: North of the Mason-Dixon
  • "Do you shovel to survive, or survive to shovel?"
Re: GH Imgur Fixer
« Reply #15 on: Fri, 29 June 2018, 17:36:35 »
Issue has been fixed.

Explanation I was given was, "Internal issue that I am not allowed to explain."

But pictures work again.

"If it happens again just email support@imgur.com and just explain that the site is being hotlinked blocked but you don’t believe the site is violating any ToS"
« Last Edit: Fri, 29 June 2018, 17:38:50 by Puddsy »
QFR | MJ2 TKL | "Schumiboard" | "Bulgogiboard" (Keycon 104) | MIRA SE "2Y10M" | TGR Alice "Pink + White" | MEME "Sound Meme" | Keycult No 1 "The Brass Behemoth" | Southpaw Fullsize (when it ships) | Daily driver: TGR Alice


Online romevi

  • Formerly romevi
  • * Exalted Elder
  • Posts: 8253
  • Location: The Windy City
Re: GH Imgur Fixer
« Reply #16 on: Fri, 29 June 2018, 17:59:35 »
Just when I was debating on posting a "Show your white pixels!" thread...

Offline SeedyOne

  • Posts: 198
  • Location: Los Angeles
Re: GH Imgur Fixer
« Reply #17 on: Fri, 29 June 2018, 20:59:20 »
Issue has been fixed.

Explanation I was given was, "Internal issue that I am not allowed to explain."

But pictures work again.

"If it happens again just email support@imgur.com and just explain that the site is being hotlinked blocked but you don’t believe the site is violating any ToS"

Thanks!  :thumb:

Offline Puddsy

  • nice
  • * Exalted Elder
  • Posts: 9275
  • Location: North of the Mason-Dixon
  • "Do you shovel to survive, or survive to shovel?"
Re: GH Imgur Fixer
« Reply #18 on: Fri, 29 June 2018, 21:34:01 »
If it's still happening for you, clear your cache. If it's still happening in ~48 hours I'll send an email to support.
QFR | MJ2 TKL | "Schumiboard" | "Bulgogiboard" (Keycon 104) | MIRA SE "2Y10M" | TGR Alice "Pink + White" | MEME "Sound Meme" | Keycult No 1 "The Brass Behemoth" | Southpaw Fullsize (when it ships) | Daily driver: TGR Alice