Welcome to mirror list, hosted at ThFree Co, Russian Federation.

zoom_link_extractor.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 92b3d6d5d3c08846284eef0f4210908f8ab04f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

# Detect links matching the following formats:
# Zoom Start links: https://zoom.us/s/<meeting-id>
# Zoom Join links: https://zoom.us/j/<meeting-id>
# Personal Zoom links: https://zoom.us/my/<meeting-id>
# Vanity Zoom links: https://gitlab.zoom.us/j/<meeting-id> (also /s and /my)

module Gitlab
  class ZoomLinkExtractor
    ZOOM_REGEXP = %r{https://(?:[\w-]+\.)?zoom\.us/(?:s|j|my)/\S+}

    def initialize(text)
      @text = text.to_s
    end

    def links
      @text.scan(ZOOM_REGEXP)
    end

    def match?
      ZOOM_REGEXP.match?(@text)
    end
  end
end