observablehq / observable-jupyter

This repository has been archived. Please see the fork maintained by Thomas Ballinger.
https://github.com/thomasballinger/observable-jupyter
ISC License
4 stars 0 forks source link

Add query param that request to indicate request is coming from this library #10

Open thomasballinger opened 4 years ago

thomasballinger commented 4 years ago

To distinguish between a raw embed, completely customizable embed and an embed created with this library we could use a query param.

We will already have PyPI's download count, but it's hard to tell much from that.

thomasballinger commented 4 years ago

What about trying to parse the referrer? The query param would still be useful for "this comes from this client library," but the referer is much more rich:

Toms-MacBook-Pro:~ tomb$ nc -l 1234
GET /some/script.js HTTP/1.1
Host: localhost:1234
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHT
ML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
Sec-Fetch-Dest: script
Accept: */*
Sec-Fetch-Site: same-site
Sec-Fetch-Mode: no-cors
Referer: http://localhost:8888/notebooks/Untitled11.ipynb?kernel_name=python3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: A_TON_OF_COOKIES

Referer: http://localhost:8888/notebooks/Untitled11.ipynb?kernel_name=python3

probably both are useful for different purposes.