feat: wire RDP service into Wails app

Register RDPService on WraithApp with a mock backend factory and expose
it as a Wails service in main.go so the frontend can call RDP methods
via bindings. The factory will be swapped to a FreeRDP purego backend
when running on Windows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell 2026-03-17 07:17:44 -04:00
parent 949ed6e672
commit c00e2a446f
2 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/vstockwell/wraith/internal/credentials" "github.com/vstockwell/wraith/internal/credentials"
"github.com/vstockwell/wraith/internal/db" "github.com/vstockwell/wraith/internal/db"
"github.com/vstockwell/wraith/internal/plugin" "github.com/vstockwell/wraith/internal/plugin"
"github.com/vstockwell/wraith/internal/rdp"
"github.com/vstockwell/wraith/internal/session" "github.com/vstockwell/wraith/internal/session"
"github.com/vstockwell/wraith/internal/settings" "github.com/vstockwell/wraith/internal/settings"
"github.com/vstockwell/wraith/internal/sftp" "github.com/vstockwell/wraith/internal/sftp"
@ -32,6 +33,7 @@ type WraithApp struct {
Plugins *plugin.Registry Plugins *plugin.Registry
SSH *ssh.SSHService SSH *ssh.SSHService
SFTP *sftp.SFTPService SFTP *sftp.SFTPService
RDP *rdp.RDPService
Credentials *credentials.CredentialService Credentials *credentials.CredentialService
unlocked bool unlocked bool
} }
@ -66,6 +68,12 @@ func New() (*WraithApp, error) {
}) })
sftpSvc := sftp.NewSFTPService() sftpSvc := sftp.NewSFTPService()
// RDP service with mock backend factory for development.
// In production on Windows, the factory will return a FreeRDP-backed implementation.
rdpSvc := rdp.NewRDPService(func() rdp.RDPBackend {
return rdp.NewMockBackend()
})
// CredentialService requires the vault to be unlocked, so it starts nil. // CredentialService requires the vault to be unlocked, so it starts nil.
// It is created lazily after the vault is unlocked via initCredentials(). // It is created lazily after the vault is unlocked via initCredentials().
@ -83,6 +91,7 @@ func New() (*WraithApp, error) {
Plugins: pluginReg, Plugins: pluginReg,
SSH: sshSvc, SSH: sshSvc,
SFTP: sftpSvc, SFTP: sftpSvc,
RDP: rdpSvc,
}, nil }, nil
} }

View File

@ -33,6 +33,7 @@ func main() {
application.NewService(wraith.Settings), application.NewService(wraith.Settings),
application.NewService(wraith.SSH), application.NewService(wraith.SSH),
application.NewService(wraith.SFTP), application.NewService(wraith.SFTP),
application.NewService(wraith.RDP),
}, },
Assets: application.AssetOptions{ Assets: application.AssetOptions{
Handler: application.BundledAssetFileServer(assets), Handler: application.BundledAssetFileServer(assets),