Compare commits
	
		
			No commits in common. "master" and "v0.6.2" have entirely different histories.
		
	
	
		|  | @ -71,7 +71,6 @@ RUN mkdir -p db | ||||||
| COPY --from=builder --chown=wgui:wgui /build/wg-ui . | COPY --from=builder --chown=wgui:wgui /build/wg-ui . | ||||||
| RUN chmod +x wg-ui | RUN chmod +x wg-ui | ||||||
| COPY init.sh . | COPY init.sh . | ||||||
| RUN chmod +x init.sh |  | ||||||
| 
 | 
 | ||||||
| EXPOSE 5000/tcp | EXPOSE 5000/tcp | ||||||
| ENTRYPOINT ["./init.sh"] | ENTRYPOINT ["./init.sh"] | ||||||
|  |  | ||||||
|  | @ -38,18 +38,13 @@ function renderClientList(data) { | ||||||
|             subnetRangesString = obj.Client.subnet_ranges.join(',') |             subnetRangesString = obj.Client.subnet_ranges.join(',') | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         let additionalNotesHtml = ""; |  | ||||||
|         if (obj.Client.additional_notes && obj.Client.additional_notes.length > 0) { |  | ||||||
|             additionalNotesHtml = `<span class="info-box-text" style="display: none"><i class="fas fa-additional_notes"></i>${obj.Client.additional_notes.toUpperCase()}</span>` |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         // render client html content
 |         // render client html content
 | ||||||
|         let html = `<div class="col-sm-6 col-md-6 col-lg-4" id="client_${obj.Client.id}">
 |         let html = `<div class="col-sm-6 col-md-6 col-lg-4" id="client_${obj.Client.id}">
 | ||||||
|                         <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> | ||||||
|                             <div class="info-box-content" style="overflow: hidden"> |                             <div class="info-box-content"> | ||||||
|                                 <div class="btn-group"> |                                 <div class="btn-group"> | ||||||
|                                     <a href="download?clientid=${obj.Client.id}" class="btn btn-outline-primary btn-sm">Download</a> |                                     <a href="download?clientid=${obj.Client.id}" class="btn btn-outline-primary btn-sm">Download</a> | ||||||
|                                 </div> |                                 </div> | ||||||
|  | @ -86,7 +81,6 @@ function renderClientList(data) { | ||||||
|                                 <span class="info-box-text" style="display: none"><i class="fas fa-key"></i> ${obj.Client.public_key}</span> |                                 <span class="info-box-text" style="display: none"><i class="fas fa-key"></i> ${obj.Client.public_key}</span> | ||||||
|                                 <span class="info-box-text" style="display: none"><i class="fas fa-subnetrange"></i>${subnetRangesString}</span> |                                 <span class="info-box-text" style="display: none"><i class="fas fa-subnetrange"></i>${subnetRangesString}</span> | ||||||
|                                 ${telegramHtml} |                                 ${telegramHtml} | ||||||
|                                 ${additionalNotesHtml} |  | ||||||
|                                 <span class="info-box-text"><i class="fas fa-envelope"></i> ${obj.Client.email}</span> |                                 <span class="info-box-text"><i class="fas fa-envelope"></i> ${obj.Client.email}</span> | ||||||
|                                 <span class="info-box-text"><i class="fas fa-clock"></i> |                                 <span class="info-box-text"><i class="fas fa-clock"></i> | ||||||
|                                     ${prettyDateTime(obj.Client.created_at)}</span> |                                     ${prettyDateTime(obj.Client.created_at)}</span> | ||||||
|  | @ -94,8 +88,6 @@ function renderClientList(data) { | ||||||
|                                     ${prettyDateTime(obj.Client.updated_at)}</span> |                                     ${prettyDateTime(obj.Client.updated_at)}</span> | ||||||
|                                 <span class="info-box-text"><i class="fas fa-server" style="${obj.Client.use_server_dns ? "opacity: 1.0" : "opacity: 0.5"}"></i> |                                 <span class="info-box-text"><i class="fas fa-server" style="${obj.Client.use_server_dns ? "opacity: 1.0" : "opacity: 0.5"}"></i> | ||||||
|                                     ${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'}</span> |                                     ${obj.Client.use_server_dns ? 'DNS enabled' : 'DNS disabled'}</span> | ||||||
|                                 <span class="info-box-text"><i class="fas fa-file"></i> |  | ||||||
|                                     ${obj.Client.additional_notes}</span> |  | ||||||
|                                 <span class="info-box-text"><strong>IP Allocation</strong></span>` |                                 <span class="info-box-text"><strong>IP Allocation</strong></span>` | ||||||
|                                 + allocatedIpsHtml |                                 + allocatedIpsHtml | ||||||
|                                 + `<span class="info-box-text"><strong>Allowed IPs</strong></span>` |                                 + `<span class="info-box-text"><strong>Allowed IPs</strong></span>` | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										2
									
								
								go.mod
								
								
								
								
							|  | @ -47,6 +47,6 @@ require ( | ||||||
| 	golang.org/x/sys v0.15.0 // indirect | 	golang.org/x/sys v0.15.0 // indirect | ||||||
| 	golang.org/x/text v0.14.0 // indirect | 	golang.org/x/text v0.14.0 // indirect | ||||||
| 	golang.org/x/time v0.5.0 // indirect | 	golang.org/x/time v0.5.0 // indirect | ||||||
| 	golang.zx2c4.com/wireguard v0.0.0-20210427022245-097af6e1351b // indirect | 	golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect | ||||||
| 	gopkg.in/go-playground/assert.v1 v1.2.1 // indirect | 	gopkg.in/go-playground/assert.v1 v1.2.1 // indirect | ||||||
| ) | ) | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										5
									
								
								go.sum
								
								
								
								
							|  | @ -174,10 +174,13 @@ golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= | ||||||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||||||
| golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
| golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= | ||||||
| golang.zx2c4.com/wireguard v0.0.0-20210427022245-097af6e1351b h1:XDLXhn7ryprJVo+Lpkiib6CIuXE2031GDwtfEm7vLjI= |  | ||||||
| golang.zx2c4.com/wireguard v0.0.0-20210427022245-097af6e1351b/go.mod h1:a057zjmoc00UN7gVkaJt2sXVK523kMJcogDTEvPIasg= | golang.zx2c4.com/wireguard v0.0.0-20210427022245-097af6e1351b/go.mod h1:a057zjmoc00UN7gVkaJt2sXVK523kMJcogDTEvPIasg= | ||||||
|  | golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4= | ||||||
|  | golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA= | ||||||
| golang.zx2c4.com/wireguard/wgctrl v0.0.0-20210803171230-4253848d036c h1:ADNrRDI5NR23/TUCnEmlLZLt4u9DnZ2nwRkPrAcFvto= | golang.zx2c4.com/wireguard/wgctrl v0.0.0-20210803171230-4253848d036c h1:ADNrRDI5NR23/TUCnEmlLZLt4u9DnZ2nwRkPrAcFvto= | ||||||
| golang.zx2c4.com/wireguard/wgctrl v0.0.0-20210803171230-4253848d036c/go.mod h1:+1XihzyZUBJcSc5WO9SwNA7v26puQwOEDwanaxfNXPQ= | golang.zx2c4.com/wireguard/wgctrl v0.0.0-20210803171230-4253848d036c/go.mod h1:+1XihzyZUBJcSc5WO9SwNA7v26puQwOEDwanaxfNXPQ= | ||||||
|  | golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6 h1:CawjfCvYQH2OU3/TnxLx97WDSUDRABfT18pCOYwc2GE= | ||||||
|  | golang.zx2c4.com/wireguard/wgctrl v0.0.0-20230429144221-925a1e7659e6/go.mod h1:3rxYc4HtVcSG9gVaTs2GEBdehh+sYPOwKtyUWEOTb80= | ||||||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||||||
| gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= | gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= | ||||||
| gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= | gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= | ||||||
|  |  | ||||||
|  | @ -720,7 +720,6 @@ func UpdateClient(db store.IStore) echo.HandlerFunc { | ||||||
| 		client.PublicKey = _client.PublicKey | 		client.PublicKey = _client.PublicKey | ||||||
| 		client.PresharedKey = _client.PresharedKey | 		client.PresharedKey = _client.PresharedKey | ||||||
| 		client.UpdatedAt = time.Now().UTC() | 		client.UpdatedAt = time.Now().UTC() | ||||||
| 		client.AdditionalNotes = strings.ReplaceAll(strings.Trim(_client.AdditionalNotes, "\r\n"), "\r\n", "\n") |  | ||||||
| 
 | 
 | ||||||
| 		// write to the database
 | 		// write to the database
 | ||||||
| 		if err := db.SaveClient(client); err != nil { | 		if err := db.SaveClient(client); err != nil { | ||||||
|  | @ -979,13 +978,10 @@ func Status(db store.IStore) echo.HandlerFunc { | ||||||
| 						LastHandshakeTime: devices[i].Peers[j].LastHandshakeTime, | 						LastHandshakeTime: devices[i].Peers[j].LastHandshakeTime, | ||||||
| 						LastHandshakeRel:  time.Since(devices[i].Peers[j].LastHandshakeTime), | 						LastHandshakeRel:  time.Since(devices[i].Peers[j].LastHandshakeTime), | ||||||
| 						AllocatedIP:       allocatedIPs, | 						AllocatedIP:       allocatedIPs, | ||||||
|  | 						Endpoint:          devices[i].Peers[j].Endpoint.String(), | ||||||
| 					} | 					} | ||||||
| 					pVm.Connected = pVm.LastHandshakeRel.Minutes() < 3. | 					pVm.Connected = pVm.LastHandshakeRel.Minutes() < 3. | ||||||
| 
 | 
 | ||||||
| 					if isAdmin(c) { |  | ||||||
| 						pVm.Endpoint = devices[i].Peers[j].Endpoint.String() |  | ||||||
| 					} |  | ||||||
| 
 |  | ||||||
| 					if _client, ok := m[pVm.PublicKey]; ok { | 					if _client, ok := m[pVm.PublicKey]; ok { | ||||||
| 						pVm.Name = _client.Name | 						pVm.Name = _client.Name | ||||||
| 						pVm.Email = _client.Email | 						pVm.Email = _client.Email | ||||||
|  |  | ||||||
|  | @ -18,7 +18,6 @@ type Client struct { | ||||||
| 	AllowedIPs      []string  `json:"allowed_ips"` | 	AllowedIPs      []string  `json:"allowed_ips"` | ||||||
| 	ExtraAllowedIPs []string  `json:"extra_allowed_ips"` | 	ExtraAllowedIPs []string  `json:"extra_allowed_ips"` | ||||||
| 	Endpoint        string    `json:"endpoint"` | 	Endpoint        string    `json:"endpoint"` | ||||||
| 	AdditionalNotes string    `json:"additional_notes"` |  | ||||||
| 	UseServerDNS    bool      `json:"use_server_dns"` | 	UseServerDNS    bool      `json:"use_server_dns"` | ||||||
| 	Enabled         bool      `json:"enabled"` | 	Enabled         bool      `json:"enabled"` | ||||||
| 	CreatedAt       time.Time `json:"created_at"` | 	CreatedAt       time.Time `json:"created_at"` | ||||||
|  |  | ||||||
|  | @ -154,7 +154,6 @@ func (o *JsonDB) Init() error { | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		o.conn.Write("users", user.Username, user) | 		o.conn.Write("users", user.Username, user) | ||||||
| 		results, _ = o.conn.ReadAll("users") |  | ||||||
| 		err = util.ManagePerms(path.Join(path.Join(o.dbPath, "users"), user.Username+".json")) | 		err = util.ManagePerms(path.Join(path.Join(o.dbPath, "users"), user.Username+".json")) | ||||||
| 		if err != nil { | 		if err != nil { | ||||||
| 			return err | 			return err | ||||||
|  |  | ||||||
|  | @ -288,10 +288,6 @@ | ||||||
|                                     <label for="client_telegram_userid" class="control-label">Telegram userid</label> |                                     <label for="client_telegram_userid" class="control-label">Telegram userid</label> | ||||||
|                                     <input type="text" class="form-control" id="client_telegram_userid" name="client_telegram_userid"> |                                     <input type="text" class="form-control" id="client_telegram_userid" name="client_telegram_userid"> | ||||||
|                                 </div> |                                 </div> | ||||||
|                                 <div class="form-group"> |  | ||||||
|                                     <label for="additional_notes" class="control-label">Notes</label> |  | ||||||
|                                     <textarea class="form-control" style="min-height: 6rem;" id="additional_notes" name="additional_notes" placeholder="Additional notes about this client"></textarea> |  | ||||||
|                                 </div> |  | ||||||
|                             </details> |                             </details> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="modal-footer justify-content-between"> |                         <div class="modal-footer justify-content-between"> | ||||||
|  | @ -400,6 +396,8 @@ | ||||||
|             toastr.options.positionClass = 'toast-top-right-fix'; |             toastr.options.positionClass = 'toast-top-right-fix'; | ||||||
| 
 | 
 | ||||||
|             updateApplyConfigVisibility() |             updateApplyConfigVisibility() | ||||||
|  |             // from clients.html | ||||||
|  |             updateSearchList() | ||||||
| 
 | 
 | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|  | @ -438,6 +436,7 @@ | ||||||
|                 }); |                 }); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |          | ||||||
|         // populateClient function for render new client info |         // populateClient function for render new client info | ||||||
|         // on the client page. |         // on the client page. | ||||||
|         function populateClient(client_id) { |         function populateClient(client_id) { | ||||||
|  | @ -485,11 +484,9 @@ | ||||||
|             const public_key = $("#client_public_key").val(); |             const public_key = $("#client_public_key").val(); | ||||||
|             const preshared_key = $("#client_preshared_key").val(); |             const preshared_key = $("#client_preshared_key").val(); | ||||||
| 
 | 
 | ||||||
|             const additional_notes = $("#additional_notes").val(); |  | ||||||
| 
 |  | ||||||
|             const data = {"name": name, "email": email, "telegram_userid": telegram_userid, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips, |             const data = {"name": name, "email": email, "telegram_userid": telegram_userid, "allocated_ips": allocated_ips, "allowed_ips": allowed_ips, | ||||||
|                 "extra_allowed_ips": extra_allowed_ips, "endpoint": endpoint, "use_server_dns": use_server_dns, "enabled": enabled, |                 "extra_allowed_ips": extra_allowed_ips, "endpoint": endpoint, "use_server_dns": use_server_dns, "enabled": enabled, | ||||||
|                 "public_key": public_key, "preshared_key": preshared_key, "additional_notes": additional_notes}; |                 "public_key": public_key, "preshared_key": preshared_key}; | ||||||
| 
 | 
 | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|                 cache: false, |                 cache: false, | ||||||
|  | @ -630,7 +627,6 @@ | ||||||
|                 $("#client_extra_allowed_ips").importTags(''); |                 $("#client_extra_allowed_ips").importTags(''); | ||||||
|                 $("#client_endpoint").val(''); |                 $("#client_endpoint").val(''); | ||||||
|                 $("#client_telegram_userid").val(''); |                 $("#client_telegram_userid").val(''); | ||||||
|                 $("#additional_notes").val(''); |  | ||||||
|                 updateSubnetRangesList("#subnet_ranges"); |                 updateSubnetRangesList("#subnet_ranges"); | ||||||
|                 updateIPAllocationSuggestion(true); |                 updateIPAllocationSuggestion(true); | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
|  | @ -195,10 +195,6 @@ Wireguard Clients | ||||||
|                             <label for="_client_telegram_userid" class="control-label">Telegram userid</label> |                             <label for="_client_telegram_userid" class="control-label">Telegram userid</label> | ||||||
|                             <input type="text" class="form-control" id="_client_telegram_userid" name="_client_telegram_userid"> |                             <input type="text" class="form-control" id="_client_telegram_userid" name="_client_telegram_userid"> | ||||||
|                         </div> |                         </div> | ||||||
|                         <div class="form-group"> |  | ||||||
|                             <label for="_additional_notes" class="control-label">Notes</label> |  | ||||||
|                             <textarea class="form-control" style="min-height: 6rem;" id="_additional_notes" name="_additional_notes" placeholder="Additional notes about this client"></textarea> |  | ||||||
|                         </div> |  | ||||||
|                     </details> |                     </details> | ||||||
|                 </div> |                 </div> | ||||||
|                 <div class="modal-footer justify-content-between"> |                 <div class="modal-footer justify-content-between"> | ||||||
|  | @ -400,7 +396,6 @@ Wireguard Clients | ||||||
|     <script> |     <script> | ||||||
|         // load client list |         // load client list | ||||||
|         $(document).ready(function () { |         $(document).ready(function () { | ||||||
|             updateSearchList(); |  | ||||||
|             populateClientList(); |             populateClientList(); | ||||||
|         }) |         }) | ||||||
| 
 | 
 | ||||||
|  | @ -416,7 +411,7 @@ Wireguard Clients | ||||||
|         // hide all clients and display only the ones that meet the search criteria (name, email, IP) |         // hide all clients and display only the ones that meet the search criteria (name, email, IP) | ||||||
|         $('#search-input').keyup(function () { |         $('#search-input').keyup(function () { | ||||||
|             $("#status-selector").val("All"); |             $("#status-selector").val("All"); | ||||||
|             let query = $(this).val().trim(); |             var query = $(this).val(); | ||||||
|             $('.col-lg-4').hide(); |             $('.col-lg-4').hide(); | ||||||
|             $(".info-box-text").each(function() { |             $(".info-box-text").each(function() { | ||||||
|                 if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0) |                 if($(this).children('i.fa-user').length > 0 || $(this).children('i.fa-envelope').length > 0) | ||||||
|  | @ -426,13 +421,7 @@ Wireguard Clients | ||||||
|                 }) |                 }) | ||||||
|             $(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show(); |             $(".badge-secondary").filter(':contains("' + query + '")').parent().parent().parent().show(); | ||||||
|             $(".fa-tguserid").each(function () { |             $(".fa-tguserid").each(function () { | ||||||
|                 if ($(this).parent().text().trim().indexOf(query) != -1) { |                 if ($(this).parent().text().trim().indexOf(query.trim()) != -1) { | ||||||
|                     $(this).closest('.col-lg-4').show(); |  | ||||||
|                 } |  | ||||||
|             }) |  | ||||||
|             let upperQuery = query.toUpperCase() |  | ||||||
|             $(".fa-additional_notes").each(function () { |  | ||||||
|                 if ($(this).parent().text().trim().indexOf(upperQuery) != -1) { |  | ||||||
|                     $(this).closest('.col-lg-4').show(); |                     $(this).closest('.col-lg-4').show(); | ||||||
|                 } |                 } | ||||||
|             }) |             }) | ||||||
|  | @ -660,8 +649,6 @@ Wireguard Clients | ||||||
|                         modal.find("#_client_public_key").val(client.public_key); |                         modal.find("#_client_public_key").val(client.public_key); | ||||||
|                         modal.find("#_client_preshared_key").val(client.preshared_key); |                         modal.find("#_client_preshared_key").val(client.preshared_key); | ||||||
| 
 | 
 | ||||||
|                         modal.find("#_additional_notes").val(client.additional_notes); |  | ||||||
| 
 |  | ||||||
|                         // handle subnet range select |                         // handle subnet range select | ||||||
|                         $('#_subnet_ranges').on('select2:select', function (e) { |                         $('#_subnet_ranges').on('select2:select', function (e) { | ||||||
|                             updateIPAllocationSuggestionExisting(); |                             updateIPAllocationSuggestionExisting(); | ||||||
|  | @ -782,11 +769,9 @@ Wireguard Clients | ||||||
|                 enabled = true; |                 enabled = true; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             const additional_notes = $("#_additional_notes").val(); |  | ||||||
| 
 |  | ||||||
|             const data = {"id": client_id, "name": name, "email": email, "telegram_userid": telegram_userid, "allocated_ips": allocated_ips, |             const data = {"id": client_id, "name": name, "email": email, "telegram_userid": telegram_userid, "allocated_ips": allocated_ips, | ||||||
|                 "allowed_ips": allowed_ips, "extra_allowed_ips": extra_allowed_ips, "endpoint": endpoint, |                 "allowed_ips": allowed_ips, "extra_allowed_ips": extra_allowed_ips, "endpoint": endpoint, | ||||||
|                 "use_server_dns": use_server_dns, "enabled": enabled, "public_key": public_key, "preshared_key": preshared_key, "additional_notes": additional_notes}; |                 "use_server_dns": use_server_dns, "enabled": enabled, "public_key": public_key, "preshared_key": preshared_key}; | ||||||
| 
 | 
 | ||||||
|             $.ajax({ |             $.ajax({ | ||||||
|                 cache: false, |                 cache: false, | ||||||
|  |  | ||||||
|  | @ -20,10 +20,6 @@ Table = {{ .globalSettings.Table }} | ||||||
| # Telegram:     {{ .Client.TgUserid }} | # Telegram:     {{ .Client.TgUserid }} | ||||||
| # Created at:   {{ .Client.CreatedAt }} | # Created at:   {{ .Client.CreatedAt }} | ||||||
| # Update at:    {{ .Client.UpdatedAt }} | # Update at:    {{ .Client.UpdatedAt }} | ||||||
| {{- if .Client.AdditionalNotes}} |  | ||||||
| 
 |  | ||||||
| # Notes: |  | ||||||
| # {{ .Client.AdditionalNotes }}{{end}} |  | ||||||
| [Peer] | [Peer] | ||||||
| PublicKey = {{ .Client.PublicKey }} | PublicKey = {{ .Client.PublicKey }} | ||||||
| {{if .Client.PresharedKey}}PresharedKey = {{ .Client.PresharedKey }}{{end}} | {{if .Client.PresharedKey}}PresharedKey = {{ .Client.PresharedKey }}{{end}} | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								util/util.go
								
								
								
								
							
							
						
						
									
										11
									
								
								util/util.go
								
								
								
								
							|  | @ -560,15 +560,6 @@ func WriteWireGuardServerConfig(tmplDir fs.FS, serverConfig model.Server, client | ||||||
| 		tmplWireguardConf = fileContent | 		tmplWireguardConf = fileContent | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// escape multiline notes
 |  | ||||||
| 	escapedClientDataList := []model.ClientData{} |  | ||||||
| 	for _, cd := range clientDataList { |  | ||||||
| 		if cd.Client.AdditionalNotes != "" { |  | ||||||
| 			cd.Client.AdditionalNotes = strings.ReplaceAll(cd.Client.AdditionalNotes, "\n", "\n# ") |  | ||||||
| 		} |  | ||||||
| 		escapedClientDataList = append(escapedClientDataList, cd) |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// parse the template
 | 	// parse the template
 | ||||||
| 	t, err := template.New("wg_config").Parse(tmplWireguardConf) | 	t, err := template.New("wg_config").Parse(tmplWireguardConf) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  | @ -583,7 +574,7 @@ func WriteWireGuardServerConfig(tmplDir fs.FS, serverConfig model.Server, client | ||||||
| 
 | 
 | ||||||
| 	config := map[string]interface{}{ | 	config := map[string]interface{}{ | ||||||
| 		"serverConfig":   serverConfig, | 		"serverConfig":   serverConfig, | ||||||
| 		"clientDataList": escapedClientDataList, | 		"clientDataList": clientDataList, | ||||||
| 		"globalSettings": globalSettings, | 		"globalSettings": globalSettings, | ||||||
| 		"usersList":      usersList, | 		"usersList":      usersList, | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue