mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-01-18 11:38:32 +01:00
feat: use the api url from device config (#161)
This commit is contained in:
@@ -6,6 +6,7 @@ import { useLocation, useNavigation, useSearchParams } from "react-router-dom";
|
||||
import Fieldset from "@components/Fieldset";
|
||||
import GridBackground from "@components/GridBackground";
|
||||
import StepCounter from "@components/StepCounter";
|
||||
import { CLOUD_API } from "@/ui.config";
|
||||
|
||||
type AuthLayoutProps = {
|
||||
title: string;
|
||||
@@ -62,7 +63,7 @@ export default function AuthLayout({
|
||||
<Fieldset className="space-y-12">
|
||||
<div className="max-w-sm mx-auto space-y-4">
|
||||
<form
|
||||
action={`${import.meta.env.VITE_CLOUD_API}/oidc/google`}
|
||||
action={`${CLOUD_API}/oidc/google`}
|
||||
method="POST"
|
||||
>
|
||||
{/*This could be the KVM ID*/}
|
||||
|
||||
@@ -14,6 +14,7 @@ import PeerConnectionStatusCard from "@components/PeerConnectionStatusCard";
|
||||
import api from "../api";
|
||||
import { isOnDevice } from "../main";
|
||||
import { Button, LinkButton } from "./Button";
|
||||
import { CLOUD_API, SIGNAL_API } from "@/ui.config";
|
||||
|
||||
interface NavbarProps {
|
||||
isLoggedIn: boolean;
|
||||
@@ -37,8 +38,8 @@ export default function DashboardNavbar({
|
||||
const navigate = useNavigate();
|
||||
const onLogout = useCallback(async () => {
|
||||
const logoutUrl = isOnDevice
|
||||
? `${import.meta.env.VITE_SIGNAL_API}/auth/logout`
|
||||
: `${import.meta.env.VITE_CLOUD_API}/logout`;
|
||||
? `${SIGNAL_API}/auth/logout`
|
||||
: `${CLOUD_API}/logout`;
|
||||
const res = await api.POST(logoutUrl);
|
||||
if (!res.ok) return;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import { ExclamationTriangleIcon } from "@heroicons/react/20/solid";
|
||||
import notifications from "../notifications";
|
||||
import Fieldset from "./Fieldset";
|
||||
import { isOnDevice } from "../main";
|
||||
import { SIGNAL_API } from "@/ui.config";
|
||||
|
||||
export default function MountMediaModal({
|
||||
open,
|
||||
@@ -1119,7 +1120,7 @@ function UploadFileView({
|
||||
alreadyUploadedBytes: number,
|
||||
dataChannel: string,
|
||||
) {
|
||||
const uploadUrl = `${import.meta.env.VITE_SIGNAL_API}/storage/upload?uploadId=${dataChannel}`;
|
||||
const uploadUrl = `${SIGNAL_API}/storage/upload?uploadId=${dataChannel}`;
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", uploadUrl, true);
|
||||
|
||||
@@ -26,6 +26,7 @@ import LocalAuthPasswordDialog from "@/components/LocalAuthPasswordDialog";
|
||||
import { LocalDevice } from "@routes/devices.$id";
|
||||
import { useRevalidator } from "react-router-dom";
|
||||
import { ShieldCheckIcon } from "@heroicons/react/20/solid";
|
||||
import { CLOUD_APP, SIGNAL_API } from "@/ui.config";
|
||||
|
||||
export function SettingsItem({
|
||||
title,
|
||||
@@ -366,7 +367,7 @@ export default function SettingsSidebar() {
|
||||
const getDevice = useCallback(async () => {
|
||||
try {
|
||||
const status = await api
|
||||
.GET(`${import.meta.env.VITE_SIGNAL_API}/device`)
|
||||
.GET(`${SIGNAL_API}/device`)
|
||||
.then(res => res.json() as Promise<LocalDevice>);
|
||||
setLocalDevice(status);
|
||||
} catch (error) {
|
||||
@@ -677,7 +678,7 @@ export default function SettingsSidebar() {
|
||||
<div>
|
||||
<LinkButton
|
||||
to={
|
||||
import.meta.env.VITE_CLOUD_APP +
|
||||
CLOUD_APP +
|
||||
"/signup?deviceId=" +
|
||||
deviceId +
|
||||
`&returnTo=${location.href}adopt`
|
||||
|
||||
Reference in New Issue
Block a user