forked from filipg/gonito
Trigger via simple GET/POST URL
This commit is contained in:
parent
56cfc57d7d
commit
e935cb6182
@ -181,6 +181,7 @@ instance Yesod App where
|
||||
isAuthorized (AvatarR _) _ = return Authorized
|
||||
|
||||
isAuthorized TriggerRemotelyR _ = return Authorized
|
||||
isAuthorized (TriggerRemotelySimpleR _ _ _ _) _ = return Authorized
|
||||
isAuthorized TriggerLocallyR _ = return Authorized
|
||||
isAuthorized (OpenViewProgressR _) _ = return Authorized
|
||||
|
||||
|
@ -276,6 +276,18 @@ postTriggerRemotelyR = do
|
||||
(Just token) <- lookupPostParam "token"
|
||||
mBranch <- lookupPostParam "branch"
|
||||
mGitAnnexRemote <- lookupPostParam "git-annex-remote"
|
||||
doTrigger token challengeName url mBranch mGitAnnexRemote
|
||||
|
||||
postTriggerRemotelySimpleR :: Text -> Text -> Text -> Text -> Handler TypedContent
|
||||
postTriggerRemotelySimpleR token challengeName url branch =
|
||||
doTrigger token challengeName url (Just branch) Nothing
|
||||
|
||||
getTriggerRemotelySimpleR :: Text -> Text -> Text -> Text -> Handler TypedContent
|
||||
getTriggerRemotelySimpleR token challengeName url branch =
|
||||
doTrigger token challengeName url (Just branch) Nothing
|
||||
|
||||
doTrigger :: Text -> Text -> Text -> Maybe Text -> Maybe Text -> Handler TypedContent
|
||||
doTrigger token challengeName url mBranch mGitAnnexRemote = do
|
||||
[Entity userId _] <- runDB $ selectList [UserTriggerToken ==. Just token] []
|
||||
trigger userId challengeName url mBranch mGitAnnexRemote
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
/challenge-discussion-rss/#Text ChallengeDiscussionFeedR GET
|
||||
/challenge-update/#ChallengeId ChallengeUpdateR GET POST
|
||||
/trigger-remotely TriggerRemotelyR POST
|
||||
/trigger-remotely-simple/#Text/#Text/#Text/#Text TriggerRemotelySimpleR GET POST
|
||||
/trigger-locally TriggerLocallyR POST
|
||||
|
||||
/indicator-graph-data/#IndicatorId IndicatorGraphDataR GET
|
||||
|
@ -131,6 +131,9 @@ $maybe token <- mToken
|
||||
<p>Your webook is:
|
||||
<pre>
|
||||
wget --timeout=0 --quiet -O - '#{appRoot settings}/trigger-remotely' --post-data 'token=#{token}&branch=#{myBranch}&challenge=#{challengeName challenge}&url=URL_TO_YOUR_REPO'
|
||||
<p>or you can just use the following URL:
|
||||
<pre>
|
||||
#{appRoot settings}/trigger-remotely-simple/#{token}/#{challengeName challenge}/URL_TO_YOUR_REPO/#{myBranch}
|
||||
|
||||
<h3>Manual submission
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user