From 597b2d99f55f776a9d79fddc5e49da074faab993 Mon Sep 17 00:00:00 2001 From: Denis Golovin Date: Thu, 29 Feb 2024 22:04:16 -0800 Subject: [PATCH] fix: add redhat registry logo (#64) * fix: add redhat registry logo Signed-off-by: Denis Golovin * Update registry name to 'Red Hat Container Registry' Co-authored-by: Florent BENOIT --------- Signed-off-by: Denis Golovin Co-authored-by: Florent BENOIT --- src/extension.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index f20d2339..e0f92cb6 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -49,6 +49,14 @@ async function getAuthService() { return authService; } +// function to encode file data to base64 encoded string +function fileToBase64(file: string) { + // read binary data + var bitmap = readFileSync(file); + // convert binary data to base64 encoded string + return new Buffer(bitmap).toString('base64'); +} + function parseJwt (token: string) { var base64Url = token.split('.')[1]; var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); @@ -75,7 +83,9 @@ async function createRegistry(username: string, secret: string, serverUrl: strin serverUrl, username, secret, - source: '' + source: '', + name: 'Red Hat Container Registry', + icon: fileToBase64(path.resolve(__dirname,'..', 'icon.png')), }); }