diff --git a/assets/css/index.css b/assets/css/index.css index abddf45..d386af6 100644 --- a/assets/css/index.css +++ b/assets/css/index.css @@ -1,30 +1,42 @@ @import url('https://fonts.cdnfonts.com/css/jetbrains-mono-2'); :root { - --font-family: "JetBrains Mono", monospace; - --line-height: 1.20rem; + // --font-family: "Pixel Code", monospace; + // --font-family: "Maple Mono", monospace; + // --font-family: "JetBrains Mono", monospace; + --font-family: "Iosevka", monospace; + // --font-family-alt: "Pixel Code", monospace; + // --font-family-alt: "AcPlus IBM VGA 9x16", monospace; + --font-family-titles: "AcPlus IBM VGA 9x16", monospace; + // --font-family-titles: "Maple Mono", monospace; + // --font-family-titles: "Pixel Code", monospace; + --line-height: 1.40rem; --border-thickness: 2px; - --text-color: #000; + --text-color: #333; --text-color-alt: #666; + --text-color-accent: #000; --background-color: #fff; --background-color-alt: #eee; + // --transform: uppercase; --font-weight-normal: 500; --font-weight-medium: 600; --font-weight-bold: 800; + --font-weight-titles: 600; font-family: var(--font-family); font-optical-sizing: auto; font-weight: var(--font-weight-normal); font-style: normal; font-variant-numeric: tabular-nums lining-nums; - font-size: 16px; + font-size: 13px; } @media (prefers-color-scheme: dark) { :root { - --text-color: #fff; - --text-color-alt: #aaa; + --text-color: #aaa; + --text-color-alt: #898; + --text-color-accent: #ddd; --background-color: #000; --background-color-alt: #111; } @@ -55,7 +67,7 @@ body { width: 100%; margin: 0; padding: var(--line-height) 2ch; - max-width: calc(min(80ch, round(down, 100%, 1ch))); + max-width: calc(min(100ch, round(down, 100%, 1ch))); line-height: var(--line-height); overflow-x: hidden; } @@ -73,19 +85,25 @@ h1, h2, h3, h4, h5, h6 { font-weight: var(--font-weight-bold); margin: calc(var(--line-height) * 2) 0 var(--line-height); line-height: var(--line-height); + color: var(--text-color-accent); } h1 { - font-size: 2rem; + font-size: 6rem; line-height: calc(2 * var(--line-height)); margin-bottom: calc(var(--line-height) * 2); - text-transform: uppercase; + text-transform: var(--transform); + font-family: var(--font-family-titles); + font-weight: var(--font-weight-titles); } h2 { - font-size: 1rem; - text-transform: uppercase; + font-size: 2rem; + font-family: var(--font-family-titles); + font-weight: var(--font-weight-titles); + text-transform: var(--transform); + // margin-left: calc(var(--line-height) * 1); } - + text-transform: var(--transform) hr { position: relative; display: block; @@ -225,15 +243,18 @@ details :last-child { pre { white-space: pre; overflow-x: auto; - margin: var(--line-height) 0; + margin: 10px; + padding: 10px; + background: var(--background-color-alt); overflow-y: hidden; + color: var(--text-color-alt); } figure pre { margin: 0; } pre, code { - font-family: var(--font-family); + font-family: var(--font-family-alt); } code { @@ -347,7 +368,7 @@ button::-moz-focus-inner { } button { - text-transform: uppercase; + text-transform: var(--transform); font-weight: var(--font-weight-medium); cursor: pointer; } diff --git a/build.zig b/build.zig index 80a9ec7..11f6aee 100644 --- a/build.zig +++ b/build.zig @@ -12,4 +12,7 @@ pub fn build(b: *std.Build) !void { const install_step = b.addInstallFile(b.path("install"), "install"); b.getInstallStep().dependOn(&install_step.step); + + const install_key = b.addInstallFile(b.path("public.gpg"), "public.gpg"); + b.getInstallStep().dependOn(&install_key.step); } diff --git a/content/index.smd b/content/index.smd index bef6e37..cac4bb3 100644 --- a/content/index.smd +++ b/content/index.smd @@ -1,12 +1,14 @@ --- -.title = "Flow Control - a programmer's text editor", +.title = "Flow Control", .date = @date("2020-07-06T00:00:00"), .author = "CJ van den Berg", .layout = "home.shtml", .draft = false, --- -This is a programmer's text editor. It is under active development, but usually stable. +## a programmer's text editor + +Flow Control is under active development, but usually very stable. []($video.siteAsset('video/flow-control.mp4').controls(true)) @@ -30,7 +32,25 @@ This is a programmer's text editor. It is under active development, but usually ## 📦 Installation ### Installer -``` curl -fsSL https://www.flow-control.dev/install | sh ``` + +Install the latest release to `/usr/local/bin`: + +``` +curl -fsSL https://flow-control.dev/install | sh +``` + +Install latest nightly build and specify the install prefix: + +``` +curl -fsSL https://flow-control.dev/install | sh -s -- --nightly --prefix ~/.local/bin +``` + +Install latest nightly build and verify against gpg signature: + +``` +curl -fsSL https://flow-control.dev/install | sh -s -- --nightly --verify +``` + ### Prebuilt Binaries - Stable: [Releases](https://github.com/neurocyte/flow/releases) @@ -82,7 +102,7 @@ kitty_mod ctrl+alt flow file.zig:42 # Open at line 42 flow --language zig CMakeLists.txt # Force file type flow --list-languages # Show all supported languages -flow --help # Full list of command line options +flow --help # List of command line options ``` ## ⌨️ Key Controls diff --git a/install b/install index 4a8ed5f..a680b1b 100644 --- a/install +++ b/install @@ -1,42 +1,149 @@ #!/bin/sh - set -e -REPO="neurocyte/flow" -INSTALL_DIR="/usr/local/bin" +install_dir="/usr/local/bin" +add_alias=0 +nightly=0 +verify=0 +local=0 -# detect os and architecture -OS="$(uname -s | tr '[:upper:]' '[:lower:]')" -if [ "$OS" = "darwin" ]; then - OS="macos" +while true; do + case "${1}" in + -a | --alias) + add_alias=1 + shift 1 + ;; + -n | --nightly) + nightly=1 + shift 1 + ;; + -p | --prefix) + install_dir=/$2 + shift 2 + ;; + -V | --verify) + verify=1 + shift 1 + ;; + -l | --local) + local=1 + shift 1 + ;; + --) + shift 1 + break + ;; + *) break ;; + esac +done + +# prompt for nightly build option if interactive +if [ "$nightly" -eq 0 ] && [ -t 0 ]; then + printf "do you want to install a Nightly build? [y/N]: " + read -r answer_nightly + if [ "$answer_nightly" = "y" ] || [ "$answer_nightly" = "Y" ]; then + nightly=1 + fi fi -ARCH="$(uname -m)" -case "$ARCH" in - x86_64) ARCH="x86_64" ;; - arm64) ARCH="aarch64" ;; +if [ "$nightly" -eq 1 ]; then + repo="neurocyte/flow-nightly" +else + repo="neurocyte/flow" +fi + +# detect os and architecture +os="$(uname -s | tr '[:upper:]' '[:lower:]')" +if [ "$os" = "darwin" ]; then + os="macos" +fi + +arch="$(uname -m)" +case "$arch" in +x86_64) arch="x86_64" ;; +arm64) arch="aarch64" ;; +i686) arch="x86" ;; +i386) arch="x86" ;; esac # get latest version tag from github releases api -VERSION=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | cut -d'"' -f4) -[ -z "$VERSION" ] && { echo "failed to fetch latest version"; exit 1; } +version=$(curl -s "https://api.github.com/repos/$repo/releases/latest" | grep '"tag_name":' | cut -d'"' -f4) +[ -z "$version" ] && { + echo "failed to fetch latest version" + exit 1 +} # construct download url -FILENAME="flow-$VERSION-$OS-$ARCH" -EXT="tar.gz" -[ "$OS" = "windows" ] && EXT="zip" -URL="https://github.com/$REPO/releases/download/$VERSION/$FILENAME.$EXT" +# note: nightly assets are named like "flow---." +filename="flow-$version-$os-$arch" +ext="tar.gz" +if [ "$os" = "windows" ]; then + ext="zip" +fi +url="https://github.com/$repo/releases/download/$version/$filename.$ext" -echo "downloading flow $VERSION..." -curl -L "$URL" -o "/tmp/$FILENAME.$EXT" - -echo "installing flow..." -if [ "$EXT" = "tar.gz" ]; then - tar -xzf "/tmp/$FILENAME.$EXT" -C "$INSTALL_DIR" +if [ "$nightly" -eq 1 ]; then + echo "downloading NIGHTLY build $version..." else - unzip -o "/tmp/$FILENAME.$EXT" -d "$INSTALL_DIR" + echo "downloading flow $version..." fi -chmod +x "$INSTALL_DIR/flow" -rm "/tmp/$FILENAME.$EXT" -echo "flow installed successfully!" \ No newline at end of file +curl -fL "$url" -o "/tmp/$filename.$ext" + +# simple file size check (adjust threshold if needed) +filesize=$(stat -c%s "/tmp/$filename.$ext" 2>/dev/null || stat -f%z "/tmp/$filename.$ext") +if [ "$filesize" -lt 100 ]; then + echo "downloaded file appears to be invalid (size: ${filesize} bytes)" + exit 1 +fi + +if [ "$verify" -eq 0 ] && [ -t 0 ]; then + printf "do you want to download and verify the gpg signature? [y/N]: " + read -r answer_verify + if [ "$answer_verify" = "y" ] || [ "$answer_verify" = "Y" ]; then + verify=1 + fi +fi + +if [ "$verify" -eq 1 ]; then + curl -fL "$url.sig" -o "/tmp/$filename.$ext.sig" + curl -fL 'https://flow-control.dev/public.gpg' -o /tmp/flow-control-public.gpg + gpg --no-default-keyring --keyring /tmp/flow-control-public.gpg --verify "/tmp/$filename.$ext.sig" "/tmp/$filename.$ext" + + if [ "$local" -eq 1 ]; then + gpg --verify "/tmp/$filename.$ext.sig" "/tmp/$filename.$ext" + fi + + rm /tmp/flow-control-public.gpg + rm "/tmp/$filename.$ext.sig" +fi + +echo "installing $([ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow')..." +if [ "$ext" = "tar.gz" ]; then + tar -xzf "/tmp/$filename.$ext" -C "$install_dir" +else + unzip -o "/tmp/$filename.$ext" -d "$install_dir" +fi + +chmod +x "$install_dir/flow" +rm "/tmp/$filename.$ext" +echo "$([ "$nightly" -eq 1 ] && echo 'NIGHTLY build' || echo 'flow') installed successfully!" + +create_alias() { + if [ -e "$install_dir/f" ]; then + echo "warning: existing file or alias detected at $install_dir/f, overwriting..." + rm -f "$install_dir/f" + fi + ln -s "$install_dir/flow" "$install_dir/f" + echo "alias 'f' created successfully!" +} + +if [ "$add_alias" -eq 1 ]; then + create_alias +elif [ -t 0 ]; then + printf "do you want to create an alias 'f' for 'flow'? [y/N]: " + read -r answer_alias + if [ "$answer_alias" = "y" ] || [ "$answer_alias" = "Y" ]; then + create_alias + fi +fi diff --git a/public.gpg b/public.gpg new file mode 100644 index 0000000..f199e02 Binary files /dev/null and b/public.gpg differ