qsu 1.9.3 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/index.d.ts +2 -1
- package/dist/node/index.js +1 -1
- package/dist/node/os/getMachineId.d.ts +1 -0
- package/dist/node/os/getMachineId.js +1 -0
- package/dist/node/os/getSid.d.ts +1 -0
- package/dist/node/os/getSid.js +1 -0
- package/dist/node/os/index.d.ts +3 -0
- package/dist/node/os/index.js +1 -0
- package/dist/node/os/runCommand.d.ts +1 -0
- package/dist/node/os/runCommand.js +1 -0
- package/package.json +2 -2
package/dist/node/index.d.ts
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./file/index.js";export*from"./
|
|
1
|
+
export*from"./crypto/index.js";export*from"./file/index.js";export*from"./os/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMachineId(): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{platform as r}from"os";import{runCommand as e}from"./runCommand.js";export async function getMachineId(){const i=r();let t;t="win32"===i?"for /f \"tokens=3 delims= \" %i in ('REG QUERY HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid ^| findstr MachineGuid') do @echo %i":"darwin"===i?"ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/' | cut -d '\"' -f4":"freebsd"===i?"kenv -q smbios.system.uuid || sysctl -n kern.hostuuid":"(cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname) | head -n 1 || :";try{const r=await e(t);if(r)return r}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSid(): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{homedir as r,platform as t,userInfo as o}from"os";import{runCommand as e}from"./runCommand.js";export async function getSid(){const n=t();if("win32"===n){try{const t=await e('REG QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList" /s');if(!t)throw new Error("Failed to get machine id");const o={};t.split("HKEY_LOCAL_MACHINE\\").forEach((r=>{const t=r.split("\n").map((r=>r.trim())).filter((r=>r));if(t.length>0){const r=t[0].split("\\").pop()||"Unknown",e=t.find((r=>r.startsWith("ProfileImagePath")));e&&(o[r]=e.split(" ").pop()||"Unknown")}}));for(let t=0;t<Object.keys(o).length;t+=1){const e=Object.keys(o)[t];if(o[e]===r())return e}}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}if("darwin"===n){try{const r=await e(`dsmemberutil getsid -U ${o().username}`);if(r)return r.replace(/\r?\n/g,"")}catch(r){if(r instanceof Error)throw new Error(r?.message)}throw new Error("Failed to get machine id")}throw new Error("Not supported on this operating system.")}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getMachineId}from"./getMachineId.js";export{getSid}from"./getSid.js";export{runCommand}from"./runCommand.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCommand(command: string): Promise<string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{exec as e}from"child_process";import{EOL as n}from"os";export function runCommand(o){return new Promise(((r,i)=>{const s=e(o,{encoding:"utf8",windowsHide:!0},((e,o)=>{e?i(e):(s?.stdin?.end(),r(o.replace(new RegExp(`${n}$`),"")))}))}))}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "qsu is a utility library that contains useful and frequently used functions. Start with your preferred language and the
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"description": "qsu is a utility library that contains useful and frequently used functions. Start with your preferred language and the modern development environment.",
|
|
5
5
|
"author": "CDGet <jooy2.contact@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://qsu.cdget.com",
|