Nach Aufräumen von Paket session kann dieses nur zu server umbenannt werden

This commit is contained in:
Jason Streifling 2024-01-06 08:27:54 +01:00
parent c1fa004384
commit c607b837b9
7 changed files with 12 additions and 12 deletions

12
main.go
View File

@ -17,7 +17,7 @@ import (
"net/http" "net/http"
"streifling.com/jason/sicherheitsunterweisung/packages/data" "streifling.com/jason/sicherheitsunterweisung/packages/data"
"streifling.com/jason/sicherheitsunterweisung/packages/session" "streifling.com/jason/sicherheitsunterweisung/packages/server"
) )
func main() { func main() {
@ -26,16 +26,16 @@ func main() {
log.Fatalln(err) log.Fatalln(err)
} }
mux := session.NewMux() mux := server.NewMux()
sessions := make([]*session.Session, 0) sessions := make([]*server.Session, 0)
sessionChan := make(chan *session.Session) sessionChan := make(chan *server.Session)
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/")))) mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("templates/index.html", "templates/login.html")).Execute(w, nil) template.Must(template.ParseFiles("templates/index.html", "templates/login.html")).Execute(w, nil)
}) })
mux.HandleFunc("/internal-login/", session.HandleInternalLogin(db, &sessions, sessionChan)) mux.HandleFunc("/internal-login/", server.HandleInternalLogin(db, &sessions, sessionChan))
mux.HandleFunc("/external-login/", session.HandleExternalLogin(&sessions)) mux.HandleFunc("/external-login/", server.HandleExternalLogin(&sessions))
go mux.HandleSessions(db, sessionChan, &sessions) go mux.HandleSessions(db, sessionChan, &sessions)

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"crypto/rand" "crypto/rand"

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"github.com/google/uuid" "github.com/google/uuid"

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"fmt" "fmt"

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"fmt" "fmt"

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"fmt" "fmt"

View File

@ -9,7 +9,7 @@
* You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package session package server
import ( import (
"html/template" "html/template"