Skip to content

Commit 3eb7ca4

Browse files
author
gilgameshskytrooper
committed
update to use TLS encryption
1 parent baef4b5 commit 3eb7ca4

File tree

7 files changed

+16
-10
lines changed

7 files changed

+16
-10
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ public/json/\._time\.txt
1818
main
1919
prometheus
2020
Macbook
21+
server.crt
22+
server.key

prometheus.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ func main() {
210210

211211
if EnableLed {
212212
if foundNixie {
213-
fmt.Println(nixie.CurrentTimeAsString() + Red + Green + Blue)
214213
b := []byte(nixie.CurrentTimeAsString() + Red + Green + Blue)
215214
_, err := port.Write(b)
216215
if err != nil {
@@ -1485,5 +1484,10 @@ func main() {
14851484
//Pass on the AJAX post /upload handler to the uploadHandler() function
14861485
http.HandleFunc("/upload", uploadHandler)
14871486
log.Println("Listening...")
1488-
log.Fatal(http.ListenAndServe(":3000", nil))
1487+
tlserr := http.ListenAndServeTLS(":3000", "server.crt", "server.key", nil)
1488+
if tlserr != nil {
1489+
fmt.Println("If you want the program to utilize TLS (i.e. host an encrypted HTTPS front end, please do the following in command line in the same directory as prometheus.go to first create a private self-signed rsa key, then a public key (x509) key based on the private key:\n\topenssl genrsa -out server.key 2048\n\topenssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650\nThen make sure you finish filling in the details asked in command line.\n\nFor now, unencrypted http will be used.")
1490+
log.Fatal(http.ListenAndServe(":3000", nil))
1491+
}
1492+
14891493
}

public/json/alarms.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[{"name":"alarm1","time":"01:31","sound":"off","vibration":"off"},
2-
{"name":"alarm2","time":"06:00","sound":"off","vibration":"off"},
3-
{"name":"alarm3","time":"19:47","sound":"off","vibration":"off"},
4-
{"name":"alarm4","time":"19:48","sound":"off","vibration":"off"}]
1+
[{"name":"alarm1","time":"16:59","sound":"off","vibration":"off"},
2+
{"name":"alarm2","time":"08:00","sound":"off","vibration":"off"},
3+
{"name":"alarm3","time":"00:12","sound":"off","vibration":"off"},
4+
{"name":"alarm4","time":"09:00","sound":"off","vibration":"off"}]

public/json/colors

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#ffffff
1+
#dbff00

public/json/enableemail

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
true
1+
false

public/json/enableled

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
false
1+
true

public/json/ip

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
130.71.230.216
1+
130.71.230.235

0 commit comments

Comments
 (0)