Skip to content

Commit

Permalink
fix(configure-node): add missing onLinkGeneration call
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Jul 1, 2023
1 parent 9b2a4d4 commit 2c93e8e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/components/ConfigureNodeFormModal/HTTPForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const HTTPForm = ({ onLinkGeneration }: { onLinkGeneration: (link: string
})
}

return generateURL(generateURLParams)
return onLinkGeneration(generateURL(generateURLParams))
})

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigureNodeFormModal/SSForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const SSForm = ({ onLinkGeneration }: { onLinkGeneration: (link: string)

link += values.name.length ? `#${encodeURIComponent(values.name)}` : ''

return link
return onLinkGeneration(link)
})

return (
Expand Down
16 changes: 9 additions & 7 deletions src/components/ConfigureNodeFormModal/SSRForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ export const SSRForm = ({ onLinkGeneration }: { onLinkGeneration: (link: string)

const handleSubmit = onSubmit((values) => {
/* ssr://server:port:proto:method:obfs:URLBASE64(password)/?remarks=URLBASE64(remarks)&protoparam=URLBASE64(protoparam)&obfsparam=URLBASE64(obfsparam)) */
return `ssr://${Base64.encode(
`${values.server}:${values.port}:${values.proto}:${values.method}:${values.obfs}:${Base64.encodeURI(
values.password
)}/?remarks=${Base64.encodeURI(values.name)}&protoparam=${Base64.encodeURI(
values.protoParam
)}&obfsparam=${Base64.encodeURI(values.obfsParam)}`
)}`
return onLinkGeneration(
`ssr://${Base64.encode(
`${values.server}:${values.port}:${values.proto}:${values.method}:${values.obfs}:${Base64.encodeURI(
values.password
)}/?remarks=${Base64.encodeURI(values.name)}&protoparam=${Base64.encodeURI(
values.protoParam
)}&obfsparam=${Base64.encodeURI(values.obfsParam)}`
)}`
)
})

return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConfigureNodeFormModal/Socks5Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Socks5Form = ({ onLinkGeneration }: { onLinkGeneration: (link: stri
})
}

return generateURL(generateURLParams)
return onLinkGeneration(generateURL(generateURLParams))
})

return (
Expand Down
18 changes: 10 additions & 8 deletions src/components/ConfigureNodeFormModal/TrojanForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ export const TrojanForm = ({ onLinkGeneration }: { onLinkGeneration: (link: stri
delete query.allowInsecure
}

return generateURL({
protocol: protocol,
username: values.password,
host: values.server,
port: values.port,
hash: values.name,
params: query,
})
return onLinkGeneration(
generateURL({
protocol: protocol,
username: values.password,
host: values.server,
port: values.port,
hash: values.name,
params: query,
})
)
})

return (
Expand Down

0 comments on commit 2c93e8e

Please sign in to comment.