Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Use regedit-rs instead of node-regedit #375

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 0 additions & 105 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@
"react-virtualized-auto-sizer": "^1.0.12",
"react-window": "^1.8.8",
"recursive-readdir": "^2.2.3",
"regedit": "^5.1.2",
"rfdc": "^1.3.0",
"rxjs": "^7.8.0",
"sanitize-filename": "^1.6.3",
Expand Down
91 changes: 89 additions & 2 deletions release/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions release/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"dependencies": {
"ps-list": "^7.2.0",
"regedit-rs": "^1.0.1",
"sharp": "^0.32.6"
},
"license": "MIT"
Expand Down
36 changes: 12 additions & 24 deletions src/main/services/liv/liv.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execOnOs } from "../../helpers/env.helpers";
import { list, createKey, putValue, deleteKey, RegSzValue } from "regedit-rs";
import path from "path";
import regedit from "regedit";

export class LivService {

Expand All @@ -23,8 +23,8 @@ export class LivService {
public async isLivInstalled(): Promise<boolean> {
return execOnOs({
win32: async () => {
const regRes = await regedit.promisified.list([this.livRegeditKey]).then(res => res[this.livRegeditKey]);
return regRes?.exists;
const regRes = await list(this.livRegeditKey).then(res => res[this.livRegeditKey]);
return regRes.exists;
},
}, true);
}
Expand All @@ -33,25 +33,13 @@ export class LivService {
return execOnOs({
win32: async () => {
const livExternalAppRegeditKey = path.join(this.livExternalAppsRegeditKey, entry.id);
await regedit.promisified.createKey([livExternalAppRegeditKey]);
await regedit.promisified.putValue({
await createKey(livExternalAppRegeditKey);
await putValue({
[livExternalAppRegeditKey]: {
"InstallPath": {
value: entry.installPath,
type: "REG_SZ"
},
"Executable": {
value: entry.executable,
type: "REG_SZ"
},
"Arguments": {
value: entry.arguments,
type: "REG_SZ"
},
"Name": {
value: entry.name,
type: "REG_SZ"
}
InstallPath: new RegSzValue(entry.installPath),
Executable: new RegSzValue(entry.executable),
Arguments: new RegSzValue(entry.arguments),
Name: new RegSzValue(entry.name)
}
});
}
Expand All @@ -62,23 +50,23 @@ export class LivService {
return execOnOs({
win32: async () => {
const shotcutsKeys = ids.map(id => path.join(this.livExternalAppsRegeditKey, id));
return regedit.promisified.deleteKey(shotcutsKeys);
return deleteKey(shotcutsKeys);
}
})
}

public getLivShortcuts(): Promise<LivEntry[]> {
return execOnOs({
win32: async () => {
const regRes = await regedit.promisified.list([this.livExternalAppsRegeditKey]).then(res => res[this.livExternalAppsRegeditKey]);
const regRes = await list(this.livExternalAppsRegeditKey).then(res => res[this.livExternalAppsRegeditKey]);

if(!regRes.exists){
return [];
}

const promises = regRes.keys.map(async key => {
const shortcutKey = path.join(this.livExternalAppsRegeditKey, key);
const entries = await regedit.promisified.list([shortcutKey]).then(res => res[shortcutKey]);
const entries = await list(shortcutKey).then(res => res[shortcutKey]);

if(!entries.exists){
return undefined;
Expand Down
Loading
Loading