diff options
| -rw-r--r-- | bin/serve.fnl | 9 | ||||
| -rw-r--r-- | etc/whitetoad.service | 2 | ||||
| -rw-r--r-- | main.lua | 5 | ||||
| -rwxr-xr-x | run.sh | 17 | ||||
| -rw-r--r-- | static/style.css | 29 | ||||
| -rw-r--r-- | templates.fnl | 10 | ||||
| -rw-r--r-- | test.fnl | 1 |
7 files changed, 31 insertions, 42 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl index 327060d..6653da9 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -1,4 +1,3 @@ -(local fennel (require :vendor.fennel)) (local lib (require :lib)) (when _G.unpack @@ -189,8 +188,12 @@ (values code headers (.. "<!DOCTYPE html>\n" content))) (values 404 {:content-type "text/html"} "not found"))))) -(luna.router.route "/" router) -(luna.router.static "GET /static/" "static/") +(_G.must + (luna.router.route "/" router)) +(_G.must (luna.router.static "GET /static" "static/" "")) +(_G.must + (luna.router.static "GET /static/files" + "static/files" "")) (when (= 0 (# (_G.must (luna.db.query db "SELECT name FROM users LIMIT 1" [])))) (let [password (_G.must (luna.crypto.random-string 20)) diff --git a/etc/whitetoad.service b/etc/whitetoad.service index 3dd3e15..13fc99a 100644 --- a/etc/whitetoad.service +++ b/etc/whitetoad.service @@ -9,7 +9,7 @@ Restart=always RestartSec=1 User=root WorkingDirectory=/root/whitetoad.ru -ExecStart=/usr/local/bin/luna -l 127.0.0.1:3001 -n 4 /root/whitetoad.ru/main.lua /root/whitetoad.ru/bin/serve.fnl +ExecStart=/usr/local/bin/luna -l 127.0.0.1:3001 -n 4 /root/whitetoad.ru/bin/serve.fnl [Install] WantedBy=multi-user.target diff --git a/main.lua b/main.lua deleted file mode 100644 index c038ba1..0000000 --- a/main.lua +++ /dev/null @@ -1,5 +0,0 @@ -assert(arg[1], "lua: file name must be specified") -local fennel = require("vendor.fennel") -debug.traceback = fennel.traceback -fennel.install() -return fennel.dofile(arg[1]) @@ -3,30 +3,23 @@ set -e usage () { echo "Usage: - serve [--jit] Serve the site pages + serve WORKERS Serve the site pages deploy Deploy changes to the production server" } serve () { - variant="$1" - if [ "$variant" = "--jit" ]; then - echo "running jit" - go run -tags jit ../. -n 1 main.lua bin/serve.fnl - else - echo "running puc" - LUA_CPATH="/usr/local/lib/lua/5.4/?.so;/usr/local/lib/lua/5.4/loadall.so;./?.so;$(guix build lua-lpeg)/lib/lua/5.3/?.so" \ - go run -tags puc ../. -n 1 main.lua bin/serve.fnl - fi + echo "running jit" + go run -tags jit ../. -n ${1:-1} bin/serve.fnl } deploy () { git stash -u scp -r bin root@everytea.ru:~/whitetoad.ru/ scp -r pages root@everytea.ru:~/whitetoad.ru/ + scp -r etc root@everytea.ru:~/whitetoad.ru/ + scp -r vendor root@everytea.ru:~/whitetoad.ru/ scp static/* root@everytea.ru:~/whitetoad.ru/static/ || true scp -r static/fonts root@everytea.ru:~/whitetoad.ru/static/fonts - scp -r vendor root@everytea.ru:~/whitetoad.ru/ - scp main.lua root@everytea.ru:~/whitetoad.ru/ scp forms.fnl root@everytea.ru:~/whitetoad.ru/ scp lib.fnl root@everytea.ru:~/whitetoad.ru/ scp macros.fnl root@everytea.ru:~/whitetoad.ru/ diff --git a/static/style.css b/static/style.css index 6b25428..8f06a61 100644 --- a/static/style.css +++ b/static/style.css @@ -155,20 +155,7 @@ nav a.active { margin-bottom: 1rem; } -.logo::before { - background-image: url("/static/logo-bg.png"); - background-repeat: no-repeat; - background-size: cover; - position: absolute; - left: -50px; - top: -58px; - z-index: -1; - content: ""; - width: 215px; - height: 215px; -} - -.logo img, +.logo-img, .logo a { height: 95px; width: 108.38px; @@ -178,9 +165,19 @@ nav a.active { font-weight: 900; } -.logo .glasses { +.logo-bg { + position: absolute; + left: -50px; + top: -58px; + z-index: -1; + width: 215px; + height: 215px; + object-fit: cover; +} + +.logo-glasses { position: absolute; - top: -10px; + top: 10px; left: 35px; width: 70px; object-fit: contain; diff --git a/templates.fnl b/templates.fnl index fb9a882..d0b74ae 100644 --- a/templates.fnl +++ b/templates.fnl @@ -20,7 +20,7 @@ "Посещение по предварительной договоренности, " "стоимость 500 рублей с человека.")}] [:style {} [:NO-ESCAPE (read-file "static/style.css")]] - [:link {:rel "icon" :href "https://whitetoad.ru/static/favicon.svg" + [:link {:rel "icon" :href "/static/favicon.svg" :type "image/svg+xml"}]] [:body {} [:main {:class "container"} (table.concat content)]]])) @@ -28,15 +28,17 @@ (fn header [current-path authenticated?] (local logo (HTML - [:img {:src "/static/logo.svg" + [:img {:class "logo-img" :src "/static/logo.svg" :alt "Белая жаба в мультяшном стиле с чайником на голове"}])) (HTML [:article {:class "article"} [:div {:class "logo"} + (HTML [:img {:class "logo-bg" :src "/static/logo-bg.png" + :alt "Солнце за логотипом, фон"}]) (if authenticated? - (HTML [:img {:class "glasses" :src "/static/glasses.png" - :alt "Солнцезащитные очки"}]) + (HTML [:img {:class "logo-glasses" :src "/static/glasses.png" + :alt "Солнцезащитные очки"}]) "") (if (~= current-path "") (HTML [:a {:href "/" :class "d-inline-block"} logo]) @@ -1,5 +1,4 @@ (import-macros {:compile-html HTML} :macros) -(local fennel (require :vendor.fennel)) (fn improve-typography [text] (var result |
