From be13796a10b2baca28a82f75d63b82d3cf021825 Mon Sep 17 00:00:00 2001 From: ItsNotGoodName Date: Thu, 28 Jul 2022 00:10:06 -0700 Subject: [PATCH] feat: add icons and web manifest --- .github/workflows/goreleaser.yml | 4 +- Makefile | 2 +- left/http/server.go | 13 +++--- left/http/{asset => static}/package-lock.json | 4 +- left/http/{asset => static}/package.json | 2 +- .../static/public/android-chrome-192x192.png | Bin 0 -> 1199 bytes .../static/public/android-chrome-512x512.png | Bin 0 -> 2702 bytes left/http/static/public/apple-touch-icon.png | Bin 0 -> 961 bytes left/http/static/public/browserconfig.xml | 9 ++++ left/http/static/public/favicon-16x16.png | Bin 0 -> 623 bytes left/http/static/public/favicon-32x32.png | Bin 0 -> 690 bytes left/http/static/public/favicon.ico | Bin 0 -> 15086 bytes left/http/static/public/favicon.svg | 9 ++++ .../http/static/public/maskable_icon_x192.png | Bin 0 -> 2170 bytes .../http/static/public/maskable_icon_x512.png | Bin 0 -> 9419 bytes left/http/static/public/mstile-144x144.png | Bin 0 -> 972 bytes left/http/static/public/mstile-150x150.png | Bin 0 -> 1044 bytes left/http/static/public/mstile-310x150.png | Bin 0 -> 1247 bytes left/http/static/public/mstile-310x310.png | Bin 0 -> 2012 bytes left/http/static/public/mstile-70x70.png | Bin 0 -> 830 bytes left/http/static/public/safari-pinned-tab.svg | 16 +++++++ left/http/static/public/site.webmanifest | 42 ++++++++++++++++++ left/http/{asset => static}/src/index.js | 0 left/http/{asset => static}/src/index.scss | 0 .../http/{asset/asset.go => static/static.go} | 15 +++++-- .../asset_dev.go => static/static_dev.go} | 10 ++++- left/http/{asset => static}/webpack.config.js | 0 left/http/util.go | 21 +++++++++ left/http/view/template/layout/default.html | 11 ++++- server/server.go | 2 +- 30 files changed, 141 insertions(+), 19 deletions(-) rename left/http/{asset => static}/package-lock.json (99%) rename left/http/{asset => static}/package.json (99%) create mode 100644 left/http/static/public/android-chrome-192x192.png create mode 100644 left/http/static/public/android-chrome-512x512.png create mode 100644 left/http/static/public/apple-touch-icon.png create mode 100644 left/http/static/public/browserconfig.xml create mode 100644 left/http/static/public/favicon-16x16.png create mode 100644 left/http/static/public/favicon-32x32.png create mode 100644 left/http/static/public/favicon.ico create mode 100644 left/http/static/public/favicon.svg create mode 100644 left/http/static/public/maskable_icon_x192.png create mode 100644 left/http/static/public/maskable_icon_x512.png create mode 100644 left/http/static/public/mstile-144x144.png create mode 100644 left/http/static/public/mstile-150x150.png create mode 100644 left/http/static/public/mstile-310x150.png create mode 100644 left/http/static/public/mstile-310x310.png create mode 100644 left/http/static/public/mstile-70x70.png create mode 100644 left/http/static/public/safari-pinned-tab.svg create mode 100644 left/http/static/public/site.webmanifest rename left/http/{asset => static}/src/index.js (100%) rename left/http/{asset => static}/src/index.scss (100%) rename left/http/{asset/asset.go => static/static.go} (53%) rename left/http/{asset/asset_dev.go => static/static_dev.go} (66%) rename left/http/{asset => static}/webpack.config.js (100%) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index a60418aa..6bf60297 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -20,8 +20,8 @@ jobs: - uses: actions/setup-node@v2 with: node-version: "16" - - run: npm install --prefix left/http/asset - - run: npm run build --prefix left/http/asset + - run: npm install --prefix left/http/static + - run: npm run build --prefix left/http/static - name: Set up Go uses: actions/setup-go@v2 with: diff --git a/Makefile b/Makefile index 040afa1a..4a1a1e13 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -NPM_PREFIX := podman run --rm -it -v "$(shell pwd)/left/http/asset:/work" -w /work docker.io/library/node:16 +NPM_PREFIX := podman run --rm -it -v "$(shell pwd)/left/http/static:/work" -w /work docker.io/library/node:16 all: npm snapshot diff --git a/left/http/server.go b/left/http/server.go index 4beb6406..4ce0d6d9 100644 --- a/left/http/server.go +++ b/left/http/server.go @@ -2,7 +2,6 @@ package http import ( "context" - "io/fs" "log" "mime" "net/http" @@ -10,8 +9,8 @@ import ( "github.com/ItsNotGoodName/smtpbridge/core/endpoint" "github.com/ItsNotGoodName/smtpbridge/core/envelope" - "github.com/ItsNotGoodName/smtpbridge/left/http/asset" c "github.com/ItsNotGoodName/smtpbridge/left/http/controller" + "github.com/ItsNotGoodName/smtpbridge/left/http/static" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" ) @@ -25,7 +24,7 @@ type Server struct { r chi.Router } -func New(addr string, dataFS fs.FS, envelopeService envelope.Service, endpointService endpoint.Service) *Server { +func New(addr string, localDataStore envelope.LocalDataStore, envelopeService envelope.Service, endpointService endpoint.Service) *Server { r := chi.NewRouter() // A good base middleware stack @@ -38,9 +37,11 @@ func New(addr string, dataFS fs.FS, envelopeService envelope.Service, endpointSe // processing should be stopped. r.Use(middleware.Timeout(60 * time.Second)) - r.Get("/assets/*", handlePrefixFS("/assets/", asset.FS())) + mountFS(r, static.FS()) - r.Get("/data/*", handlePrefixFS("/data/", dataFS)) + r.Get("/assets/*", handlePrefixFS("/assets/", static.AssetFS())) + + r.Get("/data/*", handlePrefixFS("/data/", localDataStore.DataFS())) r.Get("/", c.IndexGet(envelopeService)) @@ -86,6 +87,6 @@ func (s *Server) Run(ctx context.Context, doneC chan<- struct{}) { srv, ch := s.Start() // Start HTTP server <-ctx.Done() // Wait for context srv.Shutdown(context.Background()) // Shutdown HTTP server - <-ch // Wait for HTTP server shutodwn + <-ch // Wait for HTTP server shutdown doneC <- struct{}{} // Done } diff --git a/left/http/asset/package-lock.json b/left/http/static/package-lock.json similarity index 99% rename from left/http/asset/package-lock.json rename to left/http/static/package-lock.json index d5348425..450b5950 100644 --- a/left/http/asset/package-lock.json +++ b/left/http/static/package-lock.json @@ -1,11 +1,11 @@ { - "name": "asset", + "name": "static", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "asset", + "name": "static", "version": "1.0.0", "license": "ISC", "dependencies": { diff --git a/left/http/asset/package.json b/left/http/static/package.json similarity index 99% rename from left/http/asset/package.json rename to left/http/static/package.json index fcdce663..5c05fba9 100644 --- a/left/http/asset/package.json +++ b/left/http/static/package.json @@ -1,5 +1,5 @@ { - "name": "asset", + "name": "static", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/left/http/static/public/android-chrome-192x192.png b/left/http/static/public/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..d8da4e774e9c1de81b57e8412ff74b7634d5ba4e GIT binary patch literal 1199 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE8Azrw%`pX1Ea{HEjtmSN`?>!lvI6-E$sR$z z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD3KZ96XFV_uUxru4-C$n zIkO;2XHl%-qIlyefhv8zisAAMp-LbWtjG|m$Z+xE#fJ|cK701;(W6H|#b?i+y?*`r z)2B~w-n@D4+&Q2b=g*(NeEIU@$B(aFyLS8b?K^kw01X6c|Ns9#M|)}{&@%p#AirRS zsn@QbJ$v=~mFt?%U+K+M-oHZ>D8-oM?e3x!n;NqQ$l)yTh%9DcV6O*Z#)`NnO+Z2R z5>H=O_Gj!eY(`=``G3!1U|{O@ba4!+xb=1#r(d+A0IU7($qa02ifR7u>OE6hQgi;N zPMcTxH}ER!uc;=gzSkLnh9JNSODns=lOF?@9C-QZ*)_%T)0ZO}Km0zwx9XkU_j>0J zagM~V3*z>iKAh|!%<=GLq;1vd&!>+sF=^aT_4QNVy)Z?01r~Y3`?}`UlUQwz?CCR) zcaZ<=zDJem)(rc{y21j-_H=F!a1i}$b}xz1^-TO@UGWV0&whKvm~xZvbzgT|ka*_z zM=8!NT|W)tj2p!azaPz353qlBuR@pg)iE1^^=loD&S-yRDz-xObHScxOr}Y4-Phv| z*gd;gki5c+ zE*qvFy&aTb^XyE;ZLXdpbENZ=8yC*_{5V(df_Sm#p0})g$$DMkiW{Vh6Zc3p>Kjf! zrY&^iNQ~Tip9I;>u6wK+1>|%eg>ubkYLH^NqOgFC(UfC_qXREfmOwx=lF-k2OzG`& z;w_%;NzeJ7{|u^d=Kcebmfi9*b$I&R|LM8?{Q0_GYbw#eLpT)aZf(^LG}MFjo<$Uv;F(tFMTHQ|BQn+ z-}t4^r2e09u;$x$=`)%2*JI_mVpf|gF1XjyP$kUt%9mpWg&aTDdyIcH@1N~k)(lEy zswJ)wB`Jv|saDBFsX&Us$iT=**T7uY$RfnR%*xcj%E(CDz`)AD;Ph3$DijU5`6-!c zmAEzR>iBjHs6i5BLvVgtNqJ&XDnogBxn5>oc5!lIL8@MUQTpt6Hc~)E;Z-3KB|(Yh z3I#>^X_+~x3MG{VsS23|CCLm76>}bc;^8O^)6h8OfBKB)(;xZee9%@5v&} z!U`@8CWlj)l{bedoW618#E~;cWR9?(Ztz&(rN{6}T(IPmlj&5T6%3xPelF{r5}E)& CAM<4Z literal 0 HcmV?d00001 diff --git a/left/http/static/public/android-chrome-512x512.png b/left/http/static/public/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..eb8b1408f49cbda802e522af01800b8d9ba4ea17 GIT binary patch literal 2702 zcmeH}dsGwo6~})e5D;N?RhB?_F01bP2nnFLfVe6YC<2OLU<)KTB1M#p7*4XXkU7m- z+7&`QED9|?>TbKIB9HBM3yL~WG*QE2EsrcF5G2b(Sb|ZJNM60u|Mrjm(Vo*kdQRue z+`MZ;LBlK1EN=vR2 zya!S8I5_sttEZ>u z%7Q9a0af-b#Iw&u<%W>U zv4oi2X_CkDnx}u=66i_R={Nns3;A#{PXENW(}RTX!vn#qu0LN(d3(721c zV767Lw1|Cyv}ag1S<3?3gOi{P5t3l)4Fw1~^zW{YqZ zxJ6GqG^!&J_N+)PC#Rsr(v5P*0Cw??<>TcpsUsmNQp8P*${P#D{O0>V&{ukNpgD!Q!{JTj?VuNaxvy`{M{k*};oAIv7?SZlFm(&<~F+j%(|_#TmiwMs1RnY1u( z*^pl7vhs?GdEH;SHw*bH1Qo{c@16GVV*IR<4CE4zx!)bJxYyIx$-CG17i1B56d6KmC(SQGR*E+bM-?ncV$uJd}~ z>dq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@Ozbf^ta#rH!1yQ$b7KoXDU-k5CYurf5&HZZUuhH$Npa ztrE9}j|D9TUE%t=)!sVqoU$Sf#HW?-n8^Y{}FM`4(T#wq{P zXFQ(m_pwD+_y17GV}vaA`0(oWiWUIYi;~jVmXPoH-(Mg#C1b#{w@shF9W( VC7+y3rvj~D@O1TaS?83{1OVG1fFJ+> literal 0 HcmV?d00001 diff --git a/left/http/static/public/browserconfig.xml b/left/http/static/public/browserconfig.xml new file mode 100644 index 00000000..a47e5a5b --- /dev/null +++ b/left/http/static/public/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #2d89ef + + + diff --git a/left/http/static/public/favicon-16x16.png b/left/http/static/public/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..44b517124737daf5c17d249400d2501cc2177a8b GIT binary patch literal 623 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJOS+@4BLl<6e(pbstU$g(vPY0F z14ES>14Ba#1H&(%P{RubhEf9thF1v;3|2E37{m+a>%___foiGx+^M>pp-K!;qzq!5IdkUPwQEnFJbCu)+0&;_uV24@ z?%X+`_PclQUb=J%XvpQumx1Q||Nmb?Gx;~rbb*o}zhH*QmtWJ;x(^lYKji)6SKt}5 zmkX8xFMGaB5`@{xzl0|0s;*W6xJqyisB93|E51UkQ|h`HYMt_@nMUzU#pKf81G4pVB?cL@V^FV ziE4>!L`h0wNvc(HQ7VvPFfuSQ(ls#GHL?gXFtai>urjpJHZZUN&PEETD7-2pq9iD> zT%n*SKP@vSRiUJ^AXOo=pd^`rp<>SCPdprjVHz5z{7;|pd>X{Stjw*K%q^@e>^)h8 zSy;iP!Q^lXv-0K;h0`~#oH%mkh|Cf8(+wUAy!04ei3^r|ax$F?w1UCY)z4*}Q$iB} D=y>G? literal 0 HcmV?d00001 diff --git a/left/http/static/public/favicon-32x32.png b/left/http/static/public/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..ef6c454a16c00dfe25537c7ca162f889e9d9c788 GI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E^`F}^^JGBpAtjSlv zzqZ}8>*z7)ZTrT+XUr*6=^C2KwBLAvtrs^Y5?%%P;Co49UZi%X~j^LY1DO zsfQ;njek1cH@*Nt8Fgwq_xa|d_s<`{{J7vnpaXqi;dO07SqpV*bg3RX?l^S%ST7;v z`mUzGyu4gIi^ckceTLeHP9J*%`7V*W4)WRJq5V%e{c3jwux4X_2`sWcug#-u^BZIR iX(DI~9hbjG&VN54QsrQfXtIfDzPY?O@l(W5iT(g6eG4K0 literal 0 HcmV?d00001 diff --git a/left/http/static/public/favicon.svg b/left/http/static/public/favicon.svg new file mode 100644 index 00000000..27ea9556 --- /dev/null +++ b/left/http/static/public/favicon.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/left/http/static/public/maskable_icon_x192.png b/left/http/static/public/maskable_icon_x192.png new file mode 100644 index 0000000000000000000000000000000000000000..5969d07c5a3fc64177db8cabf1ec4e32ab32709a GIT binary patch literal 2170 zcmeH}X;4#F7>3WiT=0r!8kT}JERiK;Q&1zJEG8--Ap{UX5W`jx3AG7E1Z2Ge3hF3G zP%Duk)&VR?u(HH}NN7hXC_dc=o`9Mc#gbG2cryir%$7TLqeDg1|vWk zp;M1|`}lM#m1)62K^_DGq5ez)tI`oFJVM5LdwWG`6Jy0vh2of_gM&v)OUo~cPfwnh zz;}XrCkb)|mCMO^>MkFFqoeF2M|jpkWO-^Ue3TE@(cbr-T;RH8yNz`UiqrD1yDUum%ZO2j6#T)5MWad=_zwmaXtQ47*Umxec)S1zM;bup5Hlrlxqhs@v;>O#7*3g|IK z{%IV{6UiAg+h;F9iCWh^upB0D)@5Ft+Q7@6X(yi`2)9EfXaZ#6VMil`bl2 zz0lTylLujI1>>?p7LtcL=nG3plKZ4UD=I}wLoE8u`Ub~MFxPMzTo9fA1D97ab3|>m zFSfNX(smi7VS~BxUsW!H>|!CZAToEkpMmCenIP2HXpoHDx+ORwins6;|?qS44#?}G%g!4UKG|E zOw!~U#{)+ats6h|i(?}3G@SXW_uBw8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!p8H#9s~ zvsf&I7oB5qW5}f|33IuBDB-XC9ULMaRvFV$H8YYKP{kK-y_{KJu+aAB+J@XK^G)c+jxc5-Xb;4h3an7?zz$LE%Uj9Z`cRwyY;zqF|_K!?t%A_8=;VWN!+SwO|t{{durCt_s<(^AvvZ z6!Nu5H_J5@TE_0uC!4e?w?IQ#@_E?`@t0t-<{z1m38)S3Robvaj%4gx>-!5K8bcfX z5RrI{Kt>CVVpn~<82esb0_m|>Tyui7gKRJ>t}8Es0X0F#S%2_zF{tM`EfgAG_PU2b z8sV$KM3ct&2PTqvC<^XyM_?x!q!!w&12+@vGzXh0( z7A52fY5h%&|8r?g$mu^^PUOtA=%L=Q=)TDw>~=r4yfs-gbS7=j@JT&*;7?FyAR9jQ zGaSZ;RyBI0ClJ+<;cWk*(O(!{!=M__|86lU$M)PfqId4kq(1nO5?ZxlokOaf@1g$& D{zd(n literal 0 HcmV?d00001 diff --git a/left/http/static/public/mstile-144x144.png b/left/http/static/public/mstile-144x144.png new file mode 100644 index 0000000000000000000000000000000000000000..40077989c3f552f2e858ff7ad06e01b058aa6bd4 GIT binary patch literal 972 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q8Ax83A=Cw=SkfJR9T^xl_H+M9WCijSl0AZa z85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP@+1(C&U#<-v)zo=gyry zd-lwkGYcbimt{JwD)j63R<5)WO*3W)RRSST6^2j-hA=QYRGHz%jT=v&K7ID=*{xf* zfVwVRxN!ge{i|26K6&!w+O=yyqkyK~xpN0-?4?VW9zJ~d`0?ZG*RS8ad2>OO4$!p! z|Nl>Aec1uDUbrO4FPOn7X3pGMvo;-Cb%=G{7Ix<4YmE!GU%3sGW=!&SchT6pVe2L! zhrPtp*OmPly9}F=NI2uHZ9wTWo-U3d6}R4Ax*f)3$kY085tEW!p^CzyMT_45Z`&lp z&vRx==IkYU*Y5F8s1e^^EYX$-L$VjD+@HO!bUeQO>fD#BUUrIKS$^}*CFA*l_6$n9 z;v)*h_-B_V3h2t`+W4P8!YsHp?u+I6)xX5KUA*7!SpD+5x?0DS$M=rNa9`^At^KTG zLe!noGn@)@cho2OF`YdASG-ut!|L7I8NrT|3eA)J*gKEj?XhH55&oWcCUU`_9p97B zF+V+aSEyJ|L;c;g8J`_b7H&VT!{F7uTRTlqK=;1V<8{{>yJs%AvBTETyD{m}w_`f& zNyp#zM+zM2wiel}p&?Ulkro-Ck>_^il0y8QH8Y+%&Mo|$6vnXi_}Sh_)-Cep_Gz*g z^6m&4W;bqo+}9P!|3$hy=1kWDt9LhMggUyselcUJ<4a}^g$4#D7?I-Ge5`HxGifu{ zcYo*eDm3u%n{?cJ(X%)3PpSC+k3ZRq#iw&V7j+GjTX*8zVd2QCIlFi9RpuR=HgCg; zTf#y&tN$z#lAFJxXL)qUsmrQb&ojlRe%aD_s_L8TQrmOBvle(}@;fjvvIO9wo-Odt z{1>`$!A%oyU{tG?xJHzuB$lLFB^RXvDF!10BO_e{b6q2g5CbzSQv)j_18oBXD+7ZV zulQgT4Y~O#nQ4`{HRy^ze-G3UUKJ8i5|mi3P*9YgmYI{PP*Pcts*qVwlFYzRG3W6o z9*)8=4UJR&r_Xpk4Pszc=GIH*7FHJao-D#Ftl-jMayW%qd2@)u=^Iy09657D<_P=g e29E_^dJM0`1xr3TnN9^-!QkoY=d#Wzp$PyfDv*i* literal 0 HcmV?d00001 diff --git a/left/http/static/public/mstile-150x150.png b/left/http/static/public/mstile-150x150.png new file mode 100644 index 0000000000000000000000000000000000000000..b965effce28e5a1f1b492c051fcd45f8fcd50729 GIT binary patch literal 1044 zcmeAS@N?(olHy`uVBq!ia0y~yVB`Z~4rZW;e?I4QAjOjI=Fgvi+Aqa zdGzSf*|TRCMCqHXtZV2-bJM#yZSBx91dyNg;B$BeB&4tt5G zuPggAb{RG!k#NRY+ZY&_WISCQLn>~)y>c^5#89I3BHP4+oJ|T^k6QNq*Jk1_n0nW= zEL`$)`upErs`rmZt_2!`4jS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mbgZg zq$HN4S|t~y0x1R~10y3{19M#?ix2}dD^mk2BSUQi11kfAU$!C7Q8eV{r(~v8;?~fe z@Fp6lA-pOiq9iD>T%n*SKP@vSRiUJ^AXOo=pd^`rp<>SCPdprjVHz5z{7;|pd>X{S ztjw*K%q^@e>^)h8Sy;iP!Q^lXv-0K;h0`~#oH%mkh|Cf8(+wUAy!04ei3^r|ax$F? O@`b0XpUXO@geCy;69gsz literal 0 HcmV?d00001 diff --git a/left/http/static/public/mstile-310x310.png b/left/http/static/public/mstile-310x310.png new file mode 100644 index 0000000000000000000000000000000000000000..f81fc15c024a0ebef6d77a914551d25d00fb2086 GIT binary patch literal 2012 zcmcIkYfuwc6uydpijGsTWQsZsBA~^rAwJNcSTvv*0umz#iAqRF!8wv0n5 z&^BOr1W_D>s)O}ax*C~^bZSU=1S1fEMPL(<0nr#61ti_8zxt#9%Ff+A=YHpW=R5c8 z&Svk7**1T!&s+e&{HW~=HUKjbc+YkrkQ)VQqlB4tAe|1Yw^(ecI8{(bd(}+}wOAk#dPg zy(*0<=Td%-3rJZxn;+!1dnx#|;{50%(v#F`6rKP32yBotWlgTtNFhHo7&E`)k7n4>J1)WZ(N8}XIE%1`FV|D?zM4nH{ zh597X!^azKZ^J_~(*#a_F%h1T!raDK(O8?cjM%u#qgWB{R`_y=Or}d&@ zJtxb10vs>%rozRw6PqXBJsEv%H-9j09vV$|N;0NW?1hUI@84YemUl0+RNwcu)OhY# zzq&)*yHs6+S!C-c$Ge8OtN!kH08vw@gd&NK z1Em=%zEJ;F;Mh;uL2A#cw8S2K6CK8*k)TrTUrGgp_Mkt|gRY(3adeO0%JMRZoAV(ReukYLbPPT;v8JwxRiyy>IYTseT3 zttOgH2}d3Tj9rISn6ei%#Q}J%J?EKkbfG8VSn7E`vDkYk=RMdau^~{!NLI(IP8eaY z-sqZQtp_Z5M<;rX@7+k0tcXKA0>^ByWRonBs^CTwB@Y(qyLDY~(hNN>m4!vZlFzK3 zu~;hfdL^w1YbY3oY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yh3I#>^X_+~x3MG{VsS23|B|y_E<~;ty!%-Nfp>fLp^cl~mK@7~w+ + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/left/http/static/public/site.webmanifest b/left/http/static/public/site.webmanifest new file mode 100644 index 00000000..96e6a226 --- /dev/null +++ b/left/http/static/public/site.webmanifest @@ -0,0 +1,42 @@ +{ + "$schema": "https://json.schemastore.org/web-manifest-combined.json", + "name": "SMTPBridge", + "short_name": "SMTPBridge", + "start_url": "/", + "display": "standalone", + "background_color": "#ffffff", + "lang": "en", + "scope": "/", + "description": "Bridge email to other messaging services.", + "theme_color": "#ffffff", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/maskable_icon_x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/maskable_icon_x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/favicon.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "any" + } + ] +} diff --git a/left/http/asset/src/index.js b/left/http/static/src/index.js similarity index 100% rename from left/http/asset/src/index.js rename to left/http/static/src/index.js diff --git a/left/http/asset/src/index.scss b/left/http/static/src/index.scss similarity index 100% rename from left/http/asset/src/index.scss rename to left/http/static/src/index.scss diff --git a/left/http/asset/asset.go b/left/http/static/static.go similarity index 53% rename from left/http/asset/asset.go rename to left/http/static/static.go index 0d37920f..6418e72a 100644 --- a/left/http/asset/asset.go +++ b/left/http/static/static.go @@ -1,16 +1,16 @@ //go:build !dev -package asset +package static import ( "embed" "io/fs" ) -//go:embed dist +//go:embed dist public var assetFS embed.FS -func FS() fs.FS { +func AssetFS() fs.FS { f, err := fs.Sub(assetFS, "dist") if err != nil { panic(err) @@ -18,3 +18,12 @@ func FS() fs.FS { return f } + +func FS() fs.FS { + f, err := fs.Sub(assetFS, "public") + if err != nil { + panic(err) + } + + return f +} diff --git a/left/http/asset/asset_dev.go b/left/http/static/static_dev.go similarity index 66% rename from left/http/asset/asset_dev.go rename to left/http/static/static_dev.go index 9a681c33..90861db3 100644 --- a/left/http/asset/asset_dev.go +++ b/left/http/static/static_dev.go @@ -1,6 +1,6 @@ //go:build dev -package asset +package static import ( "io/fs" @@ -10,6 +10,7 @@ import ( ) var distFS fs.FS +var publicFS fs.FS func init() { _, filename, _, ok := runtime.Caller(0) @@ -18,8 +19,13 @@ func init() { } distFS = os.DirFS(path.Join(path.Dir(filename), "dist")) + publicFS = os.DirFS(path.Join(path.Dir(filename), "public")) } -func FS() fs.FS { +func AssetFS() fs.FS { return distFS } + +func FS() fs.FS { + return publicFS +} diff --git a/left/http/asset/webpack.config.js b/left/http/static/webpack.config.js similarity index 100% rename from left/http/asset/webpack.config.js rename to left/http/static/webpack.config.js diff --git a/left/http/util.go b/left/http/util.go index 726ebe51..18d748b0 100644 --- a/left/http/util.go +++ b/left/http/util.go @@ -3,7 +3,10 @@ package http import ( "fmt" "io/fs" + "log" "net/http" + + "github.com/go-chi/chi/v5" ) func mwMultiplexAction(get, post, delete http.HandlerFunc) http.HandlerFunc { @@ -47,3 +50,21 @@ func handlePrefixFS(prefix string, fs fs.FS) http.HandlerFunc { h.ServeHTTP(rw, r) } } + +func mountFS(r chi.Router, f fs.FS) { + httpFS := http.FS(f) + fsHandler := http.StripPrefix("/", http.FileServer(httpFS)) + + if files, err := fs.ReadDir(f, "."); err == nil { + for _, f := range files { + name := f.Name() + if f.IsDir() { + r.Get("/"+name+"/*", fsHandler.ServeHTTP) + } else { + r.Get("/"+name, fsHandler.ServeHTTP) + } + } + } else if err != fs.ErrNotExist { + log.Fatalln("http.mountFS:", err) + } +} diff --git a/left/http/view/template/layout/default.html b/left/http/view/template/layout/default.html index b94f0ad7..4c2a6e4b 100644 --- a/left/http/view/template/layout/default.html +++ b/left/http/view/template/layout/default.html @@ -1,11 +1,20 @@ {{ define "layout/default" }} - + SMTPBridge + + + + + + + + + diff --git a/server/server.go b/server/server.go index d57e51ad..9931213e 100644 --- a/server/server.go +++ b/server/server.go @@ -113,7 +113,7 @@ func Start(ctx context.Context, config *config.Config) <-chan struct{} { if !config.HTTP.Disable { backgrounds = append(backgrounds, http.New( config.HTTP.Addr(), - dataStore.(envelope.LocalDataStore).DataFS(), + dataStore.(envelope.LocalDataStore), envelopeService, endpointService, ))