jsonDiff
Michael Snoyman 8 years ago
parent 2fae2cde89
commit 20d08ffa31

@ -45,6 +45,7 @@ import Handler.Sitemap
import Handler.BuildPlan
import Handler.Download
import Handler.OldLinks
import Handler.Feed
-- 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

@ -12,6 +12,7 @@ import Text.Hamlet (hamletFile)
import Types
import Yesod.Core.Types (Logger)
import Yesod.Default.Config
import Yesod.AtomFeed
import Yesod.GitRepo
import Stackage.Database
@ -70,6 +71,7 @@ defaultLayoutWithContainer insideContainer widget = do
[ js_jquery_js
, js_bootstrap_js
]))
atomLink FeedR "Recent Stackage snapshots"
$(widgetFile "default-layout")
mcurr <- getCurrentRoute

@ -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/lts-snapshots.json DownloadLtsSnapshotsJsonR GET
/download/#SupportedArch/#Text DownloadGhcLinksR GET
/feed FeedR GET

@ -48,6 +48,7 @@ library
Handler.BuildPlan
Handler.Download
Handler.OldLinks
Handler.Feed
if flag(dev) || flag(library-only)
cpp-options: -DDEVELOPMENT
@ -136,6 +137,7 @@ library
, yesod-auth >= 1.4 && < 1.5
, yesod-core >= 1.4 && < 1.5
, yesod-form >= 1.4 && < 1.5
, yesod-newsfeed
, yesod-static >= 1.5 && < 1.6
, zlib >= 0.5 && < 0.6
, unordered-containers >= 0.2 && < 0.3

Loading…
Cancel
Save