{
e.preventDefault();
- const isHttpMode =
- window.location.protocol.startsWith("http") &&
- !window.location.hostname.startsWith("wails");
+ const _isHttpMode = isHttpMode();
try {
setLoading(true);
- if (isHttpMode) {
+ if (_isHttpMode) {
const response = await fetch("/api/backup", {
method: "POST",
headers: {
diff --git a/frontend/src/screens/setup/RestoreNode.tsx b/frontend/src/screens/setup/RestoreNode.tsx
index 86aa5cb5..a580f8de 100644
--- a/frontend/src/screens/setup/RestoreNode.tsx
+++ b/frontend/src/screens/setup/RestoreNode.tsx
@@ -21,6 +21,7 @@ import { useToast } from "src/components/ui/use-toast";
import { useInfo } from "src/hooks/useInfo";
import { handleRequestError } from "src/utils/handleRequestError";
+import { isHttpMode } from "src/utils/isHttpMode";
import { request } from "src/utils/request";
export function RestoreNode() {
@@ -34,9 +35,7 @@ export function RestoreNode() {
const [loading, setLoading] = useState(false);
const [restored, setRestored] = useState(false);
const { data: info } = useInfo(restored);
- const isHttpMode =
- window.location.protocol.startsWith("http") &&
- !window.location.hostname.startsWith("wails");
+ const _isHttpMode = isHttpMode();
React.useEffect(() => {
if (restored && info?.setupCompleted) {
@@ -73,7 +72,7 @@ export function RestoreNode() {
try {
setLoading(true);
- if (isHttpMode) {
+ if (_isHttpMode) {
const formData = new FormData();
formData.append("unlockPassword", unlockPassword);
if (file !== null) {
@@ -130,7 +129,7 @@ export function RestoreNode() {
placeholder="Unlock Password"
/>
- {isHttpMode && (
+ {_isHttpMode && (
{
+ return (
+ window.location.protocol.startsWith("http") &&
+ !window.location.hostname.startsWith("wails")
+ );
+};