diff --git a/backend/app/service/file.go b/backend/app/service/file.go index a601b356c..1f6007766 100644 --- a/backend/app/service/file.go +++ b/backend/app/service/file.go @@ -101,7 +101,7 @@ func (f FileService) GetContent(op dto.FileOption) (dto.FileInfo, error) { if err != nil { return dto.FileInfo{}, err } - return dto.FileInfo{*info}, nil + return dto.FileInfo{FileInfo: *info}, nil } func (f FileService) SaveContent(edit dto.FileEdit) error { @@ -169,7 +169,7 @@ func (f FileService) FileDownload(d dto.FileDownload) (string, error) { func getUuid() string { b := make([]byte, 16) - io.ReadFull(rand.Reader, b) + _, _ = io.ReadFull(rand.Reader, b) b[6] = (b[6] & 0x0f) | 0x40 b[8] = (b[8] & 0x3f) | 0x80 return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:]) diff --git a/backend/init/cache/badger_db/badger_db.go b/backend/init/cache/badger_db/badger_db.go index 3cbb7ac88..eeed465f1 100644 --- a/backend/init/cache/badger_db/badger_db.go +++ b/backend/init/cache/badger_db/badger_db.go @@ -55,7 +55,7 @@ func (c *Cache) Get(key string) ([]byte, error) { result = append([]byte{}, val...) return nil }) - return nil + return err }) return result, err } diff --git a/backend/init/cache/cache.go b/backend/init/cache/cache.go index e7f424ba3..c627efdb8 100644 --- a/backend/init/cache/cache.go +++ b/backend/init/cache/cache.go @@ -1,7 +1,6 @@ package cache import ( - "fmt" "github.com/1Panel-dev/1Panel/global" "github.com/1Panel-dev/1Panel/init/cache/badger_db" "github.com/dgraph-io/badger/v3" @@ -51,25 +50,4 @@ func Init() { } global.CACHE = badger_db.NewCacheDB(cache) - - err = cache.View(func(txn *badger.Txn) error { - opts := badger.DefaultIteratorOptions - opts.PrefetchValues = false - it := txn.NewIterator(opts) - defer it.Close() - for it.Rewind(); it.Valid(); it.Next() { - item := it.Item() - k := item.Key() - fmt.Printf("key=%s\n", k) - } - return nil - }) - if err != nil { - panic(err) - } - fmt.Printf("run gc") - err = cache.RunValueLogGC(0.01) - if err != nil { - fmt.Printf(err.Error()) - } } diff --git a/backend/init/session/psession/psession.go b/backend/init/session/psession/psession.go index 9fbc03460..3bf474f30 100644 --- a/backend/init/session/psession/psession.go +++ b/backend/init/session/psession/psession.go @@ -28,7 +28,7 @@ func (p *PSession) Get(sessionID string) (SessionUser, error) { if err != nil { return result, err } - json.Unmarshal(item, &result) + _ = json.Unmarshal(item, &result) return result, nil } diff --git a/backend/utils/files/file_op.go b/backend/utils/files/file_op.go index 6ef469a73..18905e709 100644 --- a/backend/utils/files/file_op.go +++ b/backend/utils/files/file_op.go @@ -50,10 +50,7 @@ func (f FileOp) DeleteDir(dst string) error { func (f FileOp) Stat(dst string) bool { info, _ := f.Fs.Stat(dst) - if info != nil { - return true - } - return false + return info != nil } func (f FileOp) DeleteFile(dst string) error { diff --git a/backend/utils/files/fileinfo.go b/backend/utils/files/fileinfo.go index 591113ab4..84455994c 100644 --- a/backend/utils/files/fileinfo.go +++ b/backend/utils/files/fileinfo.go @@ -22,6 +22,7 @@ type FileInfo struct { Size int64 `json:"size"` IsDir bool `json:"isDir"` IsSymlink bool `json:"isSymlink"` + IsHidden bool `json:"isHidden"` LinkPath string `json:"linkPath"` Type string `json:"type"` Mode string `json:"mode"` @@ -33,10 +34,11 @@ type FileInfo struct { } type FileOption struct { - Path string `json:"path"` - Search string `json:"search"` - Expand bool `json:"expand"` - Dir bool `json:"dir"` + Path string `json:"path"` + Search string `json:"search"` + Expand bool `json:"expand"` + Dir bool `json:"dir"` + ShowHidden bool `json:"showHidden"` } func NewFileInfo(op FileOption) (*FileInfo, error) { @@ -57,6 +59,7 @@ func NewFileInfo(op FileOption) (*FileInfo, error) { Size: info.Size(), IsSymlink: IsSymlink(info.Mode()), Extension: filepath.Ext(info.Name()), + IsHidden: IsHidden(op.Path), Mode: fmt.Sprintf("%04o", info.Mode().Perm()), User: GetUsername(info.Sys().(*syscall.Stat_t).Uid), Group: GetGroup(info.Sys().(*syscall.Stat_t).Gid), @@ -64,13 +67,10 @@ func NewFileInfo(op FileOption) (*FileInfo, error) { } if file.IsSymlink { file.LinkPath = GetSymlink(op.Path) - } - if op.Search != "" { - } if op.Expand { if file.IsDir { - if err := file.listChildren(op.Dir); err != nil { + if err := file.listChildren(op.Dir, op.ShowHidden); err != nil { return nil, err } return file, nil @@ -83,7 +83,7 @@ func NewFileInfo(op FileOption) (*FileInfo, error) { return file, nil } -func (f *FileInfo) listChildren(dir bool) error { +func (f *FileInfo) listChildren(dir, showHidden bool) error { afs := &afero.Afero{Fs: f.Fs} files, err := afs.ReadDir(f.Path) if err != nil { @@ -98,6 +98,10 @@ func (f *FileInfo) listChildren(dir bool) error { name := df.Name() fPath := path.Join(f.Path, df.Name()) + if !showHidden && IsHidden(name) { + continue + } + isSymlink, isInvalidLink := false, false if IsSymlink(df.Mode()) { isSymlink = true @@ -117,6 +121,7 @@ func (f *FileInfo) listChildren(dir bool) error { FileMode: df.Mode(), IsDir: df.IsDir(), IsSymlink: isSymlink, + IsHidden: IsHidden(fPath), Extension: filepath.Ext(name), Path: fPath, Mode: fmt.Sprintf("%04o", df.Mode().Perm()), diff --git a/backend/utils/files/utils.go b/backend/utils/files/utils.go index a1d8c22ea..e94a2c330 100644 --- a/backend/utils/files/utils.go +++ b/backend/utils/files/utils.go @@ -42,3 +42,9 @@ func GetSymlink(path string) string { } return linkPath } + +const dotCharacter = 46 + +func IsHidden(path string) bool { + return path[0] == dotCharacter +} diff --git a/frontend/.prettierrc.js b/frontend/.prettierrc.js index 70b8c6453..07a0838ee 100644 --- a/frontend/.prettierrc.js +++ b/frontend/.prettierrc.js @@ -29,9 +29,9 @@ module.exports = { // 不需要自动在文件开头插入 @prettier insertPragma: false, // 使用默认的折行标准 - proseWrap: 'preserve', + proseWrap: 'never', // 根据显示样式决定 html 要不要折行 - htmlWhitespaceSensitivity: 'css', + htmlWhitespaceSensitivity: 'ignore', // 换行符使用 lf endOfLine: 'auto', }; diff --git a/frontend/src/api/interface/file.ts b/frontend/src/api/interface/file.ts index 980116848..3e01d2b0a 100644 --- a/frontend/src/api/interface/file.ts +++ b/frontend/src/api/interface/file.ts @@ -23,6 +23,7 @@ export namespace File { search?: string; expand: boolean; dir?: boolean; + showHidden?: boolean; } export interface FileTree { diff --git a/frontend/src/assets/iconfont/iconfont.css b/frontend/src/assets/iconfont/iconfont.css index 588b0005e..8821367a4 100644 --- a/frontend/src/assets/iconfont/iconfont.css +++ b/frontend/src/assets/iconfont/iconfont.css @@ -1,9 +1,9 @@ @font-face { font-family: "panel"; /* Project id 3575356 */ - src: url('iconfont.woff2?t=1662608296116') format('woff2'), - url('iconfont.woff?t=1662608296116') format('woff'), - url('iconfont.ttf?t=1662608296116') format('truetype'), - url('iconfont.svg?t=1662608296116#panel') format('svg'); + src: url('iconfont.woff2?t=1662692062751') format('woff2'), + url('iconfont.woff?t=1662692062751') format('woff'), + url('iconfont.ttf?t=1662692062751') format('truetype'), + url('iconfont.svg?t=1662692062751#panel') format('svg'); } .panel { @@ -14,6 +14,22 @@ -moz-osx-font-smoothing: grayscale; } +.p-logout:before { + content: "\e8fe"; +} + +.p-terminal2:before { + content: "\e82a"; +} + +.p-yingwen:before { + content: "\e6c3"; +} + +.p-zhongwen:before { + content: "\e6c8"; +} + .p-plan:before { content: "\e746"; } diff --git a/frontend/src/assets/iconfont/iconfont.js b/frontend/src/assets/iconfont/iconfont.js index df58f78b1..46b6b3941 100644 --- a/frontend/src/assets/iconfont/iconfont.js +++ b/frontend/src/assets/iconfont/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_3575356='',function(h){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var a,t,v,e,m,o=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}a=function(){var c,l=document.createElement("div");l.innerHTML=h._iconfont_svg_string_3575356,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?o(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(t=function(){document.removeEventListener("DOMContentLoaded",t,!1),a()},document.addEventListener("DOMContentLoaded",t,!1)):document.attachEvent&&(v=a,e=h.document,m=!1,i(),e.onreadystatechange=function(){"complete"==e.readyState&&(e.onreadystatechange=null,z())})}function z(){m||(m=!0,v())}function i(){try{e.documentElement.doScroll("left")}catch(c){return void setTimeout(i,50)}z()}}(window); \ No newline at end of file +window._iconfont_svg_string_3575356='',function(h){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var t,a,v,m,e,o=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!h.__iconfont__svg__cssinject__){h.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}t=function(){var c,l=document.createElement("div");l.innerHTML=h._iconfont_svg_string_3575356,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?o(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(t,0):(a=function(){document.removeEventListener("DOMContentLoaded",a,!1),t()},document.addEventListener("DOMContentLoaded",a,!1)):document.attachEvent&&(v=t,m=h.document,e=!1,i(),m.onreadystatechange=function(){"complete"==m.readyState&&(m.onreadystatechange=null,z())})}function z(){e||(e=!0,v())}function i(){try{m.documentElement.doScroll("left")}catch(c){return void setTimeout(i,50)}z()}}(window); \ No newline at end of file diff --git a/frontend/src/assets/iconfont/iconfont.svg b/frontend/src/assets/iconfont/iconfont.svg index fa03437ab..f12b0d3d6 100644 --- a/frontend/src/assets/iconfont/iconfont.svg +++ b/frontend/src/assets/iconfont/iconfont.svg @@ -14,6 +14,14 @@ /> + + + + + + + + @@ -28,7 +36,7 @@ - + diff --git a/frontend/src/assets/iconfont/iconfont.ttf b/frontend/src/assets/iconfont/iconfont.ttf index 4e850743e..6e735a21e 100644 Binary files a/frontend/src/assets/iconfont/iconfont.ttf and b/frontend/src/assets/iconfont/iconfont.ttf differ diff --git a/frontend/src/assets/iconfont/iconfont.woff b/frontend/src/assets/iconfont/iconfont.woff index 94079c983..a2eec67f4 100644 Binary files a/frontend/src/assets/iconfont/iconfont.woff and b/frontend/src/assets/iconfont/iconfont.woff differ diff --git a/frontend/src/assets/iconfont/iconfont.woff2 b/frontend/src/assets/iconfont/iconfont.woff2 index 3bb3f29a7..34dfcf7c2 100644 Binary files a/frontend/src/assets/iconfont/iconfont.woff2 and b/frontend/src/assets/iconfont/iconfont.woff2 differ diff --git a/frontend/src/assets/images/avatar.gif b/frontend/src/assets/images/avatar.gif deleted file mode 100644 index fdbd32c67..000000000 Binary files a/frontend/src/assets/images/avatar.gif and /dev/null differ diff --git a/frontend/src/assets/images/avatar.png b/frontend/src/assets/images/avatar.png deleted file mode 100644 index ac13460d8..000000000 Binary files a/frontend/src/assets/images/avatar.png and /dev/null differ diff --git a/frontend/src/assets/images/user.png b/frontend/src/assets/images/user.png new file mode 100644 index 000000000..a769f5d62 Binary files /dev/null and b/frontend/src/assets/images/user.png differ diff --git a/frontend/src/components/app-layout/footer/index.vue b/frontend/src/components/app-layout/footer/index.vue index d4892a725..d8c80ea59 100644 --- a/frontend/src/components/app-layout/footer/index.vue +++ b/frontend/src/components/app-layout/footer/index.vue @@ -3,7 +3,7 @@ diff --git a/frontend/src/components/app-layout/header/components/Avatar.vue b/frontend/src/components/app-layout/header/components/Avatar.vue deleted file mode 100644 index 1079014be..000000000 --- a/frontend/src/components/app-layout/header/components/Avatar.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/frontend/src/components/app-layout/header/components/Info-dialog.vue b/frontend/src/components/app-layout/header/components/Info-dialog.vue deleted file mode 100644 index 7eaa4dc3d..000000000 --- a/frontend/src/components/app-layout/header/components/Info-dialog.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/frontend/src/components/app-layout/header/components/Language.vue b/frontend/src/components/app-layout/header/components/Language.vue deleted file mode 100644 index fb49460aa..000000000 --- a/frontend/src/components/app-layout/header/components/Language.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/frontend/src/components/app-layout/header/components/Theme.vue b/frontend/src/components/app-layout/header/components/Theme.vue index bf17a58e3..3224fdf05 100644 --- a/frontend/src/components/app-layout/header/components/Theme.vue +++ b/frontend/src/components/app-layout/header/components/Theme.vue @@ -10,8 +10,11 @@
{{ $t('commons.header.themeColor') }} - - +
{{ $t('commons.header.darkTheme') }} diff --git a/frontend/src/components/app-layout/header/components/password-dialog.vue b/frontend/src/components/app-layout/header/components/password-dialog.vue deleted file mode 100644 index d6ecae719..000000000 --- a/frontend/src/components/app-layout/header/components/password-dialog.vue +++ /dev/null @@ -1,25 +0,0 @@ - - - diff --git a/frontend/src/components/app-layout/header/index.vue b/frontend/src/components/app-layout/header/index.vue index 8d851fffc..0ed6d3ad0 100644 --- a/frontend/src/components/app-layout/header/index.vue +++ b/frontend/src/components/app-layout/header/index.vue @@ -4,23 +4,12 @@
-
-
- - -
- 1Panel - -