Don't set the transport until the user clicks suggestions or hits enter
This commit is contained in:
parent
a341b1dcbe
commit
9c01c9f65c
3 changed files with 5 additions and 4 deletions
|
|
@ -7,7 +7,7 @@
|
||||||
<script src="/uv/uv.bundle.js" defer></script>
|
<script src="/uv/uv.bundle.js" defer></script>
|
||||||
<script src="/uv/uv.config.js" defer></script>
|
<script src="/uv/uv.config.js" defer></script>
|
||||||
<script src="/dynamic/dynamic.config.js" defer></script>
|
<script src="/dynamic/dynamic.config.js" defer></script>
|
||||||
<script src="/localforage/localforage.min.js" defer></script>
|
<script src="/localforage/localforage.min.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="margin: 0">
|
<body style="margin: 0">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { enc } from "../aes";
|
||||||
import CloakedHead from "../util/CloakedHead";
|
import CloakedHead from "../util/CloakedHead";
|
||||||
import { useEffect } from "preact/hooks";
|
import { useEffect } from "preact/hooks";
|
||||||
import { updateServiceWorkers } from "../util/SWHelper.js";
|
import { updateServiceWorkers } from "../util/SWHelper.js";
|
||||||
|
import { setTransport } from "../util/transports";
|
||||||
|
|
||||||
export function Home() {
|
export function Home() {
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
|
|
@ -90,6 +91,7 @@ export function Home() {
|
||||||
|
|
||||||
const handleSubmit = (event) => {
|
const handleSubmit = (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
setTransport();
|
||||||
window.location.href =
|
window.location.href =
|
||||||
"/go/" +
|
"/go/" +
|
||||||
encodeURIComponent(
|
encodeURIComponent(
|
||||||
|
|
@ -165,6 +167,7 @@ export function Home() {
|
||||||
{showSuggestions &&
|
{showSuggestions &&
|
||||||
suggestions.map((suggestion, index) => (
|
suggestions.map((suggestion, index) => (
|
||||||
<a
|
<a
|
||||||
|
onClick={() => {setTransport()}}
|
||||||
href={
|
href={
|
||||||
"/go/" +
|
"/go/" +
|
||||||
encodeURIComponent(
|
encodeURIComponent(
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import { Settings } from "./pages/Settings/";
|
||||||
import { AboutBlank } from "./AboutBlank";
|
import { AboutBlank } from "./AboutBlank";
|
||||||
import { Faq } from "./pages/Faq";
|
import { Faq } from "./pages/Faq";
|
||||||
// import { registerRemoteListener } from "@mercuryworkshop/bare-mux";
|
// import { registerRemoteListener } from "@mercuryworkshop/bare-mux";
|
||||||
import { setTransport } from "./util/transports";
|
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
import "./i18n";
|
import "./i18n";
|
||||||
|
|
||||||
|
|
@ -17,11 +16,10 @@ export default function Routes() {
|
||||||
(location.protocol === "https:" ? "wss://" : "ws://") +
|
(location.protocol === "https:" ? "wss://" : "ws://") +
|
||||||
location.host +
|
location.host +
|
||||||
"/wisp/"; // @TODO Japan - US ping
|
"/wisp/"; // @TODO Japan - US ping
|
||||||
|
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
navigator.serviceWorker.ready.then(async () => {
|
navigator.serviceWorker.ready.then(async () => {
|
||||||
//await registerRemoteListener(sw.active!)
|
//await registerRemoteListener(sw.active!)
|
||||||
setTransport();
|
console.log("SW ready")
|
||||||
});
|
});
|
||||||
navigator.serviceWorker.register("/sw.js", {
|
navigator.serviceWorker.register("/sw.js", {
|
||||||
scope: "/"
|
scope: "/"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue