Clean up codebase: remove unused demos and test files

- Remove dan-eden-portfolio and devigo-web demo sites
- Clean up demo testing infrastructure and scripts
- Remove frontend test files (html-preservation, style-detection tests)
- Update configuration and auth improvements
- Simplify demo structure to focus on core functionality

This cleanup reduces repository size and focuses on essential demos.
This commit is contained in:
2025-10-19 22:38:17 +02:00
parent dbdd4361b7
commit 74de64c66b
67 changed files with 56 additions and 6026 deletions

View File

@@ -25,20 +25,15 @@ type UserInfo struct {
Provider string `json:"iss,omitempty"`
}
// Type aliases for backward compatibility
type AuthConfig = config.AuthConfig
type OAuthConfig = config.OAuthConfig
type OIDCConfig = config.OIDCConfig
// AuthService handles authentication operations
type AuthService struct {
config *AuthConfig
config *config.AuthConfig
provider *oidc.Provider
oauth2 *oauth2.Config
}
// NewAuthService creates a new authentication service
func NewAuthService(config *AuthConfig) (*AuthService, error) {
func NewAuthService(config *config.AuthConfig) (*AuthService, error) {
service := &AuthService{config: config}
// Initialize OIDC provider if configured
@@ -176,7 +171,7 @@ func (a *AuthService) parseOIDCToken(tokenString string) (*UserInfo, error) {
// parseHMACToken parses and validates a JWT token using HMAC signing
func (a *AuthService) parseHMACToken(tokenString string) (*UserInfo, error) {
// Parse the token
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (interface{}, error) {
token, err := jwt.Parse(tokenString, func(token *jwt.Token) (any, error) {
// Validate signing method
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("unexpected signing method: %v", token.Header["alg"])
@@ -336,7 +331,7 @@ func (a *AuthService) RequireAuth(next http.Handler) http.Handler {
func (a *AuthService) HandleOAuthLogin(w http.ResponseWriter, r *http.Request) {
// Handle mock authentication in dev mode
if a.config.DevMode && a.config.Provider == "mock" {
response := map[string]interface{}{
response := map[string]any{
"message": "Mock OAuth login",
"redirect_url": "/auth/callback?code=mock_code&state=mock_state",
"dev_mode": true,

View File

@@ -4,6 +4,7 @@ import (
"strings"
"golang.org/x/net/html"
"slices"
)
// GetClasses extracts CSS classes from an HTML node
@@ -19,12 +20,7 @@ func GetClasses(node *html.Node) []string {
// ContainsClass checks if a class list contains a specific class
func ContainsClass(classes []string, target string) bool {
for _, class := range classes {
if class == target {
return true
}
}
return false
return slices.Contains(classes, target)
}
// getAttribute gets an attribute value from an HTML node
@@ -37,29 +33,6 @@ func getAttribute(node *html.Node, key string) string {
return ""
}
// hasOnlyTextContent checks if a node contains only text content (no nested HTML elements)
// DEPRECATED: Use hasEditableContent for more sophisticated detection
func hasOnlyTextContent(node *html.Node) bool {
if node.Type != html.ElementNode {
return false
}
for child := node.FirstChild; child != nil; child = child.NextSibling {
switch child.Type {
case html.ElementNode:
// Found a nested HTML element - not text-only
return false
case html.TextNode:
// Text nodes are fine, continue checking
continue
default:
// Comments, etc. - continue checking
continue
}
}
return true
}
// Inline formatting elements that are safe for editing
var inlineFormattingTags = map[string]bool{
"strong": true,