mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-06-08 00:56:58 +03:00
Added checkbox FwMark in QRCode generation (#260)
This commit is contained in:
parent
9d2dd711a1
commit
a80741e748
6 changed files with 85 additions and 30 deletions
|
@ -194,7 +194,7 @@ func (o *JsonDB) GetClients(hasQRCode bool) ([]model.ClientData, error) {
|
|||
return clients, nil
|
||||
}
|
||||
|
||||
func (o *JsonDB) GetClientByID(clientID string, hasQRCode bool) (model.ClientData, error) {
|
||||
func (o *JsonDB) GetClientByID(clientID string, qrCodeSettings model.QRCodeSettings) (model.ClientData, error) {
|
||||
client := model.Client{}
|
||||
clientData := model.ClientData{}
|
||||
|
||||
|
@ -204,9 +204,17 @@ func (o *JsonDB) GetClientByID(clientID string, hasQRCode bool) (model.ClientDat
|
|||
}
|
||||
|
||||
// generate client qrcode image in base64
|
||||
if hasQRCode && client.PrivateKey != "" {
|
||||
if qrCodeSettings.Enabled && client.PrivateKey != "" {
|
||||
server, _ := o.GetServer()
|
||||
globalSettings, _ := o.GetGlobalSettings()
|
||||
client := client
|
||||
client.UseServerDNS = qrCodeSettings.IncludeDNS
|
||||
if !qrCodeSettings.IncludeMTU {
|
||||
globalSettings.MTU = 0
|
||||
}
|
||||
if !qrCodeSettings.IncludeFwMark {
|
||||
globalSettings.ForwardMark = ""
|
||||
}
|
||||
|
||||
png, err := qrcode.Encode(util.BuildClientConfig(client, server, globalSettings), qrcode.Medium, 256)
|
||||
if err == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue