CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
fix: safe cmd (#1921)
Ns2Kracy18ce1d634247
diff --git a/go.mod b/go.modindex 10da34f..6c341c9 100644--- a/go.mod+++ b/go.mod@@ -1,10 +1,10 @@module github.com/IceWhaleTech/CasaOS-go 1.20+go 1.21require (github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d- github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha3+ github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcfgithub.com/deckarep/golang-set/v2 v2.3.0github.com/deepmap/oapi-codegen v1.12.4@@ -23,7 +23,7 @@ require (github.com/h2non/filetype v1.1.3github.com/hirochachacha/go-smb2 v1.1.0github.com/json-iterator/go v1.1.12- github.com/labstack/echo/v4 v4.10.2+ github.com/labstack/echo/v4 v4.12.0github.com/maruel/natural v1.1.0github.com/mholt/archiver/v3 v3.5.1github.com/mileusna/useragent v1.2.1@@ -35,14 +35,14 @@ require (github.com/samber/lo v1.38.1github.com/shirou/gopsutil/v3 v3.23.2github.com/sirupsen/logrus v1.9.3- github.com/stretchr/testify v1.8.4- github.com/tidwall/gjson v1.14.4+ github.com/stretchr/testify v1.9.0+ github.com/tidwall/gjson v1.17.0go.uber.org/goleak v1.2.1go.uber.org/zap v1.24.0- golang.org/x/crypto v0.22.0+ golang.org/x/crypto v0.23.0golang.org/x/oauth2 v0.7.0golang.org/x/sync v0.3.0- golang.org/x/sys v0.19.0+ golang.org/x/sys v0.20.0gorm.io/gorm v1.25.0gotest.tools v2.2.0+incompatible)@@ -51,47 +51,37 @@ require (github.com/andybalholm/brotli v1.0.5 // indirectgithub.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirectgithub.com/benbjohnson/clock v1.3.1 // indirect- github.com/bytedance/sonic v1.9.1 // indirect- github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirectgithub.com/coreos/go-systemd/v22 v22.5.0 // indirectgithub.com/davecgh/go-spew v1.1.1 // indirectgithub.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirectgithub.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirectgithub.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349 // indirectgithub.com/dustin/go-humanize v1.0.1 // indirect- github.com/gabriel-vasile/mimetype v1.4.2 // indirectgithub.com/geoffgarside/ber v1.1.0 // indirect- github.com/gin-contrib/sse v0.1.0 // indirect- github.com/gin-gonic/gin v1.9.1 // indirectgithub.com/glebarez/go-sqlite v1.21.1 // indirectgithub.com/go-errors/errors v1.4.2 // indirectgithub.com/go-ole/go-ole v1.2.6 // indirectgithub.com/go-openapi/jsonpointer v0.19.6 // indirectgithub.com/go-openapi/swag v0.22.3 // indirect- github.com/go-playground/locales v0.14.1 // indirect- github.com/go-playground/universal-translator v0.18.1 // indirect- github.com/go-playground/validator/v10 v10.14.0 // indirect- github.com/goccy/go-json v0.10.2 // indirectgithub.com/godbus/dbus/v5 v5.1.0 // indirectgithub.com/gofrs/uuid v4.4.0+incompatible // indirectgithub.com/golang-jwt/jwt v3.2.2+incompatible // indirect- github.com/golang-jwt/jwt/v4 v4.5.0 // indirect+ github.com/golang-jwt/jwt/v5 v5.0.0 // indirectgithub.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirectgithub.com/golang/protobuf v1.5.3 // indirectgithub.com/golang/snappy v0.0.4 // indirectgithub.com/google/go-cmp v0.6.0 // indirectgithub.com/google/go-querystring v1.1.0 // indirect+ github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f // indirectgithub.com/gorilla/mux v1.8.0 // indirectgithub.com/invopop/yaml v0.2.0 // indirectgithub.com/jinzhu/inflection v1.0.0 // indirectgithub.com/jinzhu/now v1.1.5 // indirectgithub.com/josharian/intern v1.0.0 // indirectgithub.com/klauspost/compress v1.16.5 // indirect- github.com/klauspost/cpuid/v2 v2.2.4 // indirectgithub.com/klauspost/pgzip v1.2.5 // indirect- github.com/kr/pretty v0.3.1 // indirect+ github.com/labstack/echo-jwt/v4 v4.2.0 // indirectgithub.com/labstack/gommon v0.4.2 // indirect- github.com/leodido/go-urn v1.2.4 // indirectgithub.com/lufia/plan9stats v0.0.0-20230110061619-bbe2e5e100de // indirectgithub.com/mailru/easyjson v0.7.7 // indirectgithub.com/mattn/go-colorable v0.1.13 // indirect@@ -100,18 +90,15 @@ require (github.com/modern-go/reflect2 v1.0.2 // indirectgithub.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirectgithub.com/nwaples/rardecode v1.1.3 // indirect- github.com/pelletier/go-toml/v2 v2.0.8 // indirectgithub.com/perimeterx/marshmallow v1.1.4 // indirectgithub.com/pierrec/lz4/v4 v4.1.17 // indirectgithub.com/pmezard/go-difflib v1.0.0 // indirectgithub.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirectgithub.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect- github.com/rogpeppe/go-internal v1.10.0 // indirectgithub.com/tidwall/match v1.1.1 // indirectgithub.com/tidwall/pretty v1.2.1 // indirectgithub.com/tklauser/go-sysconf v0.3.11 // indirectgithub.com/tklauser/numcpus v0.6.0 // indirect- github.com/twitchyliquid64/golang-asm v0.15.1 // indirectgithub.com/ugorji/go/codec v1.2.11 // indirectgithub.com/ulikunitz/xz v0.5.11 // indirectgithub.com/valyala/bytebufferpool v1.0.0 // indirect@@ -120,11 +107,10 @@ require (github.com/yusufpapurcu/wmi v1.2.2 // indirectgo.uber.org/atomic v1.10.0 // indirectgo.uber.org/multierr v1.11.0 // indirect- golang.org/x/arch v0.3.0 // indirectgolang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirectgolang.org/x/image v0.6.0 // indirect- golang.org/x/net v0.24.0 // indirect- golang.org/x/text v0.14.0 // indirect+ golang.org/x/net v0.25.0 // indirect+ golang.org/x/text v0.15.0 // indirectgolang.org/x/time v0.5.0 // indirectgoogle.golang.org/appengine v1.6.7 // indirectgoogle.golang.org/protobuf v1.30.0 // indirect@@ -135,4 +121,5 @@ require (modernc.org/mathutil v1.5.0 // indirectmodernc.org/memory v1.5.0 // indirectmodernc.org/sqlite v1.21.2 // indirect+ mvdan.cc/sh/v3 v3.7.0 // indirect)diff --git a/go.sum b/go.sumindex 488426b..b355474 100644--- a/go.sum+++ b/go.sum@@ -1,7 +1,7 @@github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d h1:62lEBImTxZ83pgzywgDNIrPPuQ+j4ep9QjqrWBn1hrU=github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ=-github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha3 h1:5E5LAqi2uXpOZqcPOgQ4m6d9MagYyfhKIFXnzd8s3W4=-github.com/IceWhaleTech/CasaOS-Common v0.4.8-alpha3/go.mod h1:2IuYyy5qW1BE6jqC6M+tOU+WtUec1K565rLATBJ9p/0=+github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6 h1:ojExdb1fZDieTBYgNwopHAsW4FMGKkat4id8YwyyE0g=+github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6/go.mod h1:W/768nPd9BJXh+a72y8hUJNcmjDvyMqlXxlT+lOT3t4=github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=@@ -11,12 +11,6 @@ github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1APgithub.com/benbjohnson/clock v1.3.1 h1:Heo0FGXzOxUHquZbraxt+tT7UXVDhesUQH5ISbsOkCQ=github.com/benbjohnson/clock v1.3.1/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w=-github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=-github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=-github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=-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/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=@@ -53,16 +47,12 @@ github.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349 h1:DilThiXjegithub.com/dsoprea/go-utility/v2 v2.0.0-20221003172846-a3e1774ef349/go.mod h1:4GC5sXji84i/p+irqghpPFZBF8tRN/Q7+700G0/DLe8=github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=-github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=-github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=+github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=+github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=github.com/geoffgarside/ber v1.1.0 h1:qTmFG4jJbwiSzSXoNJeHcOprVzZ8Ulde2Rrrifu5U9w=github.com/geoffgarside/ber v1.1.0/go.mod h1:jVPKeCbj6MvQZhwLYsGwaGI52oUorHoHKNecGT85ZCc=github.com/getkin/kin-openapi v0.117.0 h1:QT2DyGujAL09F4NrKDHJGsUoIprlIcFVHWDVDcUFE8A=github.com/getkin/kin-openapi v0.117.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc=-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.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=-github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=github.com/glebarez/go-sqlite v1.21.1 h1:7MZyUPh2XTrHS7xNEHQbrhfMZuPSzhkm2A1qgg0y5NY=github.com/glebarez/go-sqlite v1.21.1/go.mod h1:ISs8MF6yk5cL4n/43rSOmVMGJJjHYr7L2MbZZ5Q4E2E=github.com/glebarez/sqlite v1.8.0 h1:02X12E2I/4C1n+v90yTqrjRa8yuo7c3KeHI3FRznCvc=@@ -82,19 +72,10 @@ github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLgithub.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=-github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=-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.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.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js=-github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=github.com/go-resty/resty/v2 v2.7.0 h1:me+K9p3uhSmXtrBZ4k9jcEAfJmuC8IivWHwaLZwPrFY=github.com/go-resty/resty/v2 v2.7.0/go.mod h1:9PWDzw47qPphMRFfhsyk0NnSgvluHcljSMVIq3w7q0I=github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=-github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=-github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=@@ -103,8 +84,8 @@ github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=-github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=-github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=+github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=+github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo=@@ -135,6 +116,9 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yDgithub.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=+github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=+github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f h1:o2yGZLlsOj5H5uvtQNEdi6DeA0GbUP3lm0gWW5RvY0s=+github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f/go.mod h1:H3K1Iu/utuCfa10JO+GsmKUYSWi7ug57Rk6GaDRHaaQ=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/googollee/go-socket.io v1.7.0 h1:ODcQSAvVIPvKozXtUGuJDV3pLwdpBLDs1Uoq/QHIlY8=@@ -167,9 +151,6 @@ github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsgithub.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=-github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=-github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=-github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=@@ -180,12 +161,12 @@ 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 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=-github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=-github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=+github.com/labstack/echo-jwt/v4 v4.2.0 h1:odSISV9JgcSCuhgQSV/6Io3i7nUmfM/QkBeR5GVJj5c=+github.com/labstack/echo-jwt/v4 v4.2.0/go.mod h1:MA2RqdXdEn4/uEglx0HcUOgQSyBaTh5JcaHIan3biwU=+github.com/labstack/echo/v4 v4.12.0 h1:IKpw49IMryVB2p1a4dzwlhP1O2Tf2E0Ir/450lH+kI0=+github.com/labstack/echo/v4 v4.12.0/go.mod h1:UP9Cr2DJXbOK3Kr9ONYzNowSh7HP0aG0ShAyycHSJvM=github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=-github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=-github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0/go.mod h1:zJYVVT2jmtg6P3p1VtQj7WsuWi/y4VnjVBn7F8KPB3I=github.com/lufia/plan9stats v0.0.0-20230110061619-bbe2e5e100de h1:V53FWzU6KAZVi1tPp5UIsMoUWJ2/PNwYIDXnu7QuBCE=github.com/lufia/plan9stats v0.0.0-20230110061619-bbe2e5e100de/go.mod h1:JKx41uQRwqlTZabZc+kILPrO/3jlKnQ2Z8b7YiVw5cE=@@ -220,14 +201,11 @@ github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lgithub.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=-github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=-github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=github.com/perimeterx/marshmallow v1.1.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw=github.com/perimeterx/marshmallow v1.1.4/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw=github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc=github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=-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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=@@ -240,9 +218,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=-github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=-github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=+github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 h1:3RPlVWzZ/PDqmVuf/FKHARG5EMid/tl7cv54Sw/QRVY=+github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=github.com/shirou/gopsutil/v3 v3.23.2 h1:PAWSuiAszn7IhPMBtXsbSCafej7PqUOvY6YywlQUExU=@@ -260,11 +237,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=-github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=-github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=-github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=-github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=-github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=+github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=+github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=+github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=+github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=@@ -274,8 +250,6 @@ github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+Kdgithub.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=-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.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M=github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=@@ -302,15 +276,12 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=-golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=-golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=-golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=-golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=-golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=+golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=+golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw=golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=@@ -333,8 +304,8 @@ golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxgolang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=golang.org/x/net v0.0.0-20221002022538-bcab6841153b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=-golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=-golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=+golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=+golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g=golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=@@ -356,7 +327,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wgolang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=@@ -365,12 +335,13 @@ golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBcgolang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=-golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=-golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=+golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=+golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=-golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=+golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=+golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=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=@@ -378,8 +349,8 @@ 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/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=-golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=-golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=+golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=+golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=@@ -426,4 +397,5 @@ modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds=modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU=modernc.org/sqlite v1.21.2 h1:ixuUG0QS413Vfzyx6FWx6PYTmHaOegTY+hjzhn7L+a0=modernc.org/sqlite v1.21.2/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0=-rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=+mvdan.cc/sh/v3 v3.7.0 h1:lSTjdP/1xsddtaKfGg7Myu7DnlHItd3/M2tomOcNNBg=+mvdan.cc/sh/v3 v3.7.0/go.mod h1:K2gwkaesF/D7av7Kxl0HbF5kGOd2ArupNTX3X44+8l8=diff --git a/main.go b/main.goindex cb527f4..26e4b8c 100644--- a/main.go+++ b/main.go@@ -13,6 +13,7 @@ import ("time""github.com/IceWhaleTech/CasaOS-Common/model"+ "github.com/IceWhaleTech/CasaOS-Common/utils/command""github.com/IceWhaleTech/CasaOS-Common/utils/constants""github.com/IceWhaleTech/CasaOS-Common/utils/logger"@@ -22,7 +23,6 @@ import ("github.com/IceWhaleTech/CasaOS/pkg/cache""github.com/IceWhaleTech/CasaOS/pkg/config""github.com/IceWhaleTech/CasaOS/pkg/sqlite"- "github.com/IceWhaleTech/CasaOS/pkg/utils/command""github.com/IceWhaleTech/CasaOS/pkg/utils/file""github.com/IceWhaleTech/CasaOS/route""github.com/IceWhaleTech/CasaOS/service"@@ -154,7 +154,6 @@ func main() {Path: apiPath,Target: "http://" + listener.Addr().String(),})-if err != nil {fmt.Println("err", err)panic(err)diff --git a/pkg/utils/command/command_helper.go b/pkg/utils/command/command_helper.godeleted file mode 100644index d83c979..0000000--- a/pkg/utils/command/command_helper.go+++ /dev/null@@ -1,159 +0,0 @@-package command--import (- "bufio"- "fmt"- "io/ioutil"- "os"- "os/exec"- "path/filepath"- "strings"-)--func OnlyExec(cmdStr string) {- cmd := exec.Command("/bin/bash", "-c", cmdStr)- stdout, err := cmd.StdoutPipe()- if err != nil {- fmt.Println(err)- return- }- defer stdout.Close()- if err := cmd.Start(); err != nil {- fmt.Println(err)- return- }-- if err := cmd.Wait(); err != nil {- fmt.Println(err)- }-}--func ExecResultStrArray(cmdStr string) []string {- cmd := exec.Command("/bin/bash", "-c", cmdStr)- stdout, err := cmd.StdoutPipe()- if err != nil {- fmt.Println(err)- return nil- }- defer stdout.Close()- if err = cmd.Start(); err != nil {- fmt.Println(err)- return nil- }- // str, err := ioutil.ReadAll(stdout)- networklist := []string{}- outputBuf := bufio.NewReader(stdout)- for {- output, _, err := outputBuf.ReadLine()- if err != nil {- if err.Error() != "EOF" {- fmt.Printf("Error :%s\n", err)- }- break- }- networklist = append(networklist, string(output))- }-- if err := cmd.Wait(); err != nil {- fmt.Println(err)- }-- return networklist-}--func ExecResultStr(cmdStr string) string {- cmd := exec.Command("/bin/bash", "-c", cmdStr)- println(cmd.String())-- stdout, err := cmd.StdoutPipe()- if err != nil {- fmt.Println(err)- return ""- }- defer stdout.Close()- if err := cmd.Start(); err != nil {- fmt.Println(err)- return ""- }- str, err := ioutil.ReadAll(stdout)- if err != nil {- fmt.Println(err)- return ""- }-- if err := cmd.Wait(); err != nil {- fmt.Println(err)- }-- return string(str)-}--// 执行 lsblk 命令-func ExecLSBLK() []byte {- output, err := exec.Command("lsblk", "-O", "-J", "-b").Output()- if err != nil {- fmt.Println("lsblk", err)- return nil- }- return output-}--// 执行 lsblk 命令-func ExecLSBLKByPath(path string) []byte {- output, err := exec.Command("lsblk", path, "-O", "-J", "-b").Output()- if err != nil {- fmt.Println("lsblk", err)- return nil- }- return output-}--func ExecuteScripts(scriptDirectory string) {- if _, err := os.Stat(scriptDirectory); os.IsNotExist(err) {- fmt.Printf("No post-start scripts at %s\n", scriptDirectory)- return- }-- files, err := os.ReadDir(scriptDirectory)- if err != nil {- fmt.Printf("Failed to read from script directory %s: %s\n", scriptDirectory, err.Error())- return- }-- for _, file := range files {- if file.IsDir() {- continue- }-- scriptFilepath := filepath.Join(scriptDirectory, file.Name())-- f, err := os.Open(scriptFilepath)- if err != nil {- fmt.Printf("Failed to open script file %s: %s\n", scriptFilepath, err.Error())- continue- }- f.Close()-- scanner := bufio.NewScanner(f)- scanner.Scan()- shebang := scanner.Text()-- interpreter := "/bin/sh"- if strings.HasPrefix(shebang, "#!") {- interpreter = shebang[2:]- }-- cmd := exec.Command(interpreter, scriptFilepath)-- fmt.Printf("Executing post-start script %s using %s\n", scriptFilepath, interpreter)-- cmd.Stdout = os.Stdout- cmd.Stderr = os.Stderr-- err = cmd.Run()- if err != nil {- fmt.Printf("Failed to execute post-start script %s: %s\n", scriptFilepath, err.Error())- }- }- fmt.Println("Finished executing post-start scripts.")-}diff --git a/pkg/utils/command/command_helper_test.go b/pkg/utils/command/command_helper_test.godeleted file mode 100644index 0bbf6e4..0000000--- a/pkg/utils/command/command_helper_test.go+++ /dev/null@@ -1,33 +0,0 @@-package command_test--import (- "os"- "testing"-- "github.com/IceWhaleTech/CasaOS/pkg/utils/command"- "go.uber.org/goleak"- "gotest.tools/assert"-)--func TestExecuteScripts(t *testing.T) {- goleak.VerifyNone(t)-- // make a temp directory- tmpDir, err := os.MkdirTemp("", "casaos-test-*")- assert.NilError(t, err)- defer os.RemoveAll(tmpDir)-- command.ExecuteScripts(tmpDir)-- // create a sample script under tmpDir- script := tmpDir + "/test.sh"- f, err := os.Create(script)- assert.NilError(t, err)- defer f.Close()-- // write a sample script- _, err = f.WriteString("#!/bin/bash\necho 123")- assert.NilError(t, err)-- command.ExecuteScripts(tmpDir)-}diff --git a/route/v1/ssh.go b/route/v1/ssh.goindex 83c2e1b..4038e49 100644--- a/route/v1/ssh.go+++ b/route/v1/ssh.go@@ -38,8 +38,8 @@ func PostSshLogin(ctx echo.Context) error {}_, err := sshHelper.NewSshClient(userName, password, port)if err != nil {- return ctx.JSON(common_err.CLIENT_ERROR, modelCommon.Result{Success: common_err.CLIENT_ERROR, Message: common_err.GetMsg(common_err.CLIENT_ERROR), Data: "Please check if the username and port are correct, and make sure that ssh server is installed."})logger.Error("connect ssh error", zap.Any("error", err))+ return ctx.JSON(common_err.CLIENT_ERROR, modelCommon.Result{Success: common_err.CLIENT_ERROR, Message: common_err.GetMsg(common_err.CLIENT_ERROR), Data: "Please check if the username and port are correct, and make sure that ssh server is installed."})}return ctx.JSON(common_err.SUCCESS, modelCommon.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS)})}diff --git a/service/connections.go b/service/connections.goindex bc35c79..52034fa 100644--- a/service/connections.go+++ b/service/connections.go@@ -39,20 +39,25 @@ func (s *connectionsStruct) GetConnectionByHost(host string) (connections []modes.db.Select("username,host,status,id").Where("host = ?", host).Find(&connections)return}+func (s *connectionsStruct) GetConnectionByID(id string) (connections model2.ConnectionsDBModel) {s.db.Select("username,password,host,status,id,directories,mount_point,port").Where("id = ?", id).First(&connections)return}+func (s *connectionsStruct) GetConnectionsList() (connections []model2.ConnectionsDBModel) {s.db.Select("username,host,port,status,id,mount_point").Find(&connections)return}+func (s *connectionsStruct) CreateConnection(connection *model2.ConnectionsDBModel) {s.db.Create(connection)}+func (s *connectionsStruct) UpdateConnection(connection *model2.ConnectionsDBModel) {s.db.Save(connection)}+func (s *connectionsStruct) DeleteConnection(id string) {s.db.Where("id= ?", id).Delete(&model.ConnectionsDBModel{})}@@ -66,9 +71,10 @@ func (s *connectionsStruct) MountSmaba(username, host, directory, port, mountPoifmt.Sprintf("username=%s,password=%s", username, password),)return err- //str := command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;MountCIFS " + username + " " + host + " " + directory + " " + port + " " + mountPoint + " " + password)- //return str+ // str := command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;MountCIFS " + username + " " + host + " " + directory + " " + port + " " + mountPoint + " " + password)+ // return str}+func (s *connectionsStruct) UnmountSmaba(mountPoint string) error {return mount.Unmount(mountPoint)}diff --git a/service/shares.go b/service/shares.goindex 7b78964..70e482c 100644--- a/service/shares.go+++ b/service/shares.go@@ -14,8 +14,8 @@ import ("path/filepath""strings"+ "github.com/IceWhaleTech/CasaOS-Common/utils/command""github.com/IceWhaleTech/CasaOS/pkg/config"- command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command""github.com/IceWhaleTech/CasaOS/pkg/utils/file""github.com/IceWhaleTech/CasaOS/service/model"model2 "github.com/IceWhaleTech/CasaOS/service/model"@@ -47,19 +47,23 @@ func (s *sharesStruct) GetSharesByName(name string) (shares []model2.SharesDBModreturn}+func (s *sharesStruct) GetSharesByPath(path string) (shares []model2.SharesDBModel) {s.db.Select("anonymous,path,id").Where("path = ?", path).Find(&shares)return}+func (s *sharesStruct) GetSharesList() (shares []model2.SharesDBModel) {s.db.Select("anonymous,path,id").Find(&shares)return}+func (s *sharesStruct) CreateShare(share model2.SharesDBModel) {s.db.Create(&share)s.InitSambaConfig()s.UpdateConfigFile()}+func (s *sharesStruct) DeleteShare(id string) {s.db.Where("id= ?", id).Delete(&model.SharesDBModel{})s.UpdateConfigFile()@@ -68,8 +72,8 @@ func (s *sharesStruct) DeleteShare(id string) {func (s *sharesStruct) UpdateConfigFile() {shares := []model2.SharesDBModel{}s.db.Select("anonymous,path").Find(&shares)- //generated config file- var configStr = ""+ // generated config file+ configStr := ""for _, share := range shares {dirName := filepath.Base(share.Path)configStr += `@@ -86,12 +90,12 @@ force user = root`}- //write config file+ // write config filefile.WriteToPath([]byte(configStr), "/etc/samba", "smb.casa.conf")- //restart samba- command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/helper.sh ;RestartSMBD")-+ // restart samba+ command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;RestartSMBD")}+func (s *sharesStruct) InitSambaConfig() {if file.Exists("/etc/samba/smb.conf") {str := file.ReadLine(1, "/etc/samba/smb.conf")@@ -99,7 +103,7 @@ func (s *sharesStruct) InitSambaConfig() {return}file.MoveFile("/etc/samba/smb.conf", "/etc/samba/smb.conf.bak")- var smbConf = ""+ smbConf := ""smbConf += `# Copyright (c) 2021-2022 CasaOS Inc. All rights reserved.##@@ -150,7 +154,6 @@ func (s *sharesStruct) InitSambaConfig() {include=/etc/samba/smb.casa.conf`file.WriteToPath([]byte(smbConf), "/etc/samba", "smb.conf")}-}func NewSharesService(db *gorm.DB) SharesService {diff --git a/service/system.go b/service/system.goindex a830c42..064d987 100644--- a/service/system.go+++ b/service/system.go@@ -4,22 +4,23 @@ import ("encoding/json""errors""fmt"- "io/ioutil"+ "io"net2 "net""os"- "os/exec""path/filepath""runtime""strconv""strings""time"+ "github.com/IceWhaleTech/CasaOS-Common/utils/command"+ exec2 "github.com/IceWhaleTech/CasaOS-Common/utils/exec"+"github.com/IceWhaleTech/CasaOS-Common/utils/file""github.com/IceWhaleTech/CasaOS-Common/utils/logger""github.com/IceWhaleTech/CasaOS/common""github.com/IceWhaleTech/CasaOS/model""github.com/IceWhaleTech/CasaOS/pkg/config"- command2 "github.com/IceWhaleTech/CasaOS/pkg/utils/command""github.com/IceWhaleTech/CasaOS/pkg/utils/common_err""github.com/IceWhaleTech/CasaOS/pkg/utils/httper""github.com/IceWhaleTech/CasaOS/pkg/utils/ip_helper"@@ -119,6 +120,7 @@ func (c *systemService) GetDeviceInfo() model.DeviceInfo {return m}+func (c *systemService) GenreateSystemEntry() {modelsPath := "/var/lib/casaos/www/modules"entryFileName := "entry.json"@@ -141,15 +143,14 @@ func (c *systemService) GenreateSystemEntry() {}json = strings.TrimRight(json, ",")json += "]"- err = os.WriteFile(entryFilePath, []byte(json), 0666)+ err = os.WriteFile(entryFilePath, []byte(json), 0o666)if err != nil {logger.Error("write entry file error", zap.Error(err))return}-}-func (c *systemService) GetSystemEntry() string {+func (c *systemService) GetSystemEntry() string {modelsPath := "/var/lib/casaos/www/modules"entryFileName := "entry.json"dir, err := os.ReadDir(modelsPath)@@ -174,6 +175,7 @@ func (c *systemService) GetSystemEntry() string {}return json}+func (c *systemService) GetMacAddress() (string, error) {interfaces, err := net.Interfaces()if err != nil {@@ -235,7 +237,11 @@ func (c *systemService) CreateFile(path string) (int, error) {}func (c *systemService) GetDeviceTree() string {- return command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;GetDeviceTree")+ if output, err := command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;GetDeviceTree"); err != nil {+ return ""+ } else {+ return output+ }}func (c *systemService) GetSysInfo() host.InfoStat {@@ -255,7 +261,11 @@ func (c *systemService) GetDiskInfo() *disk.UsageStat {}func (c *systemService) GetNetState(name string) string {- return command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;CatNetCardState " + name)+ if output, err := command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;CatNetCardState " + name); err != nil {+ return ""+ } else {+ return output+ }}func (c *systemService) GetDirPathOne(path string) (m model.Path) {@@ -352,7 +362,12 @@ func (c *systemService) GetNet(physics bool) []string {if physics {t = "2"}- return command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/helper.sh ;GetNetCard " + t)++ if output, err := command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;GetNetCard " + t); err != nil {+ return []string{}+ } else {+ return strings.Split(output, "\n")+ }}func (s *systemService) UpdateSystemVersion(version string) {@@ -364,10 +379,10 @@ func (s *systemService) UpdateSystemVersion(version string) {file.CreateFile(config.AppInfo.LogPath + "/upgrade.log")// go command2.OnlyExec("curl -fsSL https://raw.githubusercontent.com/LinkLeong/casaos-alpha/main/update.sh | bash")if len(config.ServerInfo.UpdateUrl) > 0 {- go command2.OnlyExec("curl -fsSL " + config.ServerInfo.UpdateUrl + " | bash")+ go command.OnlyExec("curl -fsSL " + config.ServerInfo.UpdateUrl + " | bash")} else {osRelease, _ := file.ReadOSRelease()- go command2.OnlyExec("curl -fsSL https://get.casaos.io/update?t=" + osRelease["MANUFACTURER"] + " | bash")+ go command.OnlyExec("curl -fsSL https://get.casaos.io/update?t=" + osRelease["MANUFACTURER"] + " | bash")}// s.log.Error(config.AppInfo.ProjectPath + "/shell/tool.sh -r " + version)@@ -375,15 +390,23 @@ func (s *systemService) UpdateSystemVersion(version string) {}func (s *systemService) UpdateAssist() {- command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/assist.sh")+ command.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/assist.sh")}func (s *systemService) GetTimeZone() string {- return command2.ExecResultStr("source " + config.AppInfo.ShellPath + "/helper.sh ;GetTimeZone")+ if output, err := command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;GetTimeZone"); err != nil {+ return ""+ } else {+ return output+ }}func (s *systemService) GetSystemConfigDebug() []string {- return command2.ExecResultStrArray("source " + config.AppInfo.ShellPath + "/helper.sh ;GetSysInfo")+ if output, err := command.OnlyExec("source " + config.AppInfo.ShellPath + "/helper.sh ;GetSysInfo"); err != nil {+ return []string{}+ } else {+ return strings.Split(output, "\n")+ }}func (s *systemService) UpAppOrderFile(str, id string) {@@ -411,7 +434,7 @@ func (s *systemService) GetCasaOSLogs(lineNumber int) string {return err.Error()}defer file.Close()- content, err := ioutil.ReadAll(file)+ content, err := io.ReadAll(file)if err != nil {return err.Error()}@@ -510,9 +533,8 @@ func (s *systemService) GetCPUPower() map[string]string {}func (s *systemService) SystemReboot() error {- // cmd := exec.Command("/bin/bash", "-c", "reboot")arg := []string{"6"}- cmd := exec.Command("init", arg...)+ cmd := exec2.Command("init", arg...)_, err := cmd.CombinedOutput()if err != nil {return err@@ -522,7 +544,7 @@ func (s *systemService) SystemReboot() error {func (s *systemService) SystemShutdown() error {arg := []string{"0"}- cmd := exec.Command("init", arg...)+ cmd := exec2.Command("init", arg...)_, err := cmd.CombinedOutput()if err != nil {return err