-
Notifications
You must be signed in to change notification settings - Fork 57
feat: sign record's public url #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
17241fe
feat: sign public url
danpoletaev 3b40e57
refactor: compose url with URL()
danpoletaev 13cdc63
refactor: clean up
danpoletaev b01c22a
Merge branch 'master' into feat/sign-public-url
danpoletaev 7a74be9
chore: added test for publicUrl
danpoletaev a404dbf
fix: use apiPublicBaseUrl to generate public url
danpoletaev 23505f1
fix: improve test
danpoletaev af0f70b
refactor: clean up
danpoletaev d2a11f3
refactor: improved test
danpoletaev 1bf60b2
Merge branch 'master' into feat/sign-public-url
danpoletaev d830ed1
refactor: clean up
danpoletaev 9477a14
Merge remote-tracking branch 'origin/master' into feat/sign-public-url
janbuchar cf7144e
fix: CI
danpoletaev 00a96f7
Merge remote-tracking branch 'origin/master' into feat/sign-public-url
janbuchar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Actor, log } from 'apify'; | ||
|
|
||
| await Actor.init(); | ||
|
|
||
| const { data } = await Actor.getInput(); | ||
|
|
||
| await Actor.setValue('public-record-key', JSON.stringify(data), { contentType: `application/json` }); | ||
|
|
||
| const defaultKeyValueStore = await Actor.openKeyValueStore(); | ||
| const publicUrl = defaultKeyValueStore.getPublicUrl('public-record-key'); | ||
|
|
||
| // Here we store the url itself | ||
| await Actor.setValue('urlToPublicData', publicUrl); | ||
|
|
||
| log.info('Generated public url', { publicUrl }); | ||
|
|
||
| await Actor.pushData({ publicUrl }); | ||
|
|
||
| await Actor.exit(); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import assert from 'node:assert/strict'; | ||
|
|
||
| import { ApifyClient } from 'apify'; | ||
|
|
||
| const PUBLIC_DATA = { exposedData: 'test' }; | ||
|
|
||
| const client = new ApifyClient({ | ||
| token: process.env.APIFY_TOKEN, | ||
| }); | ||
|
|
||
| const actor = client.actor(process.argv[2]); | ||
|
|
||
| const run = await actor.call({ data: PUBLIC_DATA }, { waitSecs: 15 }); | ||
| assert.equal(run.exitCode, 0); | ||
|
|
||
| const publicUrl = await client.keyValueStore(run.defaultKeyValueStoreId).getRecord('urlToPublicData'); | ||
| const data = await fetch(publicUrl.value).then((res) => res.json()); | ||
|
|
||
| assert.deepEqual(data, PUBLIC_DATA); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a comment here about the difference between
apiBaseUrlandapiPublicBaseUrl