From d2ea95a1822fc5bcde357eb43de1c44ad96f689f Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Tue, 16 May 2023 02:04:16 +0300 Subject: [PATCH] Fixes for frontend --- go.mod | 1 + go.sum | 28 +++ main.go | 14 ++ personal-website.code-workspace | 11 + resources/application.js | 5 - resources/decorat.js | 1 - .../{sys => dev-fs/apps}/finder/finder.css | 0 .../{sys => dev-fs/apps}/finder/finder.js | 238 ++++++------------ ...oto-placeholder-profile-picture-vector.jpg | 3 - resources/personal-properties-prop.html | 8 - resources/personal-properties.html | 29 --- .../personal-properties.js | 4 +- resources/wde.js | 106 +------- templates/base/index.tmpl | 17 +- 14 files changed, 135 insertions(+), 330 deletions(-) create mode 100644 personal-website.code-workspace delete mode 100644 resources/application.js delete mode 100644 resources/decorat.js rename resources/{sys => dev-fs/apps}/finder/finder.css (100%) rename resources/{sys => dev-fs/apps}/finder/finder.js (60%) delete mode 100644 resources/img/default-avatar-photo-placeholder-profile-picture-vector.jpg delete mode 100644 resources/personal-properties-prop.html delete mode 100644 resources/personal-properties.html diff --git a/go.mod b/go.mod index 1b7f5ff..ae8c503 100644 --- a/go.mod +++ b/go.mod @@ -21,6 +21,7 @@ require ( github.com/bytedance/sonic v1.8.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/disintegration/imaging v1.6.2 + github.com/gin-contrib/cors v1.4.0 github.com/gin-contrib/location v0.0.2 github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect diff --git a/go.sum b/go.sum index 6c047d5..e5c2bdf 100644 --- a/go.sum +++ b/go.sum @@ -4,27 +4,35 @@ github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZX github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= +github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g= +github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs= github.com/gin-contrib/location v0.0.2 h1:QZKh1+K/LLR4KG/61eIO3b7MLuKi8tytQhV6texLgP4= github.com/gin-contrib/location v0.0.2/go.mod h1:NGoidiRlf0BlA/VKSVp+g3cuSMeTmip/63PhEjRhUAc= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= +github.com/gin-gonic/gin v1.8.1/go.mod h1:ji8BvRH1azfM+SYow9zQ6SZMvR8qOMZHmsCuWR9tTTk= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= +github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= +github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -48,12 +56,16 @@ github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47e github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -67,11 +79,15 @@ github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe h1:iruDEfMl2E6f github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -86,7 +102,9 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= @@ -101,11 +119,13 @@ go.mongodb.org/mongo-driver v1.11.4 h1:4ayjakA013OdpGyL2K3ZqylTac/rMjrJOMZ1EHizX go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= @@ -115,12 +135,15 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= @@ -128,13 +151,18 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/main.go b/main.go index 88264bc..a215592 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "log" "net/http" "os" + "time" "personalwebsite/apps" "personalwebsite/apps/blogviewer" @@ -17,6 +18,7 @@ import ( "personalwebsite/wde" "personalwebsite/webfilesystem" + "github.com/gin-contrib/cors" "github.com/gin-contrib/location" "github.com/gin-gonic/gin" "github.com/joho/godotenv" @@ -153,6 +155,18 @@ func main() { blogViewerApp.Route(blogViewerRoute) } + router.Use(cors.New(cors.Config{ + AllowAllOrigins: true, + // AllowOrigins: []string{"http://localhost:8080", "http://localhost:9090"}, + // AllowMethods: []string{"PUT", "PATCH"}, + // AllowHeaders: []string{"Origin"}, + ExposeHeaders: []string{"Content-Length"}, + AllowCredentials: true, + // AllowOriginFunc: func(origin string) bool { + // return origin == "https://github.com" + // }, + MaxAge: 12 * time.Hour, + })) err = router.Run(":8080") if err != nil { log.Panicf("error: %s", err) diff --git a/personal-website.code-workspace b/personal-website.code-workspace new file mode 100644 index 0000000..a7633b0 --- /dev/null +++ b/personal-website.code-workspace @@ -0,0 +1,11 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../personal-website-frontend" + } + ], + "settings": {} +} \ No newline at end of file diff --git a/resources/application.js b/resources/application.js deleted file mode 100644 index 5d1f83e..0000000 --- a/resources/application.js +++ /dev/null @@ -1,5 +0,0 @@ -export class Application{ - Init(){ - - } -} \ No newline at end of file diff --git a/resources/decorat.js b/resources/decorat.js deleted file mode 100644 index ab0c014..0000000 --- a/resources/decorat.js +++ /dev/null @@ -1 +0,0 @@ -// \ No newline at end of file diff --git a/resources/sys/finder/finder.css b/resources/dev-fs/apps/finder/finder.css similarity index 100% rename from resources/sys/finder/finder.css rename to resources/dev-fs/apps/finder/finder.css diff --git a/resources/sys/finder/finder.js b/resources/dev-fs/apps/finder/finder.js similarity index 60% rename from resources/sys/finder/finder.js rename to resources/dev-fs/apps/finder/finder.js index 73635f9..9affb26 100644 --- a/resources/sys/finder/finder.js +++ b/resources/dev-fs/apps/finder/finder.js @@ -1,152 +1,51 @@ class Finder{ - static appId = "Finder" - appId = "Finder" - fileView = undefined - path = "/" - homePath = "/home/user" - windowElement - // previousPath = "/" - pathHistory = [] //FIXME Fixed length - constructor(){ - // this.appElem = appElem - // WebDesktopEnvironment.RegisterApp(this) - } + static AppId = "Finder" + /** * @param {string[]} args */ async NewWindow(args){ let newFinder = new FinderWindow() await newFinder.Init(args) - return - this.path = args[0] - if (args[1] == "desktop"){ - this.NewDesktop(args) - return - } - // const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile}) - fetch(`/app/${Finder.appId}/render?` + params) - .then((response) => response.text()) - .then((html) => { - let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.appId, 500, 350 ) - newWindow.innerHTML = html - - this.fileView = new FileView(newWindow.querySelector(".FileTileView"), - (event) =>{ this.Click(event) }, - (event) =>{ this.RightClick(event) }, - (event, draggedElem) =>{ this.DropEvent(event, draggedElem) }, - ) - this.OpenDir(this.path) - - newWindow.querySelector("#RootButton").addEventListener('click', () =>{ - this.OpenDir('/') - }) - - newWindow.querySelector("#HomeButton").addEventListener('click', () =>{ - this.OpenDir('/home/user') - }) - - this.windowElement = newWindow - - if (!WebDesktopEnvironment.isMobile){ - let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".FileTileView")) - // console.log(newWindow.querySelector("#closeWindowButton")) - - newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { - - WebDesktopEnvironment.CloseWindow(newWindow) - - }) - } - }) - .catch((error) => { - WebDesktopEnvironment.Alert(error); - }) } - - + /** - * @param {string[]} args - */ - NewDesktop(args){ - fetch(`${window.location.origin}/application/${Finder.appId}/renderDesktop?` + new URLSearchParams({ - isMobile: WebDesktopEnvironment.isMobile, - path: args[0] - })) - .then((response) => response.text()) - .then((html) => { - // console.log(args) - args[2].innerHTML = html - - this.fileView = new FileView(args[2].querySelector(".FileTileView"), (event) =>{ - this.Click(event, true) - }) - this.OpenDir(this.path) - }) - .catch((error) => { - WebDesktopEnvironment.Alert(error); - }) - } - - // OpenPreviousDir(){ - // if (this.pathHistory.length > 0){ - // // console.log(this.pathHistory) - // let path = this.pathHistory[this.pathHistory.length - 1] - // // console.log(typeof( this.pathHistory)) - // this.pathHistory.pop() - // this.OpenDir(this.path) - // } - // } - - /** - * @param {string} path - */ - OpenDir(path){ - this.path = path - this.fileView.OpenFolder(path) - } - - - // /** - // */ - // OpenNewDir(){ - // WebDesktopEnvironment.Open("finder", [this.path]) - // } - /** - * @param {string} path - * @returns {boolean} + * @param {string} path + * @returns {boolean} */ static async RenderProperites(path){ const params = new URLSearchParams({ path: path }) - const response = await fetch(`/application/${Finder.appId}/renderProps?` + params) + const response = await fetch(`/application/${Finder.AppId}/renderProps?` + params) if (response.status != 200){ WebDesktopEnvironment.Alert("Error in properties render") //TODO return false } const html = response.text() - let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.appId, 350, 500 ) + let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 350, 500 ) newWindow.innerHTML = html newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { WebDesktopEnvironment.CloseWindow(newWindow) }) - } + } } class FinderWindow{ - CurPath = "" + curPath = "" fileView = undefined windowElem = undefined - + async Init(args){ // console.log(args) if (args[1] === "-desktop"){ + //todo pass div id, not div in args[] const params = new URLSearchParams({ isMobile: WebDesktopEnvironment.isMobile, path: args[0] }) - const response = await fetch(`/app/${Finder.appId}/renderDesktop?` + params) + const response = await fetch(`/app/${Finder.AppId}/renderDesktop?` + params) if (response.status != 200){ WebDesktopEnvironment.Alert("Error in render desktop") //TODO } @@ -158,68 +57,71 @@ class FinderWindow{ (event) => { this.RightClick(event) }, (event, draggedElem) => { this.DropEvent(event, draggedElem)}, () => { this.ReRenderDir() } - ) - this.RenderDir(args[0]) - return - } - const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile}) - const response = await fetch(`/app/${Finder.appId}/render?` + params) + ) + this.RenderDir(args[0]) + return + } + const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile}) + const response = await fetch(`/app/${Finder.AppId}/render?` + params) if (response.status != 200){ WebDesktopEnvironment.Alert("Finder ERROR TODO") //TODO return } const html = await response.text() - - let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.appId, 500, 350 ) + + let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.AppId, 500, 350 ) newWindow.innerHTML = html - + this.fileView = new FileView( - newWindow.querySelector(".FileTileView"), - (event) => { this.Click(event) }, - (event) => { this.RightClick(event) }, - (event, draggedElem) => { this.DropEvent(event, draggedElem)}, - () => { this.ReRenderDir() } - ) - - newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { + newWindow.querySelector(".FileTileView"), + (event) => { this.Click(event) }, + (event) => { this.RightClick(event) }, + (event, draggedElem) => { this.DropEvent(event, draggedElem)}, + () => { this.ReRenderDir() } + ) - WebDesktopEnvironment.CloseWindow(newWindow) + newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) { + + WebDesktopEnvironment.CloseWindow(newWindow) + + }) - }) - - newWindow.querySelector("#RootButton").addEventListener('click', () =>{ - this.RenderDir('/') - }) - - newWindow.querySelector("#HomeButton").addEventListener('click', () =>{ - this.RenderDir('/home/user') - }) - - let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".FileTileView")) - - - this.windowElem = newWindow - this.RenderDir(args[0]) - } - + newWindow.querySelector("#RootButton").addEventListener('click', () =>{ + this.RenderDir('/') + }) + + newWindow.querySelector("#HomeButton").addEventListener('click', () =>{ + this.RenderDir('/home/user') + }) + + let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".FileTileView")) + + + this.windowElem = newWindow + this.RenderDir(args[0]) + } + + /** + * @param {string} path + */ RenderDir(path){ - this.CurPath = path + this.curPath = path this.fileView.OpenFolder(path) } - + ReRenderDir(){ - this.RenderDir(this.CurPath) + this.RenderDir(this.curPath) } - + /** - * @param {DragEvent} event - * @param {HTMLElement} draggedElem + * @param {DragEvent} event + * @param {HTMLElement} draggedElem */ async DropEvent(event){ // console.log(event.dataTransfer.getData("dropType")) if (event.dataTransfer.getData("dropType") == "move"){ const sourcePath= event.dataTransfer.getData("filePath") - const targetPath = this.CurPath + "/" + event.dataTransfer.getData("fileName") + const targetPath = this.curPath + "/" + event.dataTransfer.getData("fileName") const res = await WebFS.MoveFile(sourcePath, targetPath) if (res){ this.ReRenderDir() @@ -237,7 +139,7 @@ class FinderWindow{ formData.append("file", element) //FIXME Conn reset } const params = new URLSearchParams({ - parentPath: this.CurPath, + parentPath: this.curPath, }) const response = await fetch('/fs/upload/?' + params, { @@ -265,18 +167,18 @@ class FinderWindow{ case fileType == "objectlink": WebDesktopEnvironment.Alert("Links not supported yet") break + case fileExtension == "app": + WebDesktopEnvironment.Open(`${this.curPath}/${fileName}`, []) + break case fileType == "directory": - WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${this.CurPath}/${fileName}`]) + WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${this.curPath}/${fileName}`]) break case fileExtension == "blog": - WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`]) + WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.curPath}/${fileName}`]) break case fileExtension == "jpeg" | fileExtension == "png": - WebDesktopEnvironment.Open("img-viewer", [this.CurPath + "/" + fileName]) + WebDesktopEnvironment.Open("img-viewer", [this.curPath + "/" + fileName]) break; - case fileExtension == "app": - WebDesktopEnvironment.Open(`${this.CurPath}/${fileName}`, []) - break default: // console.log("Unsupported file type") WebDesktopEnvironment.Alert("Unsupported file type") @@ -305,8 +207,8 @@ class FinderWindow{ } else { context = fileType } - const params = new URLSearchParams({context: context, path: `${this.CurPath}/${fileName}`}) - const response = await fetch(`/app/${Finder.appId}/contextMenu?` + params) + const params = new URLSearchParams({context: context, path: `${this.curPath}/${fileName}`}) + const response = await fetch(`/app/${Finder.AppId}/contextMenu?` + params) if (response.status != 200){ WebDesktopEnvironment.Alert("ERROR in Context menu TODO"); //TODO return @@ -336,24 +238,24 @@ class FinderWindow{ let res = false switch (event.target.children[0].getAttribute("action")) { case "createDir": - res = await WebFS.CreateDirectory(`${this.CurPath}`) + res = await WebFS.CreateDirectory(`${this.curPath}`) console.log(res) if (res){ this.ReRenderDir() } break case "deleteFile": - res = await WebFS.DeleteFile(`${this.CurPath}/${fileName}`) + res = await WebFS.DeleteFile(`${this.curPath}/${fileName}`) console.log(res) if (res){ this.ReRenderDir() } break case "getInfo": - res = await Finder.RenderProperites(`${this.CurPath}/${fileName}`) + res = await Finder.RenderProperites(`${this.curPath}/${fileName}`) break case "openAsDir": - WebDesktopEnvironment.Open(`/Applications/${Finder.appId}.app`,[`${this.CurPath}/${fileName}`]) + WebDesktopEnvironment.Open(`/Applications/${Finder.AppId}.app`,[`${this.curPath}/${fileName}`]) break default: break; diff --git a/resources/img/default-avatar-photo-placeholder-profile-picture-vector.jpg b/resources/img/default-avatar-photo-placeholder-profile-picture-vector.jpg deleted file mode 100644 index f2c8795..0000000 --- a/resources/img/default-avatar-photo-placeholder-profile-picture-vector.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:83c2d9b4d2fd4356062e648e6ad6834062fd13e6dafbf23665f3dd5e652a54ed -size 1029 diff --git a/resources/personal-properties-prop.html b/resources/personal-properties-prop.html deleted file mode 100644 index d48ccf0..0000000 --- a/resources/personal-properties-prop.html +++ /dev/null @@ -1,8 +0,0 @@ -
- {{ range $book := .books }} -

{{ .Title }}

-

{{ .Author }}

-
- {{ end }} -
- diff --git a/resources/personal-properties.html b/resources/personal-properties.html deleted file mode 100644 index 308119c..0000000 --- a/resources/personal-properties.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
-
{{ .Name }}
-
{{ .BasicBio }}
-
-
- -{{ range $props := .allprops }} -
-
- Test Title: -
-
- {{range $prop := $props}} -
-
{{.Key}}:
-
- {{ range $value := .Values }} -
- {{ $value }} -
- {{ end }} -
-
- {{ end }} -
-
-{{ end }} diff --git a/resources/sys/personal-properties/personal-properties.js b/resources/sys/personal-properties/personal-properties.js index 2653ed7..6fbd7d9 100644 --- a/resources/sys/personal-properties/personal-properties.js +++ b/resources/sys/personal-properties/personal-properties.js @@ -14,12 +14,10 @@ class AboutMe{ async NewWindow(chroot, args){ console.log(chroot) if (chroot == ""){ - chroot = "/home/user" //FIXME + chroot = "/Applications" //FIXME } - console.log(`${chroot}/AboutMe.app/aboutme.props`) const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`}) const response = await fetch(`/app/${this.appId}/render?`+ params) - console.log(response) if (response.status != 200){ WebDesktopEnvironment.Alert("Error TODO") //TODO return diff --git a/resources/wde.js b/resources/wde.js index 001dbe5..a3769b7 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -19,62 +19,14 @@ document.addEventListener('DOMContentLoaded', function() { class WebDesktopEnvironment{ static Applications = {}; static isMobile = false + static decorat + static webFs constructor(){ // WebDesktopEnvironment.isMobile = WebDesktopEnvironment.CheckMobile() document.body.style.setProperty('--zoom', 1) - this.wc = new WindowsCompositor() + WebDesktopEnvironment.wc = new WindowsCompositor() + WebDesktopEnvironment.webFs = new WebFS() this.loadWDE() - let kek = new WebFS() - return - - // let applications = document.createElement("div") - // applications.setAttribute('id', 'applications') - // document.body.appendChild(applications) - - if( WebDesktopEnvironment.isMobile){ - document.body.style.setProperty('--zoom', 3) - - let mobileDesktop = document.createElement("div") - mobileDesktop.setAttribute('id', 'mobile-desktop') - document.body.appendChild(mobileDesktop) - - fetch(`${window.location.origin}/system/wde/renderMobileDesktop` ) - .then((response) => response.text()) - .then((html) => { - mobileDesktop.innerHTML = html - WebDesktopEnvironment.LoadApp("finder", () =>{ - new FileView("/kek", mobileDesktop.querySelector(".FileTileView"), Finder.Click) - - mobileDesktop.querySelector('#about-me').addEventListener('click', (event) => { - //TODO Do not allow launch second instance - WebDesktopEnvironment.Open("personal-properties", []) - }) - mobileDesktop.querySelector('#mobile-desktop-blog').addEventListener('click', (event) => { - //TODO Do not allow launch second instance - WebDesktopEnvironment.Open("blog-viewer", ['main-page']) - }) - mobileDesktop.querySelector('#mobile-dekstop-close').addEventListener('click', (event) => { - // console.log('close') - WebDesktopEnvironment.CloseFocusedWindow() - }) - }) - }) - .catch((error) => { - WebDesktopEnvironment.Alert(error); - }) - - } else{ - - // let desktopLayer = document.createElement("div") - // desktopLayer.setAttribute('id', 'desktop-layer') - // document.body.appendChild(desktopLayer) - WebDesktopEnvironment.Open("finder", ["/home/user", "desktop", desktopLayer]) - - // let windowsLayer = document.createElement("div") - // windowsLayer.setAttribute('id', 'windows-layer') - // document.body.appendChild(windowsLayer) - this.Autoload() - } } async loadWDE(){ @@ -139,53 +91,6 @@ class WebDesktopEnvironment{ return appManifest } - Autoload(){ - // WebDesktopEnvironment.Open(["/home/user/AboutMe.app"]) - // WebDesktopEnvironment.load2(["/home/user/AboutMe.app"]) - } - /** - * @param {string} appId - * @param {function} func callback after script loading - * @returns {Application | undefined} - */ - static LoadApp(appId, func){ - // console.log(`Load application ${appId}`) - - let script = document.createElement("script") - script.setAttribute("appId", appId) - script.setAttribute("src", `${window.location.origin}/system/applications/${appId}/app.js`) - script.setAttribute("async", "false") - document.getElementById("applications").appendChild(script) - - script.addEventListener('load', (event) =>{ - switch (appId) { - case "finder": - let newFinderApp = new Finder() - this.Applications[appId] = newFinderApp - func() - return newFinderApp - case "personal-properties": - let newPersonalPropertiesApp = new PersonalProperties() - this.Applications[appId] = newPersonalPropertiesApp - func() - return newPersonalPropertiesApp - case "img-viewer": - let newImgViewer = new ImgViewer() - this.Applications[appId] = newImgViewer - func() - return newImgViewer - case "blog-viewer": - let newBlogViewer = new BlogViewer() - this.Applications[appId] = newBlogViewer - func() - return newBlogViewer - default: - break; - } - - }) - } - /** * @param {string} appId * @param {number} width @@ -250,7 +155,6 @@ class WebDesktopEnvironment{ * @param {string} alertText */ static CreateAlertWindow(alertText){ - // console.log("alertWinfdo") let newWindow = document.createElement("div") newWindow.setAttribute("class", "WindowFrameless") newWindow.setAttribute("windowId", "SuperUniqUUID") //TODO: @@ -406,4 +310,4 @@ class WebFS{ } return true } -} +} \ No newline at end of file diff --git a/templates/base/index.tmpl b/templates/base/index.tmpl index 31370b6..41d8999 100644 --- a/templates/base/index.tmpl +++ b/templates/base/index.tmpl @@ -2,6 +2,7 @@ Greg Brzezinski + @@ -9,27 +10,19 @@ - - - + + + + - - - - - -
-