Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
dd29ff3a
Commit
dd29ff3a
authored
Sep 29, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Home really public now
parent
27cd8cf4
Pipeline
#1104
canceled with stage
Changes
1
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
Public.hs
src/Gargantext/API/Public.hs
+11
-8
No files found.
src/Gargantext/API/Public.hs
View file @
dd29ff3a
...
...
@@ -44,13 +44,14 @@ import qualified Data.Set as Set
------------------------------------------------------------------------
type
API
=
API_Home
--
:<|> API_Node
:<|>
API_Node
api
::
Text
->
GargServer
API
api
baseUrl
=
(
api_home
baseUrl
)
-- :<|> api_node
:<|>
api_node
-------------------------------------------------------------------------
type
API_Home
=
Summary
" Public API"
type
API_Home
=
Summary
" Public
Home
API"
:>
Get
'[
J
SON
]
[
PublicData
]
api_home
::
Text
->
GargServer
API_Home
...
...
@@ -61,14 +62,16 @@ api_home baseUrl = catMaybes
-------------------------------------------------------------------------
type
API_Node
=
Summary
" Public Node API"
:>
FileApi
:>
Capture
"node"
NodeId
:>
"file"
:>
FileApi
api_node
::
UserId
->
NodeId
->
GargServer
FileApi
api_node
uid
nId
=
do
api_node
::
NodeId
->
GargServer
FileApi
api_node
nId
=
do
pubNodes
<-
publicNodes
-- TODO optimize with SQL
case
Set
.
member
nId
pubNodes
of
False
->
panic
"Not allowed"
-- TODO throwErr
True
->
fileApi
uid
nId
True
->
fileApi
0
nId
-------------------------------------------------------------------------
...
...
@@ -116,7 +119,7 @@ toPublicData base (n , mn) = PublicData <$> (hd ^? (_Just . hf_data . cf_title))
$
n
^.
(
node_hyperdata
.
hc_fields
)
url'
::
[
NodeId
]
->
Text
url'
mn'
=
base
<>
"/
node/"
<>
"/
public/"
<>
(
cs
$
show
$
(
maybe
0
unNodeId
$
head
mn'
))
<>
"/file/download"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment