Skip to content

Commit

Permalink
Bumping version to 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Dec 21, 2018
1 parent 9b10f77 commit 4f74164
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 10 deletions.
2 changes: 1 addition & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release Notes

## 1.0.0 - 2018-12-18
## 1.0.3 - 2018-12-21
* Christmas edition

## 0.16.25 - 2018-12-18
Expand Down
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 = "1.0.0"
let Version = "1.0.3"

let IsPrerelease = false

let Notes = """
# Release Notes
## 1.0.0 - 2018-12-18
## 1.0.3 - 2018-12-21
* Christmas edition
## 0.16.25 - 2018-12-18
Expand Down
3 changes: 3 additions & 0 deletions src/Server/AzureTable.fs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ let requestsTable = getTable "requests" connection

open ServerCore.Domain
open Thoth.Json.Net
open System


let mapLink (entity: DynamicTableEntity) : Link =
Expand All @@ -141,6 +142,7 @@ let mapTag (entity: DynamicTableEntity) : Tag =
{ Token = entity.RowKey
Description = getStringProperty "Description" entity
Object = getStringProperty "Object" entity
LastVerified = getOptionalDateTimeOffsetProperty "LastVerified" entity |> Option.defaultValue DateTimeOffset.MinValue
Action =
match Decode.fromString TagAction.Decoder (getStringProperty "Action" entity) with
| Error msg -> failwith msg
Expand All @@ -154,6 +156,7 @@ let saveTag (userID:string) (tag:Tag) =
entity.Properties.["Action"] <- EntityProperty.GeneratePropertyForString (TagAction.Encoder tag.Action |> Encode.toString 0)
entity.Properties.["Description"] <- EntityProperty.GeneratePropertyForString tag.Description
entity.Properties.["Object"] <- EntityProperty.GeneratePropertyForString tag.Object
entity.Properties.["LastVerified"] <- EntityProperty.GeneratePropertyForDateTimeOffset(Nullable tag.LastVerified)
let operation = TableOperation.InsertOrReplace entity
tagsTable.ExecuteAsync operation

Expand Down
36 changes: 29 additions & 7 deletions src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@ let discoverYoutubeLink (youtubeURL:string) = task {
lines.Add line

let lines = Seq.toArray lines
let links =
lines
|> Array.filter (fun x -> x.Contains "&mime=audio")

return youtubeURL,links
return youtubeURL,lines
}

let mapYoutube (tag:Tag) = task {
Expand All @@ -113,7 +109,12 @@ let uploadEndpoint (token:string) =
let file = form.Files.[0]
use stream = file.OpenReadStream()
let! tagAction = uploadMusik stream
let tag : Tag = { Token = System.Guid.NewGuid().ToString(); Action = tagAction; Description = ""; Object = "" }
let tag : Tag = {
Token = System.Guid.NewGuid().ToString()
Action = tagAction
Description = ""
LastVerified = DateTimeOffset.UtcNow
Object = "" }
let! _saved = AzureTable.saveTag token tag
let! tag = mapBlobMusikTag tag
let txt = Tag.Encoder tag |> Encode.toString 0
Expand All @@ -130,7 +131,14 @@ let tagEndpoint (userID,token) =
let! tag =
match tag with
| Some t -> t |> mapBlobMusikTag
| _ -> task { return { Token = token; Action = TagAction.UnknownTag; Description = ""; Object = "" } }
| _ ->
let t = {
Token = token
Action = TagAction.UnknownTag
LastVerified = DateTimeOffset.MinValue
Description = ""
Object = "" }
task { return t }

let! tag = tag |> mapYoutube
let tag : TagForBox = {
Expand Down Expand Up @@ -187,6 +195,16 @@ let firmwareEndpoint =
})
}

let youtubeEndpoint =
pipeline {
set_header "Content-Type" "application/json"
plug (fun next ctx -> task {
let! _,urls = discoverYoutubeLink "https://www.youtube.com/watch?v=n2FHn3B0K4U"
let txt = sprintf "%A" urls
return! setBodyFromString txt next ctx
})
}

let tagHistoryBroadcaster = ConnectionManager()

let t = task {
Expand All @@ -203,6 +221,7 @@ let webApp =
postf "/api/upload/%s" uploadEndpoint
get "/api/startup" startupEndpoint
get "/api/firmware" firmwareEndpoint
get "/api/youtube" youtubeEndpoint
get "/api/latestfirmware" getLatestFirmware
getf "/api/taghistorysocket/%s" (TagHistorySocket.openSocket tagHistoryBroadcaster)
}
Expand Down Expand Up @@ -232,6 +251,9 @@ let discoverTask = task {
match tag.Action with
| TagAction.PlayYoutube url ->
let! _,urls = discoverYoutubeLink url
let urls =
urls
|> Array.filter (fun x -> x.Contains "&mime=audio")
let! _ = saveLinks tag urls
()
| _ -> ()
Expand Down
7 changes: 7 additions & 0 deletions src/Shared/Shared.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace ServerCore.Domain

open System

#if FABLE_COMPILER
open Thoth.Json
#else
Expand Down Expand Up @@ -113,13 +115,15 @@ type Tag =
{ Token : string
Object : string
Description : string
LastVerified : DateTimeOffset
Action : TagAction }

static member Encoder (tag : Tag) =
Encode.object [
"Token", Encode.string tag.Token
"Description", Encode.string tag.Description
"Object", Encode.string tag.Object
"LastVerified", Encode.datetimeOffset tag.LastVerified
"Action", TagAction.Encoder tag.Action
]

Expand All @@ -128,6 +132,9 @@ type Tag =
{ Token = get.Required.Field "Token" Decode.string
Object = get.Required.Field "Object" Decode.string
Description = get.Required.Field "Description" Decode.string
LastVerified =
get.Optional.Field "LastVerified" Decode.datetimeOffset
|> Option.defaultValue DateTimeOffset.MinValue
Action = get.Required.Field "Action" TagAction.Decoder }
)

Expand Down

0 comments on commit 4f74164

Please sign in to comment.