Pārlūkot izejas kodu

Added SMB password entry on web UI, not patch SMB remove bug

Toby Chui 3 gadi atpakaļ
vecāks
revīzija
1af45b958c

+ 4 - 0
mod/filesystem/abstractions/smbfs/smbfs.go

@@ -134,6 +134,7 @@ func (a ServerMessageBlockFileSystemAbstraction) Remove(filename string) error {
 func (a ServerMessageBlockFileSystemAbstraction) RemoveAll(filename string) error {
 	filename = filterFilepath(filename)
 	filename = toWinPath(filename)
+	fmt.Println("REMOVING", filename)
 	return a.share.RemoveAll(filename)
 }
 func (a ServerMessageBlockFileSystemAbstraction) Rename(oldname, newname string) error {
@@ -306,10 +307,13 @@ func toWinPath(filename string) string {
 func filterFilepath(rawpath string) string {
 	rawpath = filepath.ToSlash(filepath.Clean(rawpath))
 	rawpath = strings.TrimSpace(rawpath)
+
 	if strings.HasPrefix(rawpath, "./") {
 		return rawpath[1:]
 	} else if rawpath == "." || rawpath == "" {
 		return "/"
+	} else if rawpath[0:1] != "/" {
+		return "/" + rawpath
 	}
 	return rawpath
 }

+ 4 - 3
web/SystemAO/storage/fshedit.html

@@ -166,7 +166,6 @@
             <div class="networkfs" style="display:none;">
                 <div class="ui divider"></div>
                 <p>Security and Authentication</p>
-                <small>Leave Username / Password field empty for using the old config</small>
                 <div class="field">
                     <label>Username</label>
                     <input type="text" name="username" placeholder="">
@@ -175,7 +174,8 @@
                     <label>Password</label>
                     <input type="password" name="password" placeholder="">
                 </div>
-                <br>
+                <small>Leave Username / Password field empty for using the old config</small>
+                <br><br>
             </div>
             <button class="ui right floated button" onclick='handleCancel();'>Cancel</button>
             <button class="ui green right floated button" type="submit">Confirm</button>
@@ -272,7 +272,7 @@
         }
 
         function handleFileSystemTypeChange(fstype){
-            if (fstype == "webdav" || fstype == "ftp"){
+            if (fstype == "webdav" || fstype == "ftp" || fstype == "smb"){
                 $(".localfs").hide();
                 $(".networkfs").show();
             }else{
@@ -293,6 +293,7 @@
                 $(".networkfs").show();
             }
             $("#fstype").dropdown("set selected",option.filesystem);
+            handleFileSystemTypeChange(option.filesystem);
             $("input[name=mountdev]").val(option.mountdev);
             $("input[name=mountpt]").val(option.mountpt);
             if (option.automount == true){