repos: 195696804
This data as json
id | node_id | name | full_name | private | owner | html_url | description | fork | created_at | updated_at | pushed_at | homepage | size | stargazers_count | watchers_count | language | has_issues | has_projects | has_downloads | has_wiki | has_pages | forks_count | archived | disabled | open_issues_count | license | topics | forks | open_issues | watchers | default_branch | permissions | temp_clone_token | organization | network_count | subscribers_count | readme | readme_html | allow_forking | visibility | is_template | template_repository | web_commit_signoff_required | has_discussions |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
195696804 | MDEwOlJlcG9zaXRvcnkxOTU2OTY4MDQ= | datasette-cors | simonw/datasette-cors | 0 | 9599 | https://github.com/simonw/datasette-cors | Datasette plugin for configuring CORS headers | 0 | 2019-07-07T21:03:11Z | 2021-02-27T00:31:13Z | 2019-07-11T04:40:57Z | 11 | 9 | 9 | Python | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | apache-2.0 | ["datasette", "datasette-plugin", "datasette-io"] | 0 | 1 | 9 | master | {"admin": false, "push": false, "pull": false} | 0 | 3 | # datasette-cors [](https://pypi.org/project/datasette-cors/) [](https://circleci.com/gh/simonw/datasette-cors) [](https://github.com/simonw/datasette-cors/blob/master/LICENSE) Datasette plugin for configuring CORS headers, based on https://github.com/simonw/asgi-cors You can use this plugin to allow JavaScript running on a whitelisted set of domains to make `fetch()` calls to the JSON API provided by your Datasette instance. ## Installation pip install datasette-cors ## Configuration You need to add some configuration to your Datasette `metadata.json` file for this plugin to take effect. To whitelist specific domains, use this: ```json { "plugins": { "datasette-cors": { "hosts": ["https://www.example.com"] } } } ``` You can also whitelist patterns like this: ```json { "plugins": { "datasette-cors": { "host_wildcards": ["https://*.example.com"] } } } ``` ## Testing it To test this plugin out, run it locally by saving one of the above examples as `metadata.json` and running this: $ datasette --memory -m metadata.json Now visit https://www.example.com/ in your browser, open the browser developer console and paste in the following: ```javascript fetch("http://127.0.0.1:8001/:memory:.json?sql=select+sqlite_version%28%29").then(r => r.json()).then(console.log) ``` If the plugin is running correctly, you will see the JSON response output to the console. | <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1><a id="user-content-datasette-cors" class="anchor" aria-hidden="true" href="#user-content-datasette-cors"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>datasette-cors</h1> <p><a href="https://pypi.org/project/datasette-cors/" rel="nofollow"><img src="https://camo.githubusercontent.com/3f4dc5b1725858ca83723674cadd1a59373f3f4265fb01eb43c91ca9380b24bb/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6461746173657474652d636f72732e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/datasette-cors.svg" style="max-width:100%;"></a> <a href="https://circleci.com/gh/simonw/datasette-cors" rel="nofollow"><img src="https://camo.githubusercontent.com/831507d824fb545803ebf51bf318c316eb5f9405e6cc9dabcb4835f356f4053d/68747470733a2f2f636972636c6563692e636f6d2f67682f73696d6f6e772f6461746173657474652d636f72732e7376673f7374796c653d737667" alt="CircleCI" data-canonical-src="https://circleci.com/gh/simonw/datasette-cors.svg?style=svg" style="max-width:100%;"></a> <a href="https://github.com/simonw/datasette-cors/blob/master/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width:100%;"></a></p> <p>Datasette plugin for configuring CORS headers, based on <a href="https://github.com/simonw/asgi-cors">https://github.com/simonw/asgi-cors</a></p> <p>You can use this plugin to allow JavaScript running on a whitelisted set of domains to make <code>fetch()</code> calls to the JSON API provided by your Datasette instance.</p> <h2><a id="user-content-installation" class="anchor" aria-hidden="true" href="#user-content-installation"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Installation</h2> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="pip install datasette-cors "><pre><code>pip install datasette-cors </code></pre></div> <h2><a id="user-content-configuration" class="anchor" aria-hidden="true" href="#user-content-configuration"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Configuration</h2> <p>You need to add some configuration to your Datasette <code>metadata.json</code> file for this plugin to take effect.</p> <p>To whitelist specific domains, use this:</p> <div class="highlight highlight-source-json position-relative" data-snippet-clipboard-copy-content="{ "plugins": { "datasette-cors": { "hosts": ["https://www.example.com"] } } } "><pre>{ <span class="pl-s"><span class="pl-pds">"</span>plugins<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>datasette-cors<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>hosts<span class="pl-pds">"</span></span>: [<span class="pl-s"><span class="pl-pds">"</span>https://www.example.com<span class="pl-pds">"</span></span>] } } }</pre></div> <p>You can also whitelist patterns like this:</p> <div class="highlight highlight-source-json position-relative" data-snippet-clipboard-copy-content="{ "plugins": { "datasette-cors": { "host_wildcards": ["https://*.example.com"] } } } "><pre>{ <span class="pl-s"><span class="pl-pds">"</span>plugins<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>datasette-cors<span class="pl-pds">"</span></span>: { <span class="pl-s"><span class="pl-pds">"</span>host_wildcards<span class="pl-pds">"</span></span>: [<span class="pl-s"><span class="pl-pds">"</span>https://*.example.com<span class="pl-pds">"</span></span>] } } }</pre></div> <h2><a id="user-content-testing-it" class="anchor" aria-hidden="true" href="#user-content-testing-it"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Testing it</h2> <p>To test this plugin out, run it locally by saving one of the above examples as <code>metadata.json</code> and running this:</p> <div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="$ datasette --memory -m metadata.json "><pre><code>$ datasette --memory -m metadata.json </code></pre></div> <p>Now visit <a href="https://www.example.com/" rel="nofollow">https://www.example.com/</a> in your browser, open the browser developer console and paste in the following:</p> <div class="highlight highlight-source-js position-relative" data-snippet-clipboard-copy-content="fetch("http://127.0.0.1:8001/:memory:.json?sql=select+sqlite_version%28%29").then(r => r.json()).then(console.log) "><pre><span class="pl-en">fetch</span><span class="pl-kos">(</span><span class="pl-s">"http://127.0.0.1:8001/:memory:.json?sql=select+sqlite_version%28%29"</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-s1">r</span> <span class="pl-c1">=></span> <span class="pl-s1">r</span><span class="pl-kos">.</span><span class="pl-en">json</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">then</span><span class="pl-kos">(</span><span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-c1">log</span><span class="pl-kos">)</span></pre></div> <p>If the plugin is running correctly, you will see the JSON response output to the console.</p> </article></div> |
Links from other tables
- 1 row from repo in releases