@stefan.inc/feedback-engine 1.6.0 → 1.6.1
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.
- package/package.json +1 -1
- package/src/dom/procrastimate.ts +13 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stefan.inc/feedback-engine",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "In-app feedback for Svelte and React: point at a component, write what should change, and export its name, file:line, and data for an agent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"accessibility",
|
package/src/dom/procrastimate.ts
CHANGED
|
@@ -16,9 +16,8 @@ export type Project = { id: string; name: string; sections: Section[] };
|
|
|
16
16
|
/** Where a task goes: the Inbox without a project, and the project's top, above its sections, without a section. */
|
|
17
17
|
export type Place = { projectId?: string; sectionId?: string };
|
|
18
18
|
|
|
19
|
-
/** ProcrastiMate's `FILE_PART_BYTES`
|
|
20
|
-
const
|
|
21
|
-
const fileMaxBytes = 25_000_000;
|
|
19
|
+
/** ProcrastiMate's `FILE_PART_BYTES` (`shared/images.ts` there): the most it takes as a file in one request. */
|
|
20
|
+
const fileMaxBytes = 16 * 1024 * 1024;
|
|
22
21
|
const defaultApp = 'https://procrastimate.stf.lol';
|
|
23
22
|
|
|
24
23
|
const projectsKey = 'feedback.procrastimate.projects';
|
|
@@ -161,7 +160,8 @@ export async function postTask(
|
|
|
161
160
|
step: (text: string) => void,
|
|
162
161
|
) {
|
|
163
162
|
const bytes = new TextEncoder().encode(report);
|
|
164
|
-
if (bytes.length > fileMaxBytes)
|
|
163
|
+
if (bytes.length > fileMaxBytes)
|
|
164
|
+
throw new Error('The JSON report is over the 16 MB ProcrastiMate takes in one upload.');
|
|
165
165
|
step('Encoding the image');
|
|
166
166
|
const full = await jpeg(image, 2048, 1_500_000);
|
|
167
167
|
const thumb = await jpeg(image, 320, 200_000);
|
|
@@ -171,12 +171,15 @@ export async function postTask(
|
|
|
171
171
|
await send(config, 'PUT', 'api/images', { id: imageId, size: 'full' }, full.blob, 'image/jpeg');
|
|
172
172
|
step('Uploading the thumbnail');
|
|
173
173
|
await send(config, 'PUT', 'api/images', { id: imageId, size: 'thumb' }, thumb.blob, 'image/jpeg');
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
174
|
+
step('Uploading feedback.json');
|
|
175
|
+
await send(
|
|
176
|
+
config,
|
|
177
|
+
'PUT',
|
|
178
|
+
'api/images',
|
|
179
|
+
{ id: reportId, size: 'file', name: 'feedback.json', type: 'application/json' },
|
|
180
|
+
bytes,
|
|
181
|
+
'application/octet-stream',
|
|
182
|
+
);
|
|
180
183
|
step('Creating the task');
|
|
181
184
|
const created = await send(
|
|
182
185
|
config,
|