mirror of https://github.com/2dust/v2rayN
Bug fix
parent
8361b4e4a0
commit
07156cb55c
|
@ -35,6 +35,14 @@ namespace ServiceLib.Handler
|
|||
_client?.Dispose();
|
||||
_client = null;
|
||||
}
|
||||
if (_config.webDavItem.dirName.IsNullOrEmpty())
|
||||
{
|
||||
_webDir = Global.AppName + "_backup";
|
||||
}
|
||||
else
|
||||
{
|
||||
_webDir = _config.webDavItem.dirName.TrimEx();
|
||||
}
|
||||
|
||||
var clientParams = new WebDavClientParams
|
||||
{
|
||||
|
@ -145,6 +153,7 @@ namespace ServiceLib.Handler
|
|||
if (!response.IsSuccessful)
|
||||
{
|
||||
SaveLog(response.Description);
|
||||
return false;
|
||||
}
|
||||
using var outputFileStream = new FileStream(fileName, FileMode.Create);
|
||||
response.Stream.CopyTo(outputFileStream);
|
||||
|
|
|
@ -255,5 +255,6 @@
|
|||
public string? url { get; set; }
|
||||
public string? userName { get; set; }
|
||||
public string? password { get; set; }
|
||||
public string? dirName { get; set; }
|
||||
}
|
||||
}
|
|
@ -591,6 +591,15 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Remote folder name (optional) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LvWebDavDirName {
|
||||
get {
|
||||
return ResourceManager.GetString("LvWebDavDirName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 WebDav Password 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1312,4 +1312,7 @@
|
|||
<data name="LvWebDavCheck" xml:space="preserve">
|
||||
<value>WebDav Check</value>
|
||||
</data>
|
||||
<data name="LvWebDavDirName" xml:space="preserve">
|
||||
<value>Remote folder name (optional)</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1309,4 +1309,7 @@
|
|||
<data name="LvWebDavUrl" xml:space="preserve">
|
||||
<value>WebDav 服务器地址</value>
|
||||
</data>
|
||||
<data name="LvWebDavDirName" xml:space="preserve">
|
||||
<value>远程文件夹名称(可选)</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1189,4 +1189,7 @@
|
|||
<data name="LvWebDavUrl" xml:space="preserve">
|
||||
<value>WebDav 服務器地址</value>
|
||||
</data>
|
||||
<data name="LvWebDavDirName" xml:space="preserve">
|
||||
<value>遠端資料夾名稱(可選)</value>
|
||||
</data>
|
||||
</root>
|
|
@ -117,6 +117,11 @@ namespace ServiceLib.ViewModels
|
|||
{
|
||||
return;
|
||||
}
|
||||
//exist
|
||||
if (!File.Exists(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//backup first
|
||||
var fileBackup = Utils.GetBackupPath($"backup_{DateTime.Now:yyyyMMddHHmmss}.zip");
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
@ -184,9 +185,25 @@
|
|||
VerticalAlignment="Center"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="8"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.LvWebDavDirName}" />
|
||||
|
||||
<TextBox
|
||||
x:Name="txtWebDavDirName"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="8"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
|
||||
<Button
|
||||
x:Name="menuWebDavCheck"
|
||||
Grid.Row="3"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="8"
|
||||
VerticalAlignment="Center"
|
||||
|
|
|
@ -25,6 +25,8 @@ namespace v2rayN.Views
|
|||
this.Bind(ViewModel, vm => vm.SelectedSource.url, v => v.txtWebDavUrl.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.userName, v => v.txtWebDavUserName.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.password, v => v.txtWebDavPassword.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.dirName, v => v.txtWebDavDirName.Text).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.WebDavCheckCmd, v => v.menuWebDavCheck).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.RemoteBackupCmd, v => v.menuRemoteBackup).DisposeWith(disposables);
|
||||
|
|
Loading…
Reference in New Issue