You've already forked collage-maker
							
							Add anyhttp support #17
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@@ -3,7 +3,7 @@ module go.balki.me/collage-maker
 | 
			
		||||
go 1.21
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/oliamb/cutter v0.2.2
 | 
			
		||||
	go.balki.me/anyhttp v0.2.0
 | 
			
		||||
	go.oneofone.dev/resize v1.0.1
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
github.com/oliamb/cutter v0.2.2 h1:Lfwkya0HHNU1YLnGv2hTkzHfasrSMkgv4Dn+5rmlk3k=
 | 
			
		||||
github.com/oliamb/cutter v0.2.2/go.mod h1:4BenG2/4GuRBDbVm/OPahDVqbrOemzpPiG5mi1iryBU=
 | 
			
		||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
 | 
			
		||||
go.balki.me/anyhttp v0.2.0 h1:W6aGcmjF5CMJvJYtbYCywxnYoErFhFc76vwaqUG5FAQ=
 | 
			
		||||
go.balki.me/anyhttp v0.2.0/go.mod h1:JhfekOIjgVODoVqUCficjpIgmB3wwlB7jhN0eN2EZ/s=
 | 
			
		||||
go.oneofone.dev/resize v1.0.1 h1:HjpVar/4pxMGrjO44ThaMX1Q5UOBw0KxzbxxRDZPQuA=
 | 
			
		||||
go.oneofone.dev/resize v1.0.1/go.mod h1:zGFmn7q4EUZVlnDmxqf+b0mWpxsTt0MH2yx6ng8tpq0=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								main.go
									
									
									
									
									
								
							@@ -16,6 +16,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"log/slog"
 | 
			
		||||
 | 
			
		||||
	"go.balki.me/anyhttp"
 | 
			
		||||
	"go.balki.me/collage-maker/collage"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -25,6 +26,7 @@ var (
 | 
			
		||||
	localAssets    bool
 | 
			
		||||
	collageNameGen *nameGen
 | 
			
		||||
	imagesDirFs    fs.FS
 | 
			
		||||
	listenAddr     string
 | 
			
		||||
 | 
			
		||||
	// go:embed web/*
 | 
			
		||||
	webFS embed.FS
 | 
			
		||||
@@ -34,6 +36,7 @@ func main() {
 | 
			
		||||
	flag.StringVar(&imagesDir, "images-dir", "images", "Sets the images dir")
 | 
			
		||||
	flag.StringVar(&collageDir, "collages-dir", "collages", "Sets the collages dir")
 | 
			
		||||
	flag.BoolVar(&localAssets, "local-assets", false, "Serve local assets for testing")
 | 
			
		||||
	flag.StringVar(&listenAddr, "addr", "127.0.0.1:8767", "Sets the collages dir")
 | 
			
		||||
 | 
			
		||||
	flag.Parse()
 | 
			
		||||
 | 
			
		||||
@@ -89,7 +92,7 @@ func main() {
 | 
			
		||||
		}
 | 
			
		||||
		w.Write([]byte(collageFile))
 | 
			
		||||
	})
 | 
			
		||||
	if err := http.ListenAndServe(":8767", nil); err != nil {
 | 
			
		||||
	if err := anyhttp.ListenAndServe(listenAddr, nil); err != nil {
 | 
			
		||||
		slog.Error("http ListenAndServe failed", "error", err)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user