1
0
Fork 0
mirror of https://code.naskya.net/repos/ndqEd synced 2025-01-25 16:47:50 +09:00
vervis/src/Vervis
Pere Lev e8e587af26
Generate FEP-8b32 authenticity proofs when delivering activities
Limitations:

- Verification of proofs not implemeneted yet, just generation.
  Verification probably coming in the next commit.
- Only jcs-eddsa-2022 is supported. Can add more cryptosuites once
  they're updated for the requirements of the VC Data Integrity spec.
- Bug: The proofs aren't stored in the DB versions of outgoing activities, i.e.
  HTTP GETing an activity won't include the proof. Probably not urgent
  to fix. Ideally, change the whole PersistJSONObject/Envelope/etc.
  thing to allow to serialize the activity exactly once.
2023-05-30 09:48:21 +03:00
..
Actor Web.ActivityPub: Add Grant startTime and endTime 2023-05-29 10:47:41 +03:00
Data Web.ActivityPub: Add Grant startTime and endTime 2023-05-29 10:47:41 +03:00
Federation Web.ActivityPub: Add Grant startTime and endTime 2023-05-29 10:47:41 +03:00
Field DB: Switch to more flexible collaborator model 2022-06-22 06:19:37 +00:00
Form UI: New ticket/MR creation form + deck/loom navigation links 2022-10-17 15:08:00 +00:00
Handler Generate FEP-8b32 authenticity proofs when delivering activities 2023-05-30 09:48:21 +03:00
Migration UI, S2S: Implement Join flow in S2S + deck devs page now lists join requests 2022-11-14 15:11:25 +00:00
Model Switch to new actor layout 2022-08-15 13:57:42 +00:00
Persist Implement actor-model system and start moving Person actor to it 2023-04-29 10:40:44 +00:00
Settings Mechanism for reporting git pushes to Vervis via post-receive hooks 2019-09-05 12:02:42 +00:00
Web Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
Widget UI: New ticket/MR creation form + deck/loom navigation links 2022-10-17 15:08:00 +00:00
Access.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
ActivityPub.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
Actor.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
Actor2.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
API.hs Generate FEP-8b32 authenticity proofs when delivering activities 2023-05-30 09:48:21 +03:00
Application.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
Avatar.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
BinaryBody.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
ChangeFeed.hs Switch to new actor layout 2022-08-15 13:57:42 +00:00
Changes.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Client.hs C2S: Re-implement and enable resolveC, followC, undoC 2022-10-25 04:54:56 +00:00
Cloth.hs DB, Web: Allow origin repo for Cloths, mention in getClothR JSON 2022-09-18 15:55:42 +00:00
Colour.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Content.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Darcs.hs Client, UI: "Apply" button for local MRs & PublishMergeR form for remote MRs 2022-09-24 21:15:40 +00:00
Federation.hs Generate FEP-8b32 authenticity proofs when delivering activities 2023-05-30 09:48:21 +03:00
FedURI.hs New Network.FedURI with separate URI modes for dev and for fediverse 2019-07-23 13:59:48 +00:00
Fetch.hs C2S: Re-implement and enable resolveC, followC, undoC 2022-10-25 04:54:56 +00:00
Formatting.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Foundation.hs Generate FEP-8b32 authenticity proofs when delivering activities 2023-05-30 09:48:21 +03:00
Git.hs Client, UI: "Apply" button for local MRs & PublishMergeR form for remote MRs 2022-09-24 21:15:40 +00:00
GraphProxy.hs Prepare for ticket dependency federation 2020-06-18 10:38:04 +00:00
Hook.hs Switch to new actor layout 2022-08-15 13:57:42 +00:00
KeyFile.hs Add OAuth2 tables to database, and run their migrations 2020-03-28 14:18:00 +00:00
Migration.hs Generate FEP-8b32 authenticity proofs when delivering activities 2023-05-30 09:48:21 +03:00
Model.hs Implement actor-model system and start moving Person actor to it 2023-04-29 10:40:44 +00:00
Paginate.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Palette.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Path.hs Switch to new actor layout 2022-08-15 13:57:42 +00:00
Query.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Readme.hs Syntax-highlight the pretty JSON display of AP objects 2019-06-09 14:32:57 +00:00
Recipient.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
RemoteActorStore.hs Implement actor-model system and start moving Person actor to it 2023-04-29 10:40:44 +00:00
Role.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Secure.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Settings.hs Implement theater-based remote delivery and port personGrant 2023-05-24 22:17:14 +00:00
SourceTree.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Ssh.hs Switch to new actor layout 2022-08-15 13:57:42 +00:00
Style.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Ticket.hs C2S: Re-implement and enable resolveC, followC, undoC 2022-10-25 04:54:56 +00:00
TicketFilter.hs UI, DB: Switch ticket filter to use TicketResolve instead of TicketStatus 2022-10-16 23:44:16 +00:00
Time.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
Widget.hs Update docs for darcs->git switch, and switch from darcs-rev to gitrev 2023-05-25 13:55:56 +03:00
Wiki.hs Stop using Vervis.Import and NoImplicitPrelude, switch to plain regular imports 2019-06-15 08:24:08 +00:00
WorkItem.hs Switch to new actor layout 2022-08-15 13:57:42 +00:00

{- This file is part of Vervis.
 -
 - Written in 2016 by fr33domlover <fr33domlover@riseup.net>.
 -
 - ♡ Copying is an act of love. Please copy, reuse and share.
 -
 - The author(s) have dedicated all copyright and related and neighboring
 - rights to this software to the public domain worldwide. This software is
 - distributed without any warranty.
 -
 - You should have received a copy of the CC0 Public Domain Dedication along
 - with this software. If not, see
 - <http://creativecommons.org/publicdomain/zero/1.0/>.
 -}

-- | Tools for rendering README files in repository tree view.
module Vervis.Readme
    ( isReadme
    , renderReadme
    )
where

import Prelude hiding (takeWhile)

import Data.ByteString.Lazy (ByteString)
import Data.Git.Harder (ObjId (..))
import Data.Git.Storage (Git, getObject_)
import Data.Git.Storage.Object (Object (..))
import Data.Git.Types (Blob (..), Tree (..))
import Data.Text (Text, toCaseFold, takeWhile, unpack)
import System.FilePath (isExtSeparator)

import Data.Git.Local (TreeRows)
import Text.FilePath.Local (breakExt)
import Vervis.Foundation (Widget)
import Data.MediaType
import Yesod.RenderSource

-- | Check if the given filename should be considered as README file. Assumes
-- a flat filename which doesn't contain a directory part.
isReadme :: Text -> Bool
isReadme file =
    let basename = takeWhile (not . isExtSeparator) file
    in  toCaseFold "readme" == toCaseFold basename

-- | Render README content into a widget for inclusion in a page.
renderReadme :: [Text] -> Text -> ByteString -> Widget
renderReadme dir name content =
    let (base, ext) = breakExt name
        mediaType = chooseMediaType dir base ext () ()
    in  renderSourceBL mediaType content