datasette-secrets 0.1a4__py3-none-any.whl → 0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of datasette-secrets might be problematic. Click here for more details.
- datasette_secrets/__init__.py +20 -11
- {datasette_secrets-0.1a4.dist-info → datasette_secrets-0.2.dist-info}/METADATA +3 -2
- datasette_secrets-0.2.dist-info/RECORD +10 -0
- datasette_secrets-0.1a4.dist-info/RECORD +0 -10
- {datasette_secrets-0.1a4.dist-info → datasette_secrets-0.2.dist-info}/LICENSE +0 -0
- {datasette_secrets-0.1a4.dist-info → datasette_secrets-0.2.dist-info}/WHEEL +0 -0
- {datasette_secrets-0.1a4.dist-info → datasette_secrets-0.2.dist-info}/entry_points.txt +0 -0
- {datasette_secrets-0.1a4.dist-info → datasette_secrets-0.2.dist-info}/top_level.txt +0 -0
datasette_secrets/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import click
|
|
2
2
|
from cryptography.fernet import Fernet
|
|
3
3
|
import dataclasses
|
|
4
|
-
from datasette import hookimpl, Forbidden,
|
|
4
|
+
from datasette import hookimpl, Forbidden, Response
|
|
5
5
|
from datasette.plugins import pm
|
|
6
6
|
from datasette.utils import await_me_maybe, sqlite3
|
|
7
7
|
import os
|
|
@@ -89,7 +89,7 @@ create table if not exists datasette_secrets (
|
|
|
89
89
|
def get_database(datasette):
|
|
90
90
|
plugin_config = datasette.plugin_config("datasette-secrets") or {}
|
|
91
91
|
database = plugin_config.get("database") or "_internal"
|
|
92
|
-
if database == "_internal":
|
|
92
|
+
if database == "_internal" and hasattr(datasette, "get_internal_database"):
|
|
93
93
|
return datasette.get_internal_database()
|
|
94
94
|
return datasette.get_database(database)
|
|
95
95
|
|
|
@@ -108,6 +108,8 @@ def get_config(datasette):
|
|
|
108
108
|
|
|
109
109
|
@hookimpl
|
|
110
110
|
def register_permissions(datasette):
|
|
111
|
+
from datasette import Permission
|
|
112
|
+
|
|
111
113
|
return [
|
|
112
114
|
Permission(
|
|
113
115
|
name="manage-secrets",
|
|
@@ -187,15 +189,22 @@ async def secrets_index(datasette, request):
|
|
|
187
189
|
)
|
|
188
190
|
existing_secrets = {row["name"]: dict(row) for row in existing_secrets_result.rows}
|
|
189
191
|
# Try to turn updated_by into actors
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
192
|
+
if hasattr(datasette, "actors_from_ids"):
|
|
193
|
+
actors = await datasette.actors_from_ids(
|
|
194
|
+
{
|
|
195
|
+
row["updated_by"]
|
|
196
|
+
for row in existing_secrets.values()
|
|
197
|
+
if row["updated_by"]
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
for secret in existing_secrets.values():
|
|
201
|
+
if secret["updated_by"]:
|
|
202
|
+
actor = actors.get(secret["updated_by"])
|
|
203
|
+
if actor:
|
|
204
|
+
display = (
|
|
205
|
+
actor.get("username") or actor.get("name") or actor.get("id")
|
|
206
|
+
)
|
|
207
|
+
secret["updated_by"] = display
|
|
199
208
|
unset_secrets = [
|
|
200
209
|
secret
|
|
201
210
|
for secret in all_secrets
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: datasette-secrets
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2
|
|
4
4
|
Summary: Manage secrets such as API keys for use with other Datasette plugins
|
|
5
5
|
Author: Datasette
|
|
6
6
|
License: Apache-2.0
|
|
@@ -13,11 +13,12 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
13
13
|
Requires-Python: >=3.8
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
|
-
Requires-Dist: datasette
|
|
16
|
+
Requires-Dist: datasette
|
|
17
17
|
Requires-Dist: cryptography
|
|
18
18
|
Provides-Extra: test
|
|
19
19
|
Requires-Dist: pytest ; extra == 'test'
|
|
20
20
|
Requires-Dist: pytest-asyncio ; extra == 'test'
|
|
21
|
+
Requires-Dist: datasette-test >=0.3.2 ; extra == 'test'
|
|
21
22
|
|
|
22
23
|
# datasette-secrets
|
|
23
24
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
datasette_secrets/__init__.py,sha256=lPC5NMPvLUrwjiloohdZfdz75prGz8TEkxlIw5kyy4Q,10853
|
|
2
|
+
datasette_secrets/hookspecs.py,sha256=57v14e2Y4o5eZyAgCLpuzp1KZn7CjwLXeKwfq6Zvux8,205
|
|
3
|
+
datasette_secrets/templates/secrets_index.html,sha256=ZgIy_huFZQfnI6GjO0qauWEkTWhkBCM5WrT73Nqq4BY,1737
|
|
4
|
+
datasette_secrets/templates/secrets_update.html,sha256=qMPLVCuKKslqw_In0aSCVobB3maPw9oaYZDQQImdRIU,1678
|
|
5
|
+
datasette_secrets-0.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
6
|
+
datasette_secrets-0.2.dist-info/METADATA,sha256=BghKi7npKjiv7dvf5fojZU7AwbMKOv3WNjtrQZ6Re8c,7085
|
|
7
|
+
datasette_secrets-0.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
8
|
+
datasette_secrets-0.2.dist-info/entry_points.txt,sha256=2083uWbPpGntxRulh8_hVaelQO-xdtjedG6rGzwPUH0,40
|
|
9
|
+
datasette_secrets-0.2.dist-info/top_level.txt,sha256=ZBJKQk-DdDU9Vnwu4x79X9aaEulwGJMoLx62IZJPDaQ,18
|
|
10
|
+
datasette_secrets-0.2.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
datasette_secrets/__init__.py,sha256=rGTD35WFjkP8uqoW_L5pGBxUqFITGtkg2wQ3glZLP9U,10587
|
|
2
|
-
datasette_secrets/hookspecs.py,sha256=57v14e2Y4o5eZyAgCLpuzp1KZn7CjwLXeKwfq6Zvux8,205
|
|
3
|
-
datasette_secrets/templates/secrets_index.html,sha256=ZgIy_huFZQfnI6GjO0qauWEkTWhkBCM5WrT73Nqq4BY,1737
|
|
4
|
-
datasette_secrets/templates/secrets_update.html,sha256=qMPLVCuKKslqw_In0aSCVobB3maPw9oaYZDQQImdRIU,1678
|
|
5
|
-
datasette_secrets-0.1a4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
6
|
-
datasette_secrets-0.1a4.dist-info/METADATA,sha256=HLoZKAlUAhUprGl70egXMaDzi58YZJLn5hJcbLjGqxY,7040
|
|
7
|
-
datasette_secrets-0.1a4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
8
|
-
datasette_secrets-0.1a4.dist-info/entry_points.txt,sha256=2083uWbPpGntxRulh8_hVaelQO-xdtjedG6rGzwPUH0,40
|
|
9
|
-
datasette_secrets-0.1a4.dist-info/top_level.txt,sha256=ZBJKQk-DdDU9Vnwu4x79X9aaEulwGJMoLx62IZJPDaQ,18
|
|
10
|
-
datasette_secrets-0.1a4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|