feat(ui): streamline workspace settings and remove sharing
Unify compact workspace controls and panel transitions, move directory actions into the context menu, and remove backlink UI. Reorganize settings with searchable sections, per-setting resets, shortcut search, and accurate save feedback. Remove sharing UI, APIs, authentication helpers, and storage code; provide a transactional cleanup script with retirement tests. Reject directories during orphan image cleanup and cover mixed-batch preservation.
This commit is contained in:
1 parent
a716794e41
commit
19aab631ec
63 files changed
+1077
-3343
No files matched your search
@@ -1,9 +1,6 @@
|
||||
package vault
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
import "fmt"
|
||||
|
||||
type CleanupResult struct {
|
||||
Deleted []TrashItem `json:"deleted"`
|
||||
@@ -15,8 +12,7 @@ type CleanupSkip struct {
|
||||
}
|
||||
|
||||
// CleanupImages 在写锁内重新扫描引用;派生索引不作为删除依据。
|
||||
// protected 返回当前有效分享的主体路径,由业务数据拥有者在检查时读取。
|
||||
func (v *Vault) CleanupImages(paths []string, protected func() ([]string, error)) (CleanupResult, error) {
|
||||
func (v *Vault) CleanupImages(paths []string) (CleanupResult, error) {
|
||||
result := CleanupResult{Deleted: []TrashItem{}, Skipped: []CleanupSkip{}}
|
||||
v.mu.Lock()
|
||||
defer v.mu.Unlock()
|
||||
@@ -41,10 +37,6 @@ func (v *Vault) CleanupImages(paths []string, protected func() ([]string, error)
|
||||
references[ref.Target] = true
|
||||
}
|
||||
}
|
||||
scopes, err := protected()
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, p := range paths {
|
||||
if seen[p] {
|
||||
@@ -58,11 +50,11 @@ func (v *Vault) CleanupImages(paths []string, protected func() ([]string, error)
|
||||
case references[p]:
|
||||
reason = "仍被笔记引用"
|
||||
default:
|
||||
for _, scope := range scopes {
|
||||
if p == scope || strings.HasPrefix(p, scope+"/") || IsNote(scope) && strings.HasPrefix(p, AssetsDir(scope)+"/") {
|
||||
reason = "仍在有效分享范围内"
|
||||
break
|
||||
}
|
||||
info, err := v.Stat(p)
|
||||
if err != nil {
|
||||
reason = err.Error()
|
||||
} else if !info.Mode().IsRegular() {
|
||||
reason = "不是图片文件"
|
||||
}
|
||||
}
|
||||
if reason != "" {
|
||||
|
||||
Reference in new issue
Block a user