Skip to content

Commit

Permalink
fix: port range logseq/logseq#9211
Browse files Browse the repository at this point in the history
Signed-off-by: EINDEX <[email protected]>
  • Loading branch information
EINDEX committed Apr 23, 2023
1 parent 53d6e2f commit 2456b60
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/pages/options/components/Connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ export const LogseqConnectOptions = () => {
});
};

const changeLogseqPort = (port: string) => {
if (port === '' || parseInt(port) < 0) {
port='0'
}
setLogseqConfig({
...logseqConfig,
logseqPort: parseInt(port),
});
}

const triggerShowToken = () => setShowToken(!showToken);

const save = () => {
Expand Down Expand Up @@ -107,7 +117,7 @@ export const LogseqConnectOptions = () => {
<Text gridColumn={'1 / span 2'} fontSize="sm">
Host
</Text>
<Text fontSize="sm">Port (0 ~ 65536)</Text>
<Text fontSize="sm">Port (1 ~ 65535)</Text>
<Input
gridColumn={'1 / span 2'}
name="logseqHostName"
Expand All @@ -117,10 +127,10 @@ export const LogseqConnectOptions = () => {
/>
<NumberInput
max={65535}
min={0}
min={1}
name="logseqPort"
placeholder="Logseq Host"
onChange={onChange}
onChange={changeLogseqPort}
value={logseqConfig?.logseqPort}
>
<NumberInputField />
Expand Down

0 comments on commit 2456b60

Please sign in to comment.