-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (36 loc) · 991 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"net/http"
"strconv"
)
var g *gin.Engine
func hasBit(n int, pos uint) bool {
val := n & (1 << pos)
return (val > 0)
}
func App(c *gin.Context) {
reference := c.Params.ByName("reference")
modeStr := c.Params.ByName("mode")
mode, _ := strconv.ParseUint(modeStr, 10, 8)
fmt.Println("New Session")
fmt.Printf("Privacy Policy Statement: \t %t \n", hasBit(int(mode), 1))
fmt.Printf("Disclosure Request: \t\t %t \n", hasBit(int(mode), 0))
c.HTML(http.StatusOK, "appRoot.html", gin.H{
"reference": reference,
"pps": hasBit(int(mode), 1), // Privacy Policy Statement
"dr": hasBit(int(mode), 0), // Disclosure Request
})
}
func Index(c *gin.Context) {
reference := c.Params.ByName("reference")
mode := c.Params.ByName("mode")
c.HTML(http.StatusOK, "index.html", gin.H{
"reference": reference,
"mode": mode,
})
}
func Pps(c *gin.Context) {
c.HTML(http.StatusOK, "pps.html", gin.H{})
}