Skip to content

Commit

Permalink
Merge pull request #3 from Shiroiame-Kusu/preview
Browse files Browse the repository at this point in the history
Ver 0.10.0-RC1
  • Loading branch information
Shiroiame-Kusu authored Sep 9, 2023
2 parents ceabe88 + ec6dc9c commit 1e267d1
Show file tree
Hide file tree
Showing 28 changed files with 630 additions and 42 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Serein For JE - 新时代极简服务器面板

<p align="center">
<img alt="Serein" src="https://socialify.git.ci/Zaitonn/Serein/image?description=1&font=KoHo&logo=https%3A%2F%2Fserein.cc%2Fimg%2FSerein.png&name=1&owner=1&pattern=Circuit%20Board">
<img alt="Serein" src="https://socialify.git.ci/Zaitonn/Serein/image?description=1&descriptionEditable=%E6%9E%81%E7%AE%80%E4%BD%86%E5%A4%9A%E5%8A%9F%E8%83%BD%E7%9A%84%E6%9C%8D%E5%8A%A1%E5%99%A8%E9%9D%A2%E6%9D%BF%E8%BD%AF%E4%BB%B6&font=KoHo&logo=https%3A%2F%2Fserein.cc%2Fimg%2FSerein.png&name=1&owner=1&pattern=Circuit%20Board#light">
<br>
<img alt="GitHub Stars" src="https://img.shields.io/github/stars/Zaitonn/Serein?color=blue">
<img alt="GitHub Stars" src="https://img.shields.io/github/stars/Shiroiame-Kusu/Serein?color=blue">
<a href="https://github.com/Shiroiame-Kusu/Serein/releases/latest">
<img src="https://img.shields.io/github/v/release/Zaitonn/Serein?color=blue">
<img src="https://img.shields.io/github/v/release/Shiroiame-Kusu/Serein?color=blue">
</a>
<a href="https://github.com/Shiroiame-Kusu/Serein/releases/latest">
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/Zaitonn/Serein/total?color=blue">
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/Shiroiame-Kusu/Serein/total?color=blue">
</a>
<a href="https://github.com/Shiroiame-Kusu/Serein/actions/workflows/Build.yml">
<img alt="GitHub bulid" src="https://img.shields.io/github/actions/workflow/status/Zaitonn/Serein/Build.yml?branch=main&color=blue">
<img alt="GitHub bulid" src="https://img.shields.io/github/actions/workflow/status/Shiroiame-Kusu/Serein/Build.yml?branch=main&color=blue">
</a>
<a href="https://github.com/Shiroiame-Kusu/Serein">
<img alt="GitHub repo file count" src="https://img.shields.io/github/languages/code-size/Zaitonn/Serein">
<img alt="GitHub repo file count" src="https://img.shields.io/github/languages/code-size/Shiroiame-Kusu/Serein">
</a>
<a href="https://app.codacy.com/gh/Zaitonn/Serein/">
<a href="https://app.codacy.com/gh/Shiroiame-Kusu/Serein/">
<img alt="Codacy Grade" src="https://img.shields.io/codacy/grade/982069cd172d4ef4a40aa4bce4977542?color=blue&logo=Codacy">
</a>
</p>
Expand Down
5 changes: 4 additions & 1 deletion Serein.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
],
"settings": {
"workbench.colorTheme": "Visual Studio 2019 Dark",
"workbench.iconTheme": "vscode-icons"
"workbench.iconTheme": "vscode-icons",
"dotnet.defaultSolution": "Serein.sln",
"dotnet.server.useOmnisharp": true,
"editor.bracketPairColorization.enabled": false
}
}
5 changes: 4 additions & 1 deletion Serein/Universal/Base/Motd/Motd.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Serein.Utils;
using Newtonsoft.Json.Linq;
using Serein.Utils;
using System;
using System.Net;

Expand Down Expand Up @@ -85,6 +86,8 @@ internal abstract class Motd

private static readonly System.Text.RegularExpressions.Regex _IPv6Patten = new(@"^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$", System.Text.RegularExpressions.RegexOptions.Compiled);


public static JObject? PlayerListData;
/// <summary>
/// 尝试转换IP
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions Serein/Universal/Base/Motd/Motdje.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Serein.Extensions;
using Serein.Utils;
using System;
using System.Linq;
Expand All @@ -11,7 +13,7 @@ namespace Serein.Base.Motd
internal class Motdje : Motd
{
public static readonly byte[] SentPacket = new byte[] { 6, 0, 0, 0, 0x63, 0xdd, 1, 1, 0 };

/// <summary>
/// Java版Motd获取入口
/// </summary>
Expand Down Expand Up @@ -112,7 +114,8 @@ internal override void Get()
Logger.Output(LogType.Debug, $"Origin: {Origin}");

MotdjePacket.Packet packet = JsonConvert.DeserializeObject<MotdjePacket.Packet>(Origin) ?? throw new ArgumentNullException();

JObject PacketData = JObject.Parse(Origin);
PlayerListData = PacketData["players"].ToObject<JObject>();

Check warning on line 118 in Serein/Universal/Base/Motd/Motdje.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 118 in Serein/Universal/Base/Motd/Motdje.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 118 in Serein/Universal/Base/Motd/Motdje.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.
IsSuccessful = true;
OnlinePlayer = packet.Players.Online;
MaxPlayer = packet.Players.Max;
Expand Down
2 changes: 1 addition & 1 deletion Serein/Universal/Base/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public bool Check()
CrontabSchedule crontabSchedule;
if (Core.Generic.Command.GetType(Command) != CommandType.Invalid && (crontabSchedule = CrontabSchedule.TryParse(Cron)) != null)
{
NextTime = crontabSchedule.GetNextOccurrences(DateTime.Now, DateTime.Now.AddYears(1)).ToList()[0];
NextTime = crontabSchedule!.GetNextOccurrences(DateTime.Now, DateTime.Now.AddYears(1)).ToList()[0];
return true;
}
else
Expand Down
2 changes: 2 additions & 0 deletions Serein/Universal/Core/Server/ServerManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ internal static class ServerManager
public static int? JavaVersionNumber { get; set; }
public static bool AbleToUse_incubator_vector { get; set;}
public static string? Use_incubator_vector {get; set;}
public static bool? StartResult;

/// <summary>
/// 编码列表
Expand Down Expand Up @@ -521,6 +522,7 @@ private static void SortOutputHandler(object sender, DataReceivedEventArgs e)
if (!string.IsNullOrEmpty(e.Data))
{
string lineFiltered = LogPreProcessing.Filter(e.Data);
Console.WriteLine(lineFiltered);
if (string.IsNullOrEmpty(LevelName) && RegExp.Regex.IsMatch(lineFiltered, Global.Settings.Matches.LevelName, RegExp.RegexOptions.IgnoreCase))
{
LevelName = RegExp.Regex.Match(lineFiltered, Global.Settings.Matches.LevelName, RegExp.RegexOptions.IgnoreCase).Groups[1].Value.Trim();
Expand Down
2 changes: 1 addition & 1 deletion Serein/Universal/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ internal static class Global
/// <summary>
/// 版本号
/// </summary>
public const string VERSION = "v0.9.1-RC1";
public const string VERSION = "v0.10.0-RC1";
//public static readonly string VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion.ToString();

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Serein/Universal/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.9.1.1")]
[assembly: AssemblyFileVersion("0.9.1-RC1")]
[assembly: AssemblyVersion("0.10.0.1")]
[assembly: AssemblyFileVersion("0.10.0-RC1")]
2 changes: 1 addition & 1 deletion Serein/Universal/Settings/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal class Server

public int OutputEncoding;

public int OutputStyle = 1;
public int OutputStyle = 2;

public string Path = string.Empty;

Expand Down
2 changes: 1 addition & 1 deletion Serein/Universal/Utils/Heartbeat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static void Start()
/// </summary>
private static void Request()
{
if (Global.Settings.Serein.Function.NoHeartbeat)
if (Global.Settings.Serein.Function.NoHeartbeat)
{
return;
}
Expand Down
5 changes: 4 additions & 1 deletion Serein/Universal/Utils/LogPreProcessing.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Text;
using RegExp = System.Text.RegularExpressions;
using System;
#if WPF
using System.Windows.Documents;
using System.Windows.Media;
Expand Down Expand Up @@ -63,6 +64,7 @@ public static string Filter(string input)
{
string result = RegExp.Regex.Replace(input, @"\x1b\[.*?m", string.Empty);
result = RegExp.Regex.Replace(result, @"\x1b", string.Empty);
//Console.WriteLine(result);
StringBuilder stringBuilder = new();
for (int i = 0; i < result.Length; i++)
{
Expand Down Expand Up @@ -292,7 +294,8 @@ private static Paragraph Highlight(this Paragraph paragraph, string line)
"debug" => Brushes.DarkOrchid,
"true" => Brushes.YellowGreen,
"false" => Brushes.Tomato,
_ => RegExp.Regex.IsMatch(words, @"^\d+$") ? Brushes.Teal : run.Foreground,
_ => RegExp.Regex.IsMatch(words, @"^\d+$") ? Brushes.Teal : Global.Settings.Serein.UseDarkTheme ? Brushes.White : Brushes.Black,
//_ => Global.Settings.Serein.UseDarkTheme ? Brushes.White : Brushes.Black ,
};
paragraph.Inlines.Add(run);
}
Expand Down
2 changes: 1 addition & 1 deletion Serein/Universal/Utils/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal static class Runtime
/// <summary>
/// 命令行参数
/// </summary>
private static IList<string> _args => Environment.GetCommandLineArgs();
private readonly static IList<string> _args = Environment.GetCommandLineArgs();

/// <summary>
/// 初始化
Expand Down
15 changes: 11 additions & 4 deletions Serein/Universal/Utils/SystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ public static void Init()
#if !UNIX
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
_counter = new("Processor", "% Processor Time", "_Total")
try
{
MachineName = "."
};
Task.Run(() => _counter?.NextValue());
_counter = new("Processor", "% Processor Time", "_Total")
{
MachineName = "."
};
Task.Run(() => _counter?.NextValue());
}
catch {

}

}
#endif
Info = OperatingSystemInfo.GetOperatingSystemInfo();
Expand Down
14 changes: 9 additions & 5 deletions Serein/Universal/Utils/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using System.Threading.Tasks;
using System.Timers;

Expand Down Expand Up @@ -39,6 +40,7 @@ public static void Init()
/// 上一个获取到的版本
/// </summary>
public static string? LastVersion { get; private set; }
public static string? CurrentVersion;

/// <summary>
/// 检查更新
Expand All @@ -48,6 +50,8 @@ public static void CheckVersion()
if (!Global.Settings.Serein.EnableGetUpdate)
{
return;
}else if(Global.BRANCH.Equals("Preview")){
return;
}
try
{
Expand All @@ -61,7 +65,8 @@ public static void CheckVersion()
if (LastVersion != version && !string.IsNullOrEmpty(version))
{
LastVersion = version;
if (version != Global.VERSION)
CurrentVersion = "v" + Assembly.GetExecutingAssembly().GetName().Version.ToString();

Check warning on line 68 in Serein/Universal/Utils/Update.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 68 in Serein/Universal/Utils/Update.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 68 in Serein/Universal/Utils/Update.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 68 in Serein/Universal/Utils/Update.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.

Check warning on line 68 in Serein/Universal/Utils/Update.cs

View workflow job for this annotation

GitHub Actions / BuildForWindows (WPF)

Dereference of a possibly null reference.
if (version != CurrentVersion)
{
Logger.Output(Base.LogType.Version_New, version);
if (Global.Settings.Serein.AutoUpdate)
Expand Down Expand Up @@ -174,10 +179,9 @@ public static void StartUpdater()
}
if (!File.Exists("Updater.exe"))
{
using (FileStream fileStream = new("Updater.exe", FileMode.Create))
{
fileStream.Write(Resources.Updater, 0, Resources.Updater.Length);
}
using FileStream fileStream = new("Updater.exe", FileMode.Create);
fileStream.Write(Resources.Updater, 0, Resources.Updater.Length);

}
Process.Start(new ProcessStartInfo("Updater.exe")
{
Expand Down
2 changes: 2 additions & 0 deletions Serein/WPF/Serein-WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down Expand Up @@ -50,6 +51,7 @@
<Compile Remove="..\Universal\Core\JSPlugin\Permissions\PermissionManager.cs" />
<Compile Remove="..\Universal\Core\JSPlugin\Plugin.cs" />
<Compile Remove="..\Universal\Core\JSPlugin\PreLoadConfig.cs" />
<Compile Remove="..\Universal\Core\Server\PlayerManager.cs" />
<Compile Remove="..\Universal\Settings\Bot.cs" />
<Content Include="..\Universal\Sources\Serein.ico" />
<Resource Include="..\Universal\Sources\Serein.ico" />
Expand Down
12 changes: 12 additions & 0 deletions Serein/WPF/Serein-WPF.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@
<Compile Update="Windows\Pages\Debug.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Pages\Function\Frp\Login.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Pages\Server\Download.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Pages\Server\PlayerList.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Windows\Pages\Server\Properties.xaml.cs">
<SubType>Code</SubType>
</Compile>
Expand All @@ -24,9 +30,15 @@
<Page Update="Windows\Pages\Function\Container.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Pages\Function\Frp\Login.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Pages\Server\Download.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Pages\Server\PlayerList.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Windows\Pages\Server\Properties.xaml">
<SubType>Designer</SubType>
</Page>
Expand Down
1 change: 1 addition & 0 deletions Serein/WPF/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using Wpf.Ui.Appearance;
Expand Down
7 changes: 7 additions & 0 deletions Serein/WPF/Windows/Pages/Function/Container.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pages="clr-namespace:Serein.Windows.Pages.Function"
xmlns:pages2="clr-namespace:Serein.Windows.Pages.Function.Frp"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
d:DesignHeight="850"
d:DesignWidth="800"
Expand All @@ -29,6 +30,12 @@
Icon="Timer24"
PageTag="schedule"
PageType="{x:Type pages:Schedule}" />
<ui:NavigationItem
x:Name="LocyanFrp"
Content="定时任务"
Icon="VirtualNetwork20"
PageTag="frp"
PageType="{x:Type pages2:Login}" />
</ui:NavigationCompact.Items>
</ui:NavigationCompact>
<Border
Expand Down
Loading

0 comments on commit 1e267d1

Please sign in to comment.