Multiple playgrounds support (#215)
* Add Playground struct and basic support for creating it and retrieving it * Add missing functions in pwd mock * Get playground from request domain and validate it exists. If valid set it on the newly created session. * Move playground specific configurations to the playground struct and use it everytime we need that conf. * Don't allow to specify a duration bigger that the allowed in the playground
This commit is contained in:
committed by
GitHub
parent
3dee0d3f0b
commit
3f5b3882dd
@@ -1,10 +1,10 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/play-with-docker/play-with-docker/config"
|
||||
)
|
||||
|
||||
func Home(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -21,7 +21,14 @@ func Home(w http.ResponseWriter, r *http.Request) {
|
||||
go core.SessionDeployStack(s)
|
||||
}
|
||||
|
||||
if config.NoWindows {
|
||||
playground := core.PlaygroundGet(s.PlaygroundId)
|
||||
if playground == nil {
|
||||
log.Printf("Playground with id %s for session %s was not found!", s.PlaygroundId, s.Id)
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
if !playground.AllowWindowsInstances {
|
||||
http.ServeFile(w, r, "./www/index-nw.html")
|
||||
} else {
|
||||
http.ServeFile(w, r, "./www/index.html")
|
||||
|
||||
Reference in New Issue
Block a user