Skip to content

Commit

Permalink
hide passwords in ui + skip empty decode frames
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricve committed Jan 12, 2024
1 parent a8b7994 commit 8c44da8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
19 changes: 15 additions & 4 deletions machinery/src/capture/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ func Base64Image(captureDevice *Capture, communication *models.Communication) st

// We'll try to have a keyframe, if not we'll return an empty string.
var encodedImage string
for {
// Try for 3 times in a row.
count := 0
for count < 3 {
if queue != nil && cursor != nil && rtspClient != nil {
pkt, err := cursor.ReadPacket()
if err == nil {
Expand All @@ -632,8 +634,10 @@ func Base64Image(captureDevice *Capture, communication *models.Communication) st
bytes, _ := utils.ImageToBytes(&img)
encodedImage = base64.StdEncoding.EncodeToString(bytes)
break
} else {
count++
continue
}
break
}
} else {
break
Expand All @@ -660,15 +664,22 @@ func JpegImage(captureDevice *Capture, communication *models.Communication) imag

// We'll try to have a keyframe, if not we'll return an empty string.
var image image.YCbCr
// Try for 3 times in a row.
count := 0
for {
if queue != nil && cursor != nil && rtspClient != nil {
pkt, err := cursor.ReadPacket()
if err == nil {
if !pkt.IsKeyFrame {
continue
}
image, _ = (*rtspClient).DecodePacket(pkt)
break
image, err = (*rtspClient).DecodePacket(pkt)
if err != nil {
count++
continue
} else {
break
}
}
} else {
break
Expand Down
2 changes: 2 additions & 0 deletions machinery/src/routers/websocket/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ logreader:
if err == nil {
bytes, _ := utils.ImageToBytes(&img)
encodedImage = base64.StdEncoding.EncodeToString(bytes)
} else {
continue
}
} else {
log.Log.Error("routers.websocket.main.ForwardSDStream():" + err.Error())
Expand Down
21 changes: 14 additions & 7 deletions ui/src/pages/Settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t('settings.persistence.kerberoshub_publickey')}
placeholder={t(
'settings.persistence.kerberoshub_description_publickey'
Expand All @@ -1140,7 +1141,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t('settings.persistence.kerberoshub_privatekey')}
placeholder={t(
'settings.persistence.kerberoshub_description_privatekey'
Expand Down Expand Up @@ -1336,7 +1338,8 @@ class Settings extends React.Component {
</div>

<Input
noPadding
type="password"
iconright="activity"
label={t('settings.overview.encryption_fingerprint')}
value={config.encryption.fingerprint}
onChange={(value) =>
Expand All @@ -1349,7 +1352,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t('settings.overview.encryption_privatekey')}
value={config.encryption.private_key}
onChange={(value) =>
Expand All @@ -1362,7 +1366,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t('settings.overview.encryption_symmetrickey')}
value={config.encryption.symmetric_key}
onChange={(value) =>
Expand Down Expand Up @@ -2296,7 +2301,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t(
'settings.persistence.kerberosvault_accesskey'
)}
Expand All @@ -2316,7 +2322,8 @@ class Settings extends React.Component {
}
/>
<Input
noPadding
type="password"
iconright="activity"
label={t(
'settings.persistence.kerberosvault_secretkey'
)}
Expand Down

0 comments on commit 8c44da8

Please sign in to comment.