-
Couldn't load subscription status.
- Fork 84
Sending scheduled note via dvm #494
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
Conversation
|
Using shipyard API is CORS protected. The best I can do is keep the scheduled event in session storage or in indexed db. |
|
@staab I tried using the api via a proxy to avoid cors, but shipyard also set domain restricted cookies. Shipyard really is just an API picking up DVM request. I have 2 options:
|
|
such an API wouldn't be too hard to build, just a server accepting signed event that will be posted on behalf of the signer at the time set in the created_at field of the event propagated and to the relay defined in the tags of the event. |
|
I don't think we need anything too fancy. And I'd like to avoid relying on a third party service anyway (apart from whatever DVM picks up the request). A UI that allows a user to schedule something in the future, and which makes the DVM request, showing progress and success/failure should be enough. |
dbb86e9 to
17c9cf3
Compare
At the moment, only shipyard provide this service, so we could send the user to shipyard.pub (in the toast feedback for example) with a high level of confidence that he will be able to manage its notes there, but maybe on the long run there will be more providers so I left it out for now. |
src/app/views/NoteCreate.svelte
Outdated
| const template = createEvent(1, { | ||
| content, | ||
| tags, | ||
| created_at: options?.publish_at, |
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.
No need for ?, options should always be defined. Same thing below.
src/app/views/NoteCreate.svelte
Outdated
| if ( | ||
| Object.values(status).length === thunk.request.relays.length && | ||
| Object.values(status).every(s => s.status === PublishStatus.Pending) | ||
| Object.values(status).every((s: any) => s.status === PublishStatus.Pending) |
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.
This is the wrong way to handle this, instead use thunk: Thunk where it's declared
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.
I don't understand this comment, here I am checking that all thunk request status are pending before sending the thunk status toaster.
Would you rather send it with different requirements, ie one request status being set at least?
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.
Sorry, I mean the type hint. The line where thunk is assigned should be the line to be fixed, the whole file thinks thunk is any
src/engine/state.ts
Outdated
| } else if (event.kind === DVM_REQUEST_PUBLISH_SCHEDULE) { | ||
| console.log("DVM_REQUEST_PUBLISH_SCHEDULE", event) |
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.
debug code
826b20c to
056b429
Compare
* Get rid of old welshman tags * sending scheduled note via dvm * types * add the option to schedule a new note * hodlbod review changes * add missing types * avoid null created_at field --------- Co-authored-by: Jon Staab <[email protected]> Co-authored-by: hodlbod <[email protected]>
This is working, my DVM are picked up by shipyard but the UX is very poor at the moment.
I cannot query back the kind 5905 notes from any of the relay it was published to, I cannot consume the shipyard API without being logged in too. As a result I can't show you how many and which of your note are being scheduled or cancel them.
All I can do is effectively schedule the publishing of your note. This works.