module Sabo::Tabby
Defined in:
sabo-tabby.crsabo-tabby/cli.cr
sabo-tabby/config.cr
sabo-tabby/error_handler.cr
sabo-tabby/helpers/utils.cr
sabo-tabby/init_handler.cr
sabo-tabby/log_handler.cr
sabo-tabby/ssl.cr
sabo-tabby/static_file_handler.cr
Constant Summary
-
APP_NAME =
"sabo-tabby"
-
The app name, shown in logs and CLI messages.
-
DIRECTORY_LISTING_INDEX =
{default: ":root{--bg:#222;--color-text:white;--color-border:rgba(255,255,255,.3);--theme:#f0db78;--item-border-width:.3rem;--item-border-radius:.7rem;}@media (prefers-color-scheme:light){:root{--bg:#fff;--color-text:black;--color-border:rgba(0,0,0,.3);--theme:#a56262}}h1{text-align:center;}", gradient: ":root{--bg:linear-gradient(to top,#0c3483 0%,#a2b6df 100%,#6b8cce 100%,#a2b6df 100%);--color-text:white;--color-border:rgba(255,255,255,.3);--theme:#FFD2C8;--item-border-width:.1rem;--item-border-radius:.1rem;}@media (prefers-color-scheme:light){:root{--bg:radial-gradient(circle farthest-corner at 10% 20%,rgba(253,101,133,1) 0%,rgba(255,211,165,1) 90%);--color-text:black;--color-border:rgba(0,0,0,.3);--theme:#4f476c}}h1{text-align:left;}", flat: ":root{--bg:#2b579a;--color-text:white;--color-border:white;--theme:white;--item-border-width:.1rem;--item-border-radius:0;}@media (prefers-color-scheme:light){:root{--bg:#0078d4}}h1{text-align:left;}a,a:visited{color:black!important;}.item{background-color:white;color:black;}.item:hover{color:black!important;box-shadow:0 6px 14px 0 rgba(0,0,0,.53),0 1px 3px 0 rgba(0,0,0,.50);}", material: ":root{--bg:#1B5E20;--color-text:white;--color-border:#9eaf9e;--theme:#4CAF50;--item-border-width:.1rem;--item-border-radius:2rem;--item-background-color:var(--bg);}@media (prefers-color-scheme:light){:root{--bg:#C8E6C9;--color-text:black}}h1{text-align:center;}a,a:visited{color:white!important;}.item{background-color:var(--theme);color:white!important;box-shadow:0 .5rem .5rem 0 rgba(0,0,0,.14),0 .25rem 1.25rem 0 rgba(0,0,0,.12),0 .75rem .25rem -.5rem rgba(0,0,0,.2);border-color:var(--theme)!important;}.item:hover{color:var(--color-text)!important;background-color:var(--item-background-color);box-shadow:none;border-color:var(--color-border)!important;}"}
-
CSS files for directory_listing
-
EMOJIS =
{base: {"🐈", "🐱"}, happy: {"😺", "😽", "😻", "😸"}, sad: {"😿", "🙀", "😾"}, sleepy: {"😴", "😪", "🥱", "💤", "🛏️"}}
-
Emojis used in logs.
-
ERROR_PAGE_INDEX =
{default: ":root{--bg:#222;--color-text:white;--theme:#f0db78;}@media (prefers-color-scheme:light){:root{--bg:#fff;--color-text:black;--theme:#a56262}}svg{fill:var(--color-text)}h1,h2,.btn{text-align:center;}h1{font-size:clamp(1.8rem,40vw,15rem);color:var(--theme);}h2{font-size:clamp(1rem,20vw,4rem);}.btn{text-decoration:underline;font-size:clamp(1rem,20vw,4rem);font-weight:bold;}.btn:hover{text-decoration:dashed;text-decoration-line:underline;color:var(--theme);}", tqila: ":root{--bg:#f05b72;--color-text:black;}h1,h2,.btn{text-align:center;}h1{font-size:clamp(1.8rem,40vw,15rem);}h2{font-size:clamp(1rem,20vw,4rem);}.btn{text-decoration:underline;font-size:clamp(1rem,20vw,4rem);font-weight:bold;}.btn:hover{text-decoration:dashed;text-decoration-line:underline;}", gradient: ":root{--bg:radial-gradient(circle farthest-corner at 10.2% 55.8%,rgba(252,37,103,1) 0%,rgba(250,38,151,1) 46.2%,rgba(186,8,181,1) 90.1%);--color-text:white;--btn-color:black;}@media (prefers-color-scheme:light){:root{--bg:radial-gradient(circle farthest-corner at 10% 20%,rgba(161,255,206,1) 0%,rgba(250,255,209,1) 90%);--color-text:black;--btn-color:white}}svg{fill:var(--color-text)}h1,h2,.btn{text-align:center;}h1{font-size:clamp(5rem,50vw,25rem);}h2{font-size:clamp(1rem,20vw,4rem);}.btn{font-size:clamp(1rem,20vw,4rem);font-weight:bold;padding:1rem 2rem;background-color:var(--color-text);margin:1rem;border-radius:100px;color:var(--btn-color)!important;text-decoration:none;}.btn:hover{box-shadow:0 6px 14px 0 rgba(0,0,0,.53),0 1px 3px 0 rgba(0,0,0,.50);}", boring: ":root{--bg:#2b579a;--color-text:white;}@media (prefers-color-scheme:light){:root{--bg:#0078d4}}svg{fill:var(--color-text)}h1,h2,.btn{text-align:left;position:relative;color:var(--color-text);}h1,h2{padding-left:2rem;}body{display:block!important}h1{font-size:clamp(1.8rem,40vw,15rem);}h2{font-size:clamp(1rem,20vw,4rem);}.btn{font-size:clamp(1rem,20vw,4rem);font-weight:bold;padding:0 1rem;background-color:white;margin:1rem;margin-left:2rem;border-radius:.1rem;color:black!important;text-decoration:none;text-shadow:none!important;}.btn:hover{box-shadow:0 6px 14px 0 rgba(0,0,0,.53),0 1px 3px 0 rgba(0,0,0,.50);}"}
-
CSS files for error_page
-
LICENSE =
{{ (run("./licenses.cr")).stringify }}
-
Licenses of sabo-tabby, kemal and shards
-
LOGO =
URI.encode_path({{ read_file("/srv/crystaldoc.info/github-GeopJr-sabo-tabby-v1.1.0/src/../logo.svg") }})
-
The app logo, URI encoded for usage in ecr.
-
RESET_CSS =
{{ read_file("/srv/crystaldoc.info/github-GeopJr-sabo-tabby-v1.1.0/src/sabo-tabby/ecr/css/reset.css") }}
-
The CSS reset used in all ecr templates.
-
SERVER_HEADER =
"#{Sabo::Tabby::APP_NAME}/#{Sabo::Tabby::VERSION}"
-
The
Server
header. -
VERSION =
{{ (((read_file("/srv/crystaldoc.info/github-GeopJr-sabo-tabby-v1.1.0/src/../shard.yml")).split("version: "))[1].split("\n"))[0] }}
-
The app version, read from its
shard.yml
.
Class Method Summary
- .config(&)
- .config
-
.display_startup_message(config : Sabo::Tabby::Config, server : HTTP::Server) : Nil
Logs a startup message.
-
.run(args : Array(String) | Nil = ARGV) : Nil
The command to run a
Sabo::Tabby
application. -
.stop : Nil
Stops the server.
Macro Summary
-
create_theme_index(name, styles)
Macro that expands an array of styles into an enum based on name and loads their CSS files in memory under a
NamedTuple
based on name.
Class Method Detail
Logs a startup message.
The command to run a Sabo::Tabby
application.
To use custom command line arguments, set args to nil
Macro Detail
Macro that expands an array of styles into an enum based on name and loads their CSS files in memory under a NamedTuple
based on name.