mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-21 18:22:00 -08:00
Add GetFileLinks, also get files if public links is disabled
This commit is contained in:
parent
845f7dc331
commit
ac19c94b9f
@ -500,6 +500,25 @@ func (m *MMClient) GetPublicLinks(filenames []string) []string {
|
||||
return output
|
||||
}
|
||||
|
||||
func (m *MMClient) GetFileLinks(filenames []string) []string {
|
||||
uriScheme := "https://"
|
||||
if m.NoTLS {
|
||||
uriScheme = "http://"
|
||||
}
|
||||
|
||||
var output []string
|
||||
for _, f := range filenames {
|
||||
res, err := m.Client.GetPublicLink(f)
|
||||
if err != nil {
|
||||
// public links is probably disabled, create the link ourselves
|
||||
output = append(output, uriScheme+m.Credentials.Server+model.API_URL_SUFFIX_V3+"/files/"+f+"/get")
|
||||
continue
|
||||
}
|
||||
output = append(output, res)
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func (m *MMClient) UpdateChannelHeader(channelId string, header string) {
|
||||
data := make(map[string]string)
|
||||
data["channel_id"] = channelId
|
||||
|
Loading…
Reference in New Issue
Block a user