Skip to content

Commit

Permalink
fix(getWifiDevices): use getDevices with wireless filter instead of d…
Browse files Browse the repository at this point in the history
…eprecated method

fix #1
  • Loading branch information
nioc committed Dec 2, 2023
1 parent 0e834ac commit f59a30c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,7 @@ class SrmClient {
* @return {Promise<Object[]>} Wifi devices
*/
async getWifiDevices () {
const data = {
method: 'get',
version: 1,
api: 'SYNO.Mesh.Network.WifiDevice',
}
return (await this.request('/webapi/entry.cgi', data)).devices
return await this.getDevices('online', 'wireless')
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe('get devices', () => {
describe('get wifi devices', () => {
it('should return a array', async () => {
nock(baseUrl)
.post(pathEntry, 'method=get&version=1&api=SYNO.Mesh.Network.WifiDevice')
.post(pathEntry, 'method=get&version=5&conntype=wireless&api=SYNO.Core.Network.NSM.Device&info=online')
.reply(200, { data: { devices: [] }, success: true })
const client = new SrmClient(baseUrl, sid)
const result = await client.getWifiDevices()
Expand Down

0 comments on commit f59a30c

Please sign in to comment.