From 61fa4fe192524a6a4dfbbec5f191d6fcd33fe39e Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Wed, 13 Sep 2023 11:26:23 +0300 Subject: [PATCH] feat: assetsFS for serving images and media --- assets/images/downloads.png | Bin 0 -> 8792 bytes bindata.go | 4 ++++ main.go | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 assets/images/downloads.png diff --git a/assets/images/downloads.png b/assets/images/downloads.png new file mode 100644 index 0000000000000000000000000000000000000000..fc86131dc3ed60882417766d8893c4385cc5f8b9 GIT binary patch literal 8792 zcmeHt`9GB38}~gkjA$5=F!oGI_OfL!>!gqt$)02jlO?;E$;Z-S8(Sg76jHQ_Cd(An zCw(Lnk#$O9tYe8O%sdCr>-qWl1HM1Z>we$oT-W=&&vl=3opYait~uCQ3kqNaAP5q~ z*;qJ25F9`_v<(R^OHti_!G#}h;~WM-LaiG=*!z&m3!qRk-12Pr$&icTkzS!bP-JAJ zx_@wBn70?+M?ECew{X@713~f-&f@T?sG^yn=!RgQ=#lxk;bWot`mn2J_-)yum{S(= zWmd=9zUlXR-t6eKq&tWe6&(53b5qt1Mk{TX=Soo>ZvzxHPw&ma;v@}r zu-zCJf64s~>_HPpVCfQ<{INJXRS3!9dz?1Q$8GNyXhi7yW$www;v%0xYesm*bu=gU zw=pBv*4TzjAxT>pyfKo~dvH5gevETJQnRbb{#i1m-8d^jeId}r zg;=p%-$%ywOdX?JMs>9&Jn9!PdQ^WeA6s=KL(%xLQp~?0r|JI z!&F$5r<}?WGUePf!u80SLrI-F@A8aSybbwO(#YO~Tb(W;TX&73M42}9LUf=KtMXIt zbu5n8g~!BvO*q6weDn)^53ZnpF;#BZt>>A6yB--UHWk)}o~@aDCQ~bgBVS*_{z$pf z8xd0xXyX`oqf5|+T3C`6T*{}B5o|_xi@uzmlaC0 zZd;H;JZ&W$^vo57xt zj%vBK01{G`Tea5HBqGYBGIJyVc{eNip_k;n6Rg&KIL9OuM8=-}7n1)U{9hdYHwgYW z8UFt=!E$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mh!NZ3#Aqe(uc z=|-89U}6|n*+jj+vlj=jd zLXCytw+OzM4F4Q}j?Kw4_E3EJi>%@!9c&zHX62j6D+pRNW#x?@0!jQMZ9&Decqx%W z)1m|E*wen^cz*wh7CH2M=YP=WVFlVr++hZa@fc87ogG1%P#<28Qt{Y{Fst8X6S>1k zOkXC-2w(CUbiXlp_sp0FPuxG@a|u25vk@Pl&$YaaC`Vy^UVVQicR7aywmU+MPGIM#w1n$I3NoI80j*t%uS(d|B zT?i)o_>^^)x~|bS{U~PVDx8n(9u&u*w|wK7){Ckj2hi+@wGh;#k literal 0 HcmV?d00001 diff --git a/bindata.go b/bindata.go index 3f601d4..88ed89d 100644 --- a/bindata.go +++ b/bindata.go @@ -7,3 +7,7 @@ var TemplatesFS embed.FS //go:embed static/css/* var PublicFS embed.FS + +//go:embed assets/* +var AssetsFS embed.FS + diff --git a/main.go b/main.go index 804e428..0835842 100644 --- a/main.go +++ b/main.go @@ -113,12 +113,15 @@ func init() { log.Println("[ init ] Starting...") templates = template.Must(template.ParseFS(TemplatesFS , "templates/*.html")) + log.Println("[ init ] Templates Loaded") } + func main() { handler := http.NewServeMux() handler.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(PublicFS)))) + handler.Handle("/assets/", http.FileServer(http.FS(AssetsFS))) handler.HandleFunc( "/download",