-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from christian-photo/2.1.6.0
2.1.6.0
- Loading branch information
Showing
26 changed files
with
877 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- | ||
Copyright © 2024 Christian Palm ([email protected]) | ||
Copyright © 2025 Christian Palm ([email protected]) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
@@ -52,10 +52,12 @@ | |
Margin="0,0,5,0" | ||
VerticalAlignment="Center" | ||
Text="⚠️Use Access-Control-Allow-Origin Header⚠️" | ||
ToolTip="This makes it possible to fetch the api using javascript without having to set up a proxy. However it is advised to setup a proxy for security reasons. Though it is not recommended, it is required for some applications like Touch 'N' Stars" /> | ||
ToolTip="This makes it possible to fetch the api using javascript without having to set up a proxy. It is required for some applications like Touch 'N' Stars" /> | ||
<CheckBox IsChecked="{Binding UseAccessHeader}" /> | ||
</StackPanel> | ||
|
||
<TextBlock Margin="0,5,0,0" Text="Access-Control-Allow-Origin is part of the CORS rules and determines which websites are allowed to access a server's data. Without this header, browsers block requests from other domains for security reasons. This is only relevant if the software is accessible via the Internet - in closed networks, such attacks from outside are not possible." /> | ||
|
||
<Separator | ||
Width="20" | ||
Height="10" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#region "copyright" | ||
|
||
/* | ||
Copyright © 2024 Christian Palm ([email protected]) | ||
Copyright © 2025 Christian Palm ([email protected]) | ||
This Source Code Form is subject to the terms of the Mozilla Public | ||
License, v. 2.0. If a copy of the MPL was not distributed with this | ||
file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
@@ -16,7 +16,9 @@ This Source Code Form is subject to the terms of the Mozilla Public | |
using ninaAPI.Properties; | ||
using ninaAPI.Utility; | ||
using ninaAPI.WebService.V2; | ||
using ninaAPI.WebService.V2.Equipment; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
|
@@ -31,6 +33,8 @@ public class API | |
private CancellationTokenSource apiToken; | ||
public readonly int Port; | ||
|
||
private static List<INinaWatcher> Watchers { get; set; } = new List<INinaWatcher>(); | ||
|
||
public API(int port) | ||
{ | ||
Port = port; | ||
|
@@ -49,36 +53,32 @@ public void CreateServer() | |
|
||
public static void StartWatchers() | ||
{ | ||
ControllerV2.StartCameraWatchers(); | ||
ControllerV2.StartDomeWatchers(); | ||
ControllerV2.StartFilterWheelWatchers(); | ||
ControllerV2.StartFlatDeviceWatchers(); | ||
ControllerV2.StartFocuserWatchers(); | ||
ControllerV2.StartGuiderWatchers(); | ||
ControllerV2.StartMountWatchers(); | ||
ControllerV2.StartRotatorWatchers(); | ||
ControllerV2.StartSafetyWatchers(); | ||
ControllerV2.StartSwitchWatchers(); | ||
ControllerV2.StartWeatherWatchers(); | ||
ControllerV2.StartImageWatcher(); | ||
ControllerV2.StartLogWatcher(); | ||
Watchers.Add(new CameraWatcher()); | ||
Watchers.Add(new DomeWatcher()); | ||
Watchers.Add(new FilterWheelWatcher()); | ||
Watchers.Add(new FlatDeviceWatcher()); | ||
Watchers.Add(new FocuserWatcher()); | ||
Watchers.Add(new GuiderWatcher()); | ||
Watchers.Add(new MountWatcher()); | ||
Watchers.Add(new RotatorWatcher()); | ||
Watchers.Add(new SafetyWatcher()); | ||
Watchers.Add(new SwitchWatcher()); | ||
Watchers.Add(new WeatherWatcher()); | ||
Watchers.Add(new ImageWatcher()); | ||
Watchers.Add(new NinaLogWatcher()); | ||
|
||
foreach (INinaWatcher watcher in Watchers) | ||
{ | ||
watcher.StartWatchers(); | ||
} | ||
} | ||
|
||
public static void StopWatchers() | ||
{ | ||
ControllerV2.StopDomeWatchers(); | ||
ControllerV2.StopCameraWatchers(); | ||
ControllerV2.StopFilterWheelWatchers(); | ||
ControllerV2.StopFlatDeviceWatchers(); | ||
ControllerV2.StopFocuserWatchers(); | ||
ControllerV2.StopGuiderWatchers(); | ||
ControllerV2.StopMountWatchers(); | ||
ControllerV2.StopRotatorWatchers(); | ||
ControllerV2.StopSafetyWatchers(); | ||
ControllerV2.StopSwitchWatchers(); | ||
ControllerV2.StopWeatherWatchers(); | ||
ControllerV2.StopImageWatcher(); | ||
ControllerV2.StopLogWatcher(); | ||
foreach (INinaWatcher watcher in Watchers) | ||
{ | ||
watcher.StopWatchers(); | ||
} | ||
} | ||
|
||
public void Start() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.