Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/kitsuned/nyx-nduid' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
throwaway96 committed Oct 7, 2023
2 parents 8dedead + ed3e208 commit e2acb4b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions services/webos-service-remote/sshbus.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class Handle {
return Message.constructBody(stdout.trim(), false);
}

querySmId() {
querySmNduid() {
return new Promise((resolve, reject) => {
this.service.call('luna://com.webos.service.sm/deviceid/getIDs', { idType: ['NDUID'] }, (message) => {
if (!message.payload.returnValue) {
Expand All @@ -98,13 +98,13 @@ export default class Handle {
});
}

async queryNyxId() {
static async queryNyxNduid() {
const raw = (await asyncReadFile('/var/run/nyx/device_info.json')).toString();

const start = raw.indexOf('{');
const { nduid } = JSON.parse(raw.slice(start, raw.indexOf('}', start)));
if (!nduid) {
throw new Error('Failed to get NDU ID from Nyx');
throw new Error('Failed to get NDUID from Nyx');
}
return nduid;
}
Expand All @@ -125,9 +125,9 @@ export default class Handle {
let nduId;

try {
nduId = await this.querySmId();
nduId = await this.querySmNduid();
} catch {
nduId = await this.queryNyxId();
nduId = await Handle.queryNyxNduid();
}

return {
Expand Down

0 comments on commit e2acb4b

Please sign in to comment.