summaryrefslogtreecommitdiff
path: root/bin/zoom
blob: f1d92c35bd221e12e39da67648e4939dba8bd6f8 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash 
 
# convert https://us02web.zoom.us/j/1111111?pwd=xxxxxxxx (the URI you 
# usually get) 
# 
# into zoommtg://zoom.us/join?confno=1111111&pwd=xxxxxxxx (the URI 
# that the zoom client actually wants) 
 
munge-zoom-uri() {
    local uri="$1"
    if [[ $uri =~ ^zoommtg://[^/]+/join ]]; then
        echo "$uri"
        return
    fi
 
    if [[ $uri =~ ^https?://([^/.]+\.)?zoom\.us/j/([0-9]+)]]; then
        echo "zoommtg://zoom.us/join?confno=${BASH_REMATCH[2]}"
        return
    fi
 
    if [[ $uri =~ ^https?://([^/.]+\.)?zoom\.us/j/([0-9]+)\?pwd=(.+)]]; then
        echo "zoommtg://zoom.us/join?confno=${BASH_REMATCH[2]}&pwd=${BASH_REMATCH[3]}"
        return
    fi
 
    if [[ $uri =~ ^https?://([^/.]+\.)?zoom\.us/w/([0-9]+)\?pwd=(.+)]]; then
        echo "zoommtg://zoom.us/join?confno=${BASH_REMATCH[2]}&pwd=${BASH_REMATCH[3]}"
        return
    fi
 
    if [[ $uri =~ ^https?://([^/.]+\.)?zoom\.us/my/([a-zA-Z0-9]+)\?pwd=(.+)]]; then
        echo "zoommtg://zoom.us/join?confno=${BASH_REMATCH[2]}&pwd=${BASH_REMATCH[3]}"
        return
    fi
 
    >&2 echo "can't parse <$uri>, ignoring";
    return
}
 
declare -a args
if [[ -n "$1" ]]; then
    args+=("$(munge-zoom-uri "$1")")
fi
 
exec /opt/zoom/ZoomLauncher "${args[@]}"