Просмотр исходного кода

Fixed user vroot in agi showing backup vroot bug

TC pushbot 5 4 лет назад
Родитель
Сommit
b6ba91c2ed
5 измененных файлов с 19 добавлено и 4 удалено
  1. 1 1
      main.flags.go
  2. 3 1
      mod/agi/agi.file.go
  3. 1 1
      mod/agi/userFunc.go
  4. 13 0
      mod/user/directoryHandler.go
  5. 1 1
      web/Video/index.html

+ 1 - 1
main.flags.go

@@ -28,7 +28,7 @@ var subserviceBasePort = 12810            //Next subservice port
 
 // =========== SYSTEM BUILD INFORMATION ==============
 var build_version = "development"                      //System build flag, this can be either {development / production / stable}
-var internal_version = "0.1.115"                       //Internal build version, please follow git commit counter for setting this value. max value \[0-9].[0-9][0-9].[0-9][0-9][0-9]\
+var internal_version = "0.1.116"                       //Internal build version, please follow git commit counter for setting this value. max value \[0-9].[0-9][0-9].[0-9][0-9][0-9]\
 var deviceUUID string                                  //The device uuid of this host
 var deviceVendor = "IMUSLAB.INC"                       //Vendor of the system
 var deviceVendorURL = "http://imuslab.com"             //Vendor contact information

+ 3 - 1
mod/agi/agi.file.go

@@ -275,7 +275,9 @@ func (g *Gateway) injectFileLibFunctions(vm *otto.Otto, u *user.User) {
 			rootDirs := []string{}
 			fileHandlers := u.GetAllFileSystemHandler()
 			for _, fsh := range fileHandlers {
-				rootDirs = append(rootDirs, fsh.UUID+":/")
+				if fsh.Hierarchy != "backup" {
+					rootDirs = append(rootDirs, fsh.UUID+":/")
+				}
 			}
 
 			reply, _ := vm.ToValue(rootDirs)

+ 1 - 1
mod/agi/userFunc.go

@@ -28,7 +28,7 @@ func (g *Gateway) injectUserFunctions(vm *otto.Otto, scriptFile string, scriptSc
 	vm.Set("USERICON", u.GetUserIcon())
 	vm.Set("USERQUOTA_TOTAL", u.StorageQuota.TotalStorageQuota)
 	vm.Set("USERQUOTA_USED", u.StorageQuota.UsedStorageQuota)
-	vm.Set("USER_VROOTS", u.GetAllFileSystemHandler())
+	vm.Set("USER_VROOTS", u.GetAllAccessibleFileSystemHandler())
 	vm.Set("USER_MODULES", u.GetUserAccessibleModules())
 
 	//File system and path related

+ 13 - 0
mod/user/directoryHandler.go

@@ -22,6 +22,19 @@ func (u *User) GetHomeDirectory() (string, error) {
 	return "", errors.New("User root not found. Is this a permission group instead of a real user?")
 }
 
+//Get all user Acessible file system handlers (ignore special fsh like backups)
+func (u *User) GetAllAccessibleFileSystemHandler() []*fs.FileSystemHandler {
+	results := []*fs.FileSystemHandler{}
+	fshs := u.GetAllFileSystemHandler()
+	for _, fsh := range fshs {
+		if fsh.Hierarchy != "backup" {
+			results = append(results, fsh)
+		}
+	}
+
+	return results
+}
+
 func (u *User) GetAllFileSystemHandler() []*fs.FileSystemHandler {
 	results := []*fs.FileSystemHandler{}
 	uuids := []string{}

+ 1 - 1
web/Video/index.html

@@ -187,7 +187,7 @@
                         $("#videolist").find(".search").val(nextPlayObject.Filename);
                         $(".playing").removeClass("playing");
                         $(".videoObject").each(function(){
-                            if ($(this).attr("filename") == nextPlayObject.Filename){
+                            if ($(this).attr("filename") + $(this).attr("ext") == nextPlayObject.Filename){
                                 $(this).addClass("playing");
                             }
                         });