Imports #
"advent2024/pkg/solver"
"advent2024/web/config"
"advent2024/web/middleware"
"advent2024/web/weberrors"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"reflect"
"strings"
"text/template"
"advent2024/pkg/solver"
"advent2024/web/config"
"advent2024/web/middleware"
"advent2024/web/weberrors"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"os"
"reflect"
"strings"
"text/template"
extract field names from struct helper functions for templates
func FieldNames(v interface{}) []string
extracts value of field from struct helper functions for templates
func GetField(v interface{}, name string) interface{}
Handles healthcheck page
func HealthCheck(w http.ResponseWriter, r *http.Request)
Handles callback redirects from OAuth providers Pulls data about OAuth provider from config Renders page from template, with information pulled from configuration
func OAuthCallback(w http.ResponseWriter, r *http.Request)
Handles user code<>token exchange page TODO: implement more providers, curently only github gets OAuth code from client, exchanges code for token with provider and then generates JWT token for client
func OAuthHandler(w http.ResponseWriter, r *http.Request)
Handles documentation page Renders page from template, with information pulled from configuration
func ServerDocs(w http.ResponseWriter, r *http.Request)
Handles main page Renders page from template, with information pulled from configuration TODO: refactor to be usable for all simple pages
func ServerIndex(w http.ResponseWriter, r *http.Request)
Handles server status page. Output including hostname and list of registered solvers
func ServerStatus(w http.ResponseWriter, r *http.Request)
Handles display of registered solvers
func SolverListing(w http.ResponseWriter, r *http.Request)
Exchanges code with OAuth provider for a token
func exchangeCodeForToken(provider *config.OAuthProvider, code string) (middleware.OAuthResponse, error)