Add CORS headers and update UI for enhanced user profile handling.

- Added CORS support in server responses for cross-origin requests (`Access-Control-Allow-Origin`, etc.).
- Improved header panel behavior with a sticky position and refined CSS styling.
- Integrated profile data fetching (Kind 0 metadata) for user personalization.
- Enhanced login functionality to support dynamic profile display based on fetched metadata.
- Updated `index.html` to include Tailwind CSS for better design consistency.
This commit is contained in:
2025-09-20 19:54:27 +01:00
parent 0b69ea6d80
commit 6b38291bf9
4 changed files with 347 additions and 54 deletions

View File

@@ -34,6 +34,17 @@ type Server struct {
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Set CORS headers for all responses
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
// Handle preflight OPTIONS requests
if r.Method == "OPTIONS" {
w.WriteHeader(http.StatusOK)
return
}
// log.T.C(
// func() string {
// return fmt.Sprintf("path %v header %v", r.URL, r.Header)