mirror of https://github.com/gophish/gophish
Changed API_Campaigns_Id to be one method
Added secure cookie random []byte generation Changed sidebar css Fixed footer alignment (may consider making separate template)pull/24/head
parent
a3518032be
commit
ceaf400206
9
api.go
9
api.go
|
@ -14,13 +14,8 @@ func API_Campaigns(w http.ResponseWriter, r *http.Request) {
|
|||
fmt.Fprintf(w, "Hello api")
|
||||
}
|
||||
|
||||
func API_Campaigns_Id_Post(w http.ResponseWriter, r *http.Request) {
|
||||
func API_Campaigns_Id(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
vars := mux.Vars(r)
|
||||
fmt.Fprintf(w, "{\"id\" : "+vars["id"]+"}")
|
||||
}
|
||||
func API_Campaigns_Id_Get(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
vars := mux.Vars(r)
|
||||
fmt.Fprintf(w, "{\"id\" : "+vars["id"]+"}")
|
||||
fmt.Fprintf(w, "{\"method\" : \""+r.Method+"\", \"id\" : "+vars["id"]+"}")
|
||||
}
|
||||
|
|
7
route.go
7
route.go
|
@ -28,10 +28,14 @@ THE SOFTWARE.
|
|||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/securecookie"
|
||||
"github.com/gorilla/sessions"
|
||||
"html/template"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
var store = sessions.NewCookieStore([]byte(securecookie.GenerateRandomKey(64)))
|
||||
|
||||
func createRouter() http.Handler {
|
||||
router := mux.NewRouter()
|
||||
// Base Front-end routes
|
||||
|
@ -44,8 +48,7 @@ func createRouter() http.Handler {
|
|||
api := router.PathPrefix("/api").Subrouter()
|
||||
api.HandleFunc("/", API)
|
||||
api.HandleFunc("/campaigns", API_Campaigns)
|
||||
api.HandleFunc("/campaigns/{id}", API_Campaigns_Id_Post).Methods("POST")
|
||||
api.HandleFunc("/campaigns/{id}", API_Campaigns_Id_Get).Methods("GET")
|
||||
api.HandleFunc("/campaigns/{id}", API_Campaigns_Id)
|
||||
|
||||
//Setup static file serving
|
||||
router.PathPrefix("/").Handler(http.FileServer(http.Dir("./static/")))
|
||||
|
|
|
@ -64,4 +64,7 @@ footer > p {
|
|||
|
||||
.header {
|
||||
margin-top:10px;
|
||||
}
|
||||
.sidebar {
|
||||
padding-left:0px;
|
||||
}
|
|
@ -6,9 +6,24 @@
|
|||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="col-md-3 sidebar">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="active"><a href="#">Dashboard</a>
|
||||
</li>
|
||||
<li><a href="/users">Users & Groups</a>
|
||||
</li>
|
||||
<li><a href="/settings">Settings</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
Testing
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<hr>
|
||||
<footer>
|
||||
<footer>
|
||||
<p>© Jordan (jordan-wright) 2013</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue