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 (core) Custom Widget column mapping feature. 2022-02-08 17:41:04 +01:00
CustomSectionAPI.ts (core) Custom Widget column mapping feature. 2022-02-08 17:41:04 +01:00
DocApiTypes-ti.ts (core) add grist.selectedTable.create/update/destroy/upsert to custom widget api 2022-03-15 11:11:58 -04:00
DocApiTypes.ts (core) add grist.selectedTable.create/update/destroy/upsert to custom widget api 2022-03-15 11:11:58 -04:00
FileParserAPI-ti.ts (core) Adding schema validation for records endpoint 2021-10-18 21:40:50 +02:00
FileParserAPI.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
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 (core) add grist.onRecord and grist.onRecords event handlers 2020-08-13 14:34:23 -04:00
GristTable.ts (core) Update Plugin API documentation 2022-05-24 17:27:34 -07:00
gutil.ts (core) add grist.selectedTable.create/update/destroy/upsert to custom widget api 2022-03-15 11:11:58 -04:00
ImportSourceAPI-ti.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
ImportSourceAPI.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
InternalImportSourceAPI-ti.ts (core) Adding schema validation for records endpoint 2021-10-18 21:40:50 +02:00
InternalImportSourceAPI.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
objtypes.ts (core) Use GristObjCode in CellValue 2021-10-11 14:11:32 +02:00
PluginManifest-ti.ts (core) Adding import from google drive to the home screen 2021-08-05 20:46:11 +02:00
PluginManifest.ts (core) Adding import from google drive to the home screen 2021-08-05 20:46:11 +02:00
README.md (core) configure typedoc for generating plugin api documentation 2022-04-04 18:11:33 -04:00
RenderOptions-ti.ts (core) Adding schema validation for records endpoint 2021-10-18 21:40:50 +02:00
RenderOptions.ts (core) configure typedoc for generating plugin api documentation 2022-04-04 18:11:33 -04:00
StorageAPI-ti.ts (core) Adding schema validation for records endpoint 2021-10-18 21:40:50 +02:00
StorageAPI.ts (core) move home server into core 2020-07-21 20:39:10 -04:00
TableOperations.ts (core) Update Plugin API documentation 2022-05-24 17:27:34 -07:00
TableOperationsImpl.ts (core) Improving custom widget API. Changing destroy function signature. 2022-05-05 16:34:26 +02:00
tsconfig.json (core) move home server into core 2020-07-21 20:39:10 -04:00
TypeCheckers.ts (core) Speed up and upgrade build. 2022-06-27 16:10:10 -04:00
WidgetAPI-ti.ts (core) Widget options api 2022-01-13 11:10:17 +01:00
WidgetAPI.ts (core) Widget options api 2022-01-13 11:10:17 +01:00

Methods here are available for use in Grist custom widgets.