home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

15 rows where "updated_at" is on date 2020-06-12 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date)

issue 8

  • Release Datasette 0.44 3
  • startup() plugin hook 3
  • Incorrect URLs when served behind a proxy with base_url set 2
  • Demo deploy is broken 2
  • Log out mechanism for clearing ds_actor cookie 2
  • Writable canned queries live demo on Glitch 1
  • Example authentication plugin 1
  • Ability to execute insert/update statements with the CLI 1

author_association 3

  • OWNER 12
  • MEMBER 2
  • NONE 1

user 2

  • simonw 14
  • tsibley 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
643510240 https://github.com/simonw/datasette/issues/834#issuecomment-643510240 https://api.github.com/repos/simonw/datasette/issues/834 MDEyOklzc3VlQ29tbWVudDY0MzUxMDI0MA== simonw 9599 2020-06-12T22:40:26Z 2020-06-12T22:40:26Z OWNER

Another use-case: plugins that need their own database with the correct tables. They can write to the database on startup to create their tables.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
startup() plugin hook 637342551  
643509358 https://github.com/simonw/datasette/issues/834#issuecomment-643509358 https://api.github.com/repos/simonw/datasette/issues/834 MDEyOklzc3VlQ29tbWVudDY0MzUwOTM1OA== simonw 9599 2020-06-12T22:36:37Z 2020-06-12T22:36:37Z OWNER

This should be able to optionally return an async function which is then awaited.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
startup() plugin hook 637342551  
643501428 https://github.com/simonw/datasette/issues/805#issuecomment-643501428 https://api.github.com/repos/simonw/datasette/issues/805 MDEyOklzc3VlQ29tbWVudDY0MzUwMTQyOA== simonw 9599 2020-06-12T22:06:08Z 2020-06-12T22:06:08Z OWNER

This needs the startup hook, see https://github.com/simonw/datasette/issues/834#issuecomment-643501064

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Writable canned queries live demo on Glitch 632724154  
643501064 https://github.com/simonw/datasette/issues/834#issuecomment-643501064 https://api.github.com/repos/simonw/datasette/issues/834 MDEyOklzc3VlQ29tbWVudDY0MzUwMTA2NA== simonw 9599 2020-06-12T22:04:43Z 2020-06-12T22:04:43Z OWNER

Another use-case for this: I want to use the --root option on Glitch but it gives me a 127.0.0.1 URL. Glitch has a PROJECT_DOMAIN environment variable which tells me the URL. A datasette-glitch plugin could use a startup hook to output the correct login URL.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
startup() plugin hook 637342551  
643454625 https://github.com/simonw/datasette/issues/840#issuecomment-643454625 https://api.github.com/repos/simonw/datasette/issues/840 MDEyOklzc3VlQ29tbWVudDY0MzQ1NDYyNQ== simonw 9599 2020-06-12T19:47:38Z 2020-06-12T19:47:53Z OWNER

Another problem: what to display in the "you are logged in as", since we don't dictate an actor design.

I'm going to use a includes template for this that can easily be over-ridden by administrators or by plugins.

The default will look for the first available of the following keys:

  • display
  • name
  • username
  • login
  • id
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Log out mechanism for clearing ds_actor cookie 637966833  
643453128 https://github.com/simonw/datasette/issues/840#issuecomment-643453128 https://api.github.com/repos/simonw/datasette/issues/840 MDEyOklzc3VlQ29tbWVudDY0MzQ1MzEyOA== simonw 9599 2020-06-12T19:43:15Z 2020-06-12T19:43:15Z OWNER

I don't like how this often involves a logout link that can be maliciously activated.

I'm going to use a CSRF protected form button styled to look like a link instead.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Log out mechanism for clearing ds_actor cookie 637966833  
643414646 https://github.com/dogsheep/github-to-sqlite/issues/40#issuecomment-643414646 https://api.github.com/repos/dogsheep/github-to-sqlite/issues/40 MDEyOklzc3VlQ29tbWVudDY0MzQxNDY0Ng== simonw 9599 2020-06-12T18:06:48Z 2020-06-12T18:06:48Z MEMBER

That fixed it.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Demo deploy is broken 637899539  
643406939 https://github.com/simonw/sqlite-utils/issues/115#issuecomment-643406939 https://api.github.com/repos/simonw/sqlite-utils/issues/115 MDEyOklzc3VlQ29tbWVudDY0MzQwNjkzOQ== simonw 9599 2020-06-12T17:51:11Z 2020-06-12T17:51:11Z OWNER

https://github.com/simonw/sqlite-utils/blob/03ee97d2258254581bea72842518904fc1cbe60f/tests/test_cli.py#L1112-L1128

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Ability to execute insert/update statements with the CLI 637889964  
643393506 https://github.com/dogsheep/github-to-sqlite/issues/40#issuecomment-643393506 https://api.github.com/repos/dogsheep/github-to-sqlite/issues/40 MDEyOklzc3VlQ29tbWVudDY0MzM5MzUwNg== simonw 9599 2020-06-12T17:21:14Z 2020-06-12T17:21:14Z MEMBER

I only install SQLite for this:

https://github.com/dogsheep/github-to-sqlite/blob/c0d54e0260468be38152293df5abd775c068495d/.github/workflows/deploy-demo.yml#L77-L78

I'm going to remove the need to install sqlite3 by making this possible with sqlite-utils: https://github.com/simonw/sqlite-utils/issues/115

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Demo deploy is broken 637899539  
643083451 https://github.com/simonw/datasette/issues/838#issuecomment-643083451 https://api.github.com/repos/simonw/datasette/issues/838 MDEyOklzc3VlQ29tbWVudDY0MzA4MzQ1MQ== tsibley 79913 2020-06-12T06:04:14Z 2020-06-12T06:04:14Z NONE

Hmm, I haven't tried removing ProxyPassReverse, but it doesn't touch the HTML, which is the issue I'm seeing. You can read the documentation here. ProxyPassReverse is a standard directive when proxying with Apache. I've used it dozens of times with other applications.

Looking a little more at the code, I think the issue here is that the behaviour of base_url makes sense when Datasette is mounted at a path within a larger application, but not when HTTP requests are being proxied to it.

In a mount situation, it is perfectly fine to construct URLs reusing the domain and path from the request. In a proxy situation, it never is, as the domain and path in the request are not the domain and path that the non-proxy client actually needs to use. That is, links which include the Apache → Datasette request origin, localhost:8001, instead of the browser → Apache request origin, example.com, will be broken.

The tests you pointed to also reflect this in two ways:

  1. They strip a leading http://localhost, allowing such URLs in the facet links to pass, but inclusion of that in a proxy situation would mean the URL is broken.

  2. The test client emits direct ASGI events instead of actual proxied HTTP requests. The headers of these ASGI events don't reflect the way an HTTP proxy works; instead they pass through the original request path which contains base_url. This works because Datasette responds to requests equivalently at either /… or /{base_url}/…, which makes some sense in a mount situation but is unconventional (albeit workable) for a proxied app.

Apps that support being proxied automatically support being mounted, but apps that only support being mounted don't automatically support being proxied.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Incorrect URLs when served behind a proxy with base_url set 637395097  
643010591 https://github.com/simonw/datasette/issues/806#issuecomment-643010591 https://api.github.com/repos/simonw/datasette/issues/806 MDEyOklzc3VlQ29tbWVudDY0MzAxMDU5MQ== simonw 9599 2020-06-12T01:13:06Z 2020-06-12T01:13:06Z OWNER

Tests are passing again: https://github.com/simonw/datasette/commit/9ae0d483ead93c0832142e5dc85959ae3c8f73ea

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Release Datasette 0.44 632753851  
643000948 https://github.com/simonw/datasette/issues/806#issuecomment-643000948 https://api.github.com/repos/simonw/datasette/issues/806 MDEyOklzc3VlQ29tbWVudDY0MzAwMDk0OA== simonw 9599 2020-06-12T00:34:21Z 2020-06-12T00:34:21Z OWNER

I'm going to add https://github.com/simonw/datasette-auth-tokens and https://github.com/simonw/datasette-permissions-sql to the documentation and release notes in a few places.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Release Datasette 0.44 632753851  
642998097 https://github.com/simonw/datasette/issues/806#issuecomment-642998097 https://api.github.com/repos/simonw/datasette/issues/806 MDEyOklzc3VlQ29tbWVudDY0Mjk5ODA5Nw== simonw 9599 2020-06-12T00:26:00Z 2020-06-12T00:26:00Z OWNER

OK, I'm ready to ship. Last check of the release notes, then I'll update the news section in the README and release 0.44!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Release Datasette 0.44 632753851  
642993277 https://github.com/simonw/datasette/issues/838#issuecomment-642993277 https://api.github.com/repos/simonw/datasette/issues/838 MDEyOklzc3VlQ29tbWVudDY0Mjk5MzI3Nw== simonw 9599 2020-06-12T00:18:26Z 2020-06-12T00:18:50Z OWNER

Have you tried this without the ProxyPassReverse directive? I'm worried that might be confusing Datasette.

This is the test I used to ensure this feature works - it scrapes all of the links on a bunch of different pages. Could it be missing something here?

https://github.com/simonw/datasette/blob/647c5ff0f3e8140f40d7f41f0874ce4e1f4df65c/tests/test_html.py#L1233-L1274

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Incorrect URLs when served behind a proxy with base_url set 637395097  
642991513 https://github.com/simonw/datasette/issues/824#issuecomment-642991513 https://api.github.com/repos/simonw/datasette/issues/824 MDEyOklzc3VlQ29tbWVudDY0Mjk5MTUxMw== simonw 9599 2020-06-12T00:11:50Z 2020-06-12T00:11:50Z OWNER

Done: https://github.com/simonw/datasette-auth-tokens and https://pypi.org/project/datasette-auth-tokens/

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Example authentication plugin 635108074  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 1567.136ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows