-
Notifications
You must be signed in to change notification settings - Fork 406
Be/feature/ri 5876 fix start electron dev mode #4021
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
Merged
KIvanow
merged 65 commits into
main
from
be/feature/RI-5876-Fix-start-electron-dev-mode
Nov 28, 2024
Merged
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
e27cef8
Change the wording on the native browser authentication page
8b6c1b0
RI-5876-Fix start electron dev mode
eedcbf0
RI-5876 Fix start electron dev mode - cleanup
31b7f1d
RI-5876 Fix Electron in dev mode -> fix for window validation in dev …
4e0431d
RI-5876 Fix start electron dev mode - clean up and hardcoded values
e8b543b
RI-5876 fix start electron dev mode - fixed auth flow for dev with tcp
ca5afa5
RI-5876 Fix start electron dev mode - cleanup
58fc233
RI-5876 fix start electron dev - cleanup
e9f3ee8
RI-5876 fix electron dev mode - further cleanup and removal of
7c324cc
RI-5876
331b2d1
RI-5876 Fix start electron dev mode
da77e73
RI-5876 fix electron dev mode - removed hardcoded if statement
ca4fc09
RI-5876 fix electron dev mode - removed unused dependency
2e63fdf
Merge branch 'RI-5876-Fix-start-electron-dev-mode' of https://github.…
0d20c20
RI-5876 cleanup
b030c90
RI-5876 cleanup
531dda9
RI-5876 cleanup
3b22245
RI-5876 cleanup
4b790fe
RI-5876 - cleaned up console.logs
c9c9830
RI-5876 fixed eslint errors
dfdfb09
RI-6876 fixed api test (#4022)
KIvanow 9e3beff
Ri 5876 fix start electron dev mode (#4023)
KIvanow 5828d6e
RI-5876 resolved conflicts with main
8907bfc
RI-5876 removed the custom-tutorials submitted from testin
d333be4
RI-5876 yarn.lock updates
1ae2a2d
added a command to run api, ui and desktop at the same time
5f3c10b
Merge branch 'be/feature/RI-5876-Fix-start-electron-dev-mode' of http…
0fdce87
RI-5876 Renamed new command
d6e4446
RI-5876 updated postinstall scripts
e66af79
RI-5876 fixes around the build flow
cadefc5
fixes around the build
9d2ebd7
RI-5876 WIP (build works without window ids - bug)
343e31b
RI-5876 WIP build updates
65911e4
RI-5876 WIP builds
5af4903
RI-5876 rollback on some changes
KIvanow de314fc
resolved conflicts
KIvanow 5ecc9ad
RI-5876 clean up
KIvanow c090347
RI-5876 cleanup
KIvanow e1a4c43
RI-5876 cleanup
KIvanow 206cf00
RI-5876 cleanup
KIvanow 2d8463e
RI-5876 cleanup
KIvanow f3e6efa
RI-5876 cleanup
a781d26
RI-5876 circular dependency solved
31a4722
RI-5876 resolved dependency and all changes
6568a27
RI-5876 clean up
9df3bd0
RI-5876 fixed wrong enum import
1efa61f
RI-5876 cleaning up the PR
d6c7c70
removed unused file
7b36fb6
RI-5876 cleanup unused variables
92b1d12
RI-5876 cleanedup electron-dev conig
b8eb6df
RI-5876 simplified electron-builder.dev
d3329e3
RI-5876 removed unused properties
998adee
RI-5876 removed unecesary differences
0e44625
RI-5876 cleared up feedback (process.env.development checks and unuse…
001df41
RI-5876 Cleared up PR feedback
5546292
Merge branch 'be/feature/RI-5876-Fix-start-electron-dev-mode' of http…
2f8b858
RI-5876 removed unused file
2c7b10d
RI-5876 - PR feedback from Artem
KIvanow c6c267f
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
KIvanow cc7eb9f
RI-6876 cleared up prettier issue
KIvanow b68f8fb
RI-5876 - feedback from Artem - abstraction for the TCP approach on d…
fb0e969
RI-5876 - further PR improvements and cleanup
d145e49
Merge branch 'main' of https://github.com/RedisInsight/RedisInsight i…
39cd861
reverted yarn.lock to main's
365a108
rollback to main
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
redisinsight/api/src/modules/cloud/auth/auth-strategy/tcp-cloud.auth.strategy.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { Injectable, Logger } from '@nestjs/common'; | ||
import { createServer, Server } from 'net'; | ||
import { CloudAuthStrategy } from './cloud-auth.strategy'; | ||
import { CloudAuthService } from '../cloud-auth.service'; | ||
|
||
@Injectable() | ||
export class TcpCloudAuthStrategy extends CloudAuthStrategy { | ||
private authPort = process.env.TCP_LOCAL_CLOUD_AUTH_PORT ? parseInt(process.env.TCP_LOCAL_CLOUD_AUTH_PORT) : 5542; | ||
private server: Server; | ||
private readonly logger = new Logger('TcpCloudAuthStrategy'); | ||
|
||
constructor(private readonly cloudAuthService: CloudAuthService) { | ||
super(); | ||
|
||
this.initServer(); | ||
} | ||
|
||
private initServer() { | ||
this.server = createServer((socket) => { | ||
socket.setEncoding('utf8'); | ||
|
||
socket.on('data', async (data) => { | ||
try { | ||
this.logger.debug(`Received raw data: ${data.toString()}`); | ||
const { action, options } = JSON.parse(data.toString()); | ||
this.logger.debug('Parsed request:', { action, options }); | ||
|
||
if (action === 'getAuthUrl') { | ||
try { | ||
const url = await this.cloudAuthService.getAuthorizationUrl( | ||
options.sessionMetadata, | ||
options.authOptions | ||
); | ||
this.logger.debug('Generated URL:', url); | ||
socket.write(JSON.stringify({ success: true, url })); | ||
} catch (err) { | ||
this.logger.error('Error getting authorization URL:', err); | ||
socket.write(JSON.stringify({ | ||
success: false, | ||
error: err.message, | ||
details: err.stack, | ||
context: { action, options } // Add the context to help debug | ||
})); | ||
} | ||
} else if (action === 'handleCallback') { | ||
try { | ||
this.logger.debug('Handling callback with query:', options.query); | ||
const result = await this.cloudAuthService.handleCallback(options.query); | ||
socket.write(JSON.stringify({ success: true, result })); | ||
} catch (err) { | ||
this.logger.error('Error handling callback:', err); | ||
socket.write(JSON.stringify({ | ||
success: false, | ||
error: err.message, | ||
details: err.stack | ||
})); | ||
} | ||
} | ||
} catch (err) { | ||
this.logger.error('Error processing request:', err); | ||
socket.write(JSON.stringify({ | ||
success: false, | ||
error: err.message, | ||
details: err.stack | ||
})); | ||
} | ||
socket.end(); | ||
}); | ||
|
||
socket.on('end', () => { | ||
this.logger.debug('Client connection ended'); | ||
}); | ||
|
||
socket.on('error', (err) => { | ||
this.logger.error('Socket error:', err); | ||
}); | ||
}); | ||
|
||
this.server.listen(this.authPort, () => { | ||
this.logger.log(`TCP server listening on port ${this.authPort}`); | ||
}); | ||
|
||
this.server.on('error', (err) => { | ||
this.logger.error('Server error:', err); | ||
}); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's discuss this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. has been resolved since :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,4 +231,4 @@ export class DatabaseEntity { | |
@Expose() | ||
@Column({ nullable: true }) | ||
version: string; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,4 +262,4 @@ export class LocalDatabaseRepository extends DatabaseRepository { | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,4 +48,4 @@ export class SshOptionsEntity { | |
) | ||
@JoinColumn() | ||
database: DatabaseEntity; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "redisinsight", | ||
"version": "1.0.0", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"dev": "cross-env ELECTRON_DEV=true ELECTRON_ENABLE_LOGGING=true ELECTRON_DEBUG_LOGGING=true ELECTRON_ENABLE_STACK_DUMPING=true NODE_ENV=development yarn build && yarn build:preload && yarn build:renderer && electron . --enable-logging --inspect=5858", | ||
"build": "cross-env ELECTRON_DEV=true ELECTRON_ENABLE_LOGGING=true ELECTRON_DEBUG_LOGGING=true ELECTRON_ENABLE_STACK_DUMPING=true NODE_ENV=development vite build --config vite.main.config.ts", | ||
"build:preload": "cross-env ELECTRON_DEV=true ELECTRON_ENABLE_LOGGING=true ELECTRON_DEBUG_LOGGING=true ELECTRON_ENABLE_STACK_DUMPING=true NODE_ENV=development vite build --config vite.preload.config.ts", | ||
"build:renderer": "cross-env ELECTRON_DEV=true ELECTRON_ENABLE_LOGGING=true ELECTRON_DEBUG_LOGGING=true ELECTRON_ENABLE_STACK_DUMPING=true NODE_ENV=development vite build --config vite.renderer.config.ts" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/x-icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> | ||
<title>RedisInsight</title> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="../dist/index.js"></script> | ||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AuthStrategy } from './auth.interface' | ||
import { TcpAuthStrategy } from './tcp.auth.strategy' | ||
import { ServiceAuthStrategy } from './service.auth.strategy' | ||
|
||
export const createAuthStrategy = ( | ||
beApp?: any | ||
): AuthStrategy => { | ||
if (process.env.USE_TCP_CLOUD_AUTH === 'true') { | ||
return TcpAuthStrategy.getInstance() | ||
} | ||
return ServiceAuthStrategy.getInstance(beApp) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export interface AuthStrategy { | ||
initialize(): Promise<void> | ||
shutdown(): Promise<void> | ||
getAuthUrl(options: any): Promise<{ url: string }> | ||
handleCallback(query: any): Promise<any> | ||
getBackendApp?(): any | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.