{"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350124381", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350124381, "node_id": "IC_kwDOBm6k_c5QeUNd", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T00:07:51Z", "updated_at": "2022-12-14T00:07:51Z", "author_association": "OWNER", "body": "Another thing to consider in the future: once Datasette can support thousands of tables (see #417) the list on this page will turn into multiple MBs of HTML, which may cause all kinds of problems - not to mention the overhead of all of those table visibility permission checks. \r\n\r\nHopefully by then I'll have a good fix for the permission listings problem:\r\n- #1152\r\n\r\nAnd I can apply the same mechanism here.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350125018", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350125018, "node_id": "IC_kwDOBm6k_c5QeUXa", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T00:08:09Z", "updated_at": "2022-12-14T00:08:09Z", "author_association": "OWNER", "body": "Also: don't show hidden tables.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350148192", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350148192, "node_id": "IC_kwDOBm6k_c5QeaBg", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T00:19:06Z", "updated_at": "2022-12-14T00:19:06Z", "author_association": "OWNER", "body": "Another option: I could set a time limit - say 200ms - on how long I'm willing to spend calculating permissions before displaying this form\r\n\r\nFirst calculate view permissions for tables and databases (and maybe views and canned queries too).\r\n\r\nThen see if I can check every permission that I'm going to show as a checkbox on this page. If I get that done within the time limit use that to show the options.\r\n\r\nIf I run out of time show all options and maybe include a note saying that some of them may not actually be available.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350215936", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350215936, "node_id": "IC_kwDOBm6k_c5QeqkA", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:23:42Z", "updated_at": "2022-12-14T01:23:42Z", "author_association": "OWNER", "body": "With tilde-encoding for database and table names the HTML looks like this:\r\n\r\n```html\r\n\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350217380", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350217380, "node_id": "IC_kwDOBm6k_c5Qeq6k", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:26:22Z", "updated_at": "2022-12-14T01:26:22Z", "author_association": "OWNER", "body": "It's going to look very similar to the CLI tool, at least in terms of capabilities:\r\n```\r\nUsage: datasette create-token [OPTIONS] ID\r\n\r\n Create a signed API token for the specified actor ID\r\n\r\n Example:\r\n\r\n datasette create-token root --secret mysecret\r\n\r\n To allow only \"view-database-download\" for all databases:\r\n\r\n datasette create-token root --secret mysecret \\\r\n --all view-database-download\r\n\r\n To allow \"create-table\" against a specific database:\r\n\r\n datasette create-token root --secret mysecret \\\r\n --database mydb create-table\r\n\r\n To allow \"insert-row\" against a specific table:\r\n\r\n datasette create-token root --secret myscret \\\r\n --resource mydb mytable insert-row\r\n\r\n Restricted actions can be specified multiple times using multiple --all,\r\n --database, and --resource options.\r\n\r\n Add --debug to see a decoded version of the token.\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350218177", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350218177, "node_id": "IC_kwDOBm6k_c5QerHB", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:27:45Z", "updated_at": "2022-12-14T01:30:41Z", "author_association": "OWNER", "body": "Some sketches:\r\n```python\r\n# Token for root user\r\ntoken = datasette.create_token(\"root\")\r\n\r\n# Expiring in an hour\r\ntoken = datasette.create_token(\"root\", expires_after=3600)\r\n```\r\nMore complicated is when you want to restrict to specific permissions:\r\n```python\r\n# Limited to view-query and view-table\r\ntoken = datasette.create_token(\"root\", expires_after=3600, all=(\"view-query\", \"view-table\"))\r\n\r\n# I'm not sure about that all= name\r\n\r\n# Limits within a specific database:\r\ntoken = datasette.create_token(\"root\", expires_after=3600, databases={\r\n \"fixtures\": (\"view-query\",)\r\n})\r\n\r\n# And specific tables:\r\ntoken = datasette.create_token(\"root\", expires_after=3600, tables={\r\n \"fixtures\": {\r\n \"facetable\": (\"insert-row\", \"update-row\")\r\n }\r\n})\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350220579", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350220579, "node_id": "IC_kwDOBm6k_c5Qersj", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:31:38Z", "updated_at": "2022-12-14T01:31:38Z", "author_association": "OWNER", "body": "The problem with `all=(..)` is it feels misleading - it's actually restricting the permissions made available to the token.\r\n\r\nLikewise, `databases=` being a dict of restricted permissions isn't completely obvious.\r\n\r\nAnd the nested `tables=` dictionary feels a bit odd too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350222701", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350222701, "node_id": "IC_kwDOBm6k_c5QesNt", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:35:05Z", "updated_at": "2022-12-14T01:35:22Z", "author_association": "OWNER", "body": "Maybe this:\r\n\r\n```python\r\ndatasette.create_token(\"root\", expires_after=3600, restrict_all=(\"view-query\", \"view-table\"))\r\n\r\ntoken = datasette.create_token(\"root\", expires_after=3600, restrict_database={\r\n \"fixtures\": (\"view-query\",)\r\n})\r\n\r\ntoken = datasette.create_token(\"root\", expires_after=3600, restrict_resource={\r\n \"fixtures\": {\r\n \"facetable\": (\"insert-row\", \"update-row\")\r\n }\r\n})\r\n```", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350231654", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350231654, "node_id": "IC_kwDOBm6k_c5QeuZm", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T01:48:50Z", "updated_at": "2022-12-14T01:48:57Z", "author_association": "OWNER", "body": "I like that the word `restrict` reflects the `_r` in the actor/token.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1951#issuecomment-1350293098", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1951", "id": 1350293098, "node_id": "IC_kwDOBm6k_c5Qe9Zq", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T02:43:44Z", "updated_at": "2022-12-14T02:43:44Z", "author_association": "OWNER", "body": "Documentation for the new method: https://docs.datasette.io/en/latest/internals.html#create-token-actor-id-expires-after-none-restrict-all-none-restrict-database-none-restrict-resource-none", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495431932, "label": "`datasette.create_token(...)` method for creating signed API tokens"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350401651", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350401651, "node_id": "IC_kwDOBm6k_c5QfX5z", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:03:59Z", "updated_at": "2022-12-14T05:03:59Z", "author_association": "OWNER", "body": "I shipped a working interface. Could still do with some extra tests.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350402667", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350402667, "node_id": "IC_kwDOBm6k_c5QfYJr", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:05:10Z", "updated_at": "2022-12-14T05:05:10Z", "author_association": "OWNER", "body": "Tests can go here:\r\n\r\nhttps://github.com/simonw/datasette/blob/d98a8effb10ce8fe04a03eae42baa8a9cb0ca3f7/tests/test_auth.py#L143-L160", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350409537", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350409537, "node_id": "IC_kwDOBm6k_c5QfZ1B", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:14:16Z", "updated_at": "2022-12-14T05:14:16Z", "author_association": "OWNER", "body": "New interface now live at https://latest.datasette.io/-/create-token\r\n\r\n\"image\"\r\n\r\nIt shouldn't be showing `_memory` though.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350413555", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350413555, "node_id": "IC_kwDOBm6k_c5Qfazz", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:19:52Z", "updated_at": "2022-12-14T05:19:52Z", "author_association": "OWNER", "body": "Maybe I should have kept `_memory` listed for instances that are running with `--crossdb` enabled?\r\n\r\nYeah I think I should.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350414402", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350414402, "node_id": "IC_kwDOBm6k_c5QfbBC", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:21:07Z", "updated_at": "2022-12-14T05:21:07Z", "author_association": "OWNER", "body": "It would be neat not to show write permissions against immutable databases too - and not hard from a performance perspective since it doesn't involve hundreds more permission checks.\r\n\r\nThat will need permissions to grow a flag for if they need a mutable database though, which is a bigger job.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1947#issuecomment-1350414961", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1947", "id": 1350414961, "node_id": "IC_kwDOBm6k_c5QfbJx", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:22:00Z", "updated_at": "2022-12-14T05:22:00Z", "author_association": "OWNER", "body": "I think the next big step for this feature is for me to actually use it to build a few things.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493390939, "label": "UI to create reduced scope tokens from the `/-/create-token` page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1952#issuecomment-1350415644", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1952", "id": 1350415644, "node_id": "IC_kwDOBm6k_c5QfbUc", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T05:22:59Z", "updated_at": "2022-12-14T05:22:59Z", "author_association": "OWNER", "body": "Non-memory named databases shouldn't show write actions, since those won't persist.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1495716243, "label": "Improvements to /-/create-token restrictions interface"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1956#issuecomment-1352070655", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1956", "id": 1352070655, "node_id": "IC_kwDOBm6k_c5QlvX_", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T19:54:36Z", "updated_at": "2022-12-14T19:54:36Z", "author_association": "OWNER", "body": "Also this code should work with non-abbreviations too.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497288666, "label": "Handle abbreviations properly in permission_allowed_actor_restrictions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1956#issuecomment-1352075845", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1956", "id": 1352075845, "node_id": "IC_kwDOBm6k_c5QlwpF", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T19:57:17Z", "updated_at": "2022-12-14T19:58:22Z", "author_association": "OWNER", "body": "I'm going to test this using calls to `ds.permission_allowed()` with an actor with `_r` block.\r\n\r\nI can add extra tests to https://github.com/simonw/datasette/blob/1a3dcf494376e32f7cff110c86a88e5b0a3f3924/tests/test_permissions.py#L605-L616", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497288666, "label": "Handle abbreviations properly in permission_allowed_actor_restrictions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352329027", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352329027, "node_id": "IC_kwDOBm6k_c5QmudD", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T22:56:24Z", "updated_at": "2022-12-14T22:57:19Z", "author_association": "OWNER", "body": "Most `.json` errors DO return as JSON, thanks to this:\n\nhttps://github.com/simonw/datasette/blob/c094dde3ff2bae030f261e6440d4fb082eb860a9/datasette/handle_exception.py#L19-L24\n\nhttps://github.com/simonw/datasette/blob/c094dde3ff2bae030f261e6440d4fb082eb860a9/datasette/handle_exception.py#L57-L58\n\nBut that code triggers when the URL ends with `.json` - and none of the JSON write API endpoints (things like `/db/-/create` and `/db/table/-/insert`) follow that convention.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352330825", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352330825, "node_id": "IC_kwDOBm6k_c5Qmu5J", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T22:58:51Z", "updated_at": "2022-12-14T22:59:27Z", "author_association": "OWNER", "body": "I need a way for those JSON endpoints to communicate back to the `handle_exception` handler that they are returning JSON, so it knows to behave differently.\n\nSince it gets the `request` object, one way could be to have view code set `request.should_return_json = True` so that the handler knows to do something different.\n\nIt's a bit of a cludge though!", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352331314", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352331314, "node_id": "IC_kwDOBm6k_c5QmvAy", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T22:59:36Z", "updated_at": "2022-12-14T22:59:36Z", "author_association": "OWNER", "body": "I'm going to prototype that up to see what it looks like.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352335503", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352335503, "node_id": "IC_kwDOBm6k_c5QmwCP", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:03:28Z", "updated_at": "2022-12-14T23:03:28Z", "author_association": "OWNER", "body": "This raises a more complicated issue\n\n At some point I'm likely to want to add an HTML interface for creating tables and inserting and updating rows.\n\nThe obvious URLs for that are the same as for the JSON API: `/db/table/-/insert` and suchlike.\n\nThose endpoints are currently POST only - and can return JSON all the time.\n\nIf they start accepting form POSTs too they'll need to be able to accept form-encoded data and return HTML instead. That's OK - they can detect incoming JSON thanks to the `content-type` header an the fact that the request body starts with `{` - but the `should_return_json` fix described above could intefere with how errors are returned if I'm not careful.\n\nI think it can still work though: I'll only set `should_return_json = True` if the endpoint gets a POST with a body starting `{`, or a content-type JSON header.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352338620", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352338620, "node_id": "IC_kwDOBm6k_c5Qmwy8", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:05:17Z", "updated_at": "2022-12-14T23:05:17Z", "author_association": "OWNER", "body": "Sniffing for a `{` is a little bit tricky though, as the post body is lazily loaded on request here:\r\n\r\nhttps://github.com/simonw/datasette/blob/9ad76d279e2c3874ca5070626a25458ce129f126/datasette/utils/asgi.py#L127-L135", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352340518", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352340518, "node_id": "IC_kwDOBm6k_c5QmxQm", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:07:01Z", "updated_at": "2022-12-14T23:07:01Z", "author_association": "OWNER", "body": "Easiest fix would be to look for `accept: application/json` and/or `content-type: application/json` headers.\r\n\r\nNot bullet-proof, so people might occasionally make JSON requests and get back an HTML error - but the documentation can tell people that they need to send those headers if they want to reliably get back JSON error messages.\r\n\r\nI'm happy with this as a solution.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352354927", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352354927, "node_id": "IC_kwDOBm6k_c5Qm0xv", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:25:06Z", "updated_at": "2022-12-14T23:25:14Z", "author_association": "OWNER", "body": "Looks like the code I've written for permission checking on `TableCreateView` and friends doesn't use the regular `raise Forbidden` or `raise DatasetteError` mechanisms - it does its own thing here:\r\n\r\nhttps://github.com/simonw/datasette/blob/9ad76d279e2c3874ca5070626a25458ce129f126/datasette/views/database.py#L580-L584\r\n\r\nWhich uses this:\r\n\r\nhttps://github.com/simonw/datasette/blob/9ad76d279e2c3874ca5070626a25458ce129f126/datasette/views/base.py#L547-L548\r\n\r\nHaving two different patterns to return errors is bad, I should fix that.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1949#issuecomment-1352356356", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1949", "id": 1352356356, "node_id": "IC_kwDOBm6k_c5Qm1IE", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:27:25Z", "updated_at": "2022-12-14T23:28:16Z", "author_association": "OWNER", "body": "Also weird: errors returned by that mechanism look like this:\r\n```json\r\n{\r\n \"ok\": false,\r\n \"errors\": [\"list of error messages\"]\r\n}\r\n```\r\nWhile errors returned by the rest of Datasette look like this: https://latest.datasette.io/fixtures/no_table.json\r\n\r\n```json\r\n{\r\n \"ok\": false,\r\n \"error\": \"Table not found: no_table\",\r\n \"status\": 404,\r\n \"title\": null\r\n}\r\n```\r\nRelated:\r\n- #1875", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1493471221, "label": "`.json` errors should be returned as JSON"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1295#issuecomment-1352357322", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1295", "id": 1352357322, "node_id": "IC_kwDOBm6k_c5Qm1XK", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:28:49Z", "updated_at": "2022-12-14T23:28:49Z", "author_association": "OWNER", "body": "Related:\r\n- #1875", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 855296937, "label": "Errors should have links to further information"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1957#issuecomment-1352371019", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1957", "id": 1352371019, "node_id": "IC_kwDOBm6k_c5Qm4tL", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-12-14T23:50:50Z", "updated_at": "2022-12-14T23:50:50Z", "author_association": "OWNER", "body": "One option: if any rows were truncated, show a button you can click to run the query again with truncation disabled - maybe with `?_truncate=off` in the URL or similar.\r\n\r\nBut... still want to truncate if the user runs a query that would return multiple MBs of HTML (assuming the other Datasette query limits don't stop that from happening).", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497577017, "label": "Reconsider row value truncation on query page"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1958#issuecomment-1352644270", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1958", "id": 1352644270, "node_id": "IC_kwDOBm6k_c5Qn7au", "user": {"value": 11729897, "label": "davidhaley"}, "created_at": "2022-12-14T00:05:16Z", "updated_at": "2022-12-14T00:05:16Z", "author_association": "NONE", "body": "FYI @simonw, I don't see that message.\r\n\r\n![image](https://user-images.githubusercontent.com/11729897/207471893-1ec5d4d0-81db-4eaa-ba40-adedcc7c9a32.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497909798, "label": "datasette --root running in Docker doesn't reliably show the magic URL"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1958#issuecomment-1352644274", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1958", "id": 1352644274, "node_id": "IC_kwDOBm6k_c5Qn7ay", "user": {"value": 11729897, "label": "davidhaley"}, "created_at": "2022-12-14T14:19:24Z", "updated_at": "2022-12-14T14:19:24Z", "author_association": "NONE", "body": "Hmm, it appears after I kill the process with `Ctrl+c`:\r\n\r\n![image](https://user-images.githubusercontent.com/11729897/207619736-a49b2e97-c5d0-4e54-ad3c-3c3c279927c7.png)\r\n", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497909798, "label": "datasette --root running in Docker doesn't reliably show the magic URL"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/datasette/issues/1958#issuecomment-1352644276", "issue_url": "https://api.github.com/repos/simonw/datasette/issues/1958", "id": 1352644276, "node_id": "IC_kwDOBm6k_c5Qn7a0", "user": {"value": 11729897, "label": "davidhaley"}, "created_at": "2022-12-14T14:53:53Z", "updated_at": "2022-12-14T14:53:53Z", "author_association": "NONE", "body": "I don't have much experience with Python; however, I wonder if this print statement needs `flush=True`?\r\n\r\nhttps://github.com/simonw/datasette/blob/fdf7c27b5438f02153c3a7f8ad1b320e4b29e4f4/datasette/cli.py#L621", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1497909798, "label": "datasette --root running in Docker doesn't reliably show the magic URL"}, "performed_via_github_app": null}