databag icon indicating copy to clipboard operation
databag copied to clipboard

Post from CLI

Open daedric7 opened this issue 1 year ago • 19 comments

First of all, great project. I love how fast everything is.

Are there alternative clients, of means to post messages to a given topic?

I would find useful to be able to post and attach files from CLI for example.

daedric7 avatar Mar 22 '23 11:03 daedric7

I don't have a CLI client yet, but I've had several requests for one so I'll push it up in the backlog. Thanks for the feedback!

balzack avatar Mar 22 '23 14:03 balzack

If you need help testing don't hesitate :)

daedric7 avatar Mar 22 '23 14:03 daedric7

I was thinking of adding a button to the topic thread in the webapp. It would copy a tiny bash script to the clipboard. You could then run the bash script from the command line to post a new message to that topic, which could include an image/audio/video file. Would this be of interest, or are you looking for a more complete client app?

balzack avatar Mar 22 '23 14:03 balzack

This would suffice, but some questions rise:

Security? Anyone with the script can post to the given topic ?

How do we specify if it's a simple text message or a image, or a video? Maybe --switches ?

daedric7 avatar Mar 22 '23 15:03 daedric7

Great point on security. The script would need to contain a login prompt so that the access tokens aren't stored on disk and easily compromised. Unfortunately the login prompt would make the script more cumbersome to use.

I was thinking the script would have a switches { --image, --audio, --video } coupled with a file path and/or { ---message } coupled with quoted string for the text.

Let me know if you still think something like this would be useful?

balzack avatar Mar 22 '23 16:03 balzack

Something like https://databag.server.com/post?room=123456&token=1234567890 ?

Most other apps that i've known use tokens, or user and pass (?user=aaaa&pass=bbbb )

There's really no silver bullet here, but i would like the option.

daedric7 avatar Mar 22 '23 16:03 daedric7

The process of adding a message to a topic with an asset currently involves hitting 3 endpoints. I suppose I could add a new endpoint that combines the logic of the three. I think the user would still need to write a cURL command to post to that URL. If I were to provide a script for that cURL command, then I might as well leave it as the 3 endpoints.

balzack avatar Mar 22 '23 19:03 balzack

...perhaps I missed your point in the last message

balzack avatar Mar 22 '23 19:03 balzack

Not at all, i think you're spot on.

If we can post a message to a topic via a cURL command, no matter how complex, we're good to go.

A dedicated cli app would only make sense if it is not possible to post via a HTTP POST.

Nevertheless, whatever you decide is good for me.

daedric7 avatar Mar 22 '23 23:03 daedric7

Okay, right now I'm leaning towards adding a 'helper' endpoint that would allow this to be done via a POST. Im in the middle of webrtc integration, so it will probably be a little while before I can get to this feature, but it should be easy to do. Thanks for your interest in the project!

balzack avatar Mar 23 '23 06:03 balzack

OffTopic but, WebRTC as in, voice and video chats ?

daedric7 avatar Mar 23 '23 10:03 daedric7

Yup, I'm going for it...I think I have a handle on it, just not sure if I will be able to implement it the way I want to.

balzack avatar Mar 23 '23 16:03 balzack

Perhaps a topic in the discussion side is better for this case :)

daedric7 avatar Mar 23 '23 17:03 daedric7

I'm curious (this is a bit off topic), is there any documentation anywhere on the API? Would be neat if so, since it would help encourage potential third-party clients such as a CLI.

I'm planning to set databag up for myself and give it a spin (I only just discovered it—looks awesome), and I'm tentatively willing to help write up documentation for said API if I end up continuing to use databag after trying it.

benjaminbhollon avatar May 29 '23 22:05 benjaminbhollon

I just found this: https://github.com/balzack/databag/blob/main/doc/api.oa3

Does this exist somewhere in a more human-readable format? (If not that's okay)

benjaminbhollon avatar May 29 '23 22:05 benjaminbhollon

Yes, that is open api format, and the swagger export in html form is here: https://github.com/balzack/databag/raw/main/doc/swagger.html

Thanks for your interest in doing this. Let me know if I can support you in any way.

balzack avatar May 30 '23 04:05 balzack

I've got an instance setup (https://verboseguacamole.com), so I'll play around with it over the next few days and see where I can help document things. This is a really cool project! :D

benjaminbhollon avatar May 30 '23 04:05 benjaminbhollon

I'm really happy you like it! Any feedback on issues or areas you think I need to improve would be greatly appreciated as well. Thanks for your support!

balzack avatar May 30 '23 04:05 balzack

I just checked out your instance, it's awesome to see the project running out in the 'wild'. Did you have any issues setting it up?

balzack avatar May 30 '23 17:05 balzack