diff --git a/example/frontend/.config/dotnet-tools.json b/example/frontend/.config/dotnet-tools.json index d786017..c14bb76 100644 --- a/example/frontend/.config/dotnet-tools.json +++ b/example/frontend/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "fable": { - "version": "3.1.7", + "version": "4.0.0-theta-011", "commands": [ "fable" ] diff --git a/example/frontend/App.fsproj b/example/frontend/App.fsproj new file mode 100644 index 0000000..a979e3c --- /dev/null +++ b/example/frontend/App.fsproj @@ -0,0 +1,22 @@ + + + net6.0 + + + + + + + + + + + + + + + + + + + diff --git a/example/frontend/fs-src/App.fsproj b/example/frontend/fs-src/App.fsproj deleted file mode 100644 index 3102b1b..0000000 --- a/example/frontend/fs-src/App.fsproj +++ /dev/null @@ -1,18 +0,0 @@ - - - netstandard2.0 - - - - - - - - - - - - - - - diff --git a/example/frontend/fs-src/Utils.fs b/example/frontend/fs-src/Utils.fs deleted file mode 100644 index 8ae5a5e..0000000 --- a/example/frontend/fs-src/Utils.fs +++ /dev/null @@ -1,43 +0,0 @@ -namespace App -module Utils = - open System - open Fable.Core.JsInterop - open Fable.Core - - // https://stackoverflow.com/a/22429679 - - [] - let assignBitShiftChartCode() = jsNative - [>> 0).toString(16)).substr(-8)")>] - let convert_to_hex(s: int): string = jsNative - let hashFnv32a(str: string, asString: bool, seed: int32 option) = - let mutable hval: int32 = if seed.IsNone then 0x811c9dc5 else seed.Value - for i = 0 to str.Length do - assignBitShiftChartCode() - hval <- hval + (hval <<< 1) + (hval <<< 4) + (hval <<< 7) + (hval <<< 8) + (hval <<< 24) - if asString then - convert_to_hex(hval) - else - (hval >>> 0).ToString() - - let hash64 (str: string) = - let mutable h1 = hashFnv32a(str, true, None) - h1 + hashFnv32a(h1 + str, true, None) - - let Identicon: obj = import "*" "identicon.js" - - let getPhotoString (inputString: string) (size: int option) = - let size = size |> Option.defaultValue 20 - let h = hash64 inputString - let i = createNew (Identicon) (h, {|size=size;margin = 0|}) - "data:image/png;base64," + unbox i - - let generateRandomId(): int64 = - let r = Random() - -(r.Next()) |> int64 - - let humanFileSize (size: int) = - let i = JS.Math.floor(JS.Math.log(float size) / JS.Math.log(1024.)) - let r = (float size / JS.Math.pow(1024.,i)) - let suffix = [|"B";"kB"; "MB";"GB";"TB"|].[int i] - sprintf "%.2f %s" r suffix diff --git a/example/frontend/global.json b/example/frontend/global.json new file mode 100644 index 0000000..78eda24 --- /dev/null +++ b/example/frontend/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "6.0.2", + "rollForward": "minor" + } +} diff --git a/example/frontend/public/index.html b/example/frontend/index.html similarity index 60% rename from example/frontend/public/index.html rename to example/frontend/index.html index cd2d1c2..8412435 100644 --- a/example/frontend/public/index.html +++ b/example/frontend/index.html @@ -1,34 +1,26 @@ - - + + - + - - + Django Private Chat2 Example
+