1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-25 06:36:08 +03:00
This commit is contained in:
nuxt-autumn 2021-05-22 17:14:27 +08:00
parent cb7d7e5f21
commit 970843f561
14 changed files with 135 additions and 98 deletions

View File

@ -12,12 +12,12 @@ namespace ProxySuper.Core.Models.Projects
/// <summary>
/// ss password
/// </summary>
public string ShadowsocksPassword { get; set; }
public string ShadowSocksPassword { get; set; }
/// <summary>
/// ss method
/// </summary>
public string ShadowsocksMethod { get; set; }
public string ShadowSocksMethod { get; set; }
/// <summary>
/// ss port

View File

@ -9,6 +9,7 @@ using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -56,7 +57,6 @@ namespace ProxySuper.Core.Models
}
}
[JsonIgnore]
public IMvxCommand NavToInstallerCommand => new MvxAsyncCommand(NavigateToInstaller);
@ -76,7 +76,6 @@ namespace ProxySuper.Core.Models
this.Host = result.Host;
this.XraySettings = result.XraySettings;
await RaisePropertyChanged("Host");
}
if (Type == ProjectType.TrojanGo)
@ -87,6 +86,7 @@ namespace ProxySuper.Core.Models
this.Host = result.Host;
this.TrojanGoSettings = result.TrojanGoSettings;
}
await RaisePropertyChanged("Host");
}
public async Task NavigateToInstaller()

View File

@ -36,8 +36,8 @@ namespace ProxySuper.Core.Services
private static string BuildShadowSocksShareLink(XraySettings settings)
{
var _method = settings.ShadowsocksMethod;
var _password = settings.ShadowsocksPassword;
var _method = settings.ShadowSocksMethod;
var _password = settings.ShadowSocksPassword;
var _server = settings.Domain;
var _port = settings.ShadowSocksPort;

View File

@ -201,8 +201,8 @@ namespace ProxySuper.Core.Services
{
var ssBound = GetBound("Shadowsocks-AEAD.json");
ssBound.port = parameters.ShadowSocksPort;
ssBound.settings.clients[0].password = parameters.ShadowsocksPassword;
ssBound.settings.clients[0].method = parameters.ShadowsocksMethod;
ssBound.settings.clients[0].password = parameters.ShadowSocksPassword;
ssBound.settings.clients[0].method = parameters.ShadowSocksMethod;
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
}

View File

@ -23,12 +23,27 @@ namespace ProxySuper.Core.ViewModels
{
_navigationService = navigationService;
ReadRecords();
_navigationService.AfterClose += _navigationService_AfterClose;
}
private void _navigationService_AfterClose(object sender, MvvmCross.Navigation.EventArguments.IMvxNavigateEventArgs e)
{
if (e.ViewModel is XrayEditorViewModel ||
e.ViewModel is TrojanGoEditorViewModel)
{
SaveToJson();
}
}
public void ReadRecords()
{
List<Record> records = new List<Record>();
if (File.Exists("Data/Record.json"))
{
var json = File.ReadAllText("Data/Record.json");
var records = JsonConvert.DeserializeObject<List<Record>>(json);
records = JsonConvert.DeserializeObject<List<Record>>(json);
}
this.Records = new MvxObservableCollection<Record>();
records.ForEach(item =>
@ -41,9 +56,9 @@ namespace ProxySuper.Core.ViewModels
});
}
public void SaveRecords()
public void SaveToJson()
{
var json = JsonConvert.SerializeObject(Records);
var json = JsonConvert.SerializeObject(this);
File.WriteAllText("Data/Record.json", json);
}
@ -64,6 +79,9 @@ namespace ProxySuper.Core.ViewModels
if (result == null) return;
Records.Add(result);
SaveToJson();
}
public async Task AddTrojanGoRecord()

View File

@ -24,6 +24,76 @@ namespace ProxySuper.Core.ViewModels
Settings = parameter;
}
public bool Checked_VLESS_TCP_XTLS
{
get
{
return Settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
}
}
public bool Checked_VLESS_TCP
{
get
{
return Settings.Types.Contains(XrayType.VLESS_TCP);
}
}
public bool Checked_VLESS_WS
{
get
{
return Settings.Types.Contains(XrayType.VLESS_WS);
}
}
public bool Checked_VLESS_KCP
{
get
{
return Settings.Types.Contains(XrayType.VLESS_KCP);
}
}
public bool Checked_VMESS_TCP
{
get
{
return Settings.Types.Contains(XrayType.VMESS_TCP);
}
}
public bool Checked_VMESS_WS
{
get
{
return Settings.Types.Contains(XrayType.VMESS_WS);
}
}
public bool Checked_VMESS_KCP
{
get
{
return Settings.Types.Contains(XrayType.VMESS_KCP);
}
}
public bool Checked_Trojan_TCP
{
get
{
return Settings.Types.Contains(XrayType.Trojan_TCP);
}
}
public bool CheckedShadowSocks
{
get
{
return Settings.Types.Contains(XrayType.ShadowsocksAEAD);
}
}
}
}

View File

@ -174,18 +174,18 @@ namespace ProxySuper.Core.ViewModels
}
public string ShadowSocksPassword
{
get => Settings.ShadowsocksPassword;
set => Settings.ShadowsocksPassword = value;
get => Settings.ShadowSocksPassword;
set => Settings.ShadowSocksPassword = value;
}
public string ShadowSocksMethod
{
get => Settings.ShadowsocksMethod;
get => Settings.ShadowSocksMethod;
set
{
var namespaceStr = typeof(ComboBoxItem).FullName + ":";
var trimValue = value.Replace(namespaceStr, "");
trimValue = trimValue.Trim();
Settings.ShadowsocksMethod = trimValue;
Settings.ShadowSocksMethod = trimValue;
RaisePropertyChanged("ShadowSocksMethod");
}
}

View File

@ -38,7 +38,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
@ -111,7 +111,7 @@
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="{DynamicResource ProxyType}" Grid.Row="0" Grid.Column="0" />

View File

@ -1,54 +0,0 @@
[
{
"host": {
"tag": "123",
"address": "122.23.36.32",
"userName": null,
"password": null,
"port": 22,
"privateKeyPath": null,
"proxy": {
"address": "127.0.0.1",
"port": 1080,
"type": 0,
"userName": null,
"password": null
},
"secretType": 0
},
"settings": {
"port": 443,
"uuid": "ac082c52-0be1-4a20-a1ee-aa7e29ce2d1e",
"vlesS_WS_Path": "/vlessws",
"vlesS_H2_Path": "/vlessh2",
"vlesS_KCP_Seed": "ac082c52-0be1-4a20-a1ee-aa7e29ce2d1e",
"vlesS_KCP_Type": "none",
"vlesS_KCP_Port": 2001,
"vlesS_gRPC_ServiceName": "xray_gRPC",
"vlesS_gRPC_Port": 2002,
"vmesS_WS_Path": "/vmessws",
"vmesS_TCP_Path": "/vmesstcp",
"vmesS_H2_Path": "/vmessh2",
"vmesS_KCP_Seed": "ac082c52-0be1-4a20-a1ee-aa7e29ce2d1e",
"vmesS_KCP_Type": "none",
"vmesS_KCP_Port": 3001,
"trojanPassword": "ac082c52-0be1-4a20-a1ee-aa7e29ce2d1e",
"trojan_WS_Path": "/trojanws",
"shadowsocksPassword": "ac082c52-0be1-4a20-a1ee-aa7e29ce2d1e",
"shadowsocksMethod": "aes-128-gcm",
"shadowSocksPort": 4001,
"domain": "www.baodu.com",
"maskDomain": null,
"types": [
100,
101,
102,
104,
202,
204,
401,
301
]
}
}
]

View File

@ -258,9 +258,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Data\Record.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -395,7 +392,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Data\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets" Condition="Exists('..\packages\System.Runtime.WindowsRuntime.4.6.0\build\net461\System.Runtime.WindowsRuntime.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -34,13 +34,14 @@
<!--Editor Window-->
<sys:String x:Key="HostGroupName">Host</sys:String>
<sys:String x:Key="HostTag">Tag</sys:String>
<sys:String x:Key="HostAddress">Address</sys:String>
<sys:String x:Key="HostUserName">UserName</sys:String>
<sys:String x:Key="HostPassword">Password</sys:String>
<sys:String x:Key="HostPort">Port</sys:String>
<sys:String x:Key="HostSecretType">SecretType</sys:String>
<sys:String x:Key="HostUploadSecretKey">UploadSecretKey</sys:String>
<sys:String x:Key="HostUploadSecretKey">UploadKey</sys:String>
<sys:String x:Key="HostSertTypePassword">Password</sys:String>
<sys:String x:Key="HostSertTypePrivateKey">PrivateKey</sys:String>

View File

@ -26,8 +26,8 @@
</MenuItem>
<MenuItem Header="{DynamicResource MainMenuLanguage}" Padding="10,3">
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageEn}"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageCn}"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageEn}" Click="SetEnglish"></MenuItem>
<MenuItem Padding="0,5" Header="{DynamicResource MainMenuLanguageCn}" Click="SetSimpleChinese"></MenuItem>
</MenuItem>
<MenuItem Header="{DynamicResource MainMenuHelper}" Padding="10,3">
@ -37,6 +37,7 @@
<StackPanel Grid.Row="1" Margin="0,10">
<DataGrid AutoGenerateColumns="False"
Name="DataGrid"
ItemsSource="{Binding Records}"
VerticalContentAlignment="Bottom"
IsReadOnly="True"
@ -82,7 +83,7 @@
Padding="12,3"
Content="{DynamicResource MainDataGridColumnActionViewConfig}" />
<Button Click="NavToEditor"
<Button Command="{Binding NavToEditorCommand}"
Margin="5,0"
Padding="12,3"
Content="{DynamicResource MainDataGridColumnActionDelete}" />

View File

@ -44,16 +44,18 @@ namespace ProxySuper.WPF.Views
System.Diagnostics.Process.Start("explorer.exe", "https://github.com/proxysu/ProxySU");
}
private void NavToEditor(object sender, RoutedEventArgs e)
ResourceDictionary resource = new ResourceDictionary();
private void SetSimpleChinese(object sender, RoutedEventArgs e)
{
NavigationService.Navigate<XrayEditorViewModel, Record, Record>(ViewModel.Records[0]);
resource.Source = new Uri(@"Resources\Languages\zh_cn.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries[0] = resource;
}
protected override void Dispose(bool disposing)
private void SetEnglish(object sender, RoutedEventArgs e)
{
ViewModel.SaveRecords();
base.Dispose(disposing);
}
resource.Source = new Uri(@"Resources\Languages\en.xaml", UriKind.Relative);
Application.Current.Resources.MergedDictionaries[0] = resource;
}
}
}

View File

@ -25,70 +25,70 @@
SelectionChanged="BuildQrCode">
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_TCP_XTLS}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP_XTLS}"
IsEnabled="{Binding Checked_VLESS_TCP_XTLS}"
Header="VLESS-TCP-XTLS">
<ctrl:VLESS_XTLS_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_TCP}"
IsEnabled="{Binding Settings.Checked_VLESS_TCP}"
IsEnabled="{Binding Checked_VLESS_TCP}"
Header="VLESS-TCP-TLS">
<ctrl:VLESS_TCP_TLS_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_WS}"
IsEnabled="{Binding Settings.Checked_VLESS_WS}"
IsEnabled="{Binding Checked_VLESS_WS}"
Header="VLESS-WebSocket-TLS">
<ctrl:VLESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VLESS_KCP}"
IsEnabled="{Binding Settings.Checked_VLESS_KCP}"
IsEnabled="{Binding Checked_VLESS_KCP}"
Header="VLESS-mKCP">
<ctrl:VLESS_KCP_Control />
</TabItem>
<!--<TabItem Width="200"
Tag="{x:Static models:XrayType.VLESS_gRPC}"
IsEnabled="{Binding Settings.Checked_VLESS_gRPC}"
IsEnabled="{Binding Checked_VLESS_gRPC}"
Header="VLESS-gRPC">
<ctrl:VLESS_gRPC_Control />
</TabItem>-->
<TabItem Width="200" Height="40"
<!--<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_TCP}"
IsEnabled="{Binding Settings.Checked_VMESS_TCP}"
IsEnabled="{Binding Checked_VMESS_TCP}"
Header="VMESS-TCP-TLS">
<ctrl:VMESS_TCP_TLS_Control />
</TabItem>
</TabItem>-->
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_WS}"
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
IsEnabled="{Binding Checked_VMESS_WS}"
Header="VMESS-WebSocket-TLS">
<ctrl:VMESS_WS_TLS_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_KCP}"
IsEnabled="{Binding Settings.Checked_VMESS_KCP}"
IsEnabled="{Binding Checked_VMESS_KCP}"
Header="VMESS-mKCP">
<ctrl:VMESS_KCP_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.Trojan_TCP}"
IsEnabled="{Binding Settings.Checked_Trojan_TCP}"
IsEnabled="{Binding Checked_Trojan_TCP}"
Header="Trojan-TCP">
<ctrl:Trojan_TCP_Control />
</TabItem>
<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.ShadowsocksAEAD}"
IsEnabled="{Binding Settings.CheckedShadowSocks}"
IsEnabled="{Binding CheckedShadowSocks}"
Header="ShadowSocks">
<ctrl:ShadowSocksControl />
</TabItem>