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

Add support to upload files to xmpp from bridges with private urls like slack/mattermost/telegram (xmpp) #295

Closed
srgcdev opened this issue Nov 7, 2017 · 29 comments
Labels

Comments

@srgcdev
Copy link

srgcdev commented Nov 7, 2017

I'm using matterbridge within xmpp and telegram and I noticed that when someone sends a file in telegram I can't receive it in xmpp.

Once that #278 is solved for telegram, could it be possible to add support for upload files to xmpp using this xep:
https://xmpp.org/extensions/xep-0363.html

Basically consists in upload the file to the xmpp server and share de url link.
Some xmpp clients supports this xep (Conversations, gajim (via plugin), dino, movim...)

Thanks in advance.

@42wim 42wim added library issue enhancement New feature or request labels Nov 11, 2017
@42wim
Copy link
Owner

42wim commented Nov 11, 2017

Unfortunately the library I use (https://github.com/mattn/go-xmpp) doesn't support this.
Not much I can do for now.

@42wim
Copy link
Owner

42wim commented Nov 24, 2017

@srgcdev I've just added support for sending files to your own "mediaserver". This is supported for the irc, xmpp and gitter bridges (who don't support native uploading).

An example of how to setup your own with caddy can be found on https://github.com/42wim/matterbridge/wiki/Mediaserver-setup-%5Badvanced%5D

@srgcdev
Copy link
Author

srgcdev commented Nov 25, 2017

@42wim Thanks! But having on my own server apache I think its a bit more difficult to configure caddy. I opened an enhancement issue to go-xmpp (xmppo/go-xmpp#94) library to support native http upload for xmpp. I hope they implement it someday.

@srgcdev
Copy link
Author

srgcdev commented Nov 25, 2017

Oh, could be possible to use caddy for media server upload and apache for media server download, something like this:

[general]
MediaServerUpload="http://localhost:2015
MediaServerDownload="https://yourserver.com/"

@Madji
Copy link

Madji commented Nov 30, 2017

Hello. tell me. I configured the caddy according to your wiki. Added line in the config matterbridge. For example: investments of the telegram now appear in the folder according to the settings, but no change in xmpp. that is, they do not appear in any way in the conference. How to configure this feature

@wsdjeg
Copy link

wsdjeg commented Nov 30, 2017

@42wim I also use this project for SpaceVim's comunity; here is the channels:

  • gitter: SpaceVim/SpaceVim
  • matrix: #spacevim:matrix.org
  • telegram: t.me/SpaceVim
  • irc: #spacevim(freenode.net)

now all work well except telegram, when user send message in telegram, we can not get message in irc gitter and matrix.

@42wim
Copy link
Owner

42wim commented Nov 30, 2017

@Madji it should show the link. You also added MediaServerDownload to the config ?

Could you please run with -debug and then upload an image with telegram and paste me all of the debug logs on pastebin.com (be sure to remove any secrets / identifiers).

@42wim
Copy link
Owner

42wim commented Nov 30, 2017

@wsdjeg this is probably an issue with the telegram configuration.

Check out https://core.telegram.org/bots#privacy-mode and yagop/node-telegram-bot-api#174 (comment)

Also run with -debug and see if you get any messages from telegram in the logs.

@wsdjeg
Copy link

wsdjeg commented Nov 30, 2017

Thanks,fixed.

@Madji
Copy link

Madji commented Dec 1, 2017

Yes, of course I added in the config MediaServerDownload.
Strange, but I have updated the version to matterbridge-v1.4.1-14. and images began to appear. But to be honest to take a single domain for the transmission of pictures is too much.
https://pasteit.cf/view/08af71ac
Concerned about the TLS error in the log. Please tell me how to get rid of them?

@wsdjeg
Copy link

wsdjeg commented Dec 1, 2017

@42wim I want to use tools like this https://img.vim-cn.com/

is it possible to implement this feature? when user in tg/matrix/slack upload a file, just send them to https://img.vim-cn.com/ , and then post the url to other channels. then no need to upload file to the bridges (who don't support native uploading)

@42wim
Copy link
Owner

42wim commented Dec 1, 2017

@Madji it's probably something at telegram, does it still happen ?

@42wim
Copy link
Owner

42wim commented Dec 2, 2017

@wsdjeg please open a new issue with this feature request. It seems http://img.vim-cn.com/ only supports images ? and not videos/files ?

@wsdjeg
Copy link

wsdjeg commented Dec 2, 2017

@42wim ok, I will open new issue about it.

@ValdikSS
Copy link
Contributor

How should it work with XMPP-Telegram? I've configured Caddy, I can see that the image gets uploaded to Caddy by matterbridge, but matterbridge does not send the link to the image to XMPP. Does it use some XEP to push image to XMPP?

@ValdikSS
Copy link
Contributor

@42wim, I'm running Matterbridge v1.6.3 and it does not send the link for uploaded file to the XMPP room.

DEBU[2018-01-27T17:49:12+03:00] Receiving from telegram: &tgbotapi.Message{MessageID:220, From:(*tgbotapi.User)(0xc4204e0d20), Date:1517064552, Chat:(*tgbotapi.Chat)(0xc4208d5e60), ForwardFrom:(*tgbotapi.User)(nil), ForwardFromChat:(*tgbotapi.Chat)(nil), ForwardFromMessageID:0, ForwardDate:0, ReplyToMessage:(*tgbotapi.Message)(nil), EditDate:0, Text:"", Entities:(*[]tgbotapi.MessageEntity)(nil), Audio:(*tgbotapi.Audio)(nil), Document:(*tgbotapi.Document)(nil), Game:(*tgbotapi.Game)(nil), Photo:(*[]tgbotapi.PhotoSize)(0xc4203fa0c0), Sticker:(*tgbotapi.Sticker)(nil), Video:(*tgbotapi.Video)(nil), VideoNote:(*tgbotapi.VideoNote)(nil), Voice:(*tgbotapi.Voice)(nil), Caption:"", Contact:(*tgbotapi.Contact)(nil), Location:(*tgbotapi.Location)(nil), Venue:(*tgbotapi.Venue)(nil), NewChatMembers:(*[]tgbotapi.User)(nil), LeftChatMember:(*tgbotapi.User)(nil), NewChatTitle:"", NewChatPhoto:(*[]tgbotapi.PhotoSize)(nil), DeleteChatPhoto:false, GroupChatCreated:false, SuperGroupChatCreated:false, ChannelChatCreated:false, MigrateToChatID:0, MigrateFromChatID:0, PinnedMessage:(*tgbotapi.Message)(nil), Invoice:(*tgbotapi.Invoice)(nil), SuccessfulPayment:(*tgbotapi.SuccessfulPayment)(nil)}  module=telegram
DEBU[2018-01-27T17:49:12+03:00] trying to download "file_9.jpg" fileid "" with size 31954  module=telegram
DEBU[2018-01-27T17:49:12+03:00] download OK "file_9.jpg" 31954 96             module=telegram
DEBU[2018-01-27T17:49:12+03:00] Sending message from someuser on telegram.bridged to gateway  module=telegram
DEBU[2018-01-27T17:49:12+03:00] Message is config.Message{Text:"", Channel:"-123456789", Username:"someuser", UserID:"87654321", Avatar:"", Account:"telegram.bridged", Event:"", Protocol:"", Gateway:"", Timestamp:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)}, ID:"220", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"file_9.jpg", Data:(*[]uint8)(0xc42016c980), Comment:"", URL:""}}}}  module=telegram
DEBU[2018-01-27T17:49:12+03:00] mediaserver download URL = https://somedomain.com/f7a354f2c4b9b3d71858116dd079a97a773c9bc2/file_9.jpg

And that's all. You can't see this link anywhere except in the logs.

@42wim
Copy link
Owner

42wim commented Jan 27, 2018

@ValdikSS I also need the debug messages from module=xmpp

@ValdikSS
Copy link
Contributor

@42wim, how can I activate them? No message is sent to XMPP after mediaserver download URL. No XML payload is shown in the log, nothing on the server XML log also.

@42wim
Copy link
Owner

42wim commented Jan 27, 2018

But for normal messages the xmpp bridge works ?
Typing in telegram gives output in xmpp ?

@ValdikSS
Copy link
Contributor

I tried to downgrade down to 1.4.1, and to use current git version, but it doesn't work.
Yes, text messaging works fine.

@42wim
Copy link
Owner

42wim commented Jan 27, 2018

Ok, retry the current master, I've added a possible fix.
Or wait until the binaries are build (they will show up in a couple of minutes at https://bintray.com/42wim/nightly/Matterbridge/_latestVersion)

(binaries are available now)

@ValdikSS
Copy link
Contributor

Works now, thanks a lot!

@42wim
Copy link
Owner

42wim commented Jan 27, 2018

@ValdikSS good to hear, thanks for testing and reporting back.

@42wim
Copy link
Owner

42wim commented Dec 26, 2018

Going to close this as this needs to be fixed by the xmpp library.

@42wim 42wim closed this as completed Dec 26, 2018
@mdosch
Copy link

mdosch commented Feb 7, 2022

Going to close this as this needs to be fixed by the xmpp library.

Just in case you haven't seen my comment at xmppo/go-xmpp#94 (comment): I was also missing http-upload in mattn/go-xmpp so I wrote it directly in my program: https://salsa.debian.org/mdosch/go-sendxmpp/-/blob/master/httpupload.go

@42wim
Copy link
Owner

42wim commented Feb 9, 2022

@mdosch looks cool, willing to open a PR for this in matterbridge?:)

@mdosch
Copy link

mdosch commented Feb 10, 2022 via email

@sirdrakeistda
Copy link

@mdosch I have noticed, that your program is licensed under BSD 2, but matterbridge is licensed under Apache2. I have no idea if these licenses are compatible, but I think it would be helpfull to clearify this point to prevent work which can't be merged.

@mdosch
Copy link

mdosch commented Feb 18, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants