Compare commits

...

2 Commits

Author SHA1 Message Date
792057b297 Added current wsgi config for Apache2 for historical purposes
(and because I gained so much grey hair)
2023-11-15 14:54:59 +01:00
980349449b Removed exception message if everything is ok again 2023-11-15 14:52:02 +01:00
4 changed files with 113 additions and 35 deletions

View File

@ -0,0 +1,25 @@
<VirtualHost *:443>
ServerName brecal.bsmd-emswe.eu
ServerAlias www.brecal.bsmd-emswe.eu
ServerAdmin webmaster@localhost
DocumentRoot /var/www/brecal/src/server
WSGIDaemonProcess flaskapp_prod threads=15 display-name=%{GROUP} restart-interval=86400
WSGIProcessGroup flaskapp_prod
WSGIScriptAlias / /var/www/brecal/src/server/flaskapp.wsgi
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<Directory server>
WSGIProcessGroup brecal
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/brecal-error.log
CustomLog ${APACHE_LOG_DIR}/brecal-access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/brecal.bsmd-emswe.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/brecal.bsmd-emswe.eu/privkey.pem
</VirtualHost>

View File

@ -0,0 +1,26 @@
<VirtualHost *:443>
ServerName brecaldevel.bsmd-emswe.eu
ServerAlias www.brecaldevel.bsmd-emswe.eu
ServerAdmin webmaster@localhost
DocumentRoot /var/www/brecal_devel/src/server
WSGIDaemonProcess flaskapp_devel threads=15 display-name=%{GROUP} restart-interval=86400
WSGIProcessGroup flaskapp_devel
WSGIScriptAlias / /var/www/brecal_devel/src/server/flaskapp.wsgi
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<Directory server>
WSGIProcessGroup brecaldevel
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/brecaldevel-error.log
CustomLog ${APACHE_LOG_DIR}/brecaldevel-access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/brecaldevel.bsmd-emswe.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/brecaldevel.bsmd-emswe.eu/privkey.pem
</VirtualHost>

View File

@ -0,0 +1,26 @@
<VirtualHost *:443>
ServerName brecaltest.bsmd-emswe.eu
ServerAlias www.brecaltest.bsmd-emswe.eu
ServerAdmin webmaster@localhost
DocumentRoot /var/www/brecal_test/src/server
WSGIDaemonProcess flaskapp_test threads=15 display-name=%{GROUP} restart-interval=86400
WSGIProcessGroup flaskapp_test
WSGIScriptAlias / /var/www/brecal_test/src/server/flaskapp.wsgi
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<Directory server>
WSGIProcessGroup brecaltest
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/brecaltest-error.log
CustomLog ${APACHE_LOG_DIR}/brecaltest-access.log combined
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/brecaltest.bsmd-emswe.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/brecaltest.bsmd-emswe.eu/privkey.pem
</VirtualHost>

View File

@ -1,6 +1,6 @@
// Copyright (c) 2023 schick Informatik // Copyright (c) 2023 schick Informatik
// Description: Bremen calling main window // Description: Bremen calling main window
// //
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -38,7 +38,7 @@ namespace BreCalClient
private readonly ConcurrentDictionary<int, ShipcallControlModel> _allShipcallsDict = new(); private readonly ConcurrentDictionary<int, ShipcallControlModel> _allShipcallsDict = new();
private readonly ConcurrentDictionary<int, ShipcallControl> _allShipCallsControlDict = new(); private readonly ConcurrentDictionary<int, ShipcallControl> _allShipCallsControlDict = new();
private readonly List<ShipcallControlModel> _visibleControlModels = new(); private readonly List<ShipcallControlModel> _visibleControlModels = new();
private readonly DefaultApi _api; private readonly DefaultApi _api;
private CancellationTokenSource _tokenSource = new(); private CancellationTokenSource _tokenSource = new();
@ -71,7 +71,7 @@ namespace BreCalClient
{ {
InitializeComponent(); InitializeComponent();
_api = new DefaultApi(Properties.Settings.Default.API_URL); _api = new DefaultApi(Properties.Settings.Default.API_URL);
_api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer"; _api.Configuration.ApiKeyPrefix["Authorization"] = "Bearer";
} }
#endregion #endregion
@ -84,14 +84,14 @@ namespace BreCalClient
labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; labelVersion.Text = "V. " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
if (!string.IsNullOrEmpty(Properties.Settings.Default.APP_TITLE)) if (!string.IsNullOrEmpty(Properties.Settings.Default.APP_TITLE))
this.Title = Properties.Settings.Default.APP_TITLE; this.Title = Properties.Settings.Default.APP_TITLE;
searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged; searchFilterControl.SearchFilterChanged += SearchFilterControl_SearchFilterChanged;
searchFilterControl.LogoImageClicked += () => searchFilterControl.LogoImageClicked += () =>
{ {
Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL); Process.Start("explorer", Properties.Settings.Default.LOGO_IMAGE_URL);
}; };
this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder)); this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder));
this.comboBoxSortOrder.SelectedIndex = (int)_sortOrder; this.comboBoxSortOrder.SelectedIndex = (int)_sortOrder;
} }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{ {
@ -147,9 +147,9 @@ namespace BreCalClient
if (_loginResult != null) if (_loginResult != null)
{ {
if (_loginResult.Id > 0) if (_loginResult.Id > 0)
{ {
this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token; this._api.Configuration.ApiKey["Authorization"] = _loginResult.Token;
} }
} }
else else
{ {
@ -169,7 +169,7 @@ namespace BreCalClient
private void buttonNew_Click(object sender, RoutedEventArgs e) private void buttonNew_Click(object sender, RoutedEventArgs e)
{ {
EditShipcallControl esc = new(); EditShipcallControl esc = new();
if (esc.ShowDialog() ?? false) if (esc.ShowDialog() ?? false)
{ {
@ -187,8 +187,8 @@ namespace BreCalClient
_refreshImmediately = true; // set flag to avoid timer loop termination _refreshImmediately = true; // set flag to avoid timer loop termination
_tokenSource.Cancel(); // force timer loop end _tokenSource.Cancel(); // force timer loop end
} }
} }
} }
private void buttonInfo_Click(object sender, RoutedEventArgs e) private void buttonInfo_Click(object sender, RoutedEventArgs e)
{ {
@ -251,7 +251,7 @@ namespace BreCalClient
this.UpdateUI(); this.UpdateUI();
} }
#endregion #endregion
#region network operations #region network operations
@ -262,14 +262,14 @@ namespace BreCalClient
BreCalLists.InitializeParticipants(await _api.ParticipantsGetAsync()); BreCalLists.InitializeParticipants(await _api.ParticipantsGetAsync());
this.searchFilterControl.SetBerths(BreCalLists.Berths); this.searchFilterControl.SetBerths(BreCalLists.Berths);
foreach (Participant participant in BreCalLists.Participants) foreach (Participant participant in BreCalLists.Participants)
{ {
if (_loginResult?.ParticipantId == participant.Id) if (_loginResult?.ParticipantId == participant.Id)
{ {
App.Participant = participant; App.Participant = participant;
EnableControlsForParticipant(); EnableControlsForParticipant();
} }
} }
this.searchFilterControl.SetAgencies(BreCalLists.Participants_Agent); this.searchFilterControl.SetAgencies(BreCalLists.Participants_Agent);
@ -282,7 +282,7 @@ namespace BreCalClient
} }
_ = Task.Run(() => RefreshShipcalls()); _ = Task.Run(() => RefreshShipcalls());
} }
public async Task RefreshShipcalls() public async Task RefreshShipcalls()
{ {
@ -307,10 +307,11 @@ namespace BreCalClient
{ {
labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}"; labelGeneralStatus.Text = $"Connection {ConnectionStatus.SUCCESSFUL}";
labelGeneralStatus.Text = $"Ok"; labelGeneralStatus.Text = $"Ok";
labelStatusBar.Text = "";
})); }));
} }
catch (Exception ex) catch (Exception ex)
{ {
this.Dispatcher.Invoke(new Action(() => this.Dispatcher.Invoke(new Action(() =>
{ {
labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}"; labelGeneralStatus.Text = $"Connection {ConnectionStatus.FAILED}";
@ -337,7 +338,7 @@ namespace BreCalClient
{ {
Shipcall = shipcall, Shipcall = shipcall,
Times = currentTimes Times = currentTimes
}; };
this.AddShipcall(scm); this.AddShipcall(scm);
} }
else else
@ -346,8 +347,8 @@ namespace BreCalClient
_allShipcallsDict[shipcall.Id].Shipcall = shipcall; _allShipcallsDict[shipcall.Id].Shipcall = shipcall;
_allShipcallsDict[shipcall.Id].Times = currentTimes; _allShipcallsDict[shipcall.Id].Times = currentTimes;
UpdateShipcall(_allShipcallsDict[shipcall.Id]); UpdateShipcall(_allShipcallsDict[shipcall.Id]);
} }
} }
List<int> existingIds = new(this._allShipcallsDict.Keys); List<int> existingIds = new(this._allShipcallsDict.Keys);
@ -400,7 +401,7 @@ namespace BreCalClient
ShipcallControl sc = new() ShipcallControl sc = new()
{ {
Height = 120, Height = 120,
ShipcallControlModel = scm ShipcallControlModel = scm
}; };
sc.EditTimesRequested += Sc_EditTimesRequested; sc.EditTimesRequested += Sc_EditTimesRequested;
sc.EditRequested += Sc_EditRequested; sc.EditRequested += Sc_EditRequested;
@ -408,7 +409,7 @@ namespace BreCalClient
sc.RefreshData(); sc.RefreshData();
this._allShipCallsControlDict[scm.Shipcall.Id] = sc; this._allShipCallsControlDict[scm.Shipcall.Id] = sc;
}); });
} }
private static void UpdateShipcall(ShipcallControlModel scm) private static void UpdateShipcall(ShipcallControlModel scm)
{ {
@ -440,7 +441,7 @@ namespace BreCalClient
_visibleControlModels.Remove(removeModel); _visibleControlModels.Remove(removeModel);
this._allShipCallsControlDict.Remove(shipcallId, out _); this._allShipCallsControlDict.Remove(shipcallId, out _);
this._allShipcallsDict.Remove(shipcallId, out _); this._allShipcallsDict.Remove(shipcallId, out _);
} }
private void FilterShipcalls() private void FilterShipcalls()
@ -483,7 +484,7 @@ namespace BreCalClient
return !sfm.Agencies.Contains(agency.Id); return !sfm.Agencies.Contains(agency.Id);
} }
return true; return true;
}); });
} }
if(sfm.Categories.Count > 0 ) if(sfm.Categories.Count > 0 )
@ -520,18 +521,18 @@ namespace BreCalClient
{ {
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false); _ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);
} }
switch(this._sortOrder) switch(this._sortOrder)
{ {
case Extensions.SortOrder.SHIP_NAME: case Extensions.SortOrder.SHIP_NAME:
this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); }); this._visibleControlModels.Sort((x, y) => { if (x.Ship == null) return 0; if (y.Ship == null) return 0; return x.Ship.Name.CompareTo(y.Ship.Name); });
break; break;
case Extensions.SortOrder.MODIFIED: case Extensions.SortOrder.MODIFIED:
this._visibleControlModels.Sort((x, y) => { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; return DateTime.Compare(x.Shipcall.Modified ?? x.Shipcall.Created, y.Shipcall.Modified ?? x.Shipcall.Created); }); this._visibleControlModels.Sort((x, y) => { if (x.Shipcall == null) return 0; if (y.Shipcall == null) return 0; return DateTime.Compare(x.Shipcall.Modified ?? x.Shipcall.Created, y.Shipcall.Modified ?? x.Shipcall.Created); });
break; break;
case Extensions.SortOrder.ETA_ETD: case Extensions.SortOrder.ETA_ETD:
this._visibleControlModels.Sort((x, y) => this._visibleControlModels.Sort((x, y) =>
{ {
if (x.Shipcall == null) return 0; if (x.Shipcall == null) return 0;
if (y.Shipcall == null) return 0; if (y.Shipcall == null) return 0;
DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now; DateTime xDate = (x.Shipcall.Type == (int) Extensions.TypeEnum.Incoming) ? x.Eta ?? DateTime.Now : x.Etd ?? DateTime.Now;
@ -541,7 +542,7 @@ namespace BreCalClient
break; break;
default: default:
break; break;
} }
} }
@ -586,7 +587,7 @@ namespace BreCalClient
#region control event handler #region control event handler
private async void Sc_EditRequested(ShipcallControl obj) private async void Sc_EditRequested(ShipcallControl obj)
{ {
if (obj.ShipcallControlModel != null) if (obj.ShipcallControlModel != null)
{ {
EditShipcallControl esc = new() EditShipcallControl esc = new()
@ -632,7 +633,7 @@ namespace BreCalClient
if (times != null) if (times != null)
{ {
etc.Times = times; etc.Times = times;
wasEdit = true; wasEdit = true;
} }
else else
{ {
@ -698,7 +699,7 @@ namespace BreCalClient
{ {
editControl.Times = times; editControl.Times = times;
wasEdit = true; wasEdit = true;
} }
else else
{ {
if(editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY)) if(editControl.ShipcallModel.AssignedParticipants.ContainsKey(ParticipantType.AGENCY))
@ -726,7 +727,7 @@ namespace BreCalClient
await _api.TimesPutAsync(editControl.Times); await _api.TimesPutAsync(editControl.Times);
} }
else else
{ {
if ((sc.ShipcallControlModel != null) && (sc.ShipcallControlModel.Shipcall != null)) if ((sc.ShipcallControlModel != null) && (sc.ShipcallControlModel.Shipcall != null))
{ {
editControl.Times.ShipcallId = sc.ShipcallControlModel.Shipcall.Id; editControl.Times.ShipcallId = sc.ShipcallControlModel.Shipcall.Id;
@ -761,7 +762,7 @@ namespace BreCalClient
Dispatcher.Invoke(new Action(() => Dispatcher.Invoke(new Action(() =>
{ {
MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error); MessageBox.Show(message, caption, MessageBoxButton.OK, MessageBoxImage.Error);
})); }));
} }
private void EnableControlsForParticipant() private void EnableControlsForParticipant()
@ -771,6 +772,6 @@ namespace BreCalClient
} }
#endregion #endregion
} }
} }