本文介紹了如何通過 Electron 獲得唯一的 PC ID?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
是否可以通過 Electron 獲得唯一的 PC/設備 ID,以便我可以將 PC/設備 ID 保存到云上的 MySQL 服務器?如果這不可能,那么我還有什么其他選擇?
Is it possible to get a unique PC/Device ID via Electron so I can save PC/Device ID to MySQL Server on the cloud? If this is not possible then what other option I have?
這樣做的目的是限制他們可以使用 Electron App 的設備數量.
The purpose of this to limit how many device they can use Electron App.
推薦答案
看看下面的例子.
import {machineId, machineIdSync} from 'node-machine-id';
// Asyncronous call with async/await or Promise
async function getMachineId() {
let id = await machineId();
...
}
machineId().then((id) => {
...
})
// Syncronous call
let id = machineIdSync()
// id = c24b0fe51856497eebb6a2bfcd120247aac0d6334d670bb92e09a00ce8169365
let id = machineIdSync({original: true})
// id = 98912984-c4e9-5ceb-8000-03882a0485e4
你可以看看這個包automation-stack/node-machine-id 了解更多詳情.我想這就是你要找的.
You can take a look in this package automation-stack/node-machine-id for more details. I think this is what you are looking for.
這篇關于如何通過 Electron 獲得唯一的 PC ID?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!