diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2b6e9e2..d59da46a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -395,6 +395,10 @@ jobs: permissions: contents: write runs-on: ubuntu-24.04 + if: | + startsWith(github.ref, 'refs/tags/v') && + !contains(github.ref, '-beta') && + !contains(github.ref, '-alpha') steps: - name: Checkout uses: actions/checkout@v4 diff --git a/diff b/diff new file mode 100644 index 00000000..e69de29b diff --git a/frontend/src/components/AddConfigModal/index.tsx b/frontend/src/components/AddConfigModal/index.tsx index 6d418925..6543c231 100644 --- a/frontend/src/components/AddConfigModal/index.tsx +++ b/frontend/src/components/AddConfigModal/index.tsx @@ -47,6 +47,11 @@ const AddConfigModal: React.FC = ({ { value: 'proxy', label: 'Proxy' }, ] + const CUSTOM_PORT = { + value: -1, + label: 'Custom Port...', + } as const + const protocolOptions: StringOption[] = [ { value: 'tcp', label: 'TCP' }, { value: 'udp', label: 'UDP' }, @@ -334,15 +339,22 @@ const AddConfigModal: React.FC = ({ if (actionMeta.name === 'remote_port') { const portOption = newValue as PortOption | null - setFormState(prev => ({ - ...prev, - selectedPort: portOption, - })) - setNewConfig(prev => ({ ...prev, remote_port: portOption?.value })) + if (portOption?.value === -1) { + setFormState(prev => ({ + ...prev, + selectedPort: portOption, + })) + setNewConfig(prev => ({ ...prev, remote_port: undefined })) + } else { + setFormState(prev => ({ + ...prev, + selectedPort: portOption, + })) + setNewConfig(prev => ({ ...prev, remote_port: portOption?.value })) + } return } - const option = newValue as StringOption | null switch (actionMeta.name) { @@ -413,11 +425,12 @@ const AddConfigModal: React.FC = ({ } const portOptions: PortOption[] = useMemo( - () => - portQuery.data?.map(port => ({ + () => [ + ...(portQuery.data?.map(port => ({ value: port.port, label: port.name ? `${port.name} (${port.port})` : port.port.toString(), - })) || [], + })) || []), + ], [portQuery.data], ) @@ -738,24 +751,67 @@ const AddConfigModal: React.FC = ({ Target Port * - { + const value = parseInt(e.target.value, 10) + + if (!isNaN(value)) { + setFormState(prev => ({ + ...prev, + selectedPort: CUSTOM_PORT, + })) + const syntheticEvent = { + ...e, + target: { + ...e.target, + name: 'remote_port', + value: value.toString(), + }, + } + + handleInputChange(syntheticEvent) + } + }} + bg='#161616' + border='1px solid rgba(255, 255, 255, 0.08)' + _hover={{ + borderColor: 'rgba(255, 255, 255, 0.15)', + }} + _focus={{ + borderColor: 'blue.400', + boxShadow: 'none', + }} + height='28px' + fontSize='13px' + placeholder='Enter port number' + /> + ) : ( +