on master help sign in
Merge branch 'develop' into use-android-deploy-script
commit24d6c07bd1881439a38d1751f651b3816e9f8208 authorElliot Cameron <eacameron@gmail.com> dateTue 10 Mar 2020, 14:04 (7 years ago) parente6a7c6d344d5ca
8 files changed+76−15
ChangeLog.md+20−2 default.nix+9−8 dep/gitignore.nix/default.nix+8 dep/gitignore.nix/github.json+8 dep/snap-core/default.nix+8 dep/snap-core/github.json+8 lib/asset/serve-snap/src/Obelisk/Asset/Serve/Snap.hs+14−4 lib/command/obelisk-command.cabal+1−1
ChangeLog.md+20−2
@@ -4,6 +4,10 @@ This project's release branch is `master`. This log is written from the perspect
44
55## Unreleased
66
7+* Fully support HTTP [Range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range) requests on static assets to support Safari. ([#664](https://github.com/obsidiansystems/obelisk/pull/664))
8+
9+## v0.6.0.0 - 2020-02-21
10+
711* Fix a bug in `Obelisk.Route.Frontend` where `routeLink`, `routeLinkDynAttr`, and `dynRouteLink` would not behave exactly like `<a href="...">` when run by JavaScript. These functions now scroll to the top of the page when the link is clicked. ([#540](https://github.com/obsidiansystems/obelisk/pull/540))
812* Fix a bug in `ob run`/`ob watch`/`ob repl` where nested Obelisk projects would also be loaded into the session. These are now ignored. ([#652](https://github.com/obsidiansystems/obelisk/pull/652))
913* Improve behavior of `ob run`/`ob watch`/`ob repl` when multiple packages with the same name are encountered. Obelisk now issues a warning and tells you which one it will use. ([#653](https://github.com/obsidiansystems/obelisk/pull/653))
@@ -11,8 +15,8 @@ This project's release branch is `master`. This log is written from the perspect
1115
1216 mkRouteToUrl validFullEncoder (k :/ v) = renderObeliskRoute validFullEncoder (FullRoute_Frontend (ObeliskRoute_App k) :/ v)
1317
14−* Added `Obelisk.Backend.renderAllJsPath` to expose URL path to `ghcjs/all.js`.
15−* Added argument to `serveDefaultObeliskApp`, `serveObeliskApp`, and `serveGhcjsApp` to take the path to `all.js` instead of hard-coding it.
18+* Add `Obelisk.Backend.renderAllJsPath` to expose URL path to `ghcjs/all.js`. ([#545](https://github.com/obsidiansystems/obelisk/pull/545))
19+* Add argument to `serveDefaultObeliskApp`, `serveObeliskApp`, and `serveGhcjsApp` to take the path to `all.js` instead of hard-coding it. ([#545](https://github.com/obsidiansystems/obelisk/pull/545))
1620
1721## v0.5.0.0 - 2020-02-07
1822
@@ -36,6 +40,20 @@ This project's release branch is `master`. This log is written from the perspect
3640
3741## v0.3.0.0 - 2019-12-20
3842
43+* Change the structure of Obelisk routes to use a designated
44+ `FullRoute` type. This combines frontend and backend routes into one
45+ structure. This is a **breaking** change which requires Obelisk apps
46+ to take specific migrations. They are:
47+ * Rewrite the implementation of `_backend_routeEncoder` in
48+ `Backend` to use `mkFullRouteEncoder` instead of
49+ `handleEncoder`. Specifically, the backend and frontend cases of
50+ the top-level `pathComponentEncoder` become the second and third
51+ arguments of `mkFullRouteEncoder` respectively, while the
52+ missing route becomes the first argument. An example of how to
53+ do this is available in [a reflex-examples
54+ commit](https://github.com/reflex-frp/reflex-examples/commits/28f566c3e7dc615578dc74297b7c620c1f13683e).
55+ * Replace type constructions of `InL` with `FullRoute_Backend` and
56+ `InR` with `FullRoute_Frontend`.
3957* Generalised `pathSegmentEncoder`, added `pathFieldEncoder`.
4058* Added some `Prism`s to the encoder library for manipulating `DSum`s.
4159* Add `ob doc` command, which lists paths to haddock documentation for specified packages.
default.nix+9−8
@@ -5,10 +5,13 @@
55, reflex-platform-func ? import ./dep/reflex-platform
66}:
77let
8− cleanSource = builtins.filterSource (name: _: let baseName = builtins.baseNameOf name; in !(
9− builtins.match "^\\.ghc\\.environment.*" baseName != null ||
10− baseName == "cabal.project.local"
11− ));
8+ reflex-platform = getReflexPlatform system;
9+ inherit (reflex-platform) hackGet nixpkgs;
10+ pkgs = nixpkgs;
11+
12+ inherit (import dep/gitignore.nix { inherit (nixpkgs) lib; }) gitignoreSource;
13+
14+ cleanSource = src: gitignoreSource (pkgs.lib.cleanSource src);
1215
1316 commandRuntimeDeps = pkgs: with pkgs; [
1417 coreutils
@@ -39,6 +42,8 @@ let
3942 hnix-store-core = self.callHackage "hnix-store-core" "0.1.0.0" {};
4043
4144 ghcid = self.callCabal2nix "ghcid" (hackGet ./dep/ghcid) {};
45+ # Exports more internals
46+ snap-core = haskellLib.dontCheck (self.callCabal2nix "snap-core" (hackGet ./dep/snap-core) {});
4247 })
4348
4449 pkgs.obeliskExecutableConfig.haskellOverlay
@@ -102,10 +107,6 @@ let
102107 ];
103108 };
104109
105− reflex-platform = getReflexPlatform system;
106− inherit (reflex-platform) hackGet nixpkgs;
107− pkgs = nixpkgs;
108−
109110 # The haskell environment used to build Obelisk itself, e.g. the 'ob' command
110111 ghcObelisk = reflex-platform.ghc;
111112
dep/gitignore.nix/default.nixnew file+8
@@ -0,0 +1,8 @@
1+# DO NOT HAND-EDIT THIS FILE
2+let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
3+ if !fetchSubmodules && !private then builtins.fetchTarball {
4+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
5+ } else (import <nixpkgs> {}).fetchFromGitHub {
6+ inherit owner repo rev sha256 fetchSubmodules private;
7+ };
8+in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))
dep/gitignore.nix/github.jsonnew file+8
@@ -0,0 +1,8 @@
1+{
2+ "owner": "hercules-ci",
3+ "repo": "gitignore.nix",
4+ "branch": "master",
5+ "private": false,
6+ "rev": "7415c4feb127845553943a3856cbc5cb967ee5e0",
7+ "sha256": "1zd1ylgkndbb5szji32ivfhwh04mr1sbgrnvbrqpmfb67g2g3r9i"
8+}
dep/snap-core/default.nixnew file+8
@@ -0,0 +1,8 @@
1+# DO NOT HAND-EDIT THIS FILE
2+let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }:
3+ if !fetchSubmodules && !private then builtins.fetchTarball {
4+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256;
5+ } else (import <nixpkgs> {}).fetchFromGitHub {
6+ inherit owner repo rev sha256 fetchSubmodules private;
7+ };
8+in import (fetch (builtins.fromJSON (builtins.readFile ./github.json)))
dep/snap-core/github.jsonnew file+8
@@ -0,0 +1,8 @@
1+{
2+ "owner": "obsidiansystems",
3+ "repo": "snap-core",
4+ "branch": "ts-expose-fileserve-internals",
5+ "private": false,
6+ "rev": "e015fc484e38dd9389c58b277b1884395e553bdf",
7+ "sha256": "1793x1h4lw9vnrii5akhfxx1x9yrgxf3052jf6bs8f1mhaic6mxx"
8+}
lib/asset/serve-snap/src/Obelisk/Asset/Serve/Snap.hs+14−4
@@ -12,12 +12,13 @@ import Obelisk.Asset.Accept (Encoding (..), acceptEncodingBody, chooseEncoding,
1212import Obelisk.Snap.Extras
1313
1414import Snap
15− (MonadSnap, getHeader, getsRequest, modifyResponse, pass, redirect, sendFile, setContentLength, setContentType, setHeader, setResponseCode)
15+ (MonadSnap, getHeader, getRequest, getsRequest, modifyResponse, pass, redirect, sendFile, setContentLength, setContentType, setHeader, setResponseCode)
1616import Snap.Util.FileServe (defaultMimeTypes, fileType, getSafePath, serveFile)
17+import Snap.Internal.Util.FileServe (checkRangeReq)
1718
1819import Control.Applicative ((<|>))
1920import Control.Exception (handleJust, try, throwIO)
20−import Control.Monad (forM, liftM)
21+import Control.Monad (forM, liftM, unless)
2122import Control.Monad.IO.Class (liftIO)
2223import Control.Monad.Fail (MonadFail)
2324import Data.Attoparsec.ByteString (parseOnly, endOfInput)
@@ -94,8 +95,17 @@ serveAsset' doRedirect base fallback p = do
9495 let finalFilename = base </> p </> "encodings" </> T.unpack (decodeUtf8 e)
9596 stat <- liftIO $ getFileStatus finalFilename
9697 modifyResponse $ setHeader "Last-Modified" "Thu, 1 Jan 1970 00:00:00 GMT"
97− modifyResponse $ setResponseCode 200 . setContentLength (fromIntegral $ fileSize stat) . setContentType (fileType defaultMimeTypes p)
98− sendFile finalFilename
98+ . setHeader "Accept-Ranges" "bytes"
99+ . setContentType (fileType defaultMimeTypes p)
100+ let size = fromIntegral $ fileSize stat
101+ req <- getRequest
102+ -- Despite the name, this function actually does all of the work for
103+ -- responding to range requests. We only need to handle *none* range
104+ -- requests ourselves.
105+ wasRange <- checkRangeReq req finalFilename size
106+ unless wasRange $ do
107+ modifyResponse $ setResponseCode 200 . setContentLength size
108+ sendFile finalFilename
99109 Just _ -> cachePermanently >> modifyResponse (setResponseCode 304)
100110 Right "redirect" -> do
101111 mtarget <- liftIO $ getAssetTarget $ base </> p
lib/command/obelisk-command.cabal+1−1
@@ -1,5 +1,5 @@
11name: obelisk-command
2−version: 0.5
2+version: 0.6
33cabal-version: >= 1.8
44build-type: Simple
55