summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2013-01-09 16:44:18 +0000
committerhallgren <hallgren@chalmers.se>2013-01-09 16:44:18 +0000
commitf2751ff9e11bd7ec4b1f489913191e34f0bd78e3 (patch)
tree6f6b8ea50a642ed9ac43e922c1639d4115d18d0d /src/server
parent1497fd863ae7b1d4b2c1f7144a1d2753875bae75 (diff)
Fixes for minibar offline
Tested it in Firefox 18 (which has the new Ionmonkey JavaScript engine). Still get stack overflows.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/PGFService.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/server/PGFService.hs b/src/server/PGFService.hs
index ee83394da..71c4f37d3 100644
--- a/src/server/PGFService.hs
+++ b/src/server/PGFService.hs
@@ -48,15 +48,15 @@ cgiMain cache = handleErrors . handleCGIErrors $
cgiMain' :: Cache PGF -> FilePath -> CGI CGIResult
cgiMain' cache path =
- do pgf <- liftIO $ readCache cache path
- command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
+ do command <- liftM (maybe "grammar" (urlDecodeUnicode . UTF8.decodeString))
(getInput "command")
- pgfMain path pgf command
+ case command of
+ "download" -> outputBinary =<< liftIO (BS.readFile path)
+ _ -> pgfMain command =<< liftIO (readCache cache path)
-pgfMain :: FilePath -> PGF -> String -> CGI CGIResult
-pgfMain path pgf command =
+pgfMain :: String -> PGF -> CGI CGIResult
+pgfMain command pgf =
case command of
- "download" -> outputBinary =<< liftIO (BS.readFile path)
"parse" -> outputJSONP =<< doParse pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
"complete" -> outputJSONP =<< doComplete pgf `fmap` getText `ap` getCat `ap` getFrom `ap` getLimit
"linearize" -> outputJSONP =<< doLinearize pgf `fmap` getTree `ap` getTo