Skip to content
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

Comment post support: api & cli #16

Merged
merged 8 commits into from
Apr 29, 2024
Merged

Conversation

nain-F49FF806
Copy link
Contributor

Greetings,

This PR completes comments support by adding support for posting comments.
In addition to the above, post paste has been updated to use defined paste type.

The typing should help give more confidence in future updates to the code.
Also, we are able to focus sensitive/error-prone tasks like generating cipher parameters in one place.

Best regards.

These  are not relevant or expected for comment. see https://github.com/orgs/PrivateBin/discussions/1290

For paste they are present when getting paste, not while posting, so make them optional.

They should be part of PostPasteResponse, PostCommentResponse only.
makes some stuff easier.  will be apparent in next commit
default helps creating skeleton structure.

cipher generation is also automated for example. makes usage less error prone
@nain-F49FF806 nain-F49FF806 marked this pull request as ready for review April 28, 2024 06:22
Copy link
Owner

@Mydayyy Mydayyy left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! Just 2 (or basically one) minor questions. For me atleast it compiled without changes when changing those to be an URL, but I am not sure which impact that would have on uniffi

pub struct PostCommentResponse {
pub id: String,
pub status: u32,
pub url: String,
Copy link
Owner

Choose a reason for hiding this comment

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

Would changing this to an URL make sense or does that interfere with uniffi?

pub id: String,
pub url: String,
pub url: Option<String>,
Copy link
Owner

Choose a reason for hiding this comment

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

Would changing this to an URL make sense or does that interfere with uniffi?

Copy link
Contributor Author

@nain-F49FF806 nain-F49FF806 Apr 29, 2024

Choose a reason for hiding this comment

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

There would be no issue with uniffi.
But the "url" returned by privatebin responses can be weird:

{"status":0,"id":"ba7bf946a542eee1","url":"\/?ba7bf946a542eee1","deletetoken":"9914b0e934253e2e327f9a6477b99f6fff5d1e0e10d3d3bd08d4d9b6a20ab2ea"}

So just need to test if it parses correctly.
Same with above.

Copy link
Contributor Author

@nain-F49FF806 nain-F49FF806 Apr 29, 2024

Choose a reason for hiding this comment

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

Update: We do indeed get error when actually parsing it to url. The url value should be fixed upstream before we try to make use of this property.

Error: Json(Error("invalid value: string \"/?518ad640b320f1a4\", expected relative URL without a base", line: 0, column: 0))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have opened an issue upstream regarding this PrivateBin/PrivateBin#1294

Copy link
Owner

Choose a reason for hiding this comment

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

Hey,

in that case it appears there is nothing that can be done from our side, so I will proceed and merge this. Thank you for the contribution!

Best Regards
Mydayyy

@Mydayyy Mydayyy merged commit e668751 into Mydayyy:master Apr 29, 2024
1 check passed
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