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}" /> <img src="${obj.QRCode}" />
<div class="info-box-content"> <div class="info-box-content">
<div class="btn-group"> <div class="btn-group">
<button onclick="location.href='/download?clientid=${obj.Client.id}'" type="button" <a href="/download?clientid=${obj.Client.id}"
class="btn btn-outline-success btn-sm">Download</button> class="btn btn-outline-success btn-sm">Download</a>
<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>
<button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal" <button type="button" class="btn btn-outline-primary btn-sm" data-toggle="modal"
data-target="#modal_edit_client" data-clientid="${obj.Client.id}" data-target="#modal_edit_client" data-clientid="${obj.Client.id}"
data-clientname="${obj.Client.name}">Edit</button> data-clientname="${obj.Client.name}">Edit</button>

View file

@ -346,7 +346,7 @@ func DownloadClient(db store.IStore) echo.HandlerFunc {
reader := strings.NewReader(config) reader := strings.NewReader(config)
// set response header for downloading // 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) return c.Stream(http.StatusOK, "text/plain", reader)
} }
} }