fix QCCode bug

This commit is contained in:
sunyu 2020-09-25 17:49:06 +08:00
parent 03428646e1
commit a53a85618f
2 changed files with 15 additions and 9 deletions

View file

@ -29,9 +29,11 @@ function renderClientList(data) {
<div class="info-box"> <div class="info-box">
<div class="overlay" id="paused_${obj.Client.id}"` + clientStatusHtml <div class="overlay" id="paused_${obj.Client.id}"` + clientStatusHtml
+ `<i class="paused-client fas fa-3x fa-play" onclick="resumeClient('${obj.Client.id}')"></i> + `<i class="paused-client fas fa-3x fa-play" onclick="resumeClient('${obj.Client.id}')"></i>
</div> </div>`
<img src="${obj.QRCode}" /> if (obj.Client.hasPrivateSubnet == false) {
<div class="info-box-content"> html = html + `<img src="${obj.QRCode}" />`
}
html = html + `<div class="info-box-content">
<div class="btn-group"> <div class="btn-group">
<button onclick="location.href='/download?clientid=${obj.Client.id}'" type="button" <button onclick="location.href='/download?clientid=${obj.Client.id}'" type="button"
class="btn btn-outline-success btn-sm">Download</button> class="btn btn-outline-success btn-sm">Download</button>

View file

@ -22,8 +22,6 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
clientAddress := fmt.Sprintf("Address = %s", strings.Join(client.AllocatedIPs, ",")) clientAddress := fmt.Sprintf("Address = %s", strings.Join(client.AllocatedIPs, ","))
clientPrivateKey := fmt.Sprintf("PrivateKey = %s", client.PrivateKey) clientPrivateKey := fmt.Sprintf("PrivateKey = %s", client.PrivateKey)
clientDNS := fmt.Sprintf("DNS = %s", strings.Join(setting.DNSServers, ",")) clientDNS := fmt.Sprintf("DNS = %s", strings.Join(setting.DNSServers, ","))
clientPostUp := fmt.Sprintf("PostUp = %s", client.PostUp)
clientPostDown := fmt.Sprintf("PostDown = %s", client.PostDown)
// Peer section // Peer section
peerPublicKey := fmt.Sprintf("PublicKey = %s", server.KeyPair.PublicKey) peerPublicKey := fmt.Sprintf("PublicKey = %s", server.KeyPair.PublicKey)
@ -36,10 +34,16 @@ func BuildClientConfig(client model.Client, server model.Server, setting model.G
strConfig := "[Interface]\n" + strConfig := "[Interface]\n" +
clientAddress + "\n" + clientAddress + "\n" +
clientPrivateKey + "\n" + clientPrivateKey + "\n" +
clientDNS + "\n" + clientDNS + "\n\n"
clientPostUp + "\n" +
clientPostDown + "\n\n" + if client.HasPrivateSubnet {
"[Peer]" + "\n" + clientPostUp := fmt.Sprintf("PostUp = %s", client.PostUp)
clientPostDown := fmt.Sprintf("PostDown = %s", client.PostDown)
strConfig += clientPostUp + "\n" +
clientPostDown + "\n\n"
}
strConfig += "[Peer]" + "\n" +
peerPublicKey + "\n" + peerPublicKey + "\n" +
peerPresharedKey + "\n" + peerPresharedKey + "\n" +
peerAllowedIPs + "\n" + peerAllowedIPs + "\n" +