Skip to content

Commit

Permalink
Pass arguments to remote-viewer Close #14
Browse files Browse the repository at this point in the history
Upgrade .Net 5
  • Loading branch information
franklupo committed Jul 19, 2021
1 parent f90910f commit 19c1eed
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Options:
All nodes in a cluster runs 'spiceproxy', so it is up to the client to choose one.
By default, we return the node where the VM is currently running.
If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy.
--viewer Executable SPICE client remote viewer
--viewer Executable SPICE client remote viewer.
--viewer-options Send options directly SPICE Viewer (quote value).
Commands:
app-check-update Check update application
Expand Down Expand Up @@ -69,6 +70,7 @@ this software aims to simplify run SPICE client from Proxmox VE using command li
* Support multiple host for HA in --host parameter es. host[:port],host1[:port],host2[:port]
* Check-Update and Upgrade application
* Use Api token --api-token parameter
* Send options directly to viewer

## Api token

Expand Down Expand Up @@ -107,6 +109,11 @@ root@debian:~# cv4pve-pepper --host=192.168.0.100 --username=root@pam --password
* Linux /usr/bin/remote-viewer
* Windows C:\Program Files\VirtViewer v?.?-???\bin\remote-viewer.exe

## Options of remove viewer

Use --viewer-options to send options to viewer.
E.g. --viewer-options "-f" for full screen.

## Error

* **no spice port**: This error appears when you have not configured the display hardware on SPICE.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Version>1.4.0</Version>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.5 .0</Version>
<TargetFramework>net5.0</TargetFramework>
<AssemblyName>cv4pve-pepper</AssemblyName>
<Company>Corsinvest Srl</Company>
<Authors>Daniele Corsini</Authors>
Expand All @@ -19,9 +19,9 @@
<TrimmerRootAssembly Include="System.Net.WebClient" />

<!-- <ProjectReference Include="..\..\..\cv4pve-api-dotnet\src\Corsinvest.ProxmoxVE.Api.Shell\Corsinvest.ProxmoxVE.Api.Shell.csproj" /> -->
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.8.0" />
<PackageReference Include="Corsinvest.ProxmoxVE.Api.Shell" Version="2.8.1" />
</ItemGroup>

<Target Name="SpicNSpan" AfterTargets="Clean">
<RemoveDir Directories="$(TargetDir)" />
<RemoveDir Directories="$(ProjectDir)$(BaseIntermediateOutputPath)" />
Expand Down
12 changes: 7 additions & 5 deletions src/Corsinvest.ProxmoxVE.Pepper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ static int Main(string[] args)
" If specify http://[host]:[port] then replace proxy option in file .vv. E.g. for reverse proxy.",
CommandOptionType.SingleValue);

var optRemoteViewer = app.Option("--viewer",
"Executable SPICE client remote viewer",
CommandOptionType.SingleValue)
var optRemoteViewer = app.Option("--viewer", "Executable SPICE client remote viewer.", CommandOptionType.SingleValue)
.DependOn(app, CommandOptionExtension.HOST_OPTION_NAME);
optRemoteViewer.Accepts().ExistingFile();

var optViewerOptions = app.Option("--viewer-options", "Send options directly SPICE Viewer (quote value).", CommandOptionType.SingleValue);

app.OnExecute(() =>
{
var client = app.ClientTryLogin();
Expand Down Expand Up @@ -83,15 +83,17 @@ static int Main(string[] args)
RedirectStandardOutput = false,
};
var viewerOpts = optViewerOptions.Value() + "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
startInfo.FileName = "/bin/bash";
startInfo.Arguments = $"-c \"{optRemoteViewer.Value()} {fileName}\"";
startInfo.Arguments = $"-c \"{optRemoteViewer.Value()} {fileName} {viewerOpts}\"";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
startInfo.FileName = StringHelper.Quote(optRemoteViewer.Value());
startInfo.Arguments = StringHelper.Quote(fileName);
startInfo.Arguments = $"\"{fileName}\" {viewerOpts}";
}
var process = new Process
Expand Down
9 changes: 6 additions & 3 deletions src/Corsinvest.ProxmoxVE.Pepper/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@ Write-Output "
== Build System
========================================================="

$pathNet = "Bin\Release\netcoreapp3.1"
$pathNet = "Bin\Release\net5.0"

Remove-Item -Path ".\$pathNet" -Recurse -Force

$rids = @("linux-x64", "linux-arm", "linux-arm64", "osx-x64", "win-x86", "win-x64", "win-arm", "win-arm64")
foreach ($rid in $rids) {
dotnet publish -r $rid -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true
Write-Output "========================================="
Write-Output "== $rid"
Write-Output "========================================="
dotnet publish -r $rid -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true /p:IncludeNativeLibrariesForSelfExtract=true
$path = "$pathNet\$rid\publish\"

$fileName = Get-ChildItem $path -Exclude *.pdb -name
$fileDest = "$pathNet\$fileName-$rid.zip"
$fileDest = "$pathNet\$fileName-$rid.zip"
Remove-Item $fileDest -ErrorAction SilentlyContinue
Compress-Archive $path\$fileName $fileDest
}

0 comments on commit 19c1eed

Please sign in to comment.