~arx10/procustodibus-app

1654aa65ecc8266bcca5890a7357b76bc272e387 — Justin Ludwig 3 months ago c4e1100
comment out non-standard wg properties in download

on interface config (and conn wiz review) page
2 files changed, 23 insertions(+), 18 deletions(-)

M src/utils/download.js
M tests/unit/utils/download.spec.js
M src/utils/download.js => src/utils/download.js +13 -8
@@ 250,9 250,9 @@ function generateWgQuickConfParts(iface) {
    }

    multiLine(peerPart, eattr, 'allowed_ips', 'AllowedIPs')
    multiLine(peerPart, eattr, 'disallowed_ips', 'DisallowedIPs')
    multiLine(peerPart, extras, 'allowed_apps', 'AllowedApps')
    multiLine(peerPart, extras, 'disallowed_apps', 'DisallowedApps')
    multiLine(peerPart, eattr, 'disallowed_ips', '# DisallowedIPs')
    multiLine(peerPart, extras, 'allowed_apps', '#')
    multiLine(peerPart, extras, 'disallowed_apps', '#')

    const { hostname, ip, port } = eattr
    if (hostname || ip) {


@@ 260,10 260,10 @@ function generateWgQuickConfParts(iface) {
    }

    addLineIfTruthy(peerPart, eattr, 'keepalive', 'PersistentKeepalive')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_username')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_password')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_all_traffic')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy', '#')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_username', '#')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_password', '#')
    addLineIfTruthy(peerPart, extras, 'socks5_proxy_all_traffic', '#')

    if (eattr.available === false) peerPart = peerPart.map((x) => `#${x}`)
    peerPart.push('')


@@ 300,7 300,12 @@ function joinLinesFromArray(lines, attr, key, name) {
}

function addLine(lines, value, key, name) {
  lines.push(`${name || upperFirst(camelCase(key))} = ${value}`)
  const commented = name === '#'
  if (!name || commented) {
    name = upperFirst(camelCase(key))
    if (commented) name = `# ${name}`
  }
  lines.push(`${name} = ${value}`)
}

function iptables(upRule, { up, down, v4, v6 }) {

M tests/unit/utils/download.spec.js => tests/unit/utils/download.spec.js +10 -10
@@ 433,16 433,16 @@ PrivateKey = PRIVATE KEY GOES HERE
# Peer 1 (http://localhost:3000/endpoints/endpoint1)
[Peer]
PublicKey = pub1
DisallowedIPs = 192.168.0.0/16
DisallowedIPs = fc00::/7
AllowedApps = chrome
AllowedApps = firefox
DisallowedApps = msoffice
DisallowedApps = MicrosoftEdge
Socks5Proxy = socks5.example.com:1080
Socks5ProxyUsername = foo
Socks5ProxyPassword = bar
Socks5ProxyAllTraffic = true
# DisallowedIPs = 192.168.0.0/16
# DisallowedIPs = fc00::/7
# AllowedApps = chrome
# AllowedApps = firefox
# DisallowedApps = msoffice
# DisallowedApps = MicrosoftEdge
# Socks5Proxy = socks5.example.com:1080
# Socks5ProxyUsername = foo
# Socks5ProxyPassword = bar
# Socks5ProxyAllTraffic = true
`.trimStart(),
    )
  })