mirror of
https://code.sup39.dev/repos/Wqawg
synced 2025-01-06 06:46:46 +09:00
e325175a9c
Before, there was a single key used as a personal key for all actors. Now, things work like this: - There are 2 keys, each time one is rotated, this way the old key remains valid and we can freely rotate without a risk of race conditions on other servers and end up with our posts being rejected - The keys are explicitly instance-scope keys, all actors refer to them - We add the ActivityPub-Actor header to all activity POSTs we send, to declare for which specific actor our signature applies. Activities and otherwise different payloads may have varying ways to specify attribution; using this header will be a standard uniform way to specify the actor, regardless of payload format. Of course, servers should make sure the actual activity is attributed to the same actor we specified in the header. (This is important with instance-scope keys; for personal keys it's not critical) |
||
---|---|---|
.. | ||
Field | ||
Form | ||
Handler | ||
Import | ||
Migration | ||
Model | ||
Settings | ||
Widget | ||
Access.hs | ||
ActivityStreams.hs | ||
ActorKey.hs | ||
Application.hs | ||
Avatar.hs | ||
BinaryBody.hs | ||
ChangeFeed.hs | ||
Changes.hs | ||
Colour.hs | ||
Content.hs | ||
Darcs.hs | ||
Discussion.hs | ||
Formatting.hs | ||
Foundation.hs | ||
Git.hs | ||
GraphProxy.hs | ||
Import.hs | ||
MediaType.hs | ||
Migration.hs | ||
Model.hs | ||
Paginate.hs | ||
Palette.hs | ||
Patch.hs | ||
Path.hs | ||
Query.hs | ||
Readme.hs | ||
Render.hs | ||
Role.hs | ||
Secure.hs | ||
Settings.hs | ||
SourceTree.hs | ||
Ssh.hs | ||
Style.hs | ||
Ticket.hs | ||
TicketFilter.hs | ||
Time.hs | ||
Widget.hs | ||
Wiki.hs |
{- 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 Vervis.MediaType (chooseMediaType) import Vervis.Render (renderSourceBL) -- | 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