Skip to content

Commit

Permalink
Bumping version to 0.0.36
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Oct 5, 2018
1 parent d9794cd commit 020ed3e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Release Notes

## 0.0.35 - 2018-10-05
## 0.0.36 - 2018-10-05

* Initial release
4 changes: 2 additions & 2 deletions src/Client/ReleaseNotes.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module internal ReleaseNotes

let Version = "0.0.35"
let Version = "0.0.36"

let IsPrerelease = false

let Notes = """
# Release Notes
## 0.0.35 - 2018-10-05
## 0.0.36 - 2018-10-05
* Initial release
"""
14 changes: 7 additions & 7 deletions src/PiServer/PiServer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -137,27 +137,27 @@ let configureSerialization (services:IServiceCollection) =
services.AddNodeServices(fun x -> x.InvocationTimeoutMilliseconds <- 2 * 60 * 60 * 1000)
services

let app = application {
let builder = application {
url ("http://0.0.0.0:" + port.ToString() + "/")
use_router webApp
memory_cache
service_config configureSerialization
use_gzip
}

let x = app.Build()
x.Start()
let app = builder.Build()
app.Start()

printfn "Server started"

let firmwareCheck = checkFirmware()
firmwareCheck.Wait()
let r = firmwareCheck.Result

let service = x.Services.GetService(typeof<INodeServices>) :?> INodeServices
let service = app.Services.GetService(typeof<INodeServices>) :?> INodeServices

let t = executeStartupActions service
t.Wait()
printfn "%A" t.Result
let startupTask = executeStartupActions service
startupTask.Wait()
printfn "%A" startupTask.Result

System.Console.ReadKey() |> ignore
29 changes: 23 additions & 6 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ open ServerCore.Domain

open Thoth.Json.Net
open ServerCode.Storage
open Microsoft.AspNetCore.Http
open Microsoft.Extensions.Primitives


#if DEBUG
Expand All @@ -15,9 +17,6 @@ let publicPath = Path.GetFullPath "../Client/public"
let publicPath = Path.GetFullPath "client"
#endif

let audioPath = Path.GetFullPath "../../audio"


let allTagsEndpoint userID =
pipeline {
set_header "Content-Type" "application/json"
Expand All @@ -28,12 +27,30 @@ let allTagsEndpoint userID =
})
}

let mp3Endpoint fileName =

let audioStream (stream : Stream) : HttpHandler =
fun (next : HttpFunc) (ctx : HttpContext) ->
task {
let l = int stream.Length
stream.Position <- int64 0
ctx.Response.Headers.["Content-Length"] <- StringValues(l.ToString())
do! stream.CopyToAsync(ctx.Response.Body)
return! next ctx
}

let mp3Endpoint mediaID =
pipeline {
set_header "Content-Type" "audio/mpeg"
plug (fun next ctx -> task {
let file = Path.Combine(audioPath,sprintf "mp3/%s.mp3" fileName)
return! ctx.WriteFileStreamAsync true file None None
let connection = AzureTable.connection
let blobClient = connection.CreateCloudBlobClient()
let mediaContainer = blobClient.GetContainerReference("media")
let! _x = mediaContainer.CreateIfNotExistsAsync()

let blockBlob = mediaContainer.GetBlockBlobReference(mediaID)
use stream = new MemoryStream()
do! blockBlob.DownloadToStreamAsync(stream)
return! Successful.ok (audioStream stream) next ctx
})
}

Expand Down

0 comments on commit 020ed3e

Please sign in to comment.