summaryrefslogtreecommitdiff
path: root/pages/assets/js/download.js
blob: 5b92f3aaa6ab1f4aadf398cb07be1db60f978217 (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
46
$(document).ready(function() {
  var platform = platformStr();

  $(".download").click(function(e) {
    e.preventDefault();
    download(platform);
  });

  if (["GNU/Linux", "macOS", "Android"].indexOf(platform) != -1) {
    $(".download-text").text("Download Bitmask for " + platform);
  }
});


function download(platform) {
  var link = "install";
  switch (platform) {
    case "GNU/Linux":
      link = "https://dl.bitmask.net/RiseupVPN/linux/riseup-vpn_latest.snap";
      break;
    case "macOS":
      link = "https://dl.bitmask.net/RiseupVPN/osx/RiseupVPN-OSX-latest.pkg";
      break;
    case "Android":
      link = "install/android";
      break;
  }
  window.location = link;
};

function platformStr() {
  if (navigator.platform.toLowerCase().indexOf("linux arm") != -1 ||
      navigator.platform.toLowerCase().indexOf("android") != -1) {
    return "Android";
  }
  if (navigator.platform.indexOf("Linux") != -1) {
    return "GNU/Linux";
  }
  if (navigator.platform.indexOf("Mac") != -1) {
    return "macOS";
  }
  if (navigator.platform.indexOf("Win") != -1) {
    return "Windows";
  }
  return "Other";
}