Skip to content

Commit

Permalink
handle OPTIONS and properly save autostart api setting
Browse files Browse the repository at this point in the history
  • Loading branch information
msarilar committed Jun 26, 2018
1 parent d7a9007 commit bc1ba36
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 7 additions & 2 deletions EDEngineer.Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ let start (token,
(request(fun request ->
let timestampString = match request.queryParam "last" with
| Choice1Of2 s -> Some(s)
| Choice2Of2 other -> None
| Choice2Of2 _ -> None

cmdr {
let! state = stateRoute commander
Expand All @@ -314,7 +314,12 @@ let start (token,
| _ -> false)
return (operations, l) |> FormatPicker(f) |> OK >=> MimeType(f)
})))


OPTIONS >=>
fun context ->
context |> (
OK "CORS approved" )

NOT_FOUND "Route not found" ] >=> setHeader "Access-Control-Allow-Origin" "*" >=> cors corsConfig

startWebServer {
Expand Down
4 changes: 2 additions & 2 deletions EDEngineer/EDEngineer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>9</ApplicationRevision>
<ApplicationVersion>1.1.2.9</ApplicationVersion>
<ApplicationRevision>10</ApplicationRevision>
<ApplicationVersion>1.1.2.10</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
Expand Down
5 changes: 4 additions & 1 deletion EDEngineer/Utils/System/ServerBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ public void Stop()

public void Dispose()
{
Stop();
if (cts?.IsCancellationRequested == false)
{
cts.Cancel();
}
}

private bool TryGetPort(out ushort port)
Expand Down

0 comments on commit bc1ba36

Please sign in to comment.