Skip to content

Commit

Permalink
Revert "[stoream]: pin login support, some bug fixes"
Browse files Browse the repository at this point in the history
  • Loading branch information
muqiuhan authored May 31, 2024
1 parent 41d8d64 commit a0f89c4
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 312 deletions.
1 change: 0 additions & 1 deletion stoream-engine/src/Config/Config.fs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ open FSharp.Data
type Config =
JsonProvider<"""
{
"PIN": "294538",
"Account": {
"Username": "admin",
"Password": "admin"
Expand Down
29 changes: 0 additions & 29 deletions stoream-engine/src/Logger/Logger.fs
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
(* Copyright (c) 2024 The X-Files Research Institute
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Stoream nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*)

module Stoream.Engine.Logger.StoreamLogger

open System
Expand Down
65 changes: 0 additions & 65 deletions stoream-engine/src/PIN/PIN.fs

This file was deleted.

4 changes: 1 addition & 3 deletions stoream-engine/src/Server/Server.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ open Suave.Filters
open Suave.Operators
open Config
open Account
open PIN
open WebUI
open Stoream.Engine.Storage.Storage

Expand Down Expand Up @@ -69,8 +68,7 @@ type Server () =
(* Please add new services here. *)
WebUI.App
Account.App
Storage.GetApp
PIN.App ])
Storage.GetApp ])
POST
>=> fun context ->
context
Expand Down
1 change: 0 additions & 1 deletion stoream-engine/stoream-engine.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<Compile Include="src/Config/Config.fs" />
<Compile Include="src/API/API.fs" />
<Compile Include="src/API/Response.fs" />
<Compile Include="src/PIN/PIN.fs" />
<Compile Include="src/Account/Account.fs" />
<Compile Include="src/WebUI/WebUI.fs" />
<Compile Include="src/Storage/Secure.fs" />
Expand Down
1 change: 0 additions & 1 deletion stoream-engine/stoream-engine.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"PIN": "294538",
"Account": {
"Username": "admin",
"Password": "21232f297a57a5a743894a0e4a801fc3"
Expand Down
42 changes: 0 additions & 42 deletions stoream-webui/src/components/PreviewFile.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions stoream-webui/src/model/Pin.res

This file was deleted.

28 changes: 5 additions & 23 deletions stoream-webui/src/model/Request.res
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ module Directory = {

module File = {
let cat = async (file: File.t): Fetch.Blob.t => {
await Fetch.fetch(`/cat?path=${file.filepath}`, {mode: #cors})->Promise.then(
Fetch.Response.blob,
)
await Fetch.fetch(
`/cat?path=${file.filepath}`,
{mode: #cors},
)->Promise.then(Fetch.Response.blob)
}

let upload = async (filename: string, directory: string, filevalue: Fetch.FormData.t) => {
Expand Down Expand Up @@ -150,30 +151,11 @@ module User = {
status => {
switch status {
| "OK" => ()
| _ => Js.Exn.raiseError("Wrong username or password")
| _ => failwith("Wrong username or password")
}
}
)
})
)
}
}

module Pin = {
let request = async (pin: Pin.t): unit => {
await Fetch.fetch(`${Config.config.engine}/pin?value=${pin}`, {mode: #cors})
->Promise.then(Fetch.Response.json)
->Promise.thenResolve(response => {
response
->Response.parseStatus
->(
status => {
switch status {
| "OK" => ()
| _ => Js.Exn.raiseError("Wrong PIN code")
}
}
)
})
}
}
94 changes: 0 additions & 94 deletions stoream-webui/src/pages/Account.tsx

This file was deleted.

Loading

0 comments on commit a0f89c4

Please sign in to comment.