neoascetic/rawgithack

Feature request: Support for googlesource.com-hosted repos (Chromium, Android, PDFium, ...)

Closed this issue · 1 comments

Example URLs:

https://android.googlesource.com/platform/external/linux-tools-perf/+/jb-dev/Documentation/perf-script.txt
https://pdfium.googlesource.com/pdfium.git/+/dab1161c861cc239e48a17e1a5d729aa12785a53/core/fdrm/fx_crypt.cpp
https://chromium.googlesource.com/chromium/src.git/+/c15858db55ed54c230743eaa9678117f21d5517e/third_party/blink/renderer/core/svg/svg_point.cc

I have a web app in which I would like to display source code from these repos. However, googlesource.com (Gitiles) does not have a way to serve raw source with CORS headers. In fact, it does not have a way to serve raw unencoded source code at all! It only supports base64-encoded source code, but without CORS headers:

https://android.googlesource.com/platform/external/linux-tools-perf/+/jb-dev/Documentation/perf-script.txt?format=TEXT

There has been a long-standing feature request in the Gitiles issue tracker about this (original request (filed in 2012), migrated issue) and you can see many people complaining that they have to work around this limitation, but no progress has been made.

If rawgithack supported these repos, this would be an excellent workaround.

I've made my own proxy now, using a free Cloudflare worker (source here).