mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
No commits in common. "4191e9a19f2577f934abc3ab54031e665201110f" and "15e798c1e755160b86b85c09f9bd4efa11676386" have entirely different histories.
4191e9a19f
...
15e798c1e7
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -6,7 +6,6 @@
|
|||||||
"clientgpversion",
|
"clientgpversion",
|
||||||
"clientos",
|
"clientos",
|
||||||
"gpcommon",
|
"gpcommon",
|
||||||
"gpgui",
|
|
||||||
"gpservice",
|
"gpservice",
|
||||||
"Immer",
|
"Immer",
|
||||||
"jnlp",
|
"jnlp",
|
||||||
|
22
README.md
22
README.md
@ -1,29 +1,9 @@
|
|||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Build the service
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Build the client first
|
|
||||||
cargo build -p gpclient
|
|
||||||
|
|
||||||
# Build the service
|
|
||||||
cargo build -p gpservice
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start the service
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo ./target/debug/gpservice
|
|
||||||
```
|
|
||||||
|
|
||||||
### Start the GUI
|
### Start the GUI
|
||||||
|
|
||||||
```sh
|
```
|
||||||
cd gpgui
|
cd gpgui
|
||||||
pnpm install
|
pnpm install
|
||||||
pnpm tauri dev
|
pnpm tauri dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### Open the DevTools
|
|
||||||
|
|
||||||
Right-click on the GUI window and select "Inspect Element".
|
|
||||||
|
@ -3,15 +3,10 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Vite + React + TS</title>
|
<title>Vite + React + TS</title>
|
||||||
</head>
|
</head>
|
||||||
<body data-tauri-drag-region>
|
<body>
|
||||||
<script>
|
|
||||||
var htmlFontSize = getComputedStyle(document.documentElement).fontSize;
|
|
||||||
var ratio = parseInt(htmlFontSize) / 16;
|
|
||||||
document.documentElement.style.fontSize = (16 / ratio) + 'px';
|
|
||||||
</script>
|
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
|
@ -44,18 +44,6 @@ fn setup(app: &mut tauri::App) -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.manage(client);
|
app.manage(client);
|
||||||
|
|
||||||
match std::env::var("XDG_CURRENT_DESKTOP") {
|
|
||||||
Ok(desktop) => {
|
|
||||||
if desktop == "KDE" {
|
|
||||||
if let Some(main_window) = app.get_window("main") {
|
|
||||||
let _ = main_window.set_decorations(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Err(_) => (),
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,13 +68,11 @@
|
|||||||
},
|
},
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"title": "GlobalProtect",
|
|
||||||
"label": "main",
|
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"width": 260,
|
|
||||||
"height": 360,
|
"height": 360,
|
||||||
"resizable": false,
|
"resizable": false,
|
||||||
"fileDropEnabled": false
|
"title": "GlobalProtect",
|
||||||
|
"width": 260
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export default function App() {
|
|||||||
const ready = useAtomValue(statusReadyAtom);
|
const ready = useAtomValue(statusReadyAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box data-tauri-drag-region padding={2} paddingBottom={0}>
|
<Box padding={2} paddingBottom={0}>
|
||||||
{ready ? <MainContent /> : <Loading />}
|
{ready ? <MainContent /> : <Loading />}
|
||||||
<Notification />
|
<Notification />
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -93,17 +93,11 @@ function InnerStatusIcon() {
|
|||||||
return <DisconnectedIcon />;
|
return <DisconnectedIcon />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DragRegion = styled(Box)(({ theme }) => ({
|
|
||||||
position: "absolute",
|
|
||||||
inset: 0,
|
|
||||||
}));
|
|
||||||
|
|
||||||
export default function StatusIcon() {
|
export default function StatusIcon() {
|
||||||
return (
|
return (
|
||||||
<IconContainer>
|
<IconContainer>
|
||||||
<BackgroundIcon />
|
<BackgroundIcon />
|
||||||
<InnerStatusIcon />
|
<InnerStatusIcon />
|
||||||
<DragRegion data-tauri-drag-region />
|
|
||||||
</IconContainer>
|
</IconContainer>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ export default function StatusText() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
data-tauri-drag-region
|
|
||||||
textAlign="center"
|
textAlign="center"
|
||||||
mt={1.5}
|
mt={1.5}
|
||||||
variant="subtitle1"
|
variant="subtitle1"
|
||||||
|
@ -4,7 +4,7 @@ import StatusText from "./StatusText";
|
|||||||
|
|
||||||
export default function ConnectionStatus() {
|
export default function ConnectionStatus() {
|
||||||
return (
|
return (
|
||||||
<Box data-tauri-drag-region>
|
<Box>
|
||||||
<StatusIcon />
|
<StatusIcon />
|
||||||
<StatusText />
|
<StatusText />
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Alert, AlertTitle, Box, Slide, SlideProps, Snackbar } from "@mui/material";
|
import { Alert, AlertTitle, Slide, SlideProps, Snackbar } from "@mui/material";
|
||||||
import { useAtom, useAtomValue } from "jotai";
|
import { useAtom, useAtomValue } from "jotai";
|
||||||
import {
|
import {
|
||||||
closeNotificationAtom,
|
closeNotificationAtom,
|
||||||
@ -35,7 +35,6 @@ export default function Notification() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Alert
|
<Alert
|
||||||
data-tauri-drag-region
|
|
||||||
severity={severity}
|
severity={severity}
|
||||||
icon={false}
|
icon={false}
|
||||||
sx={{
|
sx={{
|
||||||
@ -43,8 +42,8 @@ export default function Notification() {
|
|||||||
borderRadius: 0,
|
borderRadius: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{title && <AlertTitle data-tauri-drag-region>{title}</AlertTitle>}
|
{title && <AlertTitle>{title}</AlertTitle>}
|
||||||
{message && <Box data-tauri-drag-region>{message}</Box>}
|
{message}
|
||||||
</Alert>
|
</Alert>
|
||||||
</Snackbar>
|
</Snackbar>
|
||||||
);
|
);
|
||||||
|
@ -45,7 +45,7 @@ class GatewayService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Gateway login failed: ${response.status}`);
|
throw new Error("Login failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.parseLoginResponse(response.data);
|
return this.parseLoginResponse(response.data);
|
||||||
|
@ -36,9 +36,8 @@ export type PortalCredential = {
|
|||||||
class PortalService {
|
class PortalService {
|
||||||
async prelogin(portal: string): Promise<Prelogin> {
|
async prelogin(portal: string): Promise<Prelogin> {
|
||||||
const preloginUrl = `https://${portal}/global-protect/prelogin.esp`;
|
const preloginUrl = `https://${portal}/global-protect/prelogin.esp`;
|
||||||
let response;
|
|
||||||
try {
|
try {
|
||||||
response = await fetch<string>(preloginUrl, {
|
const response = await fetch<string>(preloginUrl, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "PAN GlobalProtect",
|
"User-Agent": "PAN GlobalProtect",
|
||||||
@ -58,15 +57,14 @@ class PortalService {
|
|||||||
// "host-id": "TODO, mac address?",
|
// "host-id": "TODO, mac address?",
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
} catch (err) {
|
|
||||||
console.error("Failed to prelogin: Network error", err);
|
|
||||||
throw new Error("Failed to prelogin: Network error");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to prelogin: ${response.status}`);
|
throw new Error(`Failed to prelogin: ${response.status}`);
|
||||||
}
|
}
|
||||||
return this.parsePrelogin(response.data);
|
return this.parsePrelogin(response.data);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Failed to prelogin: Network error`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private parsePrelogin(response: string): Prelogin {
|
private parsePrelogin(response: string): Prelogin {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user