feat: add auth, hosts, & keychains ownership

This commit is contained in:
2024-11-10 18:49:35 +07:00
parent b2cc6778a6
commit 38e81049a1
31 changed files with 579 additions and 92 deletions
@@ -2,6 +2,7 @@ import React from "react";
import Terminal from "./terminal";
import { BASE_WS_URL } from "@/lib/api";
import VNCViewer from "./vncviewer";
import { useAuthStore } from "@/stores/auth";
type SSHSessionProps = {
type: "ssh";
@@ -28,7 +29,8 @@ export type InteractiveSessionProps = {
} & (SSHSessionProps | PVESessionProps | IncusSessionProps);
const InteractiveSession = ({ type, params }: InteractiveSessionProps) => {
const query = new URLSearchParams(params);
const { token } = useAuthStore();
const query = new URLSearchParams({ ...params, sid: token || "" });
const url = `${BASE_WS_URL}/ws/term?${query}`;
switch (type) {
@@ -0,0 +1,29 @@
import React from "react";
import { Button, GetProps } from "tamagui";
import Icons from "../ui/icons";
import useThemeStore from "@/stores/theme";
type Props = GetProps<typeof Button> & {
iconSize?: number;
};
const ThemeSwitcher = ({ iconSize = 24, ...props }: Props) => {
const { theme, toggle } = useThemeStore();
return (
<Button
icon={
<Icons
name={
theme === "light" ? "white-balance-sunny" : "moon-waning-crescent"
}
size={iconSize}
/>
}
onPress={toggle}
{...props}
/>
);
};
export default ThemeSwitcher;