2020-10-11 10:51:13 +08:00
|
|
|
package ui
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
2020-11-10 12:47:24 +08:00
|
|
|
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
2020-10-11 10:51:13 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 下载指定的文本内容
|
|
|
|
|
type DownloadAction struct {
|
|
|
|
|
actionutils.ParentAction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *DownloadAction) Init() {
|
|
|
|
|
this.Nav("", "", "")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *DownloadAction) RunGet(params struct {
|
|
|
|
|
File string
|
|
|
|
|
Text string
|
2020-11-10 12:47:24 +08:00
|
|
|
|
|
|
|
|
Auth *helpers.UserMustAuth
|
2020-10-11 10:51:13 +08:00
|
|
|
}) {
|
|
|
|
|
this.AddHeader("Content-Disposition", "attachment; filename=\""+params.File+"\";")
|
|
|
|
|
this.WriteString(params.Text)
|
|
|
|
|
}
|