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
@@ -25,34 +25,20 @@ func newManager(t *testing.T) (*Manager, *time.Time) {
|
||||
return m, &clock
|
||||
}
|
||||
|
||||
// 登录与分享密码合计 30 次失败后封禁 15 分钟,期间正确密码也被拒绝
|
||||
// 登录密码累计 30 次失败后封禁 15 分钟,期间正确密码也被拒绝
|
||||
func TestRateLimit(t *testing.T) {
|
||||
m, clock := newManager(t)
|
||||
share := HashSharePassword("share-pass")
|
||||
for i := 0; i < maxFailures-1; i++ {
|
||||
var err error
|
||||
if i%2 == 0 {
|
||||
_, err = m.Login("1.1.1.1", "wrong")
|
||||
} else {
|
||||
err = m.CheckSharePassword("1.1.1.1", share, "wrong")
|
||||
}
|
||||
if !errors.Is(err, ErrBadCredentials) {
|
||||
if _, err := m.Login("1.1.1.1", "wrong"); !errors.Is(err, ErrBadCredentials) {
|
||||
t.Fatalf("第 %d 次失败: %v", i+1, err)
|
||||
}
|
||||
}
|
||||
// 分享密码正确不清零计数
|
||||
if err := m.CheckSharePassword("1.1.1.1", share, "share-pass"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := m.Login("1.1.1.1", "wrong"); !errors.Is(err, ErrBadCredentials) {
|
||||
t.Fatalf("第 30 次失败: %v", err)
|
||||
}
|
||||
if _, err := m.Login("1.1.1.1", "password123"); !errors.Is(err, ErrRateLimited) {
|
||||
t.Fatalf("封禁期间正确密码也应被拒绝: %v", err)
|
||||
}
|
||||
if err := m.CheckSharePassword("1.1.1.1", share, "share-pass"); !errors.Is(err, ErrRateLimited) {
|
||||
t.Fatalf("封禁同样作用于分享密码: %v", err)
|
||||
}
|
||||
if _, err := m.Login("2.2.2.2", "password123"); err != nil {
|
||||
t.Fatalf("其他来源不受影响: %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user