Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Clash Verge
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Clash Verge
Commits
7fc96314
There was an error fetching the commit references. Please try again later.
Commit
7fc96314
authored
3 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
feat: show system proxy info
parent
df5953dd
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/setting-verge.tsx
+10
-1
10 additions, 1 deletion
src/components/setting-verge.tsx
src/components/sysproxy-tooltip.tsx
+53
-0
53 additions, 0 deletions
src/components/sysproxy-tooltip.tsx
src/services/cmds.ts
+4
-0
4 additions, 0 deletions
src/services/cmds.ts
with
67 additions
and
1 deletion
src/components/setting-verge.tsx
+
10
−
1
View file @
7fc96314
import
useSWR
,
{
useSWRConfig
}
from
"
swr
"
;
import
useSWR
,
{
useSWRConfig
}
from
"
swr
"
;
import
{
import
{
Box
,
List
,
List
,
ListItemText
,
ListItemText
,
ListSubheader
,
ListSubheader
,
...
@@ -12,6 +13,7 @@ import { version } from "../../package.json";
...
@@ -12,6 +13,7 @@ import { version } from "../../package.json";
import
GuardState
from
"
./guard-state
"
;
import
GuardState
from
"
./guard-state
"
;
import
SettingItem
from
"
./setting-item
"
;
import
SettingItem
from
"
./setting-item
"
;
import
PaletteSwitch
from
"
./palette-switch
"
;
import
PaletteSwitch
from
"
./palette-switch
"
;
import
SysproxyTooltip
from
"
./sysproxy-tooltip
"
;
interface
Props
{
interface
Props
{
onError
?:
(
err
:
Error
)
=>
void
;
onError
?:
(
err
:
Error
)
=>
void
;
...
@@ -84,7 +86,14 @@ const SettingVerge = ({ onError }: Props) => {
...
@@ -84,7 +86,14 @@ const SettingVerge = ({ onError }: Props) => {
</
SettingItem
>
</
SettingItem
>
<
SettingItem
>
<
SettingItem
>
<
ListItemText
primary
=
"System Proxy"
/>
<
ListItemText
primary
=
{
<
Box
sx
=
{
{
display
:
"
flex
"
,
alignItems
:
"
center
"
}
}
>
System Proxy
<
SysproxyTooltip
/>
</
Box
>
}
/>
<
GuardState
<
GuardState
value
=
{
proxy
}
value
=
{
proxy
}
valueProps
=
"checked"
valueProps
=
"checked"
...
...
This diff is collapsed.
Click to expand it.
src/components/sysproxy-tooltip.tsx
0 → 100644
+
53
−
0
View file @
7fc96314
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
InfoRounded
}
from
"
@mui/icons-material
"
;
import
{
ClickAwayListener
,
Tooltip
}
from
"
@mui/material
"
;
import
{
getSystemProxy
}
from
"
../services/cmds
"
;
const
SysproxyTooltip
=
()
=>
{
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
info
,
setInfo
]
=
useState
<
any
>
({});
const
onShow
=
async
()
=>
{
const
data
=
await
getSystemProxy
();
console
.
log
(
data
);
setInfo
(
data
??
{});
setOpen
(
true
);
};
useEffect
(()
=>
{
if
(
!
open
)
return
;
const
timer
=
setTimeout
(()
=>
setOpen
(
false
),
2000
);
return
()
=>
clearTimeout
(
timer
);
},
[
open
]);
// todo: add error info
const
showTitle
=
(
<
div
>
<
div
>
Enable:
{
(
!!
info
.
enable
).
toString
()
}
</
div
>
<
div
>
Server:
{
info
.
server
}
</
div
>
<
div
>
Bypass:
{
info
.
bypass
}
</
div
>
</
div
>
);
return
(
<
ClickAwayListener
onClickAway
=
{
()
=>
setOpen
(
false
)
}
>
<
Tooltip
PopperProps
=
{
{
disablePortal
:
true
,
}
}
onClose
=
{
()
=>
setOpen
(
false
)
}
open
=
{
open
}
disableFocusListener
disableHoverListener
disableTouchListener
placement
=
"top"
title
=
{
showTitle
}
arrow
>
<
InfoRounded
fontSize
=
"small"
onClick
=
{
onShow
}
/>
</
Tooltip
>
</
ClickAwayListener
>
);
};
export
default
SysproxyTooltip
;
This diff is collapsed.
Click to expand it.
src/services/cmds.ts
+
4
−
0
View file @
7fc96314
...
@@ -63,3 +63,7 @@ export async function getVergeConfig() {
...
@@ -63,3 +63,7 @@ export async function getVergeConfig() {
export
async
function
patchVergeConfig
(
payload
:
CmdType
.
VergeConfig
)
{
export
async
function
patchVergeConfig
(
payload
:
CmdType
.
VergeConfig
)
{
return
invoke
<
void
>
(
"
patch_verge_config
"
,
{
payload
});
return
invoke
<
void
>
(
"
patch_verge_config
"
,
{
payload
});
}
}
export
async
function
getSystemProxy
()
{
return
invoke
<
any
>
(
"
get_sys_proxy
"
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment