This commit is contained in:
2017-12-17 23:34:49 +01:00
parent 643e071202
commit 9a4eddcbd1
10 changed files with 37 additions and 29 deletions

View File

@@ -39,8 +39,8 @@ type FilePreview struct {
func (f FilePreview) Run(inf *pixelapi.FileInfo) string {
f.FileInfo = inf
f.FileURL = conf.ApiURL() + "/file/" + f.FileInfo.ID
f.DownloadURL = conf.ApiURL() + "/file/" + f.FileInfo.ID + "/download"
f.FileURL = conf.ApiUrlExternal() + "/file/" + f.FileInfo.ID
f.DownloadURL = conf.ApiUrlExternal() + "/file/" + f.FileInfo.ID + "/download"
if strings.HasPrefix(f.FileInfo.MimeType, "image") {
return f.image()
@@ -135,6 +135,6 @@ func (f FilePreview) def() string {
f.FileInfo.FileName,
f.FileInfo.MimeType,
f.DownloadURL,
f.FileInfo.Thumbnail,
conf.ApiUrlExternal()+f.FileInfo.ThumbnailHREF,
)
}

View File

@@ -3,16 +3,14 @@ package webcontroller
import (
"net/http"
"fornaxian.com/pixeldrain-web/conf"
"fornaxian.com/pixeldrain-web/log"
"fornaxian.com/pixeldrain-web/webcontroller/templates"
"github.com/julienschmidt/httprouter"
)
// ServeHistory is the controller for the upload history viewer
func ServeHistory(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
err := templates.Get().ExecuteTemplate(w, "history-cookies", map[string]interface{}{
"APIURL": conf.ApiURL(),
})
err := templates.Get().ExecuteTemplate(w, "history-cookies", nil)
if err != nil {
log.Error("Error executing template history: %s", err)
}

View File

@@ -35,6 +35,6 @@ func (d *OGData) FromList(l pixelapi.List) *OGData {
d.SiteName = "Pixeldrain"
d.Description = "View " + l.Title + " on Pixeldrain"
d.URL = "/l/" + l.ID
d.Image = "/api/list/" + l.ID + "/thumbnail"
d.Image = "/api/file/" + l.Files[0].ID + "/thumbnail"
return d
}

View File

@@ -10,6 +10,7 @@ import (
var funcMap = template.FuncMap{
"bgPatternCount": bgPatternCount,
"debugMode": debugMode,
"apiUrl": apiURL,
}
func bgPatternCount() uint8 {
@@ -19,3 +20,7 @@ func bgPatternCount() uint8 {
func debugMode() bool {
return conf.DebugMode()
}
func apiURL() string {
return conf.ApiUrlExternal()
}