Skip to content

Commit 59888a7

Browse files
author
zainhoda
committed
Merge remote-tracking branch 'origin/master'
Conflicts: main.go
2 parents 702d595 + 65de9c8 commit 59888a7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func AdminPage(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
179179
func AdminHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
180180
blogname := r.FormValue("blogname")
181181
website := r.FormValue("website")
182-
port := 1001
182+
port := rand.Intn(63000) + 2000
183183
blogcheck := []byte("")
184184

185185
username := getUser(w, r)
@@ -199,7 +199,8 @@ func AdminHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
199199
if err != nil && !DEBUG {
200200
fmt.Println(err)
201201
} else {
202-
fmt.Printf("%s", create)
202+
fmt.Println("80 -> " + strconv.Itoa(port))
203+
fmt.Fprintf(w, "%s", create)
203204
db.Update(func(tx *bolt.Tx) error {
204205
b := tx.Bucket([]byte("BlogMappingBucket"))
205206
err := b.Put([]byte(blogname), []byte(website))
@@ -366,6 +367,7 @@ func getUserFromCookie(value string) string {
366367
}
367368

368369
func main() {
370+
fmt.Println("Started server on port 1337")
369371
router := httprouter.New()
370372
router.GET("/", MainPage)
371373
router.POST("/login/", LoginHandler)
@@ -374,5 +376,5 @@ func main() {
374376
router.GET("/admin/", AdminPage)
375377
router.POST("/admin/", AdminHandler)
376378
router.GET("/logout/", LogoutHandler)
377-
log.Fatal(http.ListenAndServe(":1338", router))
379+
log.Fatal(http.ListenAndServe(":1337", router))
378380
}

0 commit comments

Comments
 (0)