Skip to content

Commit

Permalink
Update guacamole client
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipAB committed Dec 4, 2024
1 parent 9e044c4 commit 12db4f3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
21 changes: 12 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"angular-split": "^17.2.0",
"guacamole-common-js": "^1.4.0-a",
"guacamole-common-js": "npm:[email protected]",
"marked": "^12.0.2",
"mermaid": "^10.6.0",
"ngx-dynamic-hooks": "^3.1.1",
Expand All @@ -59,7 +59,7 @@
"@angular/compiler-cli": "^17.3.12",
"@types/d3": "^7.4.3",
"@types/dompurify": "^3.0.5",
"@types/guacamole-common-js": "^1.3.2",
"@types/guacamole-common-js": "^1.5.2",
"@types/jasmine": "~3.8.0",
"@types/marked": "^4.3.0",
"@types/prismjs": "^1.26.3",
Expand All @@ -76,4 +76,4 @@
"prettier": "^3.3.3",
"typescript": "^5.4.5"
}
}
}
2 changes: 1 addition & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ export function jwtOptionsFactory() {
MarkdownModule.forRoot({
sanitize: SecurityContext.NONE,
}),
DynamicHooksComponent,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
},
}),
DynamicHooksComponent,
],
providers: [
AppComponent,
Expand Down
5 changes: 1 addition & 4 deletions src/app/scenario/guacLibs/GuacClipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ class GuacClipboard {

let writer: StringWriter | BlobWriter;

const stream = client.createClipboardStream(
this.cache.mimetype,
'clipboardStreamPipe',
);
const stream = client.createClipboardStream(this.cache.mimetype);

if (typeof this.cache.data === 'string') {
writer = new StringWriter(stream);
Expand Down
24 changes: 12 additions & 12 deletions src/app/scenario/guacTerminal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
StringReader,
Tunnel,
WebSocketTunnel,
Event,
} from 'guacamole-common-js';
import clipboard from './guacLibs/GuacClipboard';
import states from './guacLibs/states';
Expand Down Expand Up @@ -258,10 +259,10 @@ export class GuacTerminalComponent implements OnChanges {
window.onunload = () => this.client.disconnect();
this.mouse = new Mouse(displayElm);
// Hide software cursor when mouse leaves display
this.mouse.onmouseout = () => {
this.mouse.on('onmouseout', () => {
if (!this.display) return;
this.display.showCursor(false);
};
});
// allows focusing on the display div so that keyboard doesn't always go to session
displayElm.onclick = () => {
displayElm.focus();
Expand All @@ -274,12 +275,10 @@ export class GuacTerminalComponent implements OnChanges {
};
this.keyboard = new Keyboard(displayElm);
this.installKeyboard();
this.mouse.onmousedown =
this.mouse.onmouseup =
this.mouse.onmousemove =
(mousestate) => {
this.handleMouseState(mousestate);
};
this.mouse.onEach(
['mousedown', 'mousemove', 'mouseup'],
this.handleMouseState,
);
setTimeout(() => {
this.resize();
displayElm.focus();
Expand Down Expand Up @@ -353,11 +352,12 @@ export class GuacTerminalComponent implements OnChanges {
clipboard.setRemoteClipboard(this.client);
}

handleMouseState = (mouseState: Mouse.State) => {
handleMouseState = (event: Event) => {
const mouseEvent = event as Mouse.Event;
const scale = this.display.getScale();
const scaledMouseState = Object.assign({}, mouseState, {
x: mouseState.x / scale,
y: mouseState.y / scale,
const scaledMouseState = Object.assign({}, mouseEvent.state, {
x: mouseEvent.state.x / scale,
y: mouseEvent.state.x / scale,
});
this.client.sendMouseState(scaledMouseState);
};
Expand Down

0 comments on commit 12db4f3

Please sign in to comment.