feat(archive): archive manage (#7817)
* feat(archive): archive management * fix(ftp-server): remove duplicate ReadAtSeeker realization * fix(archive): bad seeking of SeekableStream * fix(archive): split internal and driver extraction api * feat(archive): patch * fix(shutdown): clear decompress upload tasks * chore * feat(archive): support .iso format * chore
This commit is contained in:
@ -26,13 +26,14 @@ func initUser() {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
salt := random.String(16)
|
||||
admin = &model.User{
|
||||
Username: "admin",
|
||||
Salt: salt,
|
||||
PwdHash: model.TwoHashPwd(adminPassword, salt),
|
||||
Role: model.ADMIN,
|
||||
BasePath: "/",
|
||||
Authn: "[]",
|
||||
Permission: 0xFF, // 0(can see hidden) - 7(can remove)
|
||||
Username: "admin",
|
||||
Salt: salt,
|
||||
PwdHash: model.TwoHashPwd(adminPassword, salt),
|
||||
Role: model.ADMIN,
|
||||
BasePath: "/",
|
||||
Authn: "[]",
|
||||
// 0(can see hidden) - 7(can remove) & 12(can read archives) - 13(can decompress archives)
|
||||
Permission: 0x30FF,
|
||||
}
|
||||
if err := op.CreateUser(admin); err != nil {
|
||||
panic(err)
|
||||
|
@ -5,18 +5,20 @@ import (
|
||||
"github.com/alist-org/alist/v3/pkg/utils"
|
||||
)
|
||||
|
||||
// GrantAdminPermissions gives admin Permission 0(can see hidden) - 9(webdav manage)
|
||||
// This patch is written to help users upgrading from older version better adapt to PR AlistGo/alist#7705.
|
||||
// GrantAdminPermissions gives admin Permission 0(can see hidden) - 9(webdav manage) and
|
||||
// 12(can read archives) - 13(can decompress archives)
|
||||
// This patch is written to help users upgrading from older version better adapt to PR AlistGo/alist#7705 and
|
||||
// PR AlistGo/alist#7817.
|
||||
func GrantAdminPermissions() {
|
||||
admin, err := op.GetAdmin()
|
||||
if err != nil {
|
||||
utils.Log.Errorf("Cannot grant permissions to admin: %v", err)
|
||||
}
|
||||
if (admin.Permission & 0x3FF) == 0 {
|
||||
admin.Permission |= 0x3FF
|
||||
}
|
||||
err = op.UpdateUser(admin)
|
||||
if err != nil {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,4 +16,6 @@ func InitTaskManager() {
|
||||
if len(tool.TransferTaskManager.GetAll()) == 0 { //prevent offline downloaded files from being deleted
|
||||
CleanTempDir()
|
||||
}
|
||||
fs.ArchiveDownloadTaskManager = tache.NewManager[*fs.ArchiveDownloadTask](tache.WithWorks(conf.Conf.Tasks.Decompress.Workers), tache.WithPersistFunction(db.GetTaskDataFunc("decompress", conf.Conf.Tasks.Decompress.TaskPersistant), db.UpdateTaskDataFunc("decompress", conf.Conf.Tasks.Decompress.TaskPersistant)), tache.WithMaxRetry(conf.Conf.Tasks.Decompress.MaxRetry))
|
||||
fs.ArchiveContentUploadTaskManager.Manager = tache.NewManager[*fs.ArchiveContentUploadTask](tache.WithWorks(conf.Conf.Tasks.DecompressUpload.Workers), tache.WithMaxRetry(conf.Conf.Tasks.DecompressUpload.MaxRetry)) //decompress upload will not support persist
|
||||
}
|
||||
|
Reference in New Issue
Block a user