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.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>
|
||||
<body style="margin: 0">
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { enc } from "../aes";
|
|||
import CloakedHead from "../util/CloakedHead";
|
||||
import { useEffect } from "preact/hooks";
|
||||
import { updateServiceWorkers } from "../util/SWHelper.js";
|
||||
import { setTransport } from "../util/transports";
|
||||
|
||||
export function Home() {
|
||||
const [isFocused, setIsFocused] = useState(false);
|
||||
|
|
@ -90,6 +91,7 @@ export function Home() {
|
|||
|
||||
const handleSubmit = (event) => {
|
||||
event.preventDefault();
|
||||
setTransport();
|
||||
window.location.href =
|
||||
"/go/" +
|
||||
encodeURIComponent(
|
||||
|
|
@ -165,6 +167,7 @@ export function Home() {
|
|||
{showSuggestions &&
|
||||
suggestions.map((suggestion, index) => (
|
||||
<a
|
||||
onClick={() => {setTransport()}}
|
||||
href={
|
||||
"/go/" +
|
||||
encodeURIComponent(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { Settings } from "./pages/Settings/";
|
|||
import { AboutBlank } from "./AboutBlank";
|
||||
import { Faq } from "./pages/Faq";
|
||||
// import { registerRemoteListener } from "@mercuryworkshop/bare-mux";
|
||||
import { setTransport } from "./util/transports";
|
||||
import "./style.css";
|
||||
import "./i18n";
|
||||
|
||||
|
|
@ -17,11 +16,10 @@ export default function Routes() {
|
|||
(location.protocol === "https:" ? "wss://" : "ws://") +
|
||||
location.host +
|
||||
"/wisp/"; // @TODO Japan - US ping
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.ready.then(async () => {
|
||||
//await registerRemoteListener(sw.active!)
|
||||
setTransport();
|
||||
console.log("SW ready")
|
||||
});
|
||||
navigator.serviceWorker.register("/sw.js", {
|
||||
scope: "/"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue