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
08fa5205
There was an error fetching the commit references. Please try again later.
Unverified
Commit
08fa5205
authored
3 years ago
by
GyDi
Browse files
Options
Downloads
Patches
Plain Diff
fix: simply compatible with proxy providers
parent
b91daebd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/api.ts
+15
-2
15 additions, 2 deletions
src/services/api.ts
with
15 additions
and
2 deletions
src/services/api.ts
+
15
−
2
View file @
08fa5205
...
...
@@ -96,20 +96,26 @@ export async function getProxies() {
let
groups
:
ApiType
.
ProxyGroupItem
[]
=
[];
// compatible with proxy-providers
const
generateItem
=
(
name
:
string
)
=>
{
if
(
records
[
name
])
return
records
[
name
];
return
{
name
,
type
:
"
unknown
"
,
udp
:
false
,
history
:
[]
};
};
if
(
order
)
{
groups
=
order
.
filter
((
name
)
=>
records
[
name
]?.
all
)
.
map
((
name
)
=>
records
[
name
])
.
map
((
each
)
=>
({
...
each
,
all
:
each
.
all
!
.
map
((
item
)
=>
records
[
item
]
),
all
:
each
.
all
!
.
map
((
item
)
=>
generateItem
(
item
)
),
}));
}
else
{
groups
=
Object
.
values
(
records
)
.
filter
((
each
)
=>
each
.
name
!==
"
GLOBAL
"
&&
each
.
all
)
.
map
((
each
)
=>
({
...
each
,
all
:
each
.
all
!
.
map
((
item
)
=>
records
[
item
]
),
all
:
each
.
all
!
.
map
((
item
)
=>
generateItem
(
item
)
),
}));
groups
.
sort
((
a
,
b
)
=>
b
.
name
.
localeCompare
(
a
.
name
));
}
...
...
@@ -122,3 +128,10 @@ export async function getProxies() {
return
{
global
,
direct
,
groups
,
records
,
proxies
};
}
// todo: get proxy providers
export
async
function
getProviders
()
{
const
instance
=
await
getAxios
();
const
response
=
await
instance
.
get
<
any
,
any
>
(
"
/providers/proxies
"
);
return
response
.
providers
as
any
;
}
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