fraschetti / Octoslack

OctoPrint plugin for Slack, Mattermost, Pushbullet, Pushover, Rocket.Chat, Discord, Riot/Matrix, & Microsoft Teams
MIT License
74 stars 34 forks source link

[Feature Request] Add WebDav support #37

Open calonmerc opened 5 years ago

calonmerc commented 5 years ago

Love everything about the plugin, currently using it with Imgur. Would love if there was an implementation for the WebDav protocol for OpenSource storage software like Owncloud/Nextcloud.

fraschetti commented 5 years ago

Hi @calonmerc Thanks for the suggestion. I've never personally used the software you mentioned. It may be straightforward enough to upload snapshots/timelapses via the webdav protocol but surfacing them via Slack may be a bit more tricky. Can you share some additional context as to what you're hoping to happen once the file(s) have been uploaded? Is there a mechanism to expose them via HTTP/S? I've yet to give it a try (should be easy enough) but I've yet to test how Slack handles locally (I presume on your home network vs. the public internet?) hosted image URL. I suspect the Slack servers on their backend need access to the file for it to render in Slack itself.

calonmerc commented 5 years ago

My Nextcloud instance is publicly accessible, as I imagine most use cases are. It's similar to a NAS, but meant to be a replacement for Dropbox, Google Drive, or similar.

You can set public permissions on the file to be accessible from the web directly, but I don't know how much of that is surfaced directly in the WebDAV protocol. It may be something I need to investigate simply as an alternative upload location for timelapse images/videos in a separate plugin. Just wondered if it might work better with this implementation, as I would like them to also show up in Slack...

calonmerc commented 5 years ago

I've spent some time looking into this, and found that it should be possible using the OCS API to enable a publicly shared folder by link. Unsure of the development requirements, or how else I can help integrate (I can give you some space on my server for testing, if you'd like).

https://docs.nextcloud.com/server/12/developer_manual/core/ocs-share-api.html

fraschetti commented 5 years ago

Hi @calonmerc

I spent a few minutes tonight looking at what could be done here.

calonmerc commented 5 years ago

Sorry for taking quite a while to get back to this!

Sadly, I am not seeing images being directly view-able without logging in or setting up link sharing. If I set the directory they're uploading to as shared via a link with no password, then any of the images show up in Slack just fine!

calonmerc commented 5 years ago

Here is a directory that is link shared with no restrictions: Directory Sample Timelapse Sample Image