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";
|
import useAuthStore from "../../../../../stores/useAuthStore";
|
||||||
|
|
||||||
function buildConsoleUrl(domain: string, node: string, vmid: string) {
|
function buildConsoleUrl(domain: string, node: string, vmid: string) {
|
||||||
const url = new URL(domain);
|
const params = new URLSearchParams({
|
||||||
url.searchParams.append("node", node);
|
node: node,
|
||||||
url.searchParams.append("vmid", vmid);
|
vmid: vmid,
|
||||||
url.searchParams.append("resize", "1");
|
resize: "1",
|
||||||
url.searchParams.append("console", "lxc");
|
console: "lxc",
|
||||||
url.searchParams.append("xtermjs", "1");
|
xtermjs: "1",
|
||||||
return url.toString();
|
});
|
||||||
|
return `${domain}?${params}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function QEMUResourceConsolePage() {
|
export default function QEMUResourceConsolePage() {
|
||||||
const { node, vmid } = useSearchParams<{ node: string; vmid: string }>();
|
const { node, vmid } = useSearchParams<{ node: string; vmid: string }>();
|
||||||
const { domain, ticketData } = useAuthStore();
|
const { domain, ticketData } = useAuthStore();
|
||||||
console.log({ ticketData }, buildConsoleUrl(domain, node, vmid));
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1 }}>
|
<SafeAreaView style={{ flex: 1 }}>
|
||||||
<WebView
|
<WebView
|
||||||
@ -24,17 +24,10 @@ export default function QEMUResourceConsolePage() {
|
|||||||
uri: buildConsoleUrl(domain, node, vmid),
|
uri: buildConsoleUrl(domain, node, vmid),
|
||||||
headers: {
|
headers: {
|
||||||
Cookie: `PVEAuthCookie=${ticketData.data.ticket}`,
|
Cookie: `PVEAuthCookie=${ticketData.data.ticket}`,
|
||||||
Accept:
|
CSRFPreventionToken: ticketData.data.CSRFPreventionToken,
|
||||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
|
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
scalesPageToFit={false}
|
sharedCookiesEnabled={true}
|
||||||
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);
|
|
||||||
`}
|
|
||||||
/>
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user