Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ticruz38
Copy link
Collaborator

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.

@ticruz38 ticruz38 added this to the 0.5.0 milestone Nov 28, 2024
@ticruz38
Copy link
Collaborator Author

ticruz38 commented Dec 2, 2024

Using shipyard API is CORS protected.

The best I can do is keep the scheduled event in session storage or in indexed db.
I can tell if it has been successfully picked up by the DVM.
For cancelling the schedule, you also need to use the shipyard API, in that case I can send the user to https://shipyard.pub

@staab staab modified the milestones: 0.5.0, 0.6.0 Dec 12, 2024
@ticruz38
Copy link
Collaborator Author

@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:

  • Using shipyard DVM in Coracle, but the UI will be limited.
  • Using another schedule DVM, A Coracle one?

@ticruz38
Copy link
Collaborator Author

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.

@staab
Copy link
Collaborator

staab commented Dec 16, 2024

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.

@ticruz38
Copy link
Collaborator Author

  • Add the option to schedule the note, in the NoteOptions component, you can pick a date and an Hour.
  • Show "Publishing at" instead of "Send" in the submit button in NoteCreate.
  • The feedback is similar to a normal send, first the delay, then the statuses, but in the case of a DVM, it will also tell you if the note has been picked up by the DVM in a third toast.

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.

const template = createEvent(1, {
content,
tags,
created_at: options?.publish_at,
Copy link
Collaborator

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.

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)
Copy link
Collaborator

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

Copy link
Collaborator Author

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?

Copy link
Collaborator

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

Comment on lines 225 to 226
} else if (event.kind === DVM_REQUEST_PUBLISH_SCHEDULE) {
console.log("DVM_REQUEST_PUBLISH_SCHEDULE", event)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug code

@staab staab merged commit 0d8a3af into coracle-social:dev Jan 13, 2025
2 checks passed
staab added a commit that referenced this pull request Jan 15, 2025
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants