Fixes for frontend

This commit is contained in:
cyber-dream 2023-05-16 02:04:16 +03:00
parent 1b3f17777e
commit d2ea95a182
14 changed files with 135 additions and 330 deletions

1
go.mod
View File

@ -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

28
go.sum
View File

@ -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=

14
main.go
View File

@ -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)

View File

@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "../personal-website-frontend"
}
],
"settings": {}
}

View File

@ -1,5 +0,0 @@
export class Application{
Init(){
}
}

View File

@ -1 +0,0 @@
//

View File

@ -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;

View File

@ -1,8 +0,0 @@
<div id="prop" class="personal-properties-prop">
{{ range $book := .books }}
<h1>{{ .Title }}</h1>
<h3>{{ .Author }}</h3>
<hr/>
{{ end }}
</div>

View File

@ -1,29 +0,0 @@
<div class="Personal-properties-bio">
<img src="res/img/default-avatar-photo-placeholder-profile-picture-vector.jpg" style="width: 48px;height: 48px;">
<div class="Personal-properties-textbio">
<div>{{ .Name }}</div>
<div>{{ .BasicBio }}</div>
</div>
</div>
{{ range $props := .allprops }}
<div id="prop" class="Personal-properties-prop">
<div class="Personal-properties-prop-header">
Test Title:
</div>
<div class="Personal-properties-prop-content">
{{range $prop := $props}}
<div class="Personal-properties-prop-row">
<div class="Personal-properties-prop-key">{{.Key}}:</div>
<div class="Personal-properties-prop-values">
{{ range $value := .Values }}
<div class="Personal-properties-prop-value">
{{ $value }}
</div>
{{ end }}
</div>
</div>
{{ end }}
</div>
</div>
{{ end }}

View File

@ -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

View File

@ -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
}
}
}

View File

@ -2,6 +2,7 @@
<html lang="en" dir="ltr">
<title>Greg Brzezinski</title>
<head>
<script src="res/wde.js"></script>
<link rel="stylesheet" type="text/css" href="res/base.css">
<link rel="stylesheet" type="text/css" href="res/wdeUI.css">
<link rel="stylesheet" type="text/css" href="res/sys/wde/basic-widgets.css">
@ -9,27 +10,19 @@
<link rel="stylesheet" type="text/css" href="res/sys/wde/basic-widgets.css">
<link rel="stylesheet" type="text/css" href="res/sys/wde/file-view.css">
<link rel="stylesheet" type="text/css" href="res/sys/libs/fs.js">
<link rel="stylesheet" type="text/css" href="res/mobile-wdeUI.css">
<link rel="stylesheet" href="/res/sys/wde/simple-scrollbar.css">
<link rel="stylesheet" type="text/css" href="res/sys/finder/finder.css">
<!-- <link rel="stylesheet" type="text/css" href="res/mobile-wdeUI.css"> -->
<!-- TODO: Move css init to js -->
<link rel="stylesheet" type="text/css" href="res/dev-fs/apps/finder/finder.css">
<link rel="stylesheet" href="/res/sys/personal-properties/personal-properies.css">
<link rel="stylesheet" href="/res/sys/img-viewer/img-viewer.css">
<link rel="stylesheet" href="/res/sys/blog-viewer/blog-viewer.css">
<script src="/res/sys/wde/wde-scrollbar.js"></script>
<script src="/res/sys/wde/file-view.js"></script>
<script src="res/wde.js"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> -->
<!-- <script src="res/decorat.js"></script> -->
<!-- TODO Load with app -->
<!-- <script src="res/personal-properties.js"></script> -->
</head>
<body>
<!-- <div id="WindowsLayer"></div> -->
<div id="applications"></div>
<div id="desktop-layer"></div>
<div id="windows-layer"></div>
<!-- <div id="TestWindow" style="width: 100px; height: 100px; background-color: darkkhaki; position: absolute;" >
<div id="TestWindowHeader" class="VisualDragArea" style="width: 100%;height: 15px; background-color: cornflowerblue;">
</div> -->
</body>
</html>