refactor(patch): execute all patches in dev version (#7807)

pull/7847/head
j2rong4cn 2025-01-27 20:49:24 +08:00 committed by GitHub
parent fd51f34efa
commit 027edcbe53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package bootstrap
import ( import (
"fmt" "fmt"
"github.com/alist-org/alist/v3/internal/bootstrap/patch" "github.com/alist-org/alist/v3/internal/bootstrap/patch"
"github.com/alist-org/alist/v3/internal/conf" "github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/pkg/utils" "github.com/alist-org/alist/v3/pkg/utils"
@ -40,6 +41,11 @@ func compareVersion(majorA, minorA, patchNumA, majorB, minorB, patchNumB int) bo
func InitUpgradePatch() { func InitUpgradePatch() {
if !strings.HasPrefix(conf.Version, "v") { if !strings.HasPrefix(conf.Version, "v") {
for _, vp := range patch.UpgradePatches {
for i, p := range vp.Patches {
safeCall(vp.Version, i, p)
}
}
return return
} }
if LastLaunchedVersion == conf.Version { if LastLaunchedVersion == conf.Version {

View File

@ -11,14 +11,11 @@ import (
// PR AlistGo/alist#7817. // PR AlistGo/alist#7817.
func GrantAdminPermissions() { func GrantAdminPermissions() {
admin, err := op.GetAdmin() admin, err := op.GetAdmin()
if err == nil && (admin.Permission & 0x33FF) == 0 {
admin.Permission |= 0x33FF
err = op.UpdateUser(admin)
}
if err != nil { if err != nil {
utils.Log.Errorf("Cannot grant permissions to admin: %v", err) utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
} }
if (admin.Permission & 0x33FF) == 0 {
admin.Permission |= 0x33FF
err = op.UpdateUser(admin)
if err != nil {
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
}
}
} }