mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
29 lines
808 B
Haskell
29 lines
808 B
Haskell
module Handler.Download
|
|
( getDownloadR
|
|
, getDownloadStackageExecutableR
|
|
) where
|
|
|
|
import Import
|
|
|
|
executableFor :: SupportedArch -> StackageExecutable
|
|
executableFor Win32 = StackageWindowsExecutable
|
|
executableFor Win64 = StackageWindowsExecutable
|
|
executableFor _ = StackageUnixExecutable
|
|
|
|
downloadCandidates :: [(SupportedArch, StackageExecutable)]
|
|
downloadCandidates =
|
|
map (\arch -> (arch, executableFor arch))
|
|
[minBound .. maxBound]
|
|
|
|
getDownloadR :: Handler Html
|
|
getDownloadR = defaultLayout $ do
|
|
$(widgetFile "download")
|
|
|
|
getDownloadStackageExecutableR
|
|
:: SupportedArch -> StackageExecutable -> Handler Html
|
|
getDownloadStackageExecutableR arch exe = do
|
|
-- TODO: send exeutable file instead
|
|
when (executableFor arch /= exe) notFound
|
|
defaultLayout $ do
|
|
$(widgetFile "downloadExe")
|