{"html_url": "https://github.com/simonw/datasette/releases/tag/0.45", "id": 28134124, "node_id": "MDc6UmVsZWFzZTI4MTM0MTI0", "tag_name": "0.45", "target_commitish": "master", "name": "0.45", "draft": 0, "author": {"value": 9599, "label": "simonw"}, "prerelease": 0, "created_at": "2020-07-01T21:43:07Z", "published_at": "2020-07-01T21:46:07Z", "body": "Magic parameters for canned queries, a log out feature, improved plugin documentation and four new plugin hooks.\r\n\r\n### Magic parameters for canned queries\r\n\r\nCanned queries now support [Magic parameters](https://docs.datasette.io/en/stable/sql_queries.html#canned-queries-magic-parameters), which can be used to insert or select automatically generated values. For example:\r\n```sql\r\ninsert into logs\r\n (user_id, timestamp)\r\nvalues\r\n (:_actor_id, :_now_datetime_utc)\r\n```\r\nThis inserts the currently authenticated actor ID and the current datetime. ([#842](https://github.com/simonw/datasette/issues/842))\r\n\r\n### Log out\r\n\r\nThe [ds_actor cookie](https://docs.datasette.io/en/stable/authentication.html#authentication-ds-actor) can be used by plugins (or by Datasette's [--root mechanism](https://docs.datasette.io/en/stable/authentication.html#authentication-root)) to authenticate users. The new `/-/logout` page provides a way to clear that cookie.\r\n\r\nA \"Log out\" button now shows in the global navigation provided the user is authenticated using the `ds_actor` cookie. ([#840](https://github.com/simonw/datasette/issues/840))\r\n\r\n### Better plugin documentation\r\n\r\nThe plugin documentation has been re-arranged into four sections, including a brand new section on testing plugins. ([#687](https://github.com/simonw/datasette/issues/687))\r\n\r\n- [Plugins](https://docs.datasette.io/en/stable/plugins.html#plugins) introduces Datasette's plugin system and describes how to install and configure plugins.\r\n- [Writing plugins](https://docs.datasette.io/en/stable/writing_plugins.html#writing-plugins) describes how to author plugins, from simple one-off plugins to packaged plugins that can be published to PyPI. It also describes how to start a plugin using the new [datasette-plugin](https://github.com/simonw/datasette-plugin) cookiecutter template.\r\n- [Plugin hooks](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hooks) is a full list of detailed documentation for every Datasette plugin hook.\r\n- [Testing plugins](https://docs.datasette.io/en/stable/testing_plugins.html#testing-plugins) describes how to write tests for Datasette plugins, using [pytest](https://docs.pytest.org/) and [HTTPX](https://www.python-httpx.org/).\r\n\r\n### New plugin hooks\r\n\r\n- [register_magic_parameters(datasette)](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hook-register-magic-parameters) can be used to define new types of magic canned query parameters.\r\n- [startup(datasette)](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hook-startup) can run custom code when Datasette first starts up. [datasette-init](https://github.com/simonw/datasette-init) is a new plugin that uses this hook to create database tables and views on startup if they have not yet been created. ([#834](https://github.com/simonw/datasette/issues/834))\r\n- [canned_queries(datasette, database, actor)](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hook-canned-queries) lets plugins provide additional canned queries beyond those defined in Datasette's metadata. See [datasette-saved-queries](https://github.com/simonw/datasette-saved-queries) for an example of this hook in action. ([#852](https://github.com/simonw/datasette/issues/852))\r\n- [forbidden(datasette, request, message)](https://docs.datasette.io/en/stable/plugin_hooks.html#plugin-hook-forbidden) is a hook for customizing how Datasette responds to 403 forbidden errors. ([#812](https://github.com/simonw/datasette/issues/812))\r\n\r\n### Smaller changes\r\n\r\n- Cascading view permissons - so if a user has `view-table` they can view the table page even if they do not have `view-database` or `view-instance`. ([#832](https://github.com/simonw/datasette/issues/832))\r\n- CSRF protection no longer applies to `Authentication: Bearer token` requests or requests without cookies. ([#835](https://github.com/simonw/datasette/issues/835))\r\n- `datasette.add_message()` now works inside plugins. ([#864](https://github.com/simonw/datasette/issues/864))\r\n- Workaround for \"Too many open files\" error in test runs. ([#846](https://github.com/simonw/datasette/issues/846))\r\n- Respect existing `scope[\"actor\"]` if already set by ASGI middleware. ([#854](https://github.com/simonw/datasette/issues/854))\r\n- New process for shipping [Alpha and beta releases](https://docs.datasette.io/en/stable/contributing.html#contributing-alpha-beta). ([#807](https://github.com/simonw/datasette/issues/807))\r\n- `{{ csrftoken() }}` now works when plugins render a template using `datasette.render_template(..., request=request)`. ([#863](https://github.com/simonw/datasette/issues/863))\r\n- Datasette now creates a single [Request object](https://docs.datasette.io/en/stable/internals.html#internals-request) and uses it throughout the lifetime of the current HTTP request. ([#870](https://github.com/simonw/datasette/issues/870))", "repo": {"value": 107914493, "label": "datasette"}, "reactions": null} {"html_url": "https://github.com/simonw/datasette/releases/tag/0.45a5", "id": 28097766, "node_id": "MDc6UmVsZWFzZTI4MDk3NzY2", "tag_name": "0.45a5", "target_commitish": "master", "name": "0.45a5", "draft": 0, "author": {"value": 9599, "label": "simonw"}, "prerelease": 1, "created_at": "2020-07-01T04:25:35Z", "published_at": "2020-07-01T04:27:08Z", "body": "", "repo": {"value": 107914493, "label": "datasette"}, "reactions": null}