Skip to content

Commit

Permalink
Add a settings to control URL substitution (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
gbonnefille authored Jul 14, 2021
1 parent 67e9a53 commit 928f1bf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Go to Settings --> Scroll down to the Plugins section, and click on Webex Plugin

Insert the Webex Meetings URL for your organization. It is often in the format of `<companyname>.my.webex.com` or `<companyname>.webex.com`.

Depending on your situation, you will want to disable the URL conversion (known unsupported on some case with Linux clients).

This comment has been minimized.

Copy link
@aaronrothschild

aaronrothschild Jul 14, 2021

Contributor

Suggest change: "Depending on your situation, you may need to disable the URL conversion process (some Linux clients do not support it appropriately)."


## Usage
Easily start and join Webex meetings directly from Mattermost

Expand Down
7 changes: 7 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@
"help_text": "The hostname for your team's Webex site. For example: teamsite.webex.com.",
"placeholder": "teamsite.webex.com",
"default": null
},
{
"key": "UrlConversion",
"display_name": "Convert Webex URLs:",
"type": "bool",
"help_text": "Enable or disable the conversion of URL: replace /meet/ by /join/ or /start/.",

This comment has been minimized.

Copy link
@aaronrothschild

aaronrothschild Jul 14, 2021

Contributor

Suggest: "Enable or disable conversion of Webex Meeting URL - replace /meet/ by /join/ or /start/."

"default": true
}
]
}
Expand Down
2 changes: 2 additions & 0 deletions server/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
type configuration struct {
SiteHost string `json:"sitehost"`

URLConversion bool `json:"url_conversion"`

// siteName is the SiteHost up to .webex.com
// Eg., for testsite.my.webex.com, siteName would be: testsite.my
siteName string
Expand Down
5 changes: 3 additions & 2 deletions server/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,9 @@ func TestPlugin(t *testing.T) {

p := Plugin{}
p.setConfiguration(&configuration{
SiteHost: tc.SiteHost,
siteName: parseSiteNameFromSiteHost(tc.SiteHost),
SiteHost: tc.SiteHost,
siteName: parseSiteNameFromSiteHost(tc.SiteHost),
URLConversion: true,
})
p.SetAPI(api)

Expand Down
12 changes: 10 additions & 2 deletions server/meeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,19 @@ func (p *Plugin) startMeetingFromRoomURL(details meetingDetails) (*meetingPosts,
}

func (p *Plugin) makeJoinURL(meetingURL string) string {
return strings.Replace(meetingURL, "webex.com/meet/", "webex.com/join/", 1)
if p.getConfiguration().URLConversion {
meetingURL = strings.Replace(meetingURL, "webex.com/meet/", "webex.com/join/", 1)
}

return meetingURL
}

func (p *Plugin) makeStartURL(meetingURL string) string {
return strings.Replace(meetingURL, "webex.com/meet/", "webex.com/start/", 1)
if p.getConfiguration().URLConversion {
meetingURL = strings.Replace(meetingURL, "webex.com/meet/", "webex.com/start/", 1)
}

return meetingURL
}

func (p *Plugin) getURLFromRoomID(roomID string) (string, error) {
Expand Down

0 comments on commit 928f1bf

Please sign in to comment.