mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 06:05:43 +00:00 
			
		
		
		
	 504a3b87b4
			
		
	
	504a3b87b4
	
	
	
		
			
			* wip: add middlewares * refactor: use context fom middleware in handlers * refactor: use controller approach in handlers * refactor: move oauth providers into services (non-working) * feat: create oauth broker service * refactor: use a boostrap service to bootstrap the app * refactor: split utils into smaller files * refactor: use more clear name for frontend assets * feat: allow customizability of resources dir * fix: fix typo in ui middleware * fix: validate resource file paths in ui middleware * refactor: move resource handling to a controller * feat: add some logging * fix: configure middlewares before groups * fix: use correct api path in login mutation * fix: coderabbit suggestions * fix: further coderabbit suggestions
		
			
				
	
	
		
			31 lines
		
	
	
		
			506 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			506 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package utils
 | |
| 
 | |
| import (
 | |
| 	"strings"
 | |
| )
 | |
| 
 | |
| func Capitalize(str string) string {
 | |
| 	if len(str) == 0 {
 | |
| 		return ""
 | |
| 	}
 | |
| 	return strings.ToUpper(string([]rune(str)[0])) + string([]rune(str)[1:])
 | |
| }
 | |
| 
 | |
| func CoalesceToString(value any) string {
 | |
| 	switch v := value.(type) {
 | |
| 	case []any:
 | |
| 		strs := make([]string, 0, len(v))
 | |
| 		for _, item := range v {
 | |
| 			if str, ok := item.(string); ok {
 | |
| 				strs = append(strs, str)
 | |
| 				continue
 | |
| 			}
 | |
| 		}
 | |
| 		return strings.Join(strs, ",")
 | |
| 	case string:
 | |
| 		return v
 | |
| 	default:
 | |
| 		return ""
 | |
| 	}
 | |
| }
 |