images to enrich switch data
This commit is contained in:
parent
a7a7bd08bd
commit
2ac8f81c9f
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/hex"
|
||||
"flag"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
@ -80,8 +81,6 @@ var publicRoutes map[string]bool
|
|||
|
||||
func init() {
|
||||
publicRoutes = map[string]bool{
|
||||
"/webhooks/": true,
|
||||
"/static/": true,
|
||||
"/static/main.js": true,
|
||||
"/static/gruvbox.css": true,
|
||||
"/static/favicon.ico": true,
|
||||
|
@ -89,7 +88,6 @@ func init() {
|
|||
"/debug/requests": true,
|
||||
"/debug/events": true,
|
||||
"/sign-in": true,
|
||||
"/switch": true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,19 +103,27 @@ func (pm PasetoMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
var newFooter string
|
||||
var err error
|
||||
|
||||
if r.URL.EscapedPath() == "/.within/botinfo" || r.URL.EscapedPath() == "/" {
|
||||
if r.URL.Path == "/.within/botinfo" || r.URL.Path == "/" {
|
||||
goto ok
|
||||
}
|
||||
|
||||
if strings.HasPrefix(r.URL.Path, "/webhooks/") {
|
||||
goto ok
|
||||
}
|
||||
|
||||
if strings.HasPrefix(r.URL.Path, "/static/img") {
|
||||
goto ok
|
||||
}
|
||||
|
||||
for k := range publicRoutes {
|
||||
if r.URL.EscapedPath() == k {
|
||||
if r.URL.Path == k {
|
||||
goto ok
|
||||
}
|
||||
}
|
||||
|
||||
err = pm.v2.Verify(tok, pm.pubKey, &newJsonToken, &newFooter)
|
||||
if err != nil {
|
||||
http.Error(w, "Not allowed", http.StatusForbidden)
|
||||
http.Redirect(w, r, "/sign-in", http.StatusTemporaryRedirect)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import Element.Font as Font
|
|||
import Element.Input as Input
|
||||
import Generated.Params as Params
|
||||
import Global
|
||||
import Html
|
||||
import Html.Attributes
|
||||
import Http
|
||||
import Iso8601
|
||||
import Json.Decode
|
||||
|
@ -170,7 +172,17 @@ view model =
|
|||
in
|
||||
column
|
||||
[]
|
||||
[ el [ Font.size 30 ] (text data.who)
|
||||
[ row []
|
||||
[ html
|
||||
(Html.img
|
||||
[ Html.Attributes.src ("/static/img/" ++ String.toLower data.who ++ ".png")
|
||||
, Html.Attributes.width 64
|
||||
, Html.Attributes.height 64
|
||||
]
|
||||
[]
|
||||
)
|
||||
, el [ Font.size 30 ] (text data.who)
|
||||
]
|
||||
, text ("started at " ++ startTime)
|
||||
]
|
||||
|
||||
|
@ -188,7 +200,7 @@ view model =
|
|||
Input.button [] { onPress = Just NextPage, label = text "Next" }
|
||||
|
||||
tableButtons =
|
||||
row [] [ prevButton, nextButton ]
|
||||
row [] [ prevButton, text "-", nextButton ]
|
||||
|
||||
switchDataTable =
|
||||
case model.frontData of
|
||||
|
@ -215,7 +227,7 @@ view model =
|
|||
, mouseOver [ alpha 0.5 ]
|
||||
]
|
||||
{ label = text (String.slice 0 10 switch.id)
|
||||
, url = "/switch/" ++ switch.id
|
||||
, url = "/switch/id/" ++ switch.id
|
||||
}
|
||||
}
|
||||
, { header = text "Who"
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
Loading…
Reference in New Issue