Small console changes
This commit is contained in:
parent
76e2982d64
commit
30f0417378
@ -4,19 +4,19 @@ import { WebView } from "react-native-webview";
|
||||
import useAuthStore from "../../../../../stores/useAuthStore";
|
||||
|
||||
function buildConsoleUrl(domain: string, node: string, vmid: string) {
|
||||
const url = new URL(domain);
|
||||
url.searchParams.append("node", node);
|
||||
url.searchParams.append("vmid", vmid);
|
||||
url.searchParams.append("resize", "1");
|
||||
url.searchParams.append("console", "lxc");
|
||||
url.searchParams.append("xtermjs", "1");
|
||||
return url.toString();
|
||||
const params = new URLSearchParams({
|
||||
node: node,
|
||||
vmid: vmid,
|
||||
resize: "1",
|
||||
console: "lxc",
|
||||
xtermjs: "1",
|
||||
});
|
||||
return `${domain}?${params}`;
|
||||
}
|
||||
|
||||
export default function QEMUResourceConsolePage() {
|
||||
const { node, vmid } = useSearchParams<{ node: string; vmid: string }>();
|
||||
const { domain, ticketData } = useAuthStore();
|
||||
console.log({ ticketData }, buildConsoleUrl(domain, node, vmid));
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<WebView
|
||||
@ -24,17 +24,10 @@ export default function QEMUResourceConsolePage() {
|
||||
uri: buildConsoleUrl(domain, node, vmid),
|
||||
headers: {
|
||||
Cookie: `PVEAuthCookie=${ticketData.data.ticket}`,
|
||||
Accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
||||
CSRFPreventionToken: ticketData.data.CSRFPreventionToken,
|
||||
},
|
||||
}}
|
||||
scalesPageToFit={false}
|
||||
injectedJavaScript={`
|
||||
const meta = document.createElement('meta');
|
||||
meta.setAttribute('content', 'width=width, initial-scale=0.5, maximum-scale=0.5, user-scalable=2.0');
|
||||
meta.setAttribute('name', 'viewport');
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
`}
|
||||
sharedCookiesEnabled={true}
|
||||
/>
|
||||
</SafeAreaView>
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user