2016-02-27 05:41:36 +00:00
|
|
|
{- This file is part of Vervis.
|
|
|
|
-
|
2022-06-22 06:19:37 +00:00
|
|
|
- Written in 2016, 2018, 2019, 2020, 2022
|
|
|
|
- by fr33domlover <fr33domlover@riseup.net>.
|
2016-02-27 05:41:36 +00:00
|
|
|
-
|
|
|
|
- ♡ 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/>.
|
|
|
|
-}
|
|
|
|
|
|
|
|
module Vervis.Handler.Repo
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
( getRepoR
|
|
|
|
, getRepoInboxR
|
|
|
|
, postRepoInboxR
|
|
|
|
, getRepoOutboxR
|
|
|
|
, getRepoOutboxItemR
|
|
|
|
, getRepoFollowersR
|
|
|
|
|
|
|
|
, getDarcsDownloadR
|
|
|
|
, getGitRefDiscoverR
|
|
|
|
, postGitUploadRequestR
|
|
|
|
|
|
|
|
, getRepoSourceR
|
|
|
|
, getRepoBranchSourceR
|
|
|
|
, getRepoCommitsR
|
|
|
|
, getRepoBranchCommitsR
|
|
|
|
, getRepoCommitR
|
|
|
|
|
2022-10-16 11:26:24 +00:00
|
|
|
, getRepoMessageR
|
|
|
|
|
2016-02-27 05:41:36 +00:00
|
|
|
, getRepoNewR
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
, postRepoNewR
|
|
|
|
, postRepoDeleteR
|
|
|
|
, getRepoEditR
|
|
|
|
, postRepoEditR
|
|
|
|
, postRepoFollowR
|
|
|
|
, postRepoUnfollowR
|
|
|
|
|
|
|
|
, postPostReceiveR
|
|
|
|
|
2022-09-17 08:31:22 +00:00
|
|
|
, postRepoLinkR
|
|
|
|
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
, getRepoStampR
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
, getReposR
|
2016-06-05 21:11:05 +00:00
|
|
|
, putRepoR
|
2016-05-13 19:23:56 +00:00
|
|
|
, postRepoR
|
2019-08-28 15:31:40 +00:00
|
|
|
, getRepoBranchR
|
2016-05-29 14:13:25 +00:00
|
|
|
, getRepoDevsR
|
|
|
|
, postRepoDevsR
|
|
|
|
, getRepoDevNewR
|
|
|
|
, getRepoDevR
|
|
|
|
, deleteRepoDevR
|
|
|
|
, postRepoDevR
|
2019-09-09 00:27:45 +00:00
|
|
|
, getRepoTeamR
|
2022-09-16 13:47:10 +00:00
|
|
|
-}
|
2019-05-27 13:28:57 +00:00
|
|
|
|
|
|
|
, getHighlightStyleR
|
2016-02-27 05:41:36 +00:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
2019-09-09 00:27:45 +00:00
|
|
|
import Control.Exception hiding (Handler)
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Control.Monad
|
2016-05-23 20:46:54 +00:00
|
|
|
import Control.Monad.IO.Class (liftIO)
|
|
|
|
import Control.Monad.Logger (logWarn)
|
2020-07-02 13:21:59 +00:00
|
|
|
import Control.Monad.Trans.Except
|
2022-09-17 08:31:22 +00:00
|
|
|
import Control.Monad.Trans.Maybe
|
2019-09-09 00:27:45 +00:00
|
|
|
import Data.Bifunctor
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Data.Binary.Put
|
2022-09-06 10:52:14 +00:00
|
|
|
import Data.ByteString (ByteString)
|
2022-06-22 06:19:37 +00:00
|
|
|
import Data.Foldable
|
2016-04-09 15:45:00 +00:00
|
|
|
import Data.Git.Graph
|
2016-04-30 20:14:56 +00:00
|
|
|
import Data.Git.Harder
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Data.Git.Harder.Pack
|
2016-04-12 00:19:04 +00:00
|
|
|
import Data.Git.Named (RefName (..))
|
2016-03-03 08:15:54 +00:00
|
|
|
import Data.Git.Ref (toHex)
|
2016-05-04 11:44:06 +00:00
|
|
|
import Data.Git.Repository
|
2016-05-04 17:17:47 +00:00
|
|
|
import Data.Git.Storage (withRepo)
|
2016-04-12 10:06:21 +00:00
|
|
|
import Data.Git.Storage.Object (Object (..))
|
2019-09-09 00:27:45 +00:00
|
|
|
import Data.Git.Types (Blob (..), Person (..), entName)
|
2016-04-09 15:45:00 +00:00
|
|
|
import Data.Graph.Inductive.Graph (noNodes)
|
|
|
|
import Data.Graph.Inductive.Query.Topsort
|
2016-04-12 23:10:46 +00:00
|
|
|
import Data.List (inits)
|
2022-09-22 06:02:14 +00:00
|
|
|
import Data.List.NonEmpty (NonEmpty (..))
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Data.Maybe
|
|
|
|
import Data.String
|
2016-05-23 20:46:54 +00:00
|
|
|
import Data.Text (Text, unpack)
|
2019-09-09 00:27:45 +00:00
|
|
|
import Data.Text.Encoding
|
2016-03-03 08:15:54 +00:00
|
|
|
import Data.Text.Encoding.Error (lenientDecode)
|
2022-06-22 06:19:37 +00:00
|
|
|
import Data.Time.Clock
|
2016-06-05 21:11:05 +00:00
|
|
|
import Data.Traversable (for)
|
2019-09-09 00:27:45 +00:00
|
|
|
import Database.Persist
|
|
|
|
import Database.Persist.Sql
|
2016-03-03 08:15:54 +00:00
|
|
|
import Data.Hourglass (timeConvert)
|
2016-05-13 19:23:56 +00:00
|
|
|
import Formatting (sformat, stext, (%))
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Network.Git.Transport.HTTP.Fetch.RefDiscovery
|
|
|
|
import Network.Git.Transport.HTTP.Fetch.UploadRequest
|
|
|
|
import Network.Git.Types
|
|
|
|
import Network.Wai (strictRequestBody)
|
2016-05-13 19:23:56 +00:00
|
|
|
import System.Directory
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import System.FilePath
|
2016-03-03 08:15:54 +00:00
|
|
|
import System.Hourglass (dateCurrent)
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import System.IO
|
|
|
|
import System.Process
|
2016-05-23 20:46:54 +00:00
|
|
|
import Text.Blaze.Html (Html)
|
2019-05-27 13:28:57 +00:00
|
|
|
import Text.Pandoc.Highlighting
|
2022-09-16 10:34:44 +00:00
|
|
|
import Yesod.Auth
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Yesod.Core hiding (joinPath)
|
2019-05-27 13:28:57 +00:00
|
|
|
import Yesod.Core.Content
|
2022-09-16 12:46:52 +00:00
|
|
|
import Yesod.Core.Handler
|
2016-05-23 20:46:54 +00:00
|
|
|
import Yesod.Form.Functions (runFormPost)
|
|
|
|
import Yesod.Form.Types (FormResult (..))
|
2019-12-27 20:44:14 +00:00
|
|
|
import Yesod.Persist.Core
|
2016-03-03 08:15:54 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import qualified Data.ByteString as B
|
|
|
|
import qualified Data.ByteString.Lazy as BL
|
|
|
|
import qualified Data.ByteString.Lazy.Internal as BLI
|
2016-05-23 20:46:54 +00:00
|
|
|
import qualified Data.CaseInsensitive as CI (foldedCase)
|
2016-04-09 15:45:00 +00:00
|
|
|
import qualified Data.DList as D
|
2016-04-12 00:19:04 +00:00
|
|
|
import qualified Data.Set as S (member)
|
2022-10-26 10:47:38 +00:00
|
|
|
import qualified Data.Text.Encoding as TE
|
2019-09-09 00:27:45 +00:00
|
|
|
import qualified Data.Text as T
|
2016-04-12 10:06:21 +00:00
|
|
|
import qualified Data.Text.Lazy.Encoding as L (decodeUtf8With)
|
2019-09-09 00:27:45 +00:00
|
|
|
import qualified Database.Esqueleto as E
|
|
|
|
|
|
|
|
import Data.MediaType
|
2022-06-22 06:19:37 +00:00
|
|
|
import Database.Persist.JSON
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Development.PatchMediaType
|
2019-10-20 09:19:49 +00:00
|
|
|
import Network.FedURI
|
2022-10-26 10:47:38 +00:00
|
|
|
import Web.Text
|
2019-09-09 00:27:45 +00:00
|
|
|
import Yesod.ActivityPub
|
|
|
|
import Yesod.FedURI
|
|
|
|
import Yesod.Hashids
|
|
|
|
import Yesod.MonadSite
|
|
|
|
import Yesod.RenderSource
|
|
|
|
|
|
|
|
import qualified Web.ActivityPub as AP
|
2016-04-09 15:45:00 +00:00
|
|
|
|
2016-03-03 08:15:54 +00:00
|
|
|
import Data.ByteString.Char8.Local (takeLine)
|
2019-09-09 00:27:45 +00:00
|
|
|
import Data.Either.Local
|
2016-05-04 17:17:47 +00:00
|
|
|
import Data.Git.Local
|
2019-09-09 00:27:45 +00:00
|
|
|
import Database.Persist.Local
|
2016-04-17 17:55:23 +00:00
|
|
|
import Text.FilePath.Local (breakExt)
|
2022-10-26 10:47:38 +00:00
|
|
|
import Web.Hashids.Local
|
2022-09-16 10:34:44 +00:00
|
|
|
import Yesod.Form.Local
|
2019-09-09 00:27:45 +00:00
|
|
|
import Yesod.Persist.Local
|
|
|
|
|
|
|
|
import qualified Data.Git.Local as G (createRepo)
|
|
|
|
import qualified Darcs.Local.Repository as D (createRepo)
|
|
|
|
|
2022-09-08 12:00:14 +00:00
|
|
|
import Vervis.Access
|
2022-10-26 10:47:38 +00:00
|
|
|
import Vervis.ActivityPub
|
2019-09-09 00:27:45 +00:00
|
|
|
import Vervis.API
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Federation.Auth
|
2022-09-08 12:00:14 +00:00
|
|
|
import Vervis.Federation.Collab
|
2022-10-26 05:25:44 +00:00
|
|
|
import Vervis.Federation.Offer
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.FedURI
|
2022-09-16 10:34:44 +00:00
|
|
|
import Vervis.Form.Repo
|
2016-03-03 08:15:54 +00:00
|
|
|
import Vervis.Foundation
|
|
|
|
import Vervis.Path
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
import Vervis.Model
|
2016-05-23 20:46:54 +00:00
|
|
|
import Vervis.Model.Ident
|
2016-05-13 08:49:19 +00:00
|
|
|
import Vervis.Paginate
|
2022-10-26 10:47:38 +00:00
|
|
|
import Vervis.Persist.Actor
|
2016-04-13 16:17:34 +00:00
|
|
|
import Vervis.Readme
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Recipient
|
2016-03-03 08:15:54 +00:00
|
|
|
import Vervis.Settings
|
2016-05-05 07:29:19 +00:00
|
|
|
import Vervis.SourceTree
|
2016-04-12 14:44:43 +00:00
|
|
|
import Vervis.Style
|
2022-09-06 10:52:14 +00:00
|
|
|
import Vervis.Web.Actor
|
2022-09-16 11:41:58 +00:00
|
|
|
import Vervis.Web.Darcs
|
2022-10-26 10:47:38 +00:00
|
|
|
import Vervis.Web.Delivery
|
2022-09-16 11:41:58 +00:00
|
|
|
import Vervis.Web.Git
|
2016-02-27 05:41:36 +00:00
|
|
|
|
2022-09-16 10:34:44 +00:00
|
|
|
import qualified Vervis.Client as C
|
2016-05-23 20:46:54 +00:00
|
|
|
import qualified Vervis.Formatting as F
|
2019-09-09 00:27:45 +00:00
|
|
|
import qualified Vervis.Hook as H
|
2016-05-04 11:44:06 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
getRepoR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
getRepoR repoHash = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
2022-10-12 18:01:52 +00:00
|
|
|
(repo, actor, sigKeyIDs) <- runDB $ do
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
r <- get404 repoID
|
2022-10-12 18:01:52 +00:00
|
|
|
let aid = repoActor r
|
|
|
|
a <- getJust aid
|
|
|
|
sigKeys <- selectKeysList [SigKeyActor ==. aid] [Asc SigKeyId]
|
|
|
|
return (r, a, sigKeys)
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
2022-09-17 08:31:22 +00:00
|
|
|
hashLoom <- getEncodeKeyHashid
|
2022-10-12 18:01:52 +00:00
|
|
|
hashSigKey <- getEncodeKeyHashid
|
|
|
|
perActor <- asksSite $ appPerActorKeys . appSettings
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
let repoAP = AP.Repo
|
|
|
|
{ AP.repoActor = AP.Actor
|
|
|
|
{ AP.actorLocal = AP.ActorLocal
|
|
|
|
{ AP.actorId = encodeRouteLocal $ RepoR repoHash
|
|
|
|
, AP.actorInbox = encodeRouteLocal $ RepoInboxR repoHash
|
|
|
|
, AP.actorOutbox =
|
|
|
|
Just $ encodeRouteLocal $ RepoOutboxR repoHash
|
|
|
|
, AP.actorFollowers =
|
|
|
|
Just $ encodeRouteLocal $ RepoFollowersR repoHash
|
|
|
|
, AP.actorFollowing = Nothing
|
|
|
|
, AP.actorPublicKeys =
|
2022-10-12 18:01:52 +00:00
|
|
|
map (Left . encodeRouteLocal) $
|
|
|
|
if perActor
|
|
|
|
then map (RepoStampR repoHash . hashSigKey) sigKeyIDs
|
|
|
|
else [ActorKey1R, ActorKey2R]
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
, AP.actorSshKeys = []
|
|
|
|
}
|
|
|
|
, AP.actorDetail = AP.ActorDetail
|
|
|
|
{ AP.actorType = AP.ActorTypeRepo
|
|
|
|
, AP.actorUsername = Nothing
|
|
|
|
, AP.actorName = Just $ actorName actor
|
|
|
|
, AP.actorSummary = Just $ actorDesc actor
|
|
|
|
}
|
|
|
|
}
|
|
|
|
, AP.repoTeam = Nothing
|
|
|
|
, AP.repoVcs = repoVcs repo
|
2022-09-17 08:31:22 +00:00
|
|
|
, AP.repoLoom =
|
|
|
|
encodeRouteLocal . LoomR . hashLoom <$> repoLoom repo
|
2022-09-22 06:02:14 +00:00
|
|
|
, AP.repoClone = encodeRouteLocal (RepoR repoHash) :| []
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
next =
|
|
|
|
case repoVcs repo of
|
|
|
|
VCSDarcs -> RepoSourceR repoHash
|
|
|
|
VCSGit -> RepoBranchSourceR repoHash $ repoMainBranch repo
|
|
|
|
provideHtmlAndAP repoAP $ redirect $ next []
|
|
|
|
|
|
|
|
getRepoInboxR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
getRepoInboxR = getInbox RepoInboxR repoActor
|
|
|
|
|
2022-09-06 10:52:14 +00:00
|
|
|
postRepoInboxR :: KeyHashid Repo -> Handler ()
|
|
|
|
postRepoInboxR recipRepoHash =
|
|
|
|
postInbox $ handleRobotInbox (LocalActorRepo recipRepoHash) handle
|
|
|
|
where
|
|
|
|
handle
|
2022-09-08 12:00:14 +00:00
|
|
|
:: UTCTime
|
|
|
|
-> RemoteAuthor
|
|
|
|
-> ActivityBody
|
2022-09-06 10:52:14 +00:00
|
|
|
-> Maybe (RecipientRoutes, ByteString)
|
|
|
|
-> LocalURI
|
|
|
|
-> AP.SpecificActivity URIMode
|
|
|
|
-> ExceptT Text Handler (Text, Maybe (ExceptT Text Worker Text))
|
2022-09-08 12:00:14 +00:00
|
|
|
handle now author body mfwd luActivity specific =
|
2022-09-06 10:52:14 +00:00
|
|
|
case specific of
|
2022-09-08 12:00:14 +00:00
|
|
|
AP.AcceptActivity accept ->
|
|
|
|
repoAcceptF now recipRepoHash author body mfwd luActivity accept
|
2022-09-06 10:52:14 +00:00
|
|
|
{-
|
|
|
|
ApplyActivity (AP.Apply uObject uTarget) ->
|
|
|
|
repoApplyF now shrRecip rpRecip remoteAuthor body mfwd luActivity uObject uTarget
|
|
|
|
AddActivity (AP.Add obj target) ->
|
|
|
|
case obj of
|
|
|
|
Right (AddBundle patches) ->
|
|
|
|
repoAddBundleF now shrRecip rpRecip remoteAuthor body mfwd luActivity patches target
|
|
|
|
_ -> return ("Unsupported add object type for repos", Nothing)
|
|
|
|
CreateActivity (Create obj mtarget) ->
|
|
|
|
case obj of
|
|
|
|
CreateNote _ note ->
|
|
|
|
(,Nothing) <$> repoCreateNoteF now shrRecip rpRecip remoteAuthor body mfwd luActivity note
|
|
|
|
CreateTicket _ ticket ->
|
|
|
|
(,Nothing) <$> repoCreateTicketF now shrRecip rpRecip remoteAuthor body mfwd luActivity ticket mtarget
|
|
|
|
_ -> error "Unsupported create object type for repos"
|
2022-09-08 12:00:14 +00:00
|
|
|
-}
|
2022-10-26 05:25:44 +00:00
|
|
|
AP.FollowActivity follow ->
|
|
|
|
repoFollowF now recipRepoHash author body mfwd luActivity follow
|
2022-09-08 12:00:14 +00:00
|
|
|
AP.InviteActivity invite ->
|
|
|
|
topicInviteF now (GrantResourceRepo recipRepoHash) author body mfwd luActivity invite
|
2022-11-14 15:11:25 +00:00
|
|
|
AP.JoinActivity join ->
|
|
|
|
repoJoinF now recipRepoHash author body mfwd luActivity join
|
2022-09-08 12:00:14 +00:00
|
|
|
{-
|
2022-09-06 10:52:14 +00:00
|
|
|
OfferActivity (Offer obj target) ->
|
|
|
|
case obj of
|
|
|
|
OfferDep dep ->
|
|
|
|
repoOfferDepF now shrRecip rpRecip remoteAuthor body mfwd luActivity dep target
|
|
|
|
_ -> return ("Unsupported offer object type for repos", Nothing)
|
|
|
|
-}
|
2022-10-31 14:13:18 +00:00
|
|
|
AP.UndoActivity undo->
|
|
|
|
(,Nothing) <$> repoUndoF now recipRepoHash author body mfwd luActivity undo
|
2022-09-06 10:52:14 +00:00
|
|
|
_ -> return ("Unsupported activity type for repos", Nothing)
|
2016-02-27 05:41:36 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
getRepoOutboxR :: KeyHashid Repo -> Handler TypedContent
|
2022-09-26 14:20:21 +00:00
|
|
|
getRepoOutboxR = getOutbox RepoOutboxR RepoOutboxItemR repoActor
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
getRepoOutboxItemR
|
|
|
|
:: KeyHashid Repo -> KeyHashid OutboxItem -> Handler TypedContent
|
|
|
|
getRepoOutboxItemR = getOutboxItem RepoOutboxItemR repoActor
|
|
|
|
|
|
|
|
getRepoFollowersR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
getRepoFollowersR = getActorFollowersCollection RepoFollowersR repoActor
|
|
|
|
|
|
|
|
getDarcsDownloadR :: KeyHashid Repo -> [Text] -> Handler TypedContent
|
|
|
|
getDarcsDownloadR repoHash dir = do
|
|
|
|
repoPath <- askRepoDir repoHash
|
|
|
|
let filePath = repoPath </> "_darcs" </> joinPath (map T.unpack dir)
|
|
|
|
exists <- liftIO $ doesFileExist filePath
|
|
|
|
if exists
|
|
|
|
then sendFile typeOctet filePath
|
|
|
|
else notFound
|
|
|
|
|
|
|
|
getGitRefDiscoverR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
getGitRefDiscoverR repoHash = do
|
|
|
|
let typ = "application/x-git-upload-pack-advertisement"
|
|
|
|
path <- askRepoDir repoHash
|
|
|
|
let pathG = fromString path
|
|
|
|
seemsThere <- liftIO $ isRepo pathG
|
|
|
|
if seemsThere
|
|
|
|
then do
|
|
|
|
rq <- getRequest
|
|
|
|
case reqGetParams rq of
|
|
|
|
[("service", serv)] ->
|
|
|
|
if serv == "git-upload-pack"
|
|
|
|
then do
|
|
|
|
let settings =
|
|
|
|
( proc "git"
|
|
|
|
[ "upload-pack"
|
|
|
|
, "--stateless-rpc"
|
|
|
|
, "--advertise-refs"
|
|
|
|
, path
|
|
|
|
]
|
|
|
|
)
|
|
|
|
{ std_out = CreatePipe
|
|
|
|
}
|
|
|
|
(_, mh, _, _) <-
|
|
|
|
liftIO $ createProcess settings
|
|
|
|
let h = fromJust mh
|
|
|
|
refs <- liftIO $ B.hGetContents h
|
|
|
|
let content = runPut $ do
|
|
|
|
putService UploadPack
|
|
|
|
putByteString refs
|
|
|
|
setHeader "Cache-Control" "no-cache"
|
|
|
|
return $ TypedContent typ $ toContent content
|
|
|
|
else permissionDenied "Service not supported"
|
|
|
|
_ -> notFound
|
|
|
|
else notFound
|
|
|
|
|
|
|
|
postGitUploadRequestR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
postGitUploadRequestR repoHash = do
|
|
|
|
let typ = "application/x-git-upload-pack-result"
|
|
|
|
path <- askRepoDir repoHash
|
|
|
|
let pathG = fromString path
|
|
|
|
seemsThere <- liftIO $ isRepo pathG
|
|
|
|
if seemsThere
|
|
|
|
then do
|
|
|
|
getBody <- strictRequestBody <$> waiRequest
|
|
|
|
body <- liftIO getBody
|
|
|
|
let settings =
|
|
|
|
( proc "git"
|
|
|
|
[ "upload-pack"
|
|
|
|
, "--stateless-rpc"
|
|
|
|
, path
|
|
|
|
]
|
|
|
|
)
|
|
|
|
{ std_in = CreatePipe
|
|
|
|
, std_out = CreatePipe
|
|
|
|
}
|
|
|
|
(mhin, mhout, _, _) <- liftIO $ createProcess settings
|
|
|
|
let hin = fromJust mhin
|
|
|
|
hout = fromJust mhout
|
|
|
|
liftIO $ BL.hPut hin body >> hClose hin
|
|
|
|
setHeader "Cache-Control" "no-cache"
|
|
|
|
let loop = do
|
|
|
|
b <- liftIO $ B.hGet hout BLI.defaultChunkSize
|
|
|
|
unless (B.null b) $ do
|
|
|
|
sendChunkBS b
|
|
|
|
loop
|
|
|
|
respondSource typ loop
|
|
|
|
else notFound
|
|
|
|
|
|
|
|
getRepoSourceR :: KeyHashid Repo -> [Text] -> Handler Html
|
|
|
|
getRepoSourceR repoHash path = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
2022-09-17 08:31:22 +00:00
|
|
|
(repo, looms, actor) <- runDB $ do
|
2022-09-16 13:47:10 +00:00
|
|
|
r <- get404 repoID
|
2022-09-17 08:31:22 +00:00
|
|
|
ls <-
|
|
|
|
case repoLoom r of
|
|
|
|
Just _ -> pure []
|
|
|
|
Nothing -> selectKeysList [LoomRepo ==. repoID] [Desc LoomId]
|
|
|
|
(r,ls,) <$> getJust (repoActor r)
|
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
case repoVcs repo of
|
2022-09-17 08:31:22 +00:00
|
|
|
VCSDarcs -> getDarcsRepoSource repo actor repoHash path looms
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
VCSGit -> notFound
|
|
|
|
|
|
|
|
getRepoBranchSourceR :: KeyHashid Repo -> Text -> [Text] -> Handler Html
|
|
|
|
getRepoBranchSourceR repoHash branch path = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
2022-09-17 08:31:22 +00:00
|
|
|
(repo, looms, actor) <- runDB $ do
|
2022-09-16 13:47:10 +00:00
|
|
|
r <- get404 repoID
|
2022-09-17 08:31:22 +00:00
|
|
|
ls <-
|
|
|
|
case repoLoom r of
|
|
|
|
Just _ -> pure []
|
|
|
|
Nothing -> selectKeysList [LoomRepo ==. repoID] [Desc LoomId]
|
|
|
|
(r,ls,) <$> getJust (repoActor r)
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
case repoVcs repo of
|
|
|
|
VCSDarcs -> notFound
|
2022-09-17 08:31:22 +00:00
|
|
|
VCSGit -> getGitRepoSource repo actor repoHash branch path looms
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
getRepoCommitsR :: KeyHashid Repo -> Handler TypedContent
|
|
|
|
getRepoCommitsR repoHash = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
|
|
|
repo <- runDB $ get404 repoID
|
|
|
|
case repoVcs repo of
|
2022-09-16 12:46:52 +00:00
|
|
|
VCSDarcs -> getDarcsRepoChanges repoHash
|
|
|
|
VCSGit -> selectRep $ do
|
|
|
|
AP.provideAP (notFound :: Handler ())
|
|
|
|
provideRepType typeHtml
|
|
|
|
((redirect $ RepoBranchCommitsR repoHash $ repoMainBranch repo) :: Handler ())
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
getRepoBranchCommitsR :: KeyHashid Repo -> Text -> Handler TypedContent
|
|
|
|
getRepoBranchCommitsR repoHash branch = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
|
|
|
repo <- runDB $ get404 repoID
|
|
|
|
case repoVcs repo of
|
2022-09-16 12:46:52 +00:00
|
|
|
VCSDarcs -> notFound
|
|
|
|
VCSGit -> getGitRepoChanges repoHash branch
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
getRepoCommitR :: KeyHashid Repo -> Text -> Handler TypedContent
|
|
|
|
getRepoCommitR repoHash ref = do
|
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
|
|
|
repo <- runDB $ get404 repoID
|
|
|
|
case repoVcs repo of
|
|
|
|
VCSDarcs -> getDarcsPatch repoHash ref
|
|
|
|
VCSGit -> getGitPatch repoHash ref
|
|
|
|
|
2022-10-16 11:26:24 +00:00
|
|
|
getRepoMessageR
|
|
|
|
:: KeyHashid Repo -> KeyHashid LocalMessage -> Handler TypedContent
|
|
|
|
getRepoMessageR _ _ = notFound
|
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
getRepoNewR :: Handler Html
|
|
|
|
getRepoNewR = do
|
2022-09-16 10:34:44 +00:00
|
|
|
((_result, widget), enctype) <- runFormPost newRepoForm
|
|
|
|
defaultLayout $(widgetFile "repo/new")
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
postRepoNewR :: Handler Html
|
|
|
|
postRepoNewR = do
|
2022-09-23 05:20:39 +00:00
|
|
|
NewRepo name desc vcs <- runFormPostRedirect RepoNewR newRepoForm
|
2022-09-16 10:34:44 +00:00
|
|
|
|
|
|
|
personEntity@(Entity personID person) <- requireAuth
|
|
|
|
personHash <- encodeKeyHashid personID
|
|
|
|
(maybeSummary, audience, detail) <- C.createRepo personHash name desc
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
(localRecips, remoteRecips, fwdHosts, action) <-
|
|
|
|
C.makeServerInput Nothing maybeSummary audience $ AP.CreateActivity $ AP.Create (AP.CreateRepository detail vcs Nothing) Nothing
|
2022-09-16 10:34:44 +00:00
|
|
|
actor <- runDB $ getJust $ personActor person
|
|
|
|
result <-
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
runExceptT $ createRepositoryC personEntity actor Nothing localRecips remoteRecips fwdHosts action detail vcs Nothing Nothing
|
2022-09-16 10:34:44 +00:00
|
|
|
|
2016-02-27 05:41:36 +00:00
|
|
|
case result of
|
2022-09-16 10:34:44 +00:00
|
|
|
Left e -> do
|
|
|
|
setMessage $ toHtml e
|
|
|
|
redirect RepoNewR
|
|
|
|
Right createID -> do
|
|
|
|
maybeRepoID <- runDB $ getKeyBy $ UniqueRepoCreate createID
|
|
|
|
case maybeRepoID of
|
|
|
|
Nothing -> error "Can't find the newly created repo"
|
|
|
|
Just repoID -> do
|
|
|
|
repoHash <- encodeKeyHashid repoID
|
|
|
|
setMessage "New repository created"
|
|
|
|
redirect $ RepoR repoHash
|
2016-02-27 05:41:36 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
postRepoDeleteR :: KeyHashid Repo -> Handler Html
|
|
|
|
postRepoDeleteR repoHash = do
|
|
|
|
error "Temporarily disabled"
|
|
|
|
{-
|
|
|
|
runDB $ do
|
|
|
|
Entity sid _s <- getBy404 $ UniqueSharer shar
|
|
|
|
Entity rid _r <- getBy404 $ UniqueRepo repo sid
|
|
|
|
delete rid
|
|
|
|
path <- askRepoDir shar repo
|
|
|
|
exists <- liftIO $ doesDirectoryExist path
|
|
|
|
if exists
|
|
|
|
then liftIO $ removeDirectoryRecursive path
|
|
|
|
else
|
|
|
|
$logWarn $ sformat
|
|
|
|
( "Deleted repo " % F.sharer % "/" % F.repo
|
|
|
|
% " from DB but repo dir doesn't exist"
|
|
|
|
)
|
|
|
|
shar repo
|
|
|
|
setMessage "Repo deleted."
|
|
|
|
redirect HomeR
|
|
|
|
-}
|
2016-05-05 16:30:30 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
getRepoEditR :: KeyHashid Repo -> Handler Html
|
|
|
|
getRepoEditR repoHash = do
|
|
|
|
error "Temporarily disabled"
|
|
|
|
{-
|
|
|
|
(sid, er) <- runDB $ do
|
|
|
|
Entity sid _ <- getBy404 $ UniqueSharer shr
|
|
|
|
er <- getBy404 $ UniqueRepo rp sid
|
|
|
|
return (sid, er)
|
|
|
|
((_result, widget), enctype) <- runFormPost $ editRepoForm sid er
|
|
|
|
defaultLayout $(widgetFile "repo/edit")
|
|
|
|
-}
|
2016-05-05 07:29:19 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
postRepoEditR :: KeyHashid Repo -> Handler Html
|
|
|
|
postRepoEditR repoHash = do
|
|
|
|
error "Temporarily disabled"
|
|
|
|
{-
|
2016-06-05 21:11:05 +00:00
|
|
|
mer <- runDB $ do
|
|
|
|
Entity sid _ <- getBy404 $ UniqueSharer shr
|
|
|
|
er@(Entity rid r) <- getBy404 $ UniqueRepo rp sid
|
|
|
|
mwiki <- for (repoProject r) $ \ jid -> do
|
|
|
|
project <- getJust jid
|
|
|
|
return $ (== rid) <$> projectWiki project
|
|
|
|
return $ case mwiki of
|
|
|
|
Just (Just True) -> Nothing
|
2019-01-29 22:24:32 +00:00
|
|
|
_ -> Just (sid, er)
|
2016-06-05 21:11:05 +00:00
|
|
|
case mer of
|
|
|
|
Nothing -> do
|
|
|
|
setMessage "Repo used as a wiki, can't move between projects."
|
|
|
|
redirect $ RepoR shr rp
|
2019-01-29 22:24:32 +00:00
|
|
|
Just (sid, er@(Entity rid _)) -> do
|
|
|
|
((result, widget), enctype) <- runFormPost $ editRepoForm sid er
|
2016-06-05 21:11:05 +00:00
|
|
|
case result of
|
|
|
|
FormSuccess repository' -> do
|
|
|
|
runDB $ replace rid repository'
|
|
|
|
setMessage "Repository updated."
|
|
|
|
redirect $ RepoR shr rp
|
|
|
|
FormMissing -> do
|
|
|
|
setMessage "Field(s) missing."
|
|
|
|
defaultLayout $(widgetFile "repo/edit")
|
|
|
|
FormFailure _l -> do
|
|
|
|
setMessage "Repository update failed, see errors below."
|
|
|
|
defaultLayout $(widgetFile "repo/edit")
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
-}
|
|
|
|
|
|
|
|
postRepoFollowR :: KeyHashid Repo -> Handler ()
|
|
|
|
postRepoFollowR _ = error "Temporarily disabled"
|
|
|
|
|
|
|
|
postRepoUnfollowR :: KeyHashid Repo -> Handler ()
|
|
|
|
postRepoUnfollowR _ = error "Temporarily disabled"
|
|
|
|
|
|
|
|
postPostReceiveR :: Handler Text
|
2022-10-26 10:47:38 +00:00
|
|
|
postPostReceiveR = do
|
|
|
|
-- Parse the push object that the hook sent
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
push <- requireCheckJsonBody
|
2022-10-26 10:47:38 +00:00
|
|
|
|
|
|
|
errorOrPush <- runExceptT $ do
|
|
|
|
|
|
|
|
-- Compose an ActivityPub Push activity
|
|
|
|
(pushAP, repoID, repoHash) <- lift $ push2ap push
|
|
|
|
|
|
|
|
-- Find repo and person in DB
|
|
|
|
let pusherID = toSqlKey $ H.pushUser push
|
|
|
|
(Entity actorID actor, pusher) <- runDBExcept $ do
|
|
|
|
|
|
|
|
repoActorEntity <- do
|
|
|
|
repo <- getE repoID "Repo not found in DB"
|
|
|
|
lift $ getJustEntity $ repoActor repo
|
|
|
|
|
|
|
|
person <- getE pusherID "Pusher person not found in DB"
|
|
|
|
let actorID = personActor person
|
|
|
|
actor <- lift $ getJust actorID
|
|
|
|
let pusher = (Entity pusherID person, actor)
|
|
|
|
|
|
|
|
return (repoActorEntity, pusher)
|
|
|
|
|
|
|
|
-- Compose summary and audience
|
|
|
|
let repoName = actorName actor
|
|
|
|
summary <-
|
|
|
|
lift $ renderHTML <$> makeSummary push pushAP repoHash repoName pusher
|
|
|
|
let audience = [AudLocal [] [LocalStageRepoFollowers repoHash]]
|
|
|
|
(localRecips, remoteRecips, fwdHosts, action) <-
|
|
|
|
lift $ C.makeServerInput Nothing (Just summary) audience (AP.PushActivity pushAP)
|
|
|
|
|
|
|
|
-- Publish and deliver Push activity
|
|
|
|
now <- liftIO getCurrentTime
|
|
|
|
runDBExcept $ do
|
|
|
|
pushID <- lift $ insertEmptyOutboxItem (actorOutbox actor) now
|
|
|
|
luPush <- lift $ updateOutboxItem (LocalActorRepo repoID) pushID action
|
|
|
|
deliverHttpPush <-
|
|
|
|
deliverActivityDB
|
|
|
|
(LocalActorRepo repoHash) actorID localRecips remoteRecips
|
|
|
|
fwdHosts pushID action
|
|
|
|
return (luPush, deliverHttpPush)
|
|
|
|
|
|
|
|
-- HTTP delivery to remote recipients
|
|
|
|
case errorOrPush of
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
Left e -> liftIO $ throwIO $ userError $ T.unpack e
|
2022-10-26 10:47:38 +00:00
|
|
|
Right (luPush, deliverHttpPush) -> do
|
|
|
|
forkWorker "PostReceiveR: async HTTP Push delivery" deliverHttpPush
|
|
|
|
hLocal <- asksSite siteInstanceHost
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
return $
|
|
|
|
"Push activity published: " <>
|
2022-10-26 10:47:38 +00:00
|
|
|
renderObjURI (ObjURI hLocal luPush)
|
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
where
|
2022-10-26 10:47:38 +00:00
|
|
|
|
|
|
|
push2ap (H.Push secret personNum repo mbranch mbefore after early mlate) = do
|
|
|
|
secret' <- asksSite appHookSecret
|
|
|
|
unless (secret == H.hookSecretText secret') $
|
|
|
|
error "Inavlid hook secret"
|
|
|
|
repoID <- do
|
|
|
|
ctx <- asksSite siteHashidsContext
|
|
|
|
case decodeInt64 ctx $ TE.encodeUtf8 repo of
|
|
|
|
Nothing -> error "Invalid repo keyhashid"
|
|
|
|
Just repoNum -> return $ toSqlKey repoNum
|
|
|
|
repoHash <- do
|
|
|
|
repoHash <- encodeKeyHashid repoID
|
|
|
|
unless (keyHashidText repoHash == repo) $
|
|
|
|
error "decode-encode repo hash returned a different value"
|
|
|
|
return repoHash
|
|
|
|
let commit2ap' = commit2ap repoHash
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
(commitsLast, commitsFirst) <-
|
|
|
|
runDB $ case mlate of
|
|
|
|
Nothing -> (,) <$> traverse commit2ap' early <*> pure Nothing
|
|
|
|
Just (_omitted, late) ->
|
|
|
|
(,) <$> traverse commit2ap' late
|
|
|
|
<*> (Just <$> traverse commit2ap' early)
|
2022-10-26 10:47:38 +00:00
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
let pusherID = toSqlKey personNum
|
|
|
|
pusherHash <- encodeKeyHashid pusherID
|
|
|
|
let luRepo = encodeRouteLocal $ RepoR repoHash
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
return
|
2022-10-26 10:47:38 +00:00
|
|
|
( AP.Push
|
|
|
|
{ AP.pushCommitsLast = commitsLast
|
|
|
|
, AP.pushCommitsFirst = commitsFirst
|
|
|
|
, AP.pushCommitsTotal =
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
case mlate of
|
|
|
|
Nothing -> length early
|
|
|
|
Just (omitted, late) ->
|
|
|
|
length early + omitted + length late
|
2022-10-26 10:47:38 +00:00
|
|
|
, AP.pushTarget =
|
|
|
|
case mbranch of
|
|
|
|
Nothing -> Left luRepo
|
|
|
|
Just b ->
|
|
|
|
Right $ AP.Branch b ("refs/heads/" <> b) luRepo
|
|
|
|
, AP.pushAttrib = encodeRouteHome $ PersonR pusherHash
|
|
|
|
, AP.pushHashBefore = mbefore
|
|
|
|
, AP.pushHashAfter = after
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
}
|
2022-10-26 10:47:38 +00:00
|
|
|
, repoID
|
|
|
|
, repoHash
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
)
|
|
|
|
where
|
2022-10-26 10:47:38 +00:00
|
|
|
commit2ap repoHash (H.Commit (wauthor, wtime) mcommitted hash title desc) = do
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
author <- authorByEmail wauthor
|
|
|
|
mcommitter <- traverse (authorByEmail . fst) mcommitted
|
2022-10-26 10:47:38 +00:00
|
|
|
return AP.Commit
|
|
|
|
{ AP.commitId = encodeRouteLocal $ RepoCommitR repoHash hash
|
|
|
|
, AP.commitRepository = encodeRouteLocal $ RepoR repoHash
|
|
|
|
, AP.commitAuthor = second (encodeRouteHome . PersonR) author
|
|
|
|
, AP.commitCommitter =
|
|
|
|
second (encodeRouteHome . PersonR) <$> mcommitter
|
|
|
|
, AP.commitTitle = title
|
|
|
|
, AP.commitHash = AP.Hash $ TE.encodeUtf8 hash
|
|
|
|
, AP.commitDescription =
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
if T.null desc
|
|
|
|
then Nothing
|
|
|
|
else Just desc
|
2022-10-26 10:47:38 +00:00
|
|
|
, AP.commitWritten = wtime
|
|
|
|
, AP.commitCommitted = snd <$> mcommitted
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
}
|
|
|
|
where
|
|
|
|
authorByEmail (H.Author name email) = do
|
2022-10-26 10:47:38 +00:00
|
|
|
mperson <- getKeyBy $ UniquePersonEmail email
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
case mperson of
|
2022-10-26 10:47:38 +00:00
|
|
|
Nothing -> return $ Left $ AP.Author name email
|
|
|
|
Just person -> Right <$> encodeKeyHashid person
|
|
|
|
|
|
|
|
makeSummary push pushAP repoHash repoName (Entity personID person, actor) = do
|
|
|
|
let mbranch = H.pushBranch push
|
|
|
|
total = AP.pushCommitsTotal pushAP
|
|
|
|
lasts = AP.pushCommitsLast pushAP
|
|
|
|
rest firsts = total - length firsts - length lasts
|
|
|
|
hashText (AP.Hash b) = decodeUtf8 b
|
|
|
|
commitW c =
|
|
|
|
[hamlet|
|
|
|
|
<a href=@{RepoCommitR repoHash $ hashText $ AP.commitHash c}>
|
|
|
|
#{AP.commitTitle c}
|
|
|
|
|]
|
|
|
|
personHash <- encodeKeyHashid personID
|
|
|
|
withUrlRenderer
|
|
|
|
[hamlet|
|
|
|
|
<p>
|
|
|
|
<a href=@{PersonR personHash}>
|
|
|
|
#{actorName actor} ~#{username2text $ personUsername person}
|
|
|
|
\ pushed #{total} #
|
|
|
|
\ #{commitsText mbranch total} to repo #
|
|
|
|
<a href=@{RepoR repoHash}>^#{keyHashidText repoHash} #{repoName}</a>^{branchText repoHash mbranch}:
|
|
|
|
<ul>
|
|
|
|
$maybe firsts <- AP.pushCommitsFirst pushAP
|
|
|
|
$forall c <- firsts
|
|
|
|
<li>^{commitW c}
|
|
|
|
<li>#{rest firsts}
|
|
|
|
$forall c <- lasts
|
|
|
|
<li>^{commitW c}
|
|
|
|
|]
|
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
commitsText :: Maybe a -> Int -> Text
|
|
|
|
commitsText Nothing n =
|
|
|
|
if n > 1
|
|
|
|
then "patches"
|
|
|
|
else "patch"
|
|
|
|
commitsText (Just _) n =
|
|
|
|
if n > 1
|
|
|
|
then "commits"
|
|
|
|
else "commit"
|
2022-10-26 10:47:38 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
--branchText :: ShrIdent -> RpIdent -> Maybe Text -> HtmlUrl (Route App)
|
2022-10-26 10:47:38 +00:00
|
|
|
branchText _ Nothing = const mempty
|
|
|
|
branchText r (Just branch) =
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
[hamlet|
|
|
|
|
, branch #
|
2022-10-26 10:47:38 +00:00
|
|
|
<a href=@{RepoBranchCommitsR r branch}>#{branch}
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|]
|
|
|
|
|
2022-09-17 08:31:22 +00:00
|
|
|
postRepoLinkR :: KeyHashid Repo -> KeyHashid Loom -> Handler Html
|
|
|
|
postRepoLinkR repoHash loomHash = do
|
|
|
|
Entity personID person <- requireAuth
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
2022-09-17 08:31:22 +00:00
|
|
|
repoID <- decodeKeyHashid404 repoHash
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
2022-09-17 08:31:22 +00:00
|
|
|
result <- runExceptT $ runDBExcept $ do
|
|
|
|
repo <- lift $ get404 repoID
|
|
|
|
unless (isNothing $ repoLoom repo) $ throwE "Repo already has a loom"
|
|
|
|
|
|
|
|
loomID <- decodeKeyHashidE loomHash "Invalid loom hash"
|
|
|
|
loom <- getE loomID "No such loom in DB"
|
|
|
|
|
|
|
|
-- Make sure both repo and loom have a single, full-access collab,
|
|
|
|
-- granted to the logged-in person
|
|
|
|
maybeApproved <- lift $ runMaybeT $ do
|
|
|
|
collabs <- lift $ selectList [CollabTopicRepoRepo ==. repoID] []
|
|
|
|
collabID <-
|
|
|
|
case collabs of
|
|
|
|
[Entity _ c] -> return $ collabTopicRepoCollab c
|
|
|
|
_ -> mzero
|
|
|
|
CollabRecipLocal _ recipID <-
|
|
|
|
MaybeT $ getValBy $ UniqueCollabRecipLocal collabID
|
|
|
|
_ <- MaybeT $ getBy $ UniqueCollabEnable collabID
|
|
|
|
_ <- MaybeT $ getBy $ UniqueCollabFulfillsLocalTopicCreation collabID
|
|
|
|
guard $ recipID == personID
|
|
|
|
|
|
|
|
collabs' <- lift $ selectList [CollabTopicLoomLoom ==. loomID] []
|
|
|
|
collabID' <-
|
|
|
|
case collabs' of
|
|
|
|
[Entity _ c] -> return $ collabTopicLoomCollab c
|
|
|
|
_ -> mzero
|
|
|
|
CollabRecipLocal _ recipID' <-
|
|
|
|
MaybeT $ getValBy $ UniqueCollabRecipLocal collabID'
|
|
|
|
_ <- MaybeT $ getBy $ UniqueCollabEnable collabID'
|
|
|
|
_ <- MaybeT $ getBy $ UniqueCollabFulfillsLocalTopicCreation collabID'
|
|
|
|
guard $ recipID' == personID
|
|
|
|
|
|
|
|
return ()
|
|
|
|
|
|
|
|
unless (isJust maybeApproved) $
|
|
|
|
throwE "Repo and loom aren't both yours"
|
|
|
|
|
|
|
|
n <-
|
|
|
|
lift $ updateWhereCount
|
|
|
|
[RepoId ==. repoID, RepoLoom ==. Nothing]
|
|
|
|
[RepoLoom =. Just loomID]
|
|
|
|
case n of
|
|
|
|
0 -> throwE "Couldn't update the repo"
|
|
|
|
1 -> return ()
|
|
|
|
_ -> error $ "Unexpected, " ++ show n ++ " repos were updated"
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
2022-09-17 08:31:22 +00:00
|
|
|
case result of
|
|
|
|
Left e -> setMessage $ toHtml e
|
|
|
|
Right () -> setMessage "Repo successfully linked with loom!"
|
|
|
|
redirect $ RepoR repoHash
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
Improve the AP async HTTP delivery API and per-actor key support
New iteration of the ActivityPub delivery implementation and interface.
Advantages over previous interface:
* When sending a ByteString body, the sender is explicitly passed as a
parameter instead of JSON-parsing it out of the ByteString
* Clear 3 operations provided: Send, Resend and Forward
* Support for per-actor keys
* Actor-type-specific functions (e.g. deliverRemoteDB_D) removed
* Only the most high-level API is exposed to Activity handler code, making
handler code more concise and clear
Also added in this patch:
* Foundation for per-actor key support
* 1 key per actor allowed in DB
* Disabled C2S and S2S handlers now un-exported for clarity
* Audience and capability parsing automatically done for all C2S handlers
* Audience and activity composition automatically done for Vervis.Client
builder functions
Caveats:
* Actor documents still don't link to their per-actor keys; that should be the
last piece to complete per-actor key support
* No moderation and anti-spam tools yet
* Delivery API doesn't yet have good integration of persistence layer, e.g.
activity is separately encoded into bytestring for DB and for HTTP; this will
be improved in the next iteration
* Periodic delivery now done in 3 separate steps, running sequentially; it
simplifies the code, but may be changed for efficiency/robustness in the next
iterations
* Periodic delivery collects per-actor keys in a
1-DB-transaction-for-each-delivery fashion, rather than grabbing them in the
big Esqueleto query (or keeping the signed output in the DB; this isn't done
currently to allow for smooth actor key renewal)
* No support yet in the API for delivery where the actor key has already been
fetched, rather than doing a DB transaction to grab it; such support would be
just an optimization, so it's low-priority, but will be added in later
iterations
2022-10-12 16:50:11 +00:00
|
|
|
getRepoStampR :: KeyHashid Repo -> KeyHashid SigKey -> Handler TypedContent
|
|
|
|
getRepoStampR = servePerActorKey repoActor LocalActorRepo
|
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-06-05 21:11:05 +00:00
|
|
|
|
2016-05-13 19:23:56 +00:00
|
|
|
|
|
|
|
|
2016-06-05 21:11:05 +00:00
|
|
|
|
Switch to new actor layout
This is such a huge patch, it's probably impossible to tell what it does by
looking at the code. One thing is clear: It changes *everything* :P so here's
an overview:
- There are now 5 types of actors, each having its own top-level route
- So projects, repos, etc. are no longer "under" sharers
- Actor routes are now based on their KeyHashid, there are no "idents" anymore,
i.e. URLs look random and don't contain user or repo names
- No sharers anymore; people and groups are distinct entities not sharing a
common namespace or anything like that
- Project has been renamed to Deck and it simply means a ticket tracker; repos
are no longer "under" projects
- In addition to Person, Group, Repo and Deck, there's a new actor type Loom,
which is a patch tracker; i.e. Repo actors don't manage MRs anymore
- All C2S and S2S is temporarily disabled, because huge changes to the whole
code are required and I'll do them gradually in the next patches
- Since form-based actions are implemented using C2S, they're disabled as well,
so Vervis is now essentially read-only
- Some views have been temporarily removed, e.g. repo history and commit view
- A huge set of DB migrations has been added to adapt the DB to these changes;
I haven't tested them yet on a read DB so there may be errors there; I'll fix
them in the next patches if I find any (probably going to test on the main
instance where Vervis itself is hosted...)
- Some modules got tech upgrades, e.g. LocalActor became a higher-kinded type
and a similar pattern is probably relevant for several other types
- There's an 'Actor' entity in the DB schema now, and all 5 actor types use it
for common things like inbox and outbox
- Although inbox and outbox are used only by Actor, so essentially could be
removed, I haven't removed them; that's because I wonder if at some point
users can have a tree of inboxes much like in email; I don't have an excuse
for Outbox, but anyway, leaving them as is for now
- Workflows, roles and collaborators are partially removed/unused until I
figure out a sane federated way to provide these features
- Since repo routes don't contain a "sharer" anymore, SSH URIs are now simpler,
they already look like user@host/repo regardless of who "controls" that repo
2022-08-15 13:57:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
getReposR :: ShrIdent -> Handler Html
|
|
|
|
getReposR user = do
|
|
|
|
repos <- runDB $ E.select $ E.from $ \ (sharer, repo) -> do
|
|
|
|
E.where_ $
|
|
|
|
sharer E.^. SharerIdent E.==. E.val user E.&&.
|
|
|
|
sharer E.^. SharerId E.==. repo E.^. RepoSharer
|
|
|
|
E.orderBy [E.asc $ repo E.^. RepoIdent]
|
|
|
|
return $ repo E.^. RepoIdent
|
|
|
|
defaultLayout $(widgetFile "repo/list")
|
|
|
|
|
|
|
|
selectRepo :: ShrIdent -> RpIdent -> AppDB (Maybe (Sharer, Project, Workflow, Sharer), Repo)
|
|
|
|
selectRepo shar repo = do
|
|
|
|
Entity sid _s <- getBy404 $ UniqueSharer shar
|
|
|
|
Entity _rid r <- getBy404 $ UniqueRepo repo sid
|
|
|
|
mj <- for (repoProject r) $ \ jid -> do
|
|
|
|
j <- get404 jid
|
|
|
|
s <- get404 $ projectSharer j
|
|
|
|
w <- get404 $ projectWorkflow j
|
|
|
|
sw <- get404 $ workflowSharer w
|
|
|
|
return (s, j, w, sw)
|
|
|
|
return (mj, r)
|
2016-05-05 16:30:30 +00:00
|
|
|
|
2019-08-28 15:31:40 +00:00
|
|
|
getRepoBranchR :: ShrIdent -> RpIdent -> Text -> Handler TypedContent
|
|
|
|
getRepoBranchR shar repo ref = do
|
2019-12-27 20:44:14 +00:00
|
|
|
(_, repository) <- runDB $ selectRepo shar repo
|
2019-08-28 15:31:40 +00:00
|
|
|
case repoVcs repository of
|
|
|
|
VCSDarcs -> notFound
|
|
|
|
VCSGit -> getGitRepoBranch shar repo ref
|
|
|
|
|
2016-05-29 14:13:25 +00:00
|
|
|
getRepoDevsR :: ShrIdent -> RpIdent -> Handler Html
|
2016-05-31 01:52:04 +00:00
|
|
|
getRepoDevsR shr rp = do
|
|
|
|
devs <- runDB $ do
|
|
|
|
rid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
|
|
|
Entity r _ <- getBy404 $ UniqueRepo rp s
|
|
|
|
return r
|
2022-06-22 06:19:37 +00:00
|
|
|
E.select $ E.from $ \ (topic `E.InnerJoin` recip `E.InnerJoin` person `E.InnerJoin` sharer `E.LeftOuterJoin` (crole `E.InnerJoin` role)) -> do
|
|
|
|
E.on $ crole E.?. CollabRoleLocalRole E.==. role E.?. RoleId
|
|
|
|
E.on $ E.just (recip E.^. CollabRecipLocalCollab) E.==. crole E.?. CollabRoleLocalCollab
|
|
|
|
E.on $ person E.^. PersonIdent E.==. sharer E.^. SharerId
|
|
|
|
E.on $ recip E.^. CollabRecipLocalPerson E.==. person E.^. PersonId
|
|
|
|
E.on $ topic E.^. CollabTopicLocalRepoCollab E.==. recip E.^. CollabRecipLocalCollab
|
|
|
|
E.where_ $ topic E.^. CollabTopicLocalRepoRepo E.==. E.val rid
|
2019-09-09 00:27:45 +00:00
|
|
|
return (sharer, role E.?. RoleIdent)
|
2016-05-31 01:52:04 +00:00
|
|
|
defaultLayout $(widgetFile "repo/collab/list")
|
2016-05-29 14:13:25 +00:00
|
|
|
|
|
|
|
postRepoDevsR :: ShrIdent -> RpIdent -> Handler Html
|
2016-05-31 01:52:04 +00:00
|
|
|
postRepoDevsR shr rp = do
|
2022-06-22 06:19:37 +00:00
|
|
|
(sid, mjid, obid, rid) <- runDB $ do
|
2016-05-31 01:52:04 +00:00
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
2016-06-05 13:59:48 +00:00
|
|
|
Entity r repository <- getBy404 $ UniqueRepo rp s
|
2022-06-22 06:19:37 +00:00
|
|
|
return (s, repoProject repository, repoOutbox repository, r)
|
2016-06-06 17:29:54 +00:00
|
|
|
((result, widget), enctype) <- runFormPost $ newRepoCollabForm sid mjid rid
|
2016-05-31 01:52:04 +00:00
|
|
|
case result of
|
|
|
|
FormSuccess nc -> do
|
2022-06-22 06:19:37 +00:00
|
|
|
now <- liftIO getCurrentTime
|
|
|
|
host <- asksSite siteInstanceHost
|
2016-05-31 01:52:04 +00:00
|
|
|
runDB $ do
|
2022-06-22 06:19:37 +00:00
|
|
|
obiid <-
|
|
|
|
insert $
|
|
|
|
OutboxItem
|
|
|
|
obid
|
|
|
|
(persistJSONObjectFromDoc $ Doc host emptyActivity)
|
|
|
|
now
|
|
|
|
cid <- insert Collab
|
|
|
|
for_ (ncRole nc) $ \ rlid -> insert_ $ CollabRoleLocal cid rlid
|
|
|
|
insert_ $ CollabTopicLocalRepo cid rid
|
|
|
|
insert_ $ CollabSenderLocal cid obiid
|
|
|
|
insert_ $ CollabRecipLocal cid (ncPerson nc)
|
2016-05-31 01:52:04 +00:00
|
|
|
setMessage "Collaborator added."
|
|
|
|
redirect $ RepoDevsR shr rp
|
|
|
|
FormMissing -> do
|
|
|
|
setMessage "Field(s) missing"
|
|
|
|
defaultLayout $(widgetFile "repo/collab/new")
|
|
|
|
FormFailure _l -> do
|
|
|
|
setMessage "Operation failed, see errors below"
|
|
|
|
defaultLayout $(widgetFile "repo/collab/new")
|
2016-05-29 14:13:25 +00:00
|
|
|
|
|
|
|
getRepoDevNewR :: ShrIdent -> RpIdent -> Handler Html
|
2016-05-31 01:52:04 +00:00
|
|
|
getRepoDevNewR shr rp = do
|
2016-06-06 17:29:54 +00:00
|
|
|
(sid, mjid, rid) <- runDB $ do
|
2016-05-31 01:52:04 +00:00
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
2016-06-05 13:59:48 +00:00
|
|
|
Entity r repository <- getBy404 $ UniqueRepo rp s
|
2016-06-06 17:29:54 +00:00
|
|
|
return (s, repoProject repository, r)
|
2016-06-05 13:59:48 +00:00
|
|
|
((_result, widget), enctype) <-
|
2016-06-06 17:29:54 +00:00
|
|
|
runFormPost $ newRepoCollabForm sid mjid rid
|
2016-05-31 01:52:04 +00:00
|
|
|
defaultLayout $(widgetFile "repo/collab/new")
|
2016-05-29 14:13:25 +00:00
|
|
|
|
|
|
|
getRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
|
2016-05-31 01:52:04 +00:00
|
|
|
getRepoDevR shr rp dev = do
|
2019-01-29 22:24:32 +00:00
|
|
|
mrl <- runDB $ do
|
2016-05-31 01:52:04 +00:00
|
|
|
rid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
|
|
|
Entity r _ <- getBy404 $ UniqueRepo rp s
|
|
|
|
return r
|
|
|
|
pid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer dev
|
|
|
|
Entity p _ <- getBy404 $ UniquePersonIdent s
|
|
|
|
return p
|
2022-06-22 06:19:37 +00:00
|
|
|
l <- E.select $ E.from $ \ (topic `E.InnerJoin` recip) -> do
|
|
|
|
E.on $ topic E.^. CollabTopicLocalRepoCollab E.==. recip E.^. CollabRecipLocalCollab
|
|
|
|
E.where_ $
|
|
|
|
topic E.^. CollabTopicLocalRepoRepo E.==. E.val rid E.&&.
|
|
|
|
recip E.^. CollabRecipLocalPerson E.==. E.val pid
|
|
|
|
return $ recip E.^. CollabRecipLocalCollab
|
|
|
|
cid <-
|
|
|
|
case l of
|
|
|
|
[] -> notFound
|
|
|
|
[E.Value cid] -> return cid
|
|
|
|
_ -> error "Multiple collabs for repo+person"
|
|
|
|
mcrole <- getValBy $ UniqueCollabRoleLocal cid
|
|
|
|
for mcrole $
|
|
|
|
\ (CollabRoleLocal _cid rlid) -> roleIdent <$> getJust rlid
|
2016-05-31 01:52:04 +00:00
|
|
|
defaultLayout $(widgetFile "repo/collab/one")
|
2016-05-29 14:13:25 +00:00
|
|
|
|
|
|
|
deleteRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
|
2016-05-30 14:32:20 +00:00
|
|
|
deleteRepoDevR shr rp dev = do
|
|
|
|
runDB $ do
|
|
|
|
rid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer shr
|
|
|
|
Entity r _ <- getBy404 $ UniqueRepo rp s
|
|
|
|
return r
|
|
|
|
pid <- do
|
|
|
|
Entity s _ <- getBy404 $ UniqueSharer dev
|
|
|
|
Entity p _ <- getBy404 $ UniquePersonIdent s
|
|
|
|
return p
|
2022-06-22 06:19:37 +00:00
|
|
|
collabs <- E.select $ E.from $ \ (recip `E.InnerJoin` topic) -> do
|
|
|
|
E.on $ recip E.^. CollabRecipLocalCollab E.==. topic E.^. CollabTopicLocalRepoCollab
|
|
|
|
E.where_ $
|
|
|
|
recip E.^. CollabRecipLocalPerson E.==. E.val pid E.&&.
|
|
|
|
topic E.^. CollabTopicLocalRepoRepo E.==. E.val rid
|
|
|
|
return
|
|
|
|
( recip E.^. CollabRecipLocalId
|
|
|
|
, topic E.^. CollabTopicLocalRepoId
|
|
|
|
, recip E.^. CollabRecipLocalCollab
|
|
|
|
)
|
|
|
|
(E.Value crid, E.Value ctid, E.Value cid) <-
|
|
|
|
case collabs of
|
|
|
|
[] -> notFound
|
|
|
|
[c] -> return c
|
|
|
|
_ -> error "More than 1 collab for repo+person"
|
|
|
|
deleteWhere [CollabRoleLocalCollab ==. cid]
|
|
|
|
delete ctid
|
|
|
|
deleteWhere [CollabSenderLocalCollab ==. cid]
|
|
|
|
deleteWhere [CollabSenderRemoteCollab ==. cid]
|
|
|
|
delete crid
|
2016-05-30 14:32:20 +00:00
|
|
|
delete cid
|
|
|
|
setMessage "Collaborator removed."
|
|
|
|
redirect $ RepoDevsR shr rp
|
2016-05-29 14:13:25 +00:00
|
|
|
|
|
|
|
postRepoDevR :: ShrIdent -> RpIdent -> ShrIdent -> Handler Html
|
2016-05-30 14:32:20 +00:00
|
|
|
postRepoDevR shr rp dev = do
|
|
|
|
mmethod <- lookupPostParam "_method"
|
|
|
|
case mmethod of
|
|
|
|
Just "DELETE" -> deleteRepoDevR shr rp dev
|
|
|
|
_ -> notFound
|
2019-05-27 13:28:57 +00:00
|
|
|
|
2019-09-09 00:27:45 +00:00
|
|
|
getRepoTeamR :: ShrIdent -> RpIdent -> Handler TypedContent
|
|
|
|
getRepoTeamR shr rp = do
|
|
|
|
memberShrs <- runDB $ do
|
|
|
|
sid <- getKeyBy404 $ UniqueSharer shr
|
|
|
|
_rid <- getKeyBy404 $ UniqueRepo rp sid
|
|
|
|
id_ <-
|
|
|
|
requireEitherAlt
|
|
|
|
(getKeyBy $ UniquePersonIdent sid)
|
|
|
|
(getKeyBy $ UniqueGroup sid)
|
|
|
|
"Found sharer that is neither person nor group"
|
|
|
|
"Found sharer that is both person and group"
|
|
|
|
case id_ of
|
|
|
|
Left pid -> return [shr]
|
|
|
|
Right gid -> do
|
|
|
|
pids <-
|
|
|
|
map (groupMemberPerson . entityVal) <$>
|
|
|
|
selectList [GroupMemberGroup ==. gid] []
|
|
|
|
sids <-
|
|
|
|
map (personIdent . entityVal) <$>
|
|
|
|
selectList [PersonId <-. pids] []
|
|
|
|
map (sharerIdent . entityVal) <$>
|
|
|
|
selectList [SharerId <-. sids] []
|
|
|
|
|
|
|
|
let here = RepoTeamR shr rp
|
|
|
|
|
|
|
|
encodeRouteLocal <- getEncodeRouteLocal
|
|
|
|
encodeRouteHome <- getEncodeRouteHome
|
|
|
|
let team = Collection
|
|
|
|
{ collectionId = encodeRouteLocal here
|
|
|
|
, collectionType = CollectionTypeUnordered
|
|
|
|
, collectionTotalItems = Just $ length memberShrs
|
|
|
|
, collectionCurrent = Nothing
|
|
|
|
, collectionFirst = Nothing
|
|
|
|
, collectionLast = Nothing
|
|
|
|
, collectionItems = map (encodeRouteHome . SharerR) memberShrs
|
|
|
|
}
|
|
|
|
provideHtmlAndAP team $ redirectToPrettyJSON here
|
|
|
|
|
|
|
|
getRepoFollowersR :: ShrIdent -> RpIdent -> Handler TypedContent
|
|
|
|
getRepoFollowersR shr rp = getFollowersCollection here getFsid
|
|
|
|
where
|
|
|
|
here = RepoFollowersR shr rp
|
|
|
|
getFsid = do
|
|
|
|
sid <- getKeyBy404 $ UniqueSharer shr
|
|
|
|
r <- getValBy404 $ UniqueRepo rp sid
|
|
|
|
return $ repoFollowers r
|
2022-09-16 13:47:10 +00:00
|
|
|
-}
|
2019-09-09 00:27:45 +00:00
|
|
|
|
2019-05-27 19:54:11 +00:00
|
|
|
getHighlightStyleR :: Text -> Handler TypedContent
|
|
|
|
getHighlightStyleR styleName =
|
|
|
|
case lookup (unpack styleName) highlightingStyles of
|
2019-05-27 18:30:48 +00:00
|
|
|
Nothing -> notFound
|
|
|
|
Just style ->
|
|
|
|
return $ TypedContent typeCss $ toContent $ styleToCss style
|