diff options
| -rw-r--r-- | Makefile | 25 | ||||
| -rw-r--r-- | flake.nix | 25 | ||||
| -rw-r--r-- | src/Main.purs | 5 | ||||
| -rw-r--r-- | templates/auth/index.html | 18 |
4 files changed, 71 insertions, 2 deletions
@@ -2,6 +2,7 @@ TEMPLATES_API=$(shell ls templates/api) TEMPLATES_PUBNIX=$(shell ls templates/pubnix) +TEMPLATES_AUTH=$(shell ls templates/auth) all: api pubnix extension @@ -10,6 +11,8 @@ dist: mkdir -p dist/api/deploy mkdir -p dist/pubnix/test mkdir -p dist/pubnix/deploy + mkdir -p dist/auth/test + mkdir -p dist/auth/deploy main.js: $(shell find src) purs-nix bundle @@ -59,6 +62,28 @@ dist/pubnix/%/$(template): config/%.m4 templates/pubnix/$(template) endef $(foreach template,$(TEMPLATES_PUBNIX), $(eval $(GEN_RULE_PUBNIX))) +# auth +deploy_auth: dist $(addprefix dist/auth/deploy/,$(TEMPLATES_AUTH)) dist/auth/deploy/assets dist/auth/deploy/main.js dist/auth/deploy/main.css + +auth: dist $(addprefix dist/auth/test/,$(TEMPLATES_AUTH)) dist/auth/test/assets dist/auth/test/main.js dist/auth/test/main.css + +dist/auth/%/main.js: main.js dist + cp $< $@ + +dist/auth/%/main.css: main.css dist + cp $< $@ + +dist/auth/%/assets: $(shell find assets) dist + rm -rf $@ + mkdir -p $@ + cp -r assets/* $@ + +define GEN_RULE_AUTH +dist/auth/%/$(template): config/%.m4 templates/auth/$(template) + sh -c "m4 $$^ >$$@" +endef +$(foreach template,$(TEMPLATES_AUTH), $(eval $(GEN_RULE_AUTH))) + # extension extension: dist dist/extension/assets dist/extension/manifest.json dist/extension/background.js dist/extension/main.js dist/extension/main.css dist/extension/config.js @@ -49,6 +49,21 @@ cp -r dist/api/deploy/* $out/ ''; }; + bundleAuth = pkgs.stdenv.mkDerivation { + name = "bundt-bundle-auth"; + src = ./.; + buildInputs = [ + (purescript.command {}) + pkgs.m4 + ]; + buildPhase = " + make deploy_auth + "; + installPhase = '' + mkdir -p $out + cp -r dist/auth/deploy/* $out/ + ''; + }; in { devShells.x86_64-linux.default = pkgs.mkShell { buildInputs = [ @@ -64,11 +79,17 @@ }; packages.x86_64-linux = { default = bundt; - inherit bundleAPI; + inherit + bundleAPI + bundleAuth + ; }; overlay = self: super: { bundt = { - inherit bundleAPI; + inherit + bundleAPI + bundleAuth + ; }; }; }; diff --git a/src/Main.purs b/src/Main.purs index 858d289..2e2553e 100644 --- a/src/Main.purs +++ b/src/Main.purs @@ -223,6 +223,10 @@ mainMenu :: Effect Unit mainMenu = launchAff_ do liftEffect $ log "hello from menu" +mainAuth :: Effect Unit +mainAuth = launchAff_ do + liftEffect $ log "hello from auth" + main :: Effect Unit main = case Config.mode of "api" -> mainApi @@ -232,4 +236,5 @@ main = case Config.mode of "button" -> mainButton "register" -> mainRegister "menu" -> mainMenu + "auth" -> mainMenu _ -> throw $ "unknown mode: " <> Config.mode diff --git a/templates/auth/index.html b/templates/auth/index.html new file mode 100644 index 0000000..d150889 --- /dev/null +++ b/templates/auth/index.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> + <title>log in with clomq's net hooray</title> + <link rel="icon" href="./assets/mrgreen.png"> + <link rel="stylesheet" type="text/css" href="./main.css"> + <script type="module"> +CONFIG_SUBST + globalThis.mode = "auth"; + </script> + <script type="module" src="./main.js"></script> + </head> + <body id="lcolonq-auth"> + this is the auth page + </body> +</html> |
