| 1 | <template> |
| 2 | <ConfigSection title="Connection" :readonly="readonly"> |
| 3 | <div class="field-row two-col"> |
| 4 | <ConfigField label="Server Name" type="text" v-model="form.serverName" prop="serverName" |
| 5 | placeholder="Name of the proxy to visit" :readonly="readonly" /> |
| 6 | <ConfigField label="Server User" type="text" v-model="form.serverUser" |
| 7 | placeholder="Leave empty for same user" :readonly="readonly" /> |
| 8 | </div> |
| 9 | <ConfigField label="Secret Key" type="password" v-model="form.secretKey" |
| 10 | placeholder="Shared secret" :readonly="readonly" /> |
| 11 | <div class="field-row two-col"> |
| 12 | <ConfigField label="Bind Address" type="text" v-model="form.bindAddr" |
| 13 | placeholder="127.0.0.1" :readonly="readonly" /> |
| 14 | <ConfigField label="Bind Port" type="number" v-model="form.bindPort" |
| 15 | :min="bindPortMin" :max="65535" prop="bindPort" :readonly="readonly" /> |
| 16 | </div> |
| 17 | </ConfigSection> |
| 18 | </template> |
| 19 | |
| 20 | <script setup lang="ts"> |
| 21 | import { computed } from 'vue' |
| 22 | import type { VisitorFormData } from '../../types' |
| 23 | import ConfigSection from '../ConfigSection.vue' |
| 24 | import ConfigField from '../ConfigField.vue' |
| 25 | |
| 26 | const props = withDefaults(defineProps<{ |
| 27 | modelValue: VisitorFormData |
| 28 | readonly?: boolean |
| 29 | }>(), { readonly: false }) |
| 30 | |
| 31 | const emit = defineEmits<{ 'update:modelValue': [value: VisitorFormData] }>() |
| 32 | |
| 33 | const form = computed({ |
| 34 | get: () => props.modelValue, |
| 35 | set: (val) => emit('update:modelValue', val), |
| 36 | }) |
| 37 | |
| 38 | const bindPortMin = computed(() => (form.value.type === 'sudp' ? 1 : undefined)) |
| 39 | </script> |
| 40 | |
| 41 | <style scoped lang="scss"> |
| 42 | @use '@/assets/css/form-layout'; |
| 43 | </style> |