rechrome 1.37.0 → 1.37.1

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/rechrome.js +10 -7
  3. package/rechrome.ts +10 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rechrome",
3
- "version": "1.37.0",
3
+ "version": "1.37.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/snomiao/rechrome.git"
package/rechrome.js CHANGED
@@ -1073,13 +1073,16 @@ async function findInstalledExtension(
1073
1073
  // Read each profile's settings once so we can prioritize stable-ID matches over path fallbacks.
1074
1074
  const perProfile: Array<{ prof: string; settings: Record<string, any> }> = [];
1075
1075
  for (const prof of profiles) {
1076
- const prefsPath = join(userDataDir, prof, "Secure Preferences");
1077
- const f = file(prefsPath);
1078
- if (!(await f.exists())) continue;
1079
- try {
1080
- const data = JSON.parse(await f.text());
1081
- perProfile.push({ prof, settings: (data?.extensions?.settings ?? {}) as Record<string, any> });
1082
- } catch {}
1076
+ const settings: Record<string, any> = {};
1077
+ // Chrome may store unpacked extensions in either preferences file.
1078
+ // Secure Preferences wins when both contain the same extension.
1079
+ for (const name of ["Preferences", "Secure Preferences"]) {
1080
+ try {
1081
+ const data = await file(join(userDataDir, prof, name)).json();
1082
+ Object.assign(settings, data?.extensions?.settings ?? {});
1083
+ } catch {}
1084
+ }
1085
+ perProfile.push({ prof, settings });
1083
1086
  }
1084
1087
  // Pass 1: stable ID match (manifest `key` set, path-independent). This must win over any path
1085
1088
  // fallback so a stale legacy install sitting on a known path can't shadow the current extension.
package/rechrome.ts CHANGED
@@ -1073,13 +1073,16 @@ async function findInstalledExtension(
1073
1073
  // Read each profile's settings once so we can prioritize stable-ID matches over path fallbacks.
1074
1074
  const perProfile: Array<{ prof: string; settings: Record<string, any> }> = [];
1075
1075
  for (const prof of profiles) {
1076
- const prefsPath = join(userDataDir, prof, "Secure Preferences");
1077
- const f = file(prefsPath);
1078
- if (!(await f.exists())) continue;
1079
- try {
1080
- const data = JSON.parse(await f.text());
1081
- perProfile.push({ prof, settings: (data?.extensions?.settings ?? {}) as Record<string, any> });
1082
- } catch {}
1076
+ const settings: Record<string, any> = {};
1077
+ // Chrome may store unpacked extensions in either preferences file.
1078
+ // Secure Preferences wins when both contain the same extension.
1079
+ for (const name of ["Preferences", "Secure Preferences"]) {
1080
+ try {
1081
+ const data = await file(join(userDataDir, prof, name)).json();
1082
+ Object.assign(settings, data?.extensions?.settings ?? {});
1083
+ } catch {}
1084
+ }
1085
+ perProfile.push({ prof, settings });
1083
1086
  }
1084
1087
  // Pass 1: stable ID match (manifest `key` set, path-independent). This must win over any path
1085
1088
  // fallback so a stale legacy install sitting on a known path can't shadow the current extension.