gristlabs_grist-core/app/plugin
Paul Fitzpatrick dd8d2e18f5 (core) add an access token mechanism to help with attachments in custom widgets
Summary:
With this, a custom widget can render an attachment by doing:
```
const tokenInfo = await grist.docApi.getAccessToken({readOnly: true});
const img = document.getElementById('the_image');
const id = record.C[0];  // get an id of an attachment
const src = `${tokenInfo.baseUrl}/attachments/${id}/download?auth=${tokenInfo.token}`;
img.setAttribute('src', src)
```

The access token expires after a few mins, so if a user right-clicks on an image
to save it, they may get access denied unless they refresh the page. A little awkward,
but s3 pre-authorized links behave similarly and it generally isn't a deal-breaker.

Test Plan: added tests

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3488
2022-07-19 11:55:18 -04:00
..
CustomSectionAPI-ti.ts
CustomSectionAPI.ts
DocApiTypes-ti.ts
DocApiTypes.ts
FileParserAPI-ti.ts
FileParserAPI.ts
grist-plugin-api.ts (core) add an access token mechanism to help with attachments in custom widgets 2022-07-19 11:55:18 -04:00
GristAPI-ti.ts (core) add an access token mechanism to help with attachments in custom widgets 2022-07-19 11:55:18 -04:00
GristAPI.ts (core) add an access token mechanism to help with attachments in custom widgets 2022-07-19 11:55:18 -04:00
GristData-ti.ts (core) Update Plugin API documentation 2022-05-24 17:27:34 -07:00
GristData.ts (core) Speed up and upgrade build. 2022-06-27 16:10:10 -04:00
GristTable-ti.ts
GristTable.ts (core) Update Plugin API documentation 2022-05-24 17:27:34 -07:00
gutil.ts
ImportSourceAPI-ti.ts
ImportSourceAPI.ts
InternalImportSourceAPI-ti.ts
InternalImportSourceAPI.ts
objtypes.ts
PluginManifest-ti.ts
PluginManifest.ts
README.md
RenderOptions-ti.ts
RenderOptions.ts
StorageAPI-ti.ts
StorageAPI.ts
TableOperations.ts (core) Update Plugin API documentation 2022-05-24 17:27:34 -07:00
TableOperationsImpl.ts
tsconfig.json
TypeCheckers.ts (core) Speed up and upgrade build. 2022-06-27 16:10:10 -04:00
WidgetAPI-ti.ts
WidgetAPI.ts

Methods here are available for use in Grist custom widgets.