berkerpeksag / github-badge

GitHub Badge is a simple embeddable badge showing your GitHub stats like the number of public repositories, number of followers, favorite languages etc.
https://githubbadge.appspot.com/
291 stars 31 forks source link

crossdomain.xml is required for getting data in Flash #54

Closed samet closed 12 years ago

samet commented 12 years ago

Hi guys,

I tried to add this badge to my blog, it is hosted on Wordpress.com and WP.com doesn't allow this kind of JS plugins.

But there is a workaround for adding SWF files to WP.com. So that I developed Flash version of badge. But to get data, SWF makes at very first step to data provider server for cross domain policy. (exactly to the http://githubbadge.appspot.com/crossdomain.xml address in our example)

A handler for crossdomain.xml on GAE should be added. (crossdomain.xml must allow to *, since this is a public api. This version is already supports public access via JSONP.)

Here is the necessary content for this file: <?xml version="1.0" ?>

Also you can see Bing's crossdomain.xml for public API: http://api.bing.net/crossdomain.xml

Thanks.

BYK commented 12 years ago

@samet kudos for the PR! I found a workaround for JSONP though: https://gist.github.com/1204728

Do you think it can work easily for your case? How did you implement this in flash?

samet commented 12 years ago

I've seen ExternalInterface solution, but I think WP won't allow calling ExternalInterface from SWF. Because loading SWF is also depends on a workaround. Result: I think I cannot use ExternalInterface solution.

ActionScript has native data load objects and functions (URLLoader, URLRequest, URLVariables etc.) I used them.

BYK commented 12 years ago

The fix is now deployed and should be working (see http://githubbadge.appspot.com/crossdomain.xml). Thanks again @samet and looking forward for seeing your new interface at production. Don't forget to share the link!

samet commented 12 years ago

I tried, it is working.

Thanks, I'll share all soon.

Samet