Skip to content
Snippets Groups Projects
Verified Commit cd3c1f3d authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: commit save point

parent 5e44317c
No related branches found
No related tags found
No related merge requests found
...@@ -56,17 +56,23 @@ Server: ...@@ -56,17 +56,23 @@ Server:
The following placeholders can be used in the Commandline. The following placeholders can be used in the Commandline.
| Placeholder | Description | | Placeholder | Description |
| ----------- |------------------------------------------------| | ----------- |------------------------------------------------|
| `Path` | The Watched Path | | `Path` | The Watched Path |
| `IsDir` | Is the Path a directory? | | `IsDir` | Is the Path a directory? |
| `Directory` | If the path is a file, then the directory here | | `Directory` | If the path is a file, then the directory here |
| `WebPath` | The Web Path | | `WebPath` | The Web Path |
| `ConfigPath` | The Config Path |
| `PID` | The Process ID (Server) | | `PID` | The Process ID (Server) |
| `Bin` | The command used to start the server. | | `Bin` | The command used to start the server. |
| `Call` | The entire call | | `Call` | The entire call |
The `!reload` command can be used to send the browser a message to reload the page.
The command must be enclosed in quotation marks.
```bash
### Server ### Server
Start server and deliver files. Start server and deliver files.
......
...@@ -18,14 +18,24 @@ require ( ...@@ -18,14 +18,24 @@ require (
require ( require (
bitbucket.org/creachadair/shell v0.0.7 // indirect bitbucket.org/creachadair/shell v0.0.7 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/bitfield/script v0.20.2 // indirect github.com/bitfield/script v0.20.2 // indirect
github.com/dave/jennifer v1.5.1 // indirect github.com/dave/jennifer v1.5.1 // indirect
github.com/evanw/esbuild v0.15.6 // indirect github.com/evanw/esbuild v0.15.6 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/imdario/mergo v0.3.11 // indirect
github.com/itchyny/gojq v0.12.7 // indirect github.com/itchyny/gojq v0.12.7 // indirect
github.com/itchyny/timefmt-go v0.1.3 // indirect github.com/itchyny/timefmt-go v0.1.3 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/unknwon/com v1.0.1 // indirect github.com/unknwon/com v1.0.1 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
go.uber.org/atomic v1.7.0 // indirect go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect go.uber.org/multierr v1.6.0 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
) )
...@@ -2,6 +2,12 @@ bitbucket.org/creachadair/shell v0.0.7 h1:Z96pB6DkSb7F3Y3BBnJeOZH2gazyMTWlvecSD4 ...@@ -2,6 +2,12 @@ bitbucket.org/creachadair/shell v0.0.7 h1:Z96pB6DkSb7F3Y3BBnJeOZH2gazyMTWlvecSD4
bitbucket.org/creachadair/shell v0.0.7/go.mod h1:oqtXSSvSYr4624lnnabXHaBsYW6RD80caLi2b3hJk0U= bitbucket.org/creachadair/shell v0.0.7/go.mod h1:oqtXSSvSYr4624lnnabXHaBsYW6RD80caLi2b3hJk0U=
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8 h1:tJQRXgZigkLeeW9LPlps9G9aMoE6LAmqigLA+wxmd1Q= gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8 h1:tJQRXgZigkLeeW9LPlps9G9aMoE6LAmqigLA+wxmd1Q=
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8/go.mod h1:fc/pjt5EqNKgqQXYzcas1Z5L5whkZHyOvTA7OzWVJck= gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8/go.mod h1:fc/pjt5EqNKgqQXYzcas1Z5L5whkZHyOvTA7OzWVJck=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8=
github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/bitfield/script v0.20.2 h1:4DexsRtBILVMEn3EZwHbtJdDqdk43sXI8gM3F04JXgs= github.com/bitfield/script v0.20.2 h1:4DexsRtBILVMEn3EZwHbtJdDqdk43sXI8gM3F04JXgs=
github.com/bitfield/script v0.20.2/go.mod h1:l3AZPVAtKQrL03bwh7nlNTUtgrgSWurpJSbtqspYrOA= github.com/bitfield/script v0.20.2/go.mod h1:l3AZPVAtKQrL03bwh7nlNTUtgrgSWurpJSbtqspYrOA=
...@@ -46,6 +52,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ ...@@ -46,6 +52,7 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ= github.com/gookit/color v1.5.1 h1:Vjg2VEcdHpwq+oY63s/ksHrgJYCTo0bwWvmmYWdE9fQ=
...@@ -56,6 +63,10 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORR ...@@ -56,6 +63,10 @@ github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORR
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ= github.com/itchyny/gojq v0.12.7 h1:hYPTpeWfrJ1OT+2j6cvBScbhl0TkdwGM4bc66onUSOQ=
github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw= github.com/itchyny/gojq v0.12.7/go.mod h1:ZdvNHVlzPgUf8pgjnuDTmGfHA/21KoutQUJ3An/xNuw=
github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU= github.com/itchyny/timefmt-go v0.1.3 h1:7M3LGVDsqcd0VZH2U+x393obrzZisp7C0uEe921iRkU=
...@@ -68,6 +79,10 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV ...@@ -68,6 +79,10 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY=
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
...@@ -84,6 +99,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb ...@@ -84,6 +99,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sethvargo/go-envconfig v0.8.2 h1:DDUVuG21RMgeB/bn4leclUI/837y6cQCD4w8hb5797k= github.com/sethvargo/go-envconfig v0.8.2 h1:DDUVuG21RMgeB/bn4leclUI/837y6cQCD4w8hb5797k=
github.com/sethvargo/go-envconfig v0.8.2/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0= github.com/sethvargo/go-envconfig v0.8.2/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ=
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw=
github.com/siddontang/ledisdb v0.0.0-20190202134119-8ceb77e66a92/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg= github.com/siddontang/ledisdb v0.0.0-20190202134119-8ceb77e66a92/go.mod h1:mF1DpOSOUiJRMR+FDqaqu3EBqrybQtrDDszLUZ6oxPg=
github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA=
...@@ -93,8 +110,12 @@ github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1 ...@@ -93,8 +110,12 @@ github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
...@@ -112,6 +133,8 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i ...@@ -112,6 +133,8 @@ go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9i
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY= go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY= go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
...@@ -157,6 +180,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy ...@@ -157,6 +180,7 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
......
package watch package watch
import ( //
"gitlab.schukai.com/oss/utilities/conan/configuration" //import (
"gitlab.schukai.com/oss/utilities/conan/constants" // "gitlab.schukai.com/oss/utilities/conan/configuration"
"path" // "gitlab.schukai.com/oss/utilities/conan/constants"
) // "path"
//)
func getScriptName() string { //
return "app.js" //func getScriptName() string {
} // return "app.js"
func getStyleName() string { //}
return "app.css" //func getStyleName() string {
} // return "app.css"
//}
func newDataset(appID string) *Dataset { //
//func newDataset(appID string) *Dataset {
webPath := configuration.GetServerWebPath() //
// webPath := configuration.GetServerWebPath()
scriptName := getScriptName() //
relScriptPath := path.Join(appID, constants.AppScriptDirectory) // scriptName := getScriptName()
absScriptPath := path.Join(webPath, relScriptPath) // relScriptPath := path.Join(appID, constants.AppScriptDirectory)
scriptHash := GetFileHash(path.Join(absScriptPath, scriptName)) // absScriptPath := path.Join(webPath, relScriptPath)
relScriptPath = path.Join("/", relScriptPath, scriptHash, scriptName) // scriptHash := GetFileHash(path.Join(absScriptPath, scriptName))
// relScriptPath = path.Join("/", relScriptPath, scriptHash, scriptName)
styleName := getStyleName() //
relStylePath := path.Join(appID, constants.AppStyleDirectory) // styleName := getStyleName()
absStylePath := path.Join(webPath, relStylePath) // relStylePath := path.Join(appID, constants.AppStyleDirectory)
styleHash := GetFileHash(path.Join(absStylePath, styleName)) // absStylePath := path.Join(webPath, relStylePath)
relStylePath = path.Join("/", relStylePath, styleHash, styleName) // styleHash := GetFileHash(path.Join(absStylePath, styleName))
// relStylePath = path.Join("/", relStylePath, styleHash, styleName)
manifestPath := path.Join("/", appID, constants.WebManifestName) //
faviconPath := path.Join("/", appID, constants.FaviconName) // manifestPath := path.Join("/", appID, constants.WebManifestName)
// faviconPath := path.Join("/", appID, constants.FaviconName)
tags := &Tags{ //
Config: "", // tags := &Tags{
WebManifest: "<link rel=\"manifest\" href=\"" + manifestPath + "\" crossorigin=\"use-credentials\">", // Config: "",
Favicon: "<link rel=\"icon\" href=\"" + faviconPath + "\">", // WebManifest: "<link rel=\"manifest\" href=\"" + manifestPath + "\" crossorigin=\"use-credentials\">",
Script: "<script type=\"module\" src=\"" + relScriptPath + "\"></script>", // Favicon: "<link rel=\"icon\" href=\"" + faviconPath + "\">",
Style: "<link rel=\"stylesheet\" href=\"" + relStylePath + "\">", // Script: "<script type=\"module\" src=\"" + relScriptPath + "\"></script>",
Cache: "<meta http-equiv=\"cache-control\" content=\"" + constants.StandardCacheControl + "\">", // Style: "<link rel=\"stylesheet\" href=\"" + relStylePath + "\">",
} // Cache: "<meta http-equiv=\"cache-control\" content=\"" + constants.StandardCacheControl + "\">",
// }
meta := &Meta{ //
Language: "en", // meta := &Meta{
} // Language: "en",
// }
dataset := &Dataset{ //
Mnemonic: appID, // dataset := &Dataset{
Tags: tags, // Mnemonic: appID,
Meta: meta, // Tags: tags,
} // Meta: meta,
// }
return dataset //
// return dataset
} //
//}
type Meta struct { //
Language string //type Meta struct {
} // Language string
//}
type Resources struct { //
Script string //type Resources struct {
Style string // Script string
} // Style string
//}
type Tags struct { //
Config string //type Tags struct {
WebManifest string // Config string
Favicon string // WebManifest string
Script string // Favicon string
Style string // Script string
Cache string // Style string
} // Cache string
//}
type Dataset struct { //
Mnemonic string //type Dataset struct {
*Tags // Mnemonic string
*Meta // *Tags
*Resources // *Meta
} // *Resources
//}
package watch package watch
import ( //
"crypto/md5" //import (
"encoding/hex" // "crypto/md5"
"io" // "encoding/hex"
"os" // "io"
"sync" // "os"
"time" // "sync"
) // "time"
//)
type FileHash struct { //
Name string //type FileHash struct {
Hash string // Name string
expiresAt int64 // Hash string
} // expiresAt int64
//}
var ( //
fileHashCache map[string]FileHash //var (
fileHashMutex *sync.Mutex // fileHashCache map[string]FileHash
) // fileHashMutex *sync.Mutex
//)
func init() { //
fileHashCache = make(map[string]FileHash) //func init() {
fileHashMutex = &sync.Mutex{} // fileHashCache = make(map[string]FileHash)
// fileHashMutex = &sync.Mutex{}
go func() { //
for { // go func() {
time.Sleep(time.Minute * 60 * 24) // 1 day // for {
fileHashMutex.Lock() // time.Sleep(time.Minute * 60 * 24) // 1 day
for k, v := range fileHashCache { // fileHashMutex.Lock()
if v.expiresAt < time.Now().Unix() { // for k, v := range fileHashCache {
delete(fileHashCache, k) // if v.expiresAt < time.Now().Unix() {
} // delete(fileHashCache, k)
} // }
fileHashMutex.Unlock() // }
} // fileHashMutex.Unlock()
}() // }
// }()
} //
//}
func RemoveFileHash(path string) { //
fileHashMutex.Lock() //func RemoveFileHash(path string) {
defer fileHashMutex.Unlock() // fileHashMutex.Lock()
// defer fileHashMutex.Unlock()
if _, ok := fileHashCache[path]; ok { //
delete(fileHashCache, path) // if _, ok := fileHashCache[path]; ok {
} // delete(fileHashCache, path)
// }
} //
//}
func GetFileHash(path string) string { //
fileHashMutex.Lock() //func GetFileHash(path string) string {
defer fileHashMutex.Unlock() // fileHashMutex.Lock()
// defer fileHashMutex.Unlock()
if hash, ok := fileHashCache[path]; ok { //
return hash.Hash // if hash, ok := fileHashCache[path]; ok {
} // return hash.Hash
// }
h, err := buildHash(path) //
if err != nil { // h, err := buildHash(path)
return "" // if err != nil {
} // return ""
// }
fileHashCache[path] = h //
// fileHashCache[path] = h
return h.Hash //
} // return h.Hash
//}
type FileHashes map[string]FileHash //
//type FileHashes map[string]FileHash
func buildHash(path string) (FileHash, error) { //
var h FileHash // HASH //func buildHash(path string) (FileHash, error) {
// var h FileHash // HASH
h.Name = path //
h.Hash, _ = hashFile(path) // h.Name = path
h.expiresAt = time.Now().Unix() + 3600*24 // 1 day // h.Hash, _ = hashFile(path)
return h, nil // h.expiresAt = time.Now().Unix() + 3600*24 // 1 day
} // return h, nil
//}
func hashFile(path string) (string, error) { //
var h string // HASH //func hashFile(path string) (string, error) {
// var h string // HASH
file, err := os.Open(path) //
if err != nil { // file, err := os.Open(path)
return h, err // if err != nil {
} // return h, err
// }
defer file.Close() //
// defer file.Close()
hash := md5.New() //
// hash := md5.New()
if _, err := io.Copy(hash, file); err != nil { //
return h, err // if _, err := io.Copy(hash, file); err != nil {
} // return h, err
// }
hashInBytes := hash.Sum(nil)[:16] //
h = hex.EncodeToString(hashInBytes) // hashInBytes := hash.Sum(nil)[:16]
// h = hex.EncodeToString(hashInBytes)
return h, nil //
// return h, nil
} //
//}
...@@ -2,6 +2,7 @@ package watch ...@@ -2,6 +2,7 @@ package watch
import ( import (
"bytes" "bytes"
"github.com/Masterminds/sprig/v3"
"github.com/bitfield/script" "github.com/bitfield/script"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
"gitlab.schukai.com/oss/utilities/conan/configuration" "gitlab.schukai.com/oss/utilities/conan/configuration"
...@@ -68,13 +69,17 @@ func executeWatchAction(watchPath string) { ...@@ -68,13 +69,17 @@ func executeWatchAction(watchPath string) {
if w.Command == "" { if w.Command == "" {
logging.LogDebug("watching: no command defined for %s", watchPath) logging.LogDebug("watching: no command defined for %s", watchPath)
continue
}
if w.Command == "!reload" {
websocket.SendReloadMessage() websocket.SendReloadMessage()
continue continue
} }
logging.LogDebug("watching: execute watch action: %s", w.Command) logging.LogDebug("watching: execute watch action: %s", w.Command)
t, err := template.New("command").Parse(w.Command) t, err := template.New("").Funcs(sprig.FuncMap()).Parse(w.Command)
if err != nil { if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error()) logging.LogError("watching: execute watch action error: %v", err.Error())
continue continue
...@@ -83,6 +88,7 @@ func executeWatchAction(watchPath string) { ...@@ -83,6 +88,7 @@ func executeWatchAction(watchPath string) {
data := make(map[string]interface{}) data := make(map[string]interface{})
data["Path"] = watchPath data["Path"] = watchPath
data["WebPath"] = configuration.GetServerWebPath() data["WebPath"] = configuration.GetServerWebPath()
data["ConfigPath"] = configuration.GetConfigurationPath()
data["PID"] = os.Getpid() data["PID"] = os.Getpid()
data["Bin"] = os.Args[0] data["Bin"] = os.Args[0]
data["Call"] = strings.Join(os.Args[0:], " ") data["Call"] = strings.Join(os.Args[0:], " ")
...@@ -116,7 +122,7 @@ func executeWatchAction(watchPath string) { ...@@ -116,7 +122,7 @@ func executeWatchAction(watchPath string) {
} }
r, err := result.String() r, err := result.String()
logging.LogDebug("%s", r) logging.LogInfo("%s", r)
if err != nil { if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error()) logging.LogError("watching: execute watch action error: %v", err.Error())
...@@ -144,7 +150,7 @@ func StartWatching() error { ...@@ -144,7 +150,7 @@ func StartWatching() error {
if event.Op&fsnotify.Chmod == fsnotify.Chmod { if event.Op&fsnotify.Chmod == fsnotify.Chmod {
logging.LogDebug("watching: chmod file: %s", d) logging.LogDebug("watching: chmod file: %s", d)
RemoveFileHash(fullPath) //RemoveFileHash(fullPath)
} }
if event.Op&fsnotify.Write == fsnotify.Write { if event.Op&fsnotify.Write == fsnotify.Write {
...@@ -155,7 +161,7 @@ func StartWatching() error { ...@@ -155,7 +161,7 @@ func StartWatching() error {
continue continue
} }
RemoveFileHash(fullPath) //RemoveFileHash(fullPath)
executeWatchAction(fullPath) executeWatchAction(fullPath)
} }
...@@ -168,13 +174,13 @@ func StartWatching() error { ...@@ -168,13 +174,13 @@ func StartWatching() error {
if event.Op&fsnotify.Remove == fsnotify.Remove { if event.Op&fsnotify.Remove == fsnotify.Remove {
logging.LogDebug("watching: removed file: %s", d) logging.LogDebug("watching: removed file: %s", d)
removeFromWatchlist(fullPath) removeFromWatchlist(fullPath)
RemoveFileHash(fullPath) //RemoveFileHash(fullPath)
} }
if event.Op&fsnotify.Rename == fsnotify.Rename { if event.Op&fsnotify.Rename == fsnotify.Rename {
logging.LogDebug("watching: renamed file: %s", event.Name) logging.LogDebug("watching: renamed file: %s", event.Name)
removeFromWatchlist(fullPath) removeFromWatchlist(fullPath)
RemoveFileHash(fullPath) //RemoveFileHash(fullPath)
} }
case err, ok := <-watcher.Errors: case err, ok := <-watcher.Errors:
...@@ -197,7 +203,8 @@ func InitWatch() { ...@@ -197,7 +203,8 @@ func InitWatch() {
watchList := configuration.GetWatch() watchList := configuration.GetWatch()
if len(watchList) == 0 { if len(watchList) == 0 {
watchList = append(watchList, configuration.Watch{ watchList = append(watchList, configuration.Watch{
Path: configuration.GetServerWebPath(), Path: configuration.GetServerWebPath(),
Command: "!reload",
}) })
} }
......
{"version":"1.0.1"} {"version":"1.0.2"}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment