gitcoinco / browser-extension

Grow Open Source
https://gitcoin.co
Other
48 stars 30 forks source link

browser extension should inject a users's kudos on their github profile #67

Open owocki opened 5 years ago

octavioamu commented 5 years ago

I was playing a little with this

image

Some restrictions in gitcoin injection

Refused to load the image 'https://pbs.twimg.com/profile_images/809025702196609024/yoUKPJet_bigger.jpg' because it violates the following Content Security Policy directive: "img-src 'self' data: assets-cdn.github.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com *.githubusercontent.com".

BUT looks like the cdn they use for markdown files in readme files works so something like this can be injected

https://camo.githubusercontent.com/f3aadf2ce7c93dc57fc4b18128960995a56db4b5/68747470733a2f2f64337676366c703535716a6171632e636c6f756466726f6e742e6e65742f6974656d732f323633653371314d32593272334c3158336332792f68656c6d65742e706e67

But not good to make it dynamic so the other option and I think the best is base64 images from the repo because we also have cors in our cdn In this code I fetch the svg and transform it to a base64 image, since the images are complex we should limit to show only a few.

https://jsbin.com/zugifig/2/edit?html,js,output