Skip to content

Commit

Permalink
feat: getClashNodeNames 增加默认节点
Browse files Browse the repository at this point in the history
  • Loading branch information
GodD6366 committed Jan 9, 2024
1 parent df33a80 commit 97b710a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/utils/clash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const getClashNodeNames = function (
list: ReadonlyArray<PossibleNodeConfigType>,
filter?: NodeFilterType | SortedNodeFilterType,
prependNodeNames?: ReadonlyArray<string>,
defaultNodeNames?: ReadonlyArray<string>,
): ReadonlyArray<string> {
// istanbul ignore next
if (arguments.length === 2 && typeof filter === 'undefined') {
Expand All @@ -47,6 +48,10 @@ export const getClashNodeNames = function (

result = result.concat(getClashNodes(list, filter).map((item) => item.name))

if(result.length === 0 && defaultNodeNames) {

Check failure on line 51 in src/utils/clash.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 18)

Insert `·`

Check failure on line 51 in src/utils/clash.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 20)

Insert `·`
result = result.concat(defaultNodeNames)
}

return result
}

Expand Down

0 comments on commit 97b710a

Please sign in to comment.