mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix ensure hashed directory for extension (#7188)
* Fix ensure hashed directory for extension Earlier open lens versions stored extension_data directory based on path of extension's package.json. This causes problems because extensions have moved to new location. This ensures backward compatibility that extension will get the same directory than before the change. Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Reconstruct the key for old hashed directories Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Remove unnecessary return Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Use sync version of random bytes Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Add migration to new type of key Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Fix global override for random bytes to not return a promise Signed-off-by: Juho Heikka <juho.heikka@gmail.com> * Make registeredExtensions a dependency Signed-off-by: Juho Heikka <juho.heikka@gmail.com> --------- Signed-off-by: Juho Heikka <juho.heikka@gmail.com>
This commit is contained in:
1 parent
b3ae5a0446
commit
d8acff67d1
9 files changed
+173
-18
No files matched your search
@@ -6,7 +6,7 @@
|
||||
import { getGlobalOverride } from "../test-utils/get-global-override";
|
||||
import randomBytesInjectable from "./random-bytes.injectable";
|
||||
|
||||
export default getGlobalOverride(randomBytesInjectable, () => async (size) => {
|
||||
export default getGlobalOverride(randomBytesInjectable, () => (size) => {
|
||||
const res = Buffer.alloc(size);
|
||||
|
||||
for (let i = 0; i < size; i += 1) {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { randomBytes } from "crypto";
|
||||
import { promisify } from "util";
|
||||
|
||||
export type RandomBytes = (size: number) => Promise<Buffer>;
|
||||
export type RandomBytes = (size: number) => Buffer;
|
||||
|
||||
const randomBytesInjectable = getInjectable({
|
||||
id: "random-bytes",
|
||||
instantiate: (): RandomBytes => promisify(randomBytes),
|
||||
instantiate: (): RandomBytes => randomBytes,
|
||||
causesSideEffects: true,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user