Skip to content

Commit

Permalink
Ver 2.3.0-Alpha.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiroiame-Kusu committed Oct 30, 2024
1 parent 19d95ff commit 9455edd
Show file tree
Hide file tree
Showing 16 changed files with 240 additions and 33 deletions.
13 changes: 13 additions & 0 deletions .idea/.idea.Kairo/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.Kairo/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.Kairo/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Kairo/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Kairo/Utils/Download.xaml → Kairo/Components/Download.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Height="250"
Width="400"
Title="Downloader"
Icon="/Resource/favicon.ico"
Icon="/Resource/favicon.ico.disabled"
AllowDrop="True"
Style="{StaticResource UiWindow}"
WindowStyle="None"
Expand All @@ -29,7 +29,7 @@
Grid.Row="0"
Margin="5,0,0,0"
Padding="0"
Icon="/Resource/favicon.ico"
Icon="/Resource/favicon.ico.disabled"
ShowClose="True"
CloseClicked="_TitleBar_CloseClicked"
ShowMaximize="False"
Expand Down
File renamed without changes.
50 changes: 50 additions & 0 deletions Kairo/Components/ProxyCreator.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<ui:UiWindow x:Class="Kairo.Components.ProxyCreator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Kairo.Components"
mc:Ignorable="d"
Title="创建新隧道" Height="300" Width="200"
Style="{StaticResource UiWindow}"
ResizeMode="NoResize"
>
<Grid >
<Border
Margin="10"
Padding="10,5"
Background="{DynamicResource ControlFillColorDefaultBrush}"
CornerRadius="8">
<Grid Opacity="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<StackPanel>
<TextBlock Grid.Row="0">隧道名字</TextBlock>
<ui:TextBox></ui:TextBox>
</StackPanel>
</Grid>
<Grid Grid.Column="1">
<StackPanel>
<TextBlock Grid.Row="0">隧道类型</TextBlock>
<ListView Grid.Row="1" FontSize="12" Height="20" SelectedItem="0" HorizontalAlignment="Stretch">
<ListViewItem>TCP</ListViewItem>
<ListViewItem>UDP</ListViewItem>
<ListViewItem>HTTP</ListViewItem>
<ListViewItem>HTTPS</ListViewItem>
</ListView>
</StackPanel>
</Grid>






</Grid>
</Border>
</Grid>
</ui:UiWindow>
28 changes: 28 additions & 0 deletions Kairo/Components/ProxyCreator.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Wpf.Ui.Controls;

namespace Kairo.Components
{
/// <summary>
/// Interaction logic for ProxyCreator.xaml
/// </summary>
public partial class ProxyCreator : UiWindow
{
public ProxyCreator()
{
InitializeComponent();
}
}
}
2 changes: 1 addition & 1 deletion Kairo/Dashboard/Home.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<DockPanel VerticalAlignment="Stretch">
<Border CornerRadius="20" Height="40" Width="40" BorderThickness="1" BorderBrush="LightBlue" Margin="10,0,10,0" Name="Avatar">
<Border.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resource/favicon.ico"/>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resource/favicon.ico.disabled"/>
</Border.Background>
</Border>
<TextBlock VerticalAlignment="Center" Name="title_username" Text="欢迎回来," FontSize="25" Margin="0,0,10,0" />
Expand Down
42 changes: 31 additions & 11 deletions Kairo/Dashboard/Home.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Windows.Media;
using System.Windows.Media.Imaging;
Expand Down Expand Up @@ -214,7 +215,6 @@ private async void RefreshAvatar()
catch (Exception ex)
{
Logger.MsgBox("无法获取您的头像, 请稍后重试", "Kairo", 0, 48, 1);
CrashInterception.ShowException(ex);
}
}

Expand All @@ -224,23 +224,43 @@ private void ToSign_Click(object sender, RoutedEventArgs e)
using (var hc = new HttpClient())
{
hc.DefaultRequestHeaders.Add("Authorization", $"Bearer {Global.Config.Token}");
HttpContent httpContent = null;
HttpResponseMessage responseMessage = hc.PostAsync($"{Global.API}/api/v2/sign?username={Global.Config.Username}",httpContent).Result;
if (!responseMessage.IsSuccessStatusCode)
{
Logger.MsgBox("无法连接到服务器, 请检查您的网络链接", "Kairo", 0, 48, 1);
return;
}
HttpResponseMessage responseMessage = hc.PostAsync($"{Global.API}/api/v2/sign?username={Global.Config.Username}",new FormUrlEncodedContent(new List<KeyValuePair<string, string>>())).Result;


var temp = JObject.Parse(responseMessage.Content.ReadAsStringAsync().Result);
if (!string.IsNullOrEmpty(temp.ToString()) && int.Parse(temp["status"].ToString()) == 200) {
int i = int.Parse(temp["data"]["get_traffic"].ToString());
Logger.MsgBox($"签到成功,您获得 {i}GB 流量", "Kairo", 0, 47, 1);
Dispatcher.BeginInvoke(() =>
{
Traffic.Text = $"剩余流量: {(MainWindow.Traffic / 1024) + i}";
Traffic.Text = $"剩余流量: {(MainWindow.Traffic / 1024) + i}GB";
});
Dispatcher.BeginInvoke(() =>
{
ToSign.Visibility = Visibility.Collapsed;
SignStatus.Visibility = Visibility.Visible;
});
ToSign.Visibility = Visibility.Collapsed;
SignStatus.Visibility = Visibility.Visible;
}
if(int.Parse(temp["status"].ToString()) == 403)
{
if (temp["message"].ToString() == "你今天已经签到过了")
{

Logger.MsgBox("你今天已经签到过了", "Kairo", 0, 48, 1);
Dispatcher.BeginInvoke(() =>
{
ToSign.Visibility = Visibility.Collapsed;
SignStatus.Visibility = Visibility.Visible;
});
return;
}
Logger.MsgBox("无法连接到服务器, 请检查您的网络链接", "Kairo", 0, 48, 1);
return;
}
if (!responseMessage.IsSuccessStatusCode)
{
Logger.MsgBox("无法连接到服务器, 请检查您的网络链接", "Kairo", 0, 48, 1);
return;
}
}
});
Expand Down
11 changes: 7 additions & 4 deletions Kairo/Dashboard/ProxyList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<DockPanel VerticalAlignment="Stretch">
<Border CornerRadius="20" Height="40" Width="40" BorderThickness="1" BorderBrush="LightBlue" Margin="10,0,10,0" Name="Avatar">
<Border.Background>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resource/favicon.ico"/>
<ImageBrush Stretch="UniformToFill" ImageSource="/Resource/favicon.ico.disabled"/>
</Border.Background>
</Border>
<TextBlock VerticalAlignment="Center" Text="隧道列表" FontSize="25" Margin="0,0,10,0" />
Expand All @@ -60,9 +60,9 @@
>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel >

<WrapPanel Name="ListPanel">

<WrapPanel Name="ListPanel">

</WrapPanel>


Expand All @@ -78,10 +78,13 @@
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ui:Card Grid.Column="0" Padding="10" Margin="10,0,0,0">
<ui:Button Grid.Column="0" Padding="10" Margin="10,0,0,0" Icon="AddCircle24" Content="创建新隧道" Click="CreateNewProxy_Click"/>
<ui:Button Grid.Column="1" Padding="10" Margin="10,0,0,0" Icon="Recycle20" Content="刷新" Click="Refresh_Click"/>
<ui:Card Grid.Column="2" Padding="10" Margin="10,0,0,0">
<TextBlock Text="PS:右键隧道可以打开菜单哦喵~" />
</ui:Card>

Expand Down
Loading

0 comments on commit 9455edd

Please sign in to comment.