fix: clear CI security, lint, and formatting gates

This commit is contained in:
jrangus 2026-11-10 14:50:53 +08:00
parent 5979306459
commit 155e2b0e5c
7 changed files with 35 additions and 54 deletions

View file

@ -1,32 +0,0 @@
name: Publish 3x-ui-20261110 once
on:
push:
paths:
- .github/workflows/publish-3x-ui-20261110-once.yml
permissions:
actions: write
contents: write
jobs:
publish:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
SOURCE_SHA: 8c56ee16baf396e53037a857393e1671d8bae5a4
RELEASE_TAG: 3x-ui-20261110
steps:
- name: Publish final tested source and refresh update channel
shell: bash
run: |
set -euo pipefail
gh release edit "$RELEASE_TAG" --target "$SOURCE_SHA" --draft --title "$RELEASE_TAG"
gh workflow run release.yml --ref main -f source_ref="$SOURCE_SHA" -f release_tag="$RELEASE_TAG"
sleep 10
RUN_ID="$(gh run list --workflow release.yml --event workflow_dispatch --limit 1 --json databaseId --jq '.[0].databaseId')"
[[ "$RUN_ID" =~ ^[0-9]+$ ]]
echo "3x-ui release run: $RUN_ID"
gh run watch "$RUN_ID" --exit-status

View file

@ -411,4 +411,3 @@
.submit-row {
margin-bottom: 0;
}

View file

@ -54,10 +54,7 @@ interface MemberRow {
email: string;
}
type ExitSourceCategory =
| 'xnvgatebox_stable'
| 'new_residential'
| 'new_native_datacenter';
type ExitSourceCategory = 'xnvgatebox_stable' | 'new_residential' | 'new_native_datacenter';
type ExitSourceFilter = ExitSourceCategory | 'all';
const SOURCE_LABELS: Record<ExitSourceCategory, string> = {
@ -98,8 +95,7 @@ export default function ExitPoolTab(_: ExitPoolTabProps) {
const [name, setName] = useState('Multi-region');
const [subId, setSubId] = useState('');
const [exitSort, setExitSort] = useState<'region' | 'latency'>('region');
const [sourceFilter, setSourceFilter] =
useState<ExitSourceFilter>('xnvgatebox_stable');
const [sourceFilter, setSourceFilter] = useState<ExitSourceFilter>('xnvgatebox_stable');
const [showConsole, setShowConsole] = useState(false);
const refresh = useCallback(async () => {
@ -150,8 +146,7 @@ export default function ExitPoolTab(_: ExitPoolTabProps) {
sortedExits.filter(
(exit) =>
exit.status === 'up' &&
(sourceFilter === 'all' ||
(exit.sourceCategory || 'xnvgatebox_stable') === sourceFilter),
(sourceFilter === 'all' || (exit.sourceCategory || 'xnvgatebox_stable') === sourceFilter),
),
[sortedExits, sourceFilter],
);
@ -159,8 +154,7 @@ export default function ExitPoolTab(_: ExitPoolTabProps) {
() =>
sortedExits.filter(
(exit) =>
sourceFilter === 'all' ||
(exit.sourceCategory || 'xnvgatebox_stable') === sourceFilter,
sourceFilter === 'all' || (exit.sourceCategory || 'xnvgatebox_stable') === sourceFilter,
),
[sortedExits, sourceFilter],
);
@ -376,7 +370,15 @@ export default function ExitPoolTab(_: ExitPoolTabProps) {
{
title: '分类',
render: (_, row: ExitRow) => (
<Tag color={row.sourceCategory === 'xnvgatebox_stable' ? 'blue' : row.sourceCategory === 'new_residential' ? 'green' : 'gold'}>
<Tag
color={
row.sourceCategory === 'xnvgatebox_stable'
? 'blue'
: row.sourceCategory === 'new_residential'
? 'green'
: 'gold'
}
>
{sourceLabel(row.sourceCategory)}
</Tag>
),
@ -414,7 +416,8 @@ export default function ExitPoolTab(_: ExitPoolTabProps) {
<Space wrap>
{row.members.map((member) => (
<Tag key={member.slot}>
{sourceLabel(member.sourceCategory)} · {member.country || member.region || `Slot ${member.slot}`}
{sourceLabel(member.sourceCategory)} ·{' '}
{member.country || member.region || `Slot ${member.slot}`}
</Tag>
))}
</Space>

2
go.mod
View file

@ -1,6 +1,6 @@
module github.com/mhsanaei/3x-ui/v3
go 1.27.2
go 1.27.3
require (
github.com/amnezia-vpn/amneziawg-go/v3 v3.1.20260828

View file

@ -28,7 +28,6 @@ type IndexController struct {
settingService service.SettingService
userService panel.UserService
panelService panel.PanelService
tgbot tgbot.Tgbot
}

View file

@ -211,12 +211,22 @@ func exitPoolPublicIPv4(ip net.IP) bool {
if len(ip) != net.IPv4len || ip.IsPrivate() || ip.IsLoopback() || ip.IsUnspecified() || ip.IsMulticast() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() {
return false
}
return ip[0] != 0 && ip[0] != 127 && ip[0] < 224 &&
!(ip[0] == 100 && ip[1]&0xc0 == 64) &&
!(ip[0] == 169 && ip[1] == 254) &&
!(ip[0] == 192 && (ip[1] == 0 || ip[1] == 2)) &&
!(ip[0] == 198 && (ip[1] == 18 || ip[1] == 19 || ip[1] == 51)) &&
!(ip[0] == 203 && ip[1] == 0)
switch {
case ip[0] == 0, ip[0] == 127, ip[0] >= 224:
return false
case ip[0] == 100 && ip[1]&0xc0 == 64:
return false
case ip[0] == 169 && ip[1] == 254:
return false
case ip[0] == 192 && (ip[1] == 0 || ip[1] == 2):
return false
case ip[0] == 198 && (ip[1] == 18 || ip[1] == 19 || ip[1] == 51):
return false
case ip[0] == 203 && ip[1] == 0:
return false
default:
return true
}
}
func exitPoolSOCKSServer(e ExitPoolExit) map[string]any {

View file

@ -269,7 +269,9 @@ func (s *PanelService) startUpdate(useDev bool) (int64, error) {
if err != nil {
return 0, err
}
if output, syntaxErr := exec.Command(bash, "-n", scriptPath).CombinedOutput(); syntaxErr != nil {
checkCtx, cancelCheck := context.WithTimeout(context.Background(), 15*time.Second)
defer cancelCheck()
if output, syntaxErr := exec.CommandContext(checkCtx, bash, "-n", scriptPath).CombinedOutput(); syntaxErr != nil {
_ = os.Remove(scriptPath)
return 0, fmt.Errorf("downloaded panel updater failed syntax validation: %w: %s", syntaxErr, strings.TrimSpace(string(output)))
}