mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-21 08:21:55 +01:00
/feed
This commit is contained in:
parent
2fae2cde89
commit
20d08ffa31
@ -45,6 +45,7 @@ import Handler.Sitemap
|
|||||||
import Handler.BuildPlan
|
import Handler.BuildPlan
|
||||||
import Handler.Download
|
import Handler.Download
|
||||||
import Handler.OldLinks
|
import Handler.OldLinks
|
||||||
|
import Handler.Feed
|
||||||
|
|
||||||
-- This line actually creates our YesodDispatch instance. It is the second half
|
-- This line actually creates our YesodDispatch instance. It is the second half
|
||||||
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
|
-- of the call to mkYesodData which occurs in Foundation.hs. Please see the
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import Text.Hamlet (hamletFile)
|
|||||||
import Types
|
import Types
|
||||||
import Yesod.Core.Types (Logger)
|
import Yesod.Core.Types (Logger)
|
||||||
import Yesod.Default.Config
|
import Yesod.Default.Config
|
||||||
|
import Yesod.AtomFeed
|
||||||
import Yesod.GitRepo
|
import Yesod.GitRepo
|
||||||
import Stackage.Database
|
import Stackage.Database
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ defaultLayoutWithContainer insideContainer widget = do
|
|||||||
[ js_jquery_js
|
[ js_jquery_js
|
||||||
, js_bootstrap_js
|
, js_bootstrap_js
|
||||||
]))
|
]))
|
||||||
|
atomLink FeedR "Recent Stackage snapshots"
|
||||||
$(widgetFile "default-layout")
|
$(widgetFile "default-layout")
|
||||||
|
|
||||||
mcurr <- getCurrentRoute
|
mcurr <- getCurrentRoute
|
||||||
|
|||||||
28
Handler/Feed.hs
Normal file
28
Handler/Feed.hs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
module Handler.Feed where
|
||||||
|
|
||||||
|
import Import
|
||||||
|
import Stackage.Database
|
||||||
|
|
||||||
|
getFeedR :: Handler TypedContent
|
||||||
|
getFeedR = do
|
||||||
|
(_, snaps) <- getSnapshots 20 0
|
||||||
|
let entries = flip map snaps $ \snap -> FeedEntry
|
||||||
|
{ feedEntryLink = SnapshotR (snapshotName snap) StackageHomeR
|
||||||
|
, feedEntryUpdated = UTCTime (snapshotCreated snap) 0
|
||||||
|
, feedEntryTitle = prettyName (snapshotName snap) (snapshotGhc snap)
|
||||||
|
, feedEntryContent = ""
|
||||||
|
}
|
||||||
|
updated <-
|
||||||
|
case entries of
|
||||||
|
[] -> liftIO getCurrentTime
|
||||||
|
x:_ -> return $ feedEntryUpdated x
|
||||||
|
newsFeed Feed
|
||||||
|
{ feedTitle = "Recent Stackage snapshots"
|
||||||
|
, feedLinkSelf = FeedR
|
||||||
|
, feedLinkHome = HomeR
|
||||||
|
, feedAuthor = "Stackage Project"
|
||||||
|
, feedDescription = "Recent Stackage snapshots"
|
||||||
|
, feedLanguage = "en"
|
||||||
|
, feedUpdated = updated
|
||||||
|
, feedEntries = entries
|
||||||
|
}
|
||||||
@ -45,3 +45,4 @@
|
|||||||
/download/snapshots.json DownloadSnapshotsJsonR GET
|
/download/snapshots.json DownloadSnapshotsJsonR GET
|
||||||
/download/lts-snapshots.json DownloadLtsSnapshotsJsonR GET
|
/download/lts-snapshots.json DownloadLtsSnapshotsJsonR GET
|
||||||
/download/#SupportedArch/#Text DownloadGhcLinksR GET
|
/download/#SupportedArch/#Text DownloadGhcLinksR GET
|
||||||
|
/feed FeedR GET
|
||||||
|
|||||||
@ -48,6 +48,7 @@ library
|
|||||||
Handler.BuildPlan
|
Handler.BuildPlan
|
||||||
Handler.Download
|
Handler.Download
|
||||||
Handler.OldLinks
|
Handler.OldLinks
|
||||||
|
Handler.Feed
|
||||||
|
|
||||||
if flag(dev) || flag(library-only)
|
if flag(dev) || flag(library-only)
|
||||||
cpp-options: -DDEVELOPMENT
|
cpp-options: -DDEVELOPMENT
|
||||||
@ -136,6 +137,7 @@ library
|
|||||||
, yesod-auth >= 1.4 && < 1.5
|
, yesod-auth >= 1.4 && < 1.5
|
||||||
, yesod-core >= 1.4 && < 1.5
|
, yesod-core >= 1.4 && < 1.5
|
||||||
, yesod-form >= 1.4 && < 1.5
|
, yesod-form >= 1.4 && < 1.5
|
||||||
|
, yesod-newsfeed
|
||||||
, yesod-static >= 1.5 && < 1.6
|
, yesod-static >= 1.5 && < 1.6
|
||||||
, zlib >= 0.5 && < 0.6
|
, zlib >= 0.5 && < 0.6
|
||||||
, unordered-containers >= 0.2 && < 0.3
|
, unordered-containers >= 0.2 && < 0.3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user