Upgrade asset API calls to v4.1 and pass browser user agent - #233
Open
nicomiguelino wants to merge 1 commit into
Open
Upgrade asset API calls to v4.1 and pass browser user agent#233nicomiguelino wants to merge 1 commit into
nicomiguelino wants to merge 1 commit into
Conversation
The v4 assets endpoint never granted write access to the user_agent column, so there was no way to tell Screenly's screenshot/rendering pipeline which browser produced a saved asset's headers. Move createWebAsset, updateWebAsset, getWebAsset, and the existing-asset lookup to v4.1 (a strict superset of v4) and forward navigator.userAgent when creating or updating a web asset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createWebAsset,updateWebAsset,getWebAsset, and the existing-asset lookup inupdateProposalfrom thev4assets endpoint tov4.1. Thev4endpoint's write grants never included theuser_agentcolumn, so there was no way to send it through;v4.1is a strict superset ofv4's fields, so this should be behavior-preserving for everything the extension already reads/writes.createWebAsset/updateWebAssetnow accept an optionaluserAgentparameter and include it asuser_agentin the request body when provided.submitAssetnow passesnavigator.userAgentwhen creating or updating a web asset, so the browser that captured the page/cookies is recorded on the asset.Test plan
npx tsc --noEmitpassesnpm test(29 specs, 0 failures)npm run lint:check/npm run format:checkcleannpm run buildcompiles successfullyv4.1endpoint