Skip to content
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

Allow auto upgrade url set #619

Merged
merged 76 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
b470187
Merge pull request #535 from openziti/release-next
dovholuknf Jun 17, 2022
c56d8f2
Merge pull request #543 from openziti/release-next
dovholuknf Jun 28, 2022
ae0140e
Merge pull request #546 from openziti/release-next
dovholuknf Jun 29, 2022
7181922
Merge pull request #553 from openziti/release-next
dovholuknf Jul 19, 2022
8f8ea56
Merge pull request #558 from openziti/release-next
dovholuknf Aug 1, 2022
a020719
Merge pull request #563 from openziti/release-next
dovholuknf Aug 12, 2022
0cf81be
Merge pull request #569 from openziti/release-next
dovholuknf Aug 19, 2022
452ddf8
Merge pull request #570 from openziti/release-next
dovholuknf Aug 19, 2022
d279f13
Merge pull request #572 from openziti/release-next
dovholuknf Aug 22, 2022
b7aead4
quick stab at configuring the url for updates
dovholuknf Oct 25, 2023
8427fac
fix compilation
dovholuknf Oct 25, 2023
9685a61
Use Click instead of Mouse Up
JeremyTellier Oct 25, 2023
790ab77
Switch PCs not working here
JeremyTellier Oct 25, 2023
e960a03
Button Skinned Form Not Yet - Switching Back
JeremyTellier Oct 25, 2023
20b2282
Style Screen
JeremyTellier Oct 26, 2023
cdf73aa
add initial set url impl
dovholuknf Oct 27, 2023
41b6f9c
formatting
dovholuknf Oct 27, 2023
49ec668
formatting
dovholuknf Oct 27, 2023
3317d56
formatting
dovholuknf Oct 27, 2023
88ed3c8
and more... formatting
dovholuknf Oct 27, 2023
b747967
and more... formatting
dovholuknf Oct 27, 2023
3d72171
update version and put comma back
dovholuknf Oct 27, 2023
3ed340f
add a blurb on save. move the testing json to a separate dir
dovholuknf Oct 27, 2023
1878cbe
ignore ZitiDesktopEdgeClient* folders. update readme again
dovholuknf Oct 27, 2023
b010584
another version to test
dovholuknf Oct 27, 2023
cf39317
add c redist
dovholuknf Oct 31, 2023
d14ce07
freshen deps
dovholuknf Oct 31, 2023
9503208
download the vc redist during build and use it
dovholuknf Oct 31, 2023
5457b04
maybe case sensitive
dovholuknf Oct 31, 2023
86a643b
kick thebuild
dovholuknf Oct 31, 2023
7552c77
change VC to vc and verify file
dovholuknf Oct 31, 2023
831e553
use buildPath not scriptPath
dovholuknf Oct 31, 2023
cf93058
initial version check
dovholuknf Oct 31, 2023
5f83023
Merge remote-tracking branch 'origin/release-next' into allow-auto-up…
dovholuknf Oct 31, 2023
8f45749
additional refactoring, test, etc of setting the update url
dovholuknf Nov 1, 2023
d2b6c59
testing resources
dovholuknf Nov 1, 2023
12e8bc8
try triggering an installer build
dovholuknf Nov 1, 2023
8239182
make another version for upgrade testing
dovholuknf Nov 1, 2023
a786833
make another version for upgrade testing
dovholuknf Nov 1, 2023
e84b787
make another version for upgrade testing
dovholuknf Nov 1, 2023
9be9b62
make another version for upgrade testing
dovholuknf Nov 1, 2023
8f19b99
try to emit an update json file as well
dovholuknf Nov 1, 2023
20ff4bc
try putting all three files into one zip
dovholuknf Nov 1, 2023
b0b37c0
keep trying to get github actions to do what i want
dovholuknf Nov 1, 2023
53370f6
build a test 2.1.17
dovholuknf Nov 1, 2023
8e44ff7
update adv installer with new icons
dovholuknf Nov 1, 2023
ce9bd6d
updates to various parts of the puzzle
dovholuknf Nov 1, 2023
0034b7b
last big round of changes before looking to review
dovholuknf Nov 1, 2023
7058bb8
try to fix icon
dovholuknf Nov 2, 2023
416c02a
fix install icon
dovholuknf Nov 2, 2023
a4b8843
update version to 2.2
dovholuknf Nov 2, 2023
d2c0e91
migrate from using github to using cloudfront
dovholuknf Nov 2, 2023
f4f9101
add images
dovholuknf Nov 2, 2023
95e9d58
still working on getting the .ico nice
dovholuknf Nov 2, 2023
7ba62e9
rephrase warning
dovholuknf Nov 2, 2023
adf5018
put the App.xaml back for now
dovholuknf Nov 2, 2023
77ce020
so many formatting issues...
dovholuknf Nov 2, 2023
9529a52
formatting fixes....
dovholuknf Nov 2, 2023
fe5c3b3
revert OnClickEvt to OnClick
dovholuknf Nov 2, 2023
14f62ac
formatting still...
dovholuknf Nov 2, 2023
5c0af0c
icon changes
dovholuknf Nov 2, 2023
9fc3723
revert app.config chnages
dovholuknf Nov 2, 2023
8ce4d29
another format
dovholuknf Nov 2, 2023
fbd90a5
stop building on *url* branches
dovholuknf Nov 2, 2023
3a14bdf
Merge pull request #621 from openziti/additional-set-url-refinements
dovholuknf Nov 2, 2023
97f666c
formatting
dovholuknf Nov 2, 2023
607526f
Merge remote-tracking branch 'origin/main' into allow-auto-upgrade-ur…
dovholuknf Nov 2, 2023
3ad1015
Merge remote-tracking branch 'origin/release-next' into allow-auto-up…
dovholuknf Nov 2, 2023
09756f0
add how to test locally instructions
dovholuknf Nov 2, 2023
a09fd9c
allow either update button to successfully upgrade the app and show b…
dovholuknf Nov 2, 2023
f0180cf
refactoring build scripts a bit to support local upgrade dev
dovholuknf Nov 2, 2023
7a3fc4c
interim commit
dovholuknf Nov 2, 2023
0035c4d
small build updates and ui tweak
dovholuknf Nov 3, 2023
8077639
update all the ui elements when an upgrade is available
dovholuknf Nov 3, 2023
135497b
changes from review, cache wintun due to how often dl'ing fails
dovholuknf Nov 8, 2023
7573674
updates per review
dovholuknf Nov 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions DesktopEdge/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ protected override void OnStartup(StartupEventArgs e) {

bool createdNew;


_mutex = new Mutex(true, appName, out createdNew);

if (!createdNew) {
Expand All @@ -59,8 +58,8 @@ protected override void OnStartup(StartupEventArgs e) {
#pragma warning disable 4014 //This async method lacks 'await'
StartServer();
#pragma warning restore 4014 //This async method lacks 'await'
}
}
}
}

async public Task StartServer() {
logger.Debug("Starting IPC server to listen for other instances of the app");
Expand Down
16 changes: 2 additions & 14 deletions DesktopEdge/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,9 @@ private void MonitorClient_OnServiceStatusEvent(object sender, MonitorServiceSta
notifyIcon.Icon.Dispose();
notifyIcon.Dispose();
Application.Current.Shutdown();
}
}
state.AutomaticUpdatesEnabledFromString(evt.AutomaticUpgradeDisabled);
state.AutomaticUpdateURL = evt.AutomaticUpgradeURL;
MainMenu.ShowUpdateAvailable();
logger.Debug("MonitorClient_OnServiceStatusEvent: {0}", evt.Status);
Application.Current.Properties["ReleaseStream"] = evt.ReleaseStream;
Expand Down Expand Up @@ -956,19 +957,6 @@ async private void StartZitiService(object sender, RoutedEventArgs e) {
private void ShowServiceNotStarted() {
TunnelConnected(false);
LoadIdentities(true);
/*
this.Dispatcher.Invoke(() => {
semaphoreSlim.Wait(); //make sure the event is only added to the button once
CloseErrorButton.Click -= CloseError;
if (!startZitiButtonVisible) {
CloseErrorButton.Content = "Start Service";
startZitiButtonVisible = true;
CloseErrorButton.Click += StartZitiService;
}
semaphoreSlim.Release();
SetCantDisplay("Service Not Started", "Do you want to start the data service now?", Visibility.Visible);
});
*/
}

private void MonitorClient_OnClientConnected(object sender, object e) {
Expand Down
38 changes: 19 additions & 19 deletions DesktopEdge/Models/ViewState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,45 @@
using System.Threading.Tasks;
using System.Windows;

namespace Ziti.Desktop.Edge.Models
{
public class ZDEWViewState
{
namespace Ziti.Desktop.Edge.Models {
public class ZDEWViewState {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

private bool automaticUpdatesDisabled = false;
public bool AutomaticUpdatesDisabled
{
get
{
private string updateUrl = "not set yet";
public bool AutomaticUpdatesDisabled {
get {
return automaticUpdatesDisabled;
}
set
{
set {
automaticUpdatesDisabled = value;
}
}
public string AutomaticUpdateURL {
get {
return updateUrl;
}
set {
updateUrl = value;
}
}

public UpdateInfo PendingUpdate { get; set; } = new UpdateInfo();

internal void AutomaticUpdatesEnabledFromString(string automaticUpgradeDisabled)
{
internal void AutomaticUpdatesEnabledFromString(string automaticUpgradeDisabled) {
bool disabled = bool.TrueString.ToLower() == automaticUpgradeDisabled?.ToLower().Trim();
this.AutomaticUpdatesDisabled = disabled;
}
}
public class UpdateInfo
{
public class UpdateInfo {
public DateTime InstallTime { get; set; } = DateTime.MinValue;
public string Version { get; set; } = "0.0.0.0";

public double TimeLeft
{
get
{
public double TimeLeft {
get {
double timeLeft = (InstallTime - DateTime.Now).TotalSeconds;
return timeLeft;
}
}
}
}
}
19 changes: 18 additions & 1 deletion DesktopEdge/Views/Screens/MainMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,26 @@
</StackPanel>
</StackPanel>
<StackPanel Name="AutomaticUpgradesItems" Visibility="Collapsed" Orientation="Vertical" HorizontalAlignment="Stretch">
<Label FontWeight="Bold" FontSize="16" Margin="0,20,0,0">Automatic upgrades:</Label>
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
<local:SubOptionItem x:Name="AutomaticUpgradesItemOn" HorizontalAlignment="Stretch" Width="Auto" Label="Enabled" MouseUp="SetAutomaticUpgradesMenuAction"></local:SubOptionItem>
<local:SubOptionItem x:Name="AutomaticUpgradesItemOff" HorizontalAlignment="Stretch" Width="Auto" Label="Disabled" MouseUp="SetAutomaticUpgradesMenuAction"></local:SubOptionItem>

<Label FontWeight="Bold" FontSize="16" Margin="0,20,0,0">URL used to discover new upgrades:</Label>

<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
<Label Opacity="0.6">Do not change unless you understand the result</Label>

<TextBox x:Name="UpdateUrl" Padding="10" Margin="10,10,10,10" Width="325" BorderThickness="1" TextAlignment="Left" FontSize="14" Foreground="Black" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans">
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="7"/>
</Style>
</TextBox.Resources>
</TextBox>
<local:StyledButton x:Name="SetUpdateUrlButton" OnClick="SetUpdateUrlButton_Click" Label="Set Update URL" Grid.Row="8"></local:StyledButton>
</StackPanel>

<StackPanel Name="ConfigItems" Visibility="Collapsed" Orientation="Vertical" HorizontalAlignment="Stretch">
<local:MenuEditItem x:Name="ConfigIp" HorizontalAlignment="Stretch" Width="Auto" Label="IPv4 Address:"></local:MenuEditItem>
<local:MenuEditItem x:Name="ConfigSubnet" HorizontalAlignment="Stretch" Width="Auto" Label="Subnet Mask:"></local:MenuEditItem>
Expand All @@ -118,7 +135,7 @@
<TextBox Name="LogsItems" Height="400" Width="{Binding ActualWidth, ElementName=MainStack}" TextWrapping="Wrap" Visibility="Collapsed" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>

<StackPanel Name="AboutItemsArea" Orientation="Vertical" HorizontalAlignment="Stretch" Visibility="Collapsed">
<Label Name="VersionInfo" HorizontalAlignment="Center" FontSize="10" Height="50" Padding="0,30,0,0" Foreground="#638190" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
<Label Name="VersionInfo" HorizontalAlignment="Center" FontSize="10" Height="50" Padding="0,30,0,0" Foreground="#638190" Margin="0,-20,0,0" FontFamily="pack:Up//application:,,,/Assets/Fonts/#Open Sans"></Label>

<Label Name="VersionOlder" Content=" checking version information " HorizontalAlignment="Center" FontSize="10" Height="50" Padding="0,30,0,0" Foreground="#F4044D" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
<Label Name="VersionNewer" Content="" HorizontalAlignment="Center" FontSize="10" Height="50" Padding="0,30,0,0" Foreground="#0069FF" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
Expand Down
27 changes: 20 additions & 7 deletions DesktopEdge/Views/Screens/MainMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private bool isBeta {

public void ShowUpdateAvailable() {
ForceUpdate.Visibility = Visibility.Visible;
if (state.PendingUpdate.TimeLeft>0) {
if (state.PendingUpdate.TimeLeft > 0) {
UpdateTimeLeft.Visibility = Visibility.Visible;
if (!state.AutomaticUpdatesDisabled) {
UpdateTimeLeft.Content = $"Automatic update to {state.PendingUpdate.Version} will occur on or after {state.PendingUpdate.InstallTime.ToString("g")}";
Expand Down Expand Up @@ -177,7 +177,7 @@ async private void SetAutomaticUpgradesMenuAction(object sender, MouseButtonEven
var monitorClient = (MonitorClient)Application.Current.Properties["MonitorClient"];

SvcResponse r = await monitorClient.SetAutomaticUpgradeDisabledAsync(disableAutomaticUpgrades);
if(r.Code != 0) {
if (r.Code != 0) {
logger.Error(r?.Error);
}
SetAutomaticUpgradesState();
Expand Down Expand Up @@ -214,7 +214,7 @@ private void UpdateState() {
LogLevelItems.Visibility = Visibility.Collapsed;
ReleaseStreamItems.Visibility = Visibility.Collapsed;
AutomaticUpgradesItems.Visibility = Visibility.Collapsed;

if (menuState == "About") {
MenuTitle.Content = "About";
AboutItemsArea.Visibility = Visibility.Visible;
Expand Down Expand Up @@ -277,8 +277,8 @@ private void UpdateState() {
ConfigItems.Visibility = Visibility.Visible;
BackArrow.Visibility = Visibility.Visible;

ConfigPageSize.Value = ((Application.Current.Properties.Contains("ApiPageSize"))?Application.Current.Properties["ApiPageSize"].ToString(): "25");
ConfigIp.Value = Application.Current.Properties["ip"]?.ToString();
ConfigPageSize.Value = ((Application.Current.Properties.Contains("ApiPageSize")) ? Application.Current.Properties["ApiPageSize"].ToString() : "25");
ConfigIp.Value = Application.Current.Properties["ip"]?.ToString();
ConfigSubnet.Value = Application.Current.Properties["subnet"]?.ToString();
ConfigMtu.Value = Application.Current.Properties["mtu"]?.ToString();
ConfigDns.Value = Application.Current.Properties["dns"]?.ToString();
Expand Down Expand Up @@ -436,7 +436,8 @@ private void SetAutomaticUpgradesState() {
bool disabled = state.AutomaticUpdatesDisabled;
this.AutomaticUpgradesItemOn.IsSelected = !disabled;
this.AutomaticUpgradesItemOff.IsSelected = disabled;
}
this.UpdateUrl.Text = state.AutomaticUpdateURL;
}

async private void CheckForUpdate_Click(object sender, RoutedEventArgs e) {
logger.Info("checking for update...");
Expand Down Expand Up @@ -745,6 +746,18 @@ private void CheckRange() {
}
if (value < 10 || value > 500) value = defaultVal;
ConfigePageSizeNew.Text = value.ToString();
}
}

private async void SetUpdateUrlButton_Click() {
var monitorClient = (MonitorClient)Application.Current.Properties["MonitorClient"];

SvcResponse r = await monitorClient.SetAutomaticUpgradeURLAsync(UpdateUrl.Text);
if (r.Code != 0) {
logger.Error(r?.Error);
MainWindow.ShowError("Could not set url", r?.Error);
} else {
this.OnShowBlurb?.Invoke("Config Saved.");
}
}
}
}
Loading