Update helper.js (#66)

This commit is contained in:
Hoang Nguyen 2021-11-09 17:06:19 +07:00 committed by GitHub
parent 4093722926
commit 93e3e847f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -27,11 +27,8 @@ function renderClientList(data) {
<img src="${obj.QRCode}" />
<div class="info-box-content">
<div class="btn-group">
<button onclick="location.href='/download?clientid=${obj.Client.id}'" type="button"
class="btn btn-outline-success btn-sm">Download</button>
<button type="button" class="btn btn-outline-warning btn-sm" data-toggle="modal"
data-target="#modal_email_client" data-clientid="${obj.Client.id}"
data-clientname="${obj.Client.name}">Email</button>
<a href="/download?clientid=${obj.Client.id}"
class="btn btn-outline-success btn-sm">Download</a>
<button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal"
data-target="#modal_edit_client" data-clientid="${obj.Client.id}"
data-clientname="${obj.Client.name}">Edit</button>

View File

@ -346,7 +346,7 @@ func DownloadClient(db store.IStore) echo.HandlerFunc {
reader := strings.NewReader(config)
// set response header for downloading
c.Response().Header().Set(echo.HeaderContentDisposition, "attachment; filename=wg0.conf")
c.Response().Header().Set(echo.HeaderContentDisposition, fmt.Sprintf("attachment; filename=%s.conf", clientData.Client.Name))
return c.Stream(http.StatusOK, "text/plain", reader)
}
}