mirror of https://github.com/Xhofe/alist
refactor(patch): execute all patches in dev version (#7807)
parent
fd51f34efa
commit
027edcbe53
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
if err == nil && (admin.Permission & 0x33FF) == 0 {
|
||||||
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
|
|
||||||
}
|
|
||||||
if (admin.Permission & 0x33FF) == 0 {
|
|
||||||
admin.Permission |= 0x33FF
|
admin.Permission |= 0x33FF
|
||||||
err = op.UpdateUser(admin)
|
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)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue