Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
privatestoragemobile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PrivateStorage
privatestoragemobile
Commits
af666e19
Commit
af666e19
authored
2 years ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Try a little harder to use tahoe-chk correctly
parent
1ff6d3ab
No related branches found
No related tags found
1 merge request
!9
Call an API from tahoe-chk as a demonstration that we can
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
obelisk/frontend/frontend.cabal
+1
-0
1 addition, 0 deletions
obelisk/frontend/frontend.cabal
obelisk/frontend/src/Frontend.hs
+27
-5
27 additions, 5 deletions
obelisk/frontend/src/Frontend.hs
with
28 additions
and
5 deletions
obelisk/frontend/frontend.cabal
+
1
−
0
View file @
af666e19
...
...
@@ -14,6 +14,7 @@ library
, obelisk-executable-config-lookup
, obelisk-generated-static
, text
, bytestring
, tahoe-chk
exposed-modules:
Frontend
...
...
This diff is collapsed.
Click to expand it.
obelisk/frontend/src/Frontend.hs
+
27
−
5
View file @
af666e19
...
...
@@ -8,6 +8,7 @@ import Control.Monad.IO.Class ( liftIO )
import
Control.Monad
import
qualified
Data.Text
as
T
import
qualified
Data.Text.Encoding
as
T
import
qualified
Data.ByteString.Lazy
as
LBS
import
Language.Javascript.JSaddle
(
eval
,
liftJSM
)
import
Obelisk.Frontend
...
...
@@ -20,7 +21,8 @@ import Reflex.Dom.Core
import
Common.Api
import
Common.Route
import
Tahoe.CHK.Upload
(
memoryUploadableWithConvergence
,
store
)
import
Tahoe.CHK.Capability
(
CHK
(
CHKReader
),
dangerRealShow
)
import
Tahoe.CHK.Upload
(
UploadResult
(
..
),
memoryUploadableWithConvergence
,
store
,
filesystemStorageServer
)
import
Tahoe.CHK.Types
(
Parameters
(
..
))
-- This runs in a monad that can be run on the client or the server.
...
...
@@ -33,9 +35,29 @@ frontend = Frontend
elAttr
"link"
(
"href"
=:
$
(
static
"main.css"
)
<>
"type"
=:
"text/css"
<>
"rel"
=:
"stylesheet"
)
blank
,
_frontend_body
=
do
pageLoaded
<-
getPostBuild
theCap
<-
performEvent
$
ffor
pageLoaded
$
\
_
->
liftIO
$
memoryUploadableWithConvergence
"secret"
(
length
"Hello world!"
)
"Hello world!"
(
Parameters
64
1
1
1
)
el
"h1"
$
text
"Tahoe-LAFS Mobule"
el
"p"
$
dynText
$
theCap
let
plaintext
::
LBS
.
ByteString
plaintext
=
"Hello world!"
-- Once the page is built create an object to be uploaded.
uploadableEv
<-
performEvent
$
ffor
pageLoaded
$
\
_
->
liftIO
$
memoryUploadableWithConvergence
"secret"
(
fromIntegral
$
LBS
.
length
plaintext
)
plaintext
(
Parameters
64
1
1
1
)
-- Once the page is built create some servers to upload to.
serversEv
<-
performEvent
$
ffor
pageLoaded
$
\
_
->
liftIO
$
sequence
[
filesystemStorageServer
"1"
,
filesystemStorageServer
"2"
,
filesystemStorageServer
"3"
]
serversBehavior
<-
hold
[]
serversEv
let
inputsReady
=
attach
serversBehavior
uploadableEv
theResultEv
<-
performEvent
$
ffor
inputsReady
$
\
(
servers
,
uploadable
)
->
liftIO
$
store
servers
uploadable
let
theCapTextEv
=
dangerRealShow
.
CHKReader
.
uploadResultReadCap
<$>
theResultEv
theCapTextDyn
<-
holdDyn
""
theCapTextEv
el
"h1"
$
text
"Tahoe-LAFS Mobile"
el
"p"
$
dynText
$
theCapTextDyn
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment