Compare commits

..

No commits in common. "fce86e143447c8e9b75710c599f02162c0760dee" and "7329dbae11e322e3b29edfea888253a628d9d118" have entirely different histories.

4 changed files with 5 additions and 29 deletions

View file

@ -253,14 +253,11 @@ download_xray() {
} }
download_singbox() { download_singbox() {
# Download sing-box local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin cronet
mkdir -p "$outdir" mkdir -p "$outdir"
if [[ -z "$ver" ]]; then if [[ -z "$ver" ]]; then
ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \ ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \
| grep -Eo '"tag_name":\s*"v[^"]+"' \ | grep -Eo '"tag_name":\s*"v[^"]+"' | sed -E 's/.*"v([^"]+)".*/\1/' | head -n1)" || true
| sed -E 's/.*"v([^"]+)".*/\1/' \
| head -n1)" || true
fi fi
[[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; } [[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; }
if [[ "$rid" == "linux-arm64" ]]; then if [[ "$rid" == "linux-arm64" ]]; then
@ -275,8 +272,6 @@ download_singbox() {
bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)" bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)"
[[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; } [[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; }
install -m 755 "$bin" "$outdir/sing-box" install -m 755 "$bin" "$outdir/sing-box"
cronet="$(find "$tmp" -type f -name 'libcronet*.so*' | head -n1 || true)"
[[ -n "$cronet" ]] && install -m 644 "$cronet" "$outdir/libcronet.so"
rm -rf "$tmp" rm -rf "$tmp"
} }

View file

@ -232,13 +232,11 @@ download_xray() {
download_singbox() { download_singbox() {
# Download sing-box # Download sing-box
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin cronet local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin
mkdir -p "$outdir" mkdir -p "$outdir"
if [[ -z "$ver" ]]; then if [[ -z "$ver" ]]; then
ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \ ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \
| grep -Eo '"tag_name":\s*"v[^"]+"' \ | grep -Eo '"tag_name":\s*"v[^"]+"' | sed -E 's/.*"v([^"]+)".*/\1/' | head -n1)" || true
| sed -E 's/.*"v([^"]+)".*/\1/' \
| head -n1)" || true
fi fi
[[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; } [[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; }
if [[ "$rid" == "linux-arm64" ]]; then if [[ "$rid" == "linux-arm64" ]]; then
@ -253,8 +251,6 @@ download_singbox() {
bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)" bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)"
[[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; } [[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; }
install -m 755 "$bin" "$outdir/sing-box" install -m 755 "$bin" "$outdir/sing-box"
cronet="$(find "$tmp" -type f -name 'libcronet*.so*' | head -n1 || true)"
[[ -n "$cronet" ]] && install -m 644 "$cronet" "$outdir/libcronet.so"
rm -rf "$tmp" rm -rf "$tmp"
} }

View file

@ -1,5 +1,3 @@
using System.ComponentModel.DataAnnotations;
namespace ServiceLib.Handler.Builder; namespace ServiceLib.Handler.Builder;
public record CoreConfigContextBuilderResult(CoreConfigContext Context, NodeValidatorResult ValidatorResult) public record CoreConfigContextBuilderResult(CoreConfigContext Context, NodeValidatorResult ValidatorResult)
@ -311,11 +309,6 @@ public class CoreConfigContextBuilder
} }
var nodeValidatorResult = NodeValidator.Validate(node, context.RunCoreType); var nodeValidatorResult = NodeValidator.Validate(node, context.RunCoreType);
var msgs = new List<string>([.. nodeValidatorResult.Errors, .. nodeValidatorResult.Warnings]);
if (msgs.Count > 0)
{
Logging.SaveLog($"{node.Remarks}: {string.Join("; ", msgs)}");
}
if (!nodeValidatorResult.Success) if (!nodeValidatorResult.Success)
{ {
return nodeValidatorResult; return nodeValidatorResult;

View file

@ -143,19 +143,11 @@ public class NodeValidator
if (item.Network == nameof(ETransport.xhttp) && !item.Extra.IsNullOrEmpty()) if (item.Network == nameof(ETransport.xhttp) && !item.Extra.IsNullOrEmpty())
{ {
if (JsonUtils.ParseJson(item.Extra) is not JsonObject) if (JsonUtils.ParseJson(item.Extra) is null)
{ {
v.Error(string.Format(ResUI.MsgInvalidProperty, "XHTTP Extra")); v.Error(string.Format(ResUI.MsgInvalidProperty, "XHTTP Extra"));
} }
} }
if (!item.Finalmask.IsNullOrEmpty())
{
if (JsonUtils.ParseJson(item.Finalmask) is not JsonObject)
{
v.Error(string.Format(ResUI.MsgInvalidProperty, "Finalmask"));
}
}
} }
private static string? ValidateSingboxTransport(EConfigType configType, string net) private static string? ValidateSingboxTransport(EConfigType configType, string net)