mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-18 23:21:55 +01:00
Use StackageBranch in OldLinks
This commit is contained in:
parent
e66813be9f
commit
5133a38006
@ -1,7 +1,5 @@
|
||||
module Handler.OldLinks
|
||||
( getOldLtsR
|
||||
, getOldLtsMajorR
|
||||
, getOldNightlyR
|
||||
( getOldStackageBranchR
|
||||
, getOldSnapshotR
|
||||
) where
|
||||
|
||||
@ -28,8 +26,8 @@ redirectWithQueryText url = do
|
||||
req <- waiRequest
|
||||
redirect $ url ++ decodeUtf8 (rawQueryString req)
|
||||
|
||||
getOldLtsR :: [Text] -> Handler ()
|
||||
getOldLtsR pieces = do
|
||||
getOldStackageBranchR :: StackageBranch -> [Text] -> Handler ()
|
||||
getOldStackageBranchR LtsBranch pieces = do
|
||||
(x, y, pieces') <- case pieces of
|
||||
t:ts | Just suffix <- parseLtsSuffix t -> do
|
||||
(x, y) <- case suffix of
|
||||
@ -44,14 +42,12 @@ getOldLtsR pieces = do
|
||||
let name = concat ["lts-", tshow x, ".", tshow y]
|
||||
redirectWithQueryText $ concatMap (cons '/') $ name : pieces'
|
||||
|
||||
getOldLtsMajorR :: LtsMajor -> [Text] -> Handler ()
|
||||
getOldLtsMajorR (LtsMajor x) pieces = do
|
||||
getOldStackageBranchR (LtsMajorBranch x) pieces = do
|
||||
y <- newestLTSMajor x >>= maybe notFound return
|
||||
let name = concat ["lts-", tshow x, ".", tshow y]
|
||||
redirectWithQueryText $ concatMap (cons '/') $ name : pieces
|
||||
|
||||
getOldNightlyR :: [Text] -> Handler ()
|
||||
getOldNightlyR pieces = do
|
||||
getOldStackageBranchR NightlyBranch pieces = do
|
||||
(day, pieces') <- case pieces of
|
||||
t:ts | Just day <- fromPathPiece t -> return (day, ts)
|
||||
_ -> do
|
||||
|
||||
@ -11,10 +11,10 @@ getSitemapR :: Handler TypedContent
|
||||
getSitemapR = sitemap $ do
|
||||
priority 1.0 $ HomeR
|
||||
|
||||
priority 0.9 $ OldLtsR []
|
||||
priority 0.9 $ OldStackageBranchR LtsBranch []
|
||||
-- TODO: uncomment when this is presentable
|
||||
--priority 0.9 $ DownloadR
|
||||
priority 0.8 $ OldNightlyR []
|
||||
priority 0.8 $ OldStackageBranchR NightlyBranch []
|
||||
|
||||
priority 0.7 $ AllSnapshotsR
|
||||
priority 0.7 $ PackageListR
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
!/#LtsMajor/*Texts OldLtsMajorR GET
|
||||
!/#StackageBranch/*Texts OldStackageBranchR GET
|
||||
|
||||
/static StaticR Static getStatic
|
||||
/reload WebsiteContentR GitRepo-WebsiteContent websiteContent
|
||||
@ -32,9 +32,6 @@
|
||||
/package/#PackageName/snapshots PackageSnapshotsR GET
|
||||
/package PackageListR GET
|
||||
|
||||
/lts/*Texts OldLtsR GET
|
||||
/nightly/*Texts OldNightlyR GET
|
||||
|
||||
/authors AuthorsR GET
|
||||
/install InstallR GET
|
||||
/older-releases OlderReleasesR GET
|
||||
|
||||
Loading…
Reference in New Issue
Block a user