Skip to content

Commit

Permalink
fix: auto configure (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xffffharry authored Jun 2, 2024
1 parent 14215e2 commit ce4f67d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/Setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,21 @@ export default () => {
}

onMount(() => {
const query = new URLSearchParams(location.search)
let search = location.search

if (search.length === 0) {
const searchList = location.hash.match(/\?.*$/)

if (searchList.length > 0 && searchList[0].length > 0) {
search = searchList[0].replace('?', '', 1)
}
}

const query = new URLSearchParams(search)

if (query.has('hostname')) {
void onSubmit({
url: `${window.location.protocol}//${query.get('hostname')}${
url: `${query.get('http') ? 'http:' : query.get('https') ? 'https:' : window.location.protocol}//${query.get('hostname')}${
query.get('port') ? `:${query.get('port')}` : ''
}`,
secret: query.get('secret') ?? '',
Expand Down

0 comments on commit ce4f67d

Please sign in to comment.