Log error when ad click fails
This commit is contained in:
@@ -27,7 +27,7 @@ func (wc *WebController) serveAdClick(w http.ResponseWriter, r *http.Request, p
|
|||||||
|
|
||||||
// Log a view on the file
|
// Log a view on the file
|
||||||
if err := api.PostFileView(p.ByName("id"), wc.viewTokenOrBust()); err != nil {
|
if err := api.PostFileView(p.ByName("id"), wc.viewTokenOrBust()); err != nil {
|
||||||
log.Warn("Failed to log view")
|
log.Error("Failed to log view: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"fornaxian.com/pixeldrain-web/pixelapi"
|
"fornaxian.com/pixeldrain-web/pixelapi"
|
||||||
"github.com/Fornaxian/log"
|
"github.com/Fornaxian/log"
|
||||||
@@ -65,9 +64,6 @@ func (wc *WebController) adminGlobalsForm(td *TemplateData, r *http.Request) (f
|
|||||||
if f.ReadInput(r) {
|
if f.ReadInput(r) {
|
||||||
var successfulUpdates = 0
|
var successfulUpdates = 0
|
||||||
for k, v := range f.Fields {
|
for k, v := range f.Fields {
|
||||||
// Remove carriage returns from input
|
|
||||||
v.EnteredValue = strings.ReplaceAll(v.EnteredValue, "\r", "")
|
|
||||||
|
|
||||||
if v.EnteredValue == globalsMap[v.Name] {
|
if v.EnteredValue == globalsMap[v.Name] {
|
||||||
continue // Change changes, no need to update
|
continue // Change changes, no need to update
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Form is a form which can be rendered in HTML and submitted
|
// Form is a form which can be rendered in HTML and submitted
|
||||||
@@ -99,7 +100,8 @@ func (f *Form) ReadInput(r *http.Request) (success bool) {
|
|||||||
f.Submitted = true
|
f.Submitted = true
|
||||||
|
|
||||||
for i, field := range f.Fields {
|
for i, field := range f.Fields {
|
||||||
field.EnteredValue = r.FormValue(field.Name)
|
// Remove carriage returns
|
||||||
|
field.EnteredValue = strings.ReplaceAll(r.FormValue(field.Name), "\r", "")
|
||||||
|
|
||||||
if field.DefaultValue == "" {
|
if field.DefaultValue == "" {
|
||||||
field.DefaultValue = field.EnteredValue
|
field.DefaultValue = field.EnteredValue
|
||||||
|
Reference in New Issue
Block a user