Update to Anubis v1.28.2 (#1)
This upgrades the Masyunis fork from Anubis v1.25.0 to the latest stable release, **v1.28.2** (“Wuk Lamat Echo 2”), while keeping the fork’s custom styling and removals. ## Approach The Gitea repo is a tree snapshot of v1.25.0, not a git-level fork of [TecharoHQ/anubis](https://github.com/TecharoHQ/anubis). The histories share no commits, so a merge or rebase onto the upstream tag is not usable. The first commit on this branch replaces the tree with a snapshot of the **v1.28.2** tag (`git rm -r` plus `git checkout v1.28.2 -- .`; the import tree is identical to the tag). A short patch series on top restores the Masyunis customizations. ## Customizations kept - Masyunya mascots (`web/static/img/{happy,pensive,reject}.webp`), hashes match current `master`. - `web/static/img/ATTRIBUTIONS.txt` stays deleted. - Challenge footer: drop the `made_with` (Canada / maple-leaf) line and the CELPHASE mascot credit; keep “Protected by Anubis from Techaro”. The generated `web/index_templ.go` matches `go generate ./web`. - Short README (the old `anubisc` typo is fixed). - Version stamped `v1.28.2/masyunis` via Makefile ldflags. `anubis.go` `init()` does not overwrite a link-time version; `go run` / `go test` still report `devel` on purpose. - Upstream `.github`, `.devcontainer`, `.husky`, and `.vscode` stay deleted. - `"uk"` is removed from `lib/localization/locales/manifest.json` **on purpose**, because of Alpine locale problems. `uk.json` and its test entry stay; the served manifest lists 27 languages. - `package.json` `prepare` no longer runs `husky` (the hooks directory is gone). The rest of the script is unchanged. `husky` remains in devDependencies, as upstream left it. ## Deploy notes - **Cookie rename (v1.27):** with the default `DYNAMIC_COOKIE_SUFFIX=true`, cookie names become e.g. `techaro.lol-anubis-auth-<hash>`. Existing clients get a **one-time re-challenge**. That is expected, not a loop. - **Docker / ko / yeet builds** skip the Makefile ldflags, so the displayed version is `<git-version>/masyunis`. It is `v1.28.2/masyunis` only when built from a `v1.28.2` tag (or via `make build` / `make prebaked-build`). - Go 1.27.3 is required (upstream bump in v1.28.2). Thoth (`THOTH_URL` / `THOTH_TOKEN`) was removed upstream; those settings now warn and do nothing. New WASM challenge methods stay disabled unless opted in. ## Verification - `make build` succeeds. `./var/anubis --version` prints `Anubis v1.28.2/masyunis`. - `SKIP_INTEGRATION=1 go test ./...` passes (unit tests; integration package is skipped). - Local challenge/reject pages (en and ru) show Masyunya, version `v1.28.2/masyunis`, and no Canada / CELPHASE / mascot-credit text. Screenshots:   - Upstream Playwright tests (`make test` without `SKIP_INTEGRATION`) fail on this box because the browser download fails. A clean v1.28.2 tree fails the same three Playwright tests here, so this is not a fork regression. - `npm audit` reports **4** findings in upstream’s lockfile (2 moderate, 2 high: `brace-expansion`, `fast-uri`, `lodash.trim`, `source-map-js`). Left alone. Please review and merge when ready. I will not merge this myself. Reviewed-on: #1 Co-authored-by: Lead <3+lead_bot@noreply.git.unvr.site>
This commit was merged in pull request #1.
This commit is contained in:
1 parent
eb3e46d8d0
commit
caf4d72880
529 files changed
+33015
-6659
No files matched your search
@@ -0,0 +1,320 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import clsx from "clsx";
|
||||
import styles from "./styles.module.css";
|
||||
|
||||
// The diagram shows a 64 bit hash rather than a full SHA-256 digest. Real
|
||||
// hashes are 256 bits, but 64 of them fit on a phone screen and the point
|
||||
// about bits versus nibbles is the same either way.
|
||||
const HASH_BYTES = 8;
|
||||
const HEX_CHARS = HASH_BYTES * 2;
|
||||
const HASH_BITS = HASH_BYTES * 8;
|
||||
|
||||
// Each row of the diagram covers four hex characters, so 16 bits.
|
||||
const HEX_PER_CHUNK = 4;
|
||||
const BITS_PER_CHUNK = HEX_PER_CHUNK * 4;
|
||||
const CHUNKS = HEX_CHARS / HEX_PER_CHUNK;
|
||||
|
||||
// A fixed starting hash so the server-rendered markup matches the first
|
||||
// client render. Mining replaces it with random hashes.
|
||||
const INITIAL_HEX = "f3a2b1c4d5e6f7a8";
|
||||
const INITIAL_BIN = hexToBin(INITIAL_HEX);
|
||||
|
||||
// Number of hashes to try per animation frame. High enough to feel like
|
||||
// mining, low enough to keep the page responsive.
|
||||
const HASHES_PER_FRAME = 200;
|
||||
|
||||
// How often the hash display is allowed to change when the reader has asked
|
||||
// for reduced motion. Mining still runs every frame; only the repaint slows
|
||||
// down, which turns a 60fps strobe into a readable ticker.
|
||||
const REDUCED_MOTION_PAINT_MS = 400;
|
||||
|
||||
// Converts a hex string into its binary expansion, four bits per character.
|
||||
function hexToBin(hex) {
|
||||
return hex
|
||||
.split("")
|
||||
.map((c) => parseInt(c, 16).toString(2).padStart(4, "0"))
|
||||
.join("");
|
||||
}
|
||||
|
||||
// Generates a random hash value in both hex and binary form.
|
||||
function generateRandomHash() {
|
||||
const buffer = new Uint8Array(HASH_BYTES);
|
||||
crypto.getRandomValues(buffer);
|
||||
const hex = Array.from(buffer)
|
||||
.map((byte) => byte.toString(16).padStart(2, "0"))
|
||||
.join("");
|
||||
return { hex, bin: hexToBin(hex) };
|
||||
}
|
||||
|
||||
// Reports whether a hash clears the target: `difficulty` leading zero bits in
|
||||
// bit mode, or `difficulty` leading zero hex characters in nibble mode.
|
||||
function meetsTarget(mode, difficulty, hex, bin) {
|
||||
const prefix = "0".repeat(difficulty);
|
||||
return mode === "bit" ? bin.startsWith(prefix) : hex.startsWith(prefix);
|
||||
}
|
||||
|
||||
// Tracks the reader's reduced motion preference. Starts false so the server
|
||||
// and the first client render agree, then corrects itself on mount.
|
||||
function usePrefersReducedMotion() {
|
||||
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
||||
setPrefersReducedMotion(query.matches);
|
||||
|
||||
const handleChange = (event) => setPrefersReducedMotion(event.matches);
|
||||
query.addEventListener("change", handleChange);
|
||||
return () => query.removeEventListener("change", handleChange);
|
||||
}, []);
|
||||
|
||||
return prefersReducedMotion;
|
||||
}
|
||||
|
||||
export default function DifficultyVisualizer() {
|
||||
const [mode, setMode] = useState("nibble");
|
||||
const [difficulty, setDifficulty] = useState(1);
|
||||
const [nonce, setNonce] = useState(0);
|
||||
const [hashHex, setHashHex] = useState(INITIAL_HEX);
|
||||
const [hashBin, setHashBin] = useState(INITIAL_BIN);
|
||||
const [isMining, setIsMining] = useState(false);
|
||||
const frameRef = useRef(null);
|
||||
const untalliedRef = useRef(0);
|
||||
const lastPaintRef = useRef(0);
|
||||
const prefersReducedMotion = usePrefersReducedMotion();
|
||||
|
||||
const maxDifficulty = mode === "bit" ? HASH_BITS : HEX_CHARS;
|
||||
const isSolved = nonce > 0 && meetsTarget(mode, difficulty, hashHex, hashBin);
|
||||
const isSlow =
|
||||
(mode === "bit" && difficulty > 20) ||
|
||||
(mode === "nibble" && difficulty > 5);
|
||||
|
||||
// Drives the mining loop. Reruns whenever the target changes so the loop
|
||||
// always tests against the current mode and difficulty.
|
||||
useEffect(() => {
|
||||
if (!isMining) return;
|
||||
|
||||
const mineStep = () => {
|
||||
let found = false;
|
||||
let latest = null;
|
||||
|
||||
for (let i = 0; i < HASHES_PER_FRAME; i++) {
|
||||
untalliedRef.current++;
|
||||
latest = generateRandomHash();
|
||||
if (meetsTarget(mode, difficulty, latest.hex, latest.bin)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Under reduced motion, keep hashing at full speed but let the display
|
||||
// settle between updates. The winning hash always paints immediately.
|
||||
const now = performance.now();
|
||||
const shouldPaint =
|
||||
found ||
|
||||
!prefersReducedMotion ||
|
||||
now - lastPaintRef.current >= REDUCED_MOTION_PAINT_MS;
|
||||
|
||||
if (shouldPaint) {
|
||||
const tried = untalliedRef.current;
|
||||
untalliedRef.current = 0;
|
||||
lastPaintRef.current = now;
|
||||
setNonce((prev) => prev + tried);
|
||||
setHashHex(latest.hex);
|
||||
setHashBin(latest.bin);
|
||||
}
|
||||
|
||||
if (found) {
|
||||
setIsMining(false);
|
||||
} else {
|
||||
frameRef.current = requestAnimationFrame(mineStep);
|
||||
}
|
||||
};
|
||||
|
||||
frameRef.current = requestAnimationFrame(mineStep);
|
||||
|
||||
return () => {
|
||||
if (frameRef.current !== null) {
|
||||
cancelAnimationFrame(frameRef.current);
|
||||
frameRef.current = null;
|
||||
}
|
||||
|
||||
// Stopping between throttled repaints would otherwise drop the hashes
|
||||
// tried since the last one, leaving the nonce reading low.
|
||||
if (untalliedRef.current > 0) {
|
||||
const tried = untalliedRef.current;
|
||||
untalliedRef.current = 0;
|
||||
setNonce((prev) => prev + tried);
|
||||
}
|
||||
};
|
||||
}, [isMining, mode, difficulty, prefersReducedMotion]);
|
||||
|
||||
const handleModeChange = (nextMode) => {
|
||||
setMode(nextMode);
|
||||
setDifficulty(1);
|
||||
setIsMining(false);
|
||||
};
|
||||
|
||||
const handleDifficultyChange = (event) => {
|
||||
setDifficulty(Number(event.target.value));
|
||||
setIsMining(false);
|
||||
};
|
||||
|
||||
const handleMineClick = () => {
|
||||
setNonce(0);
|
||||
untalliedRef.current = 0;
|
||||
lastPaintRef.current = 0;
|
||||
setIsMining(true);
|
||||
};
|
||||
|
||||
const handleStopClick = () => {
|
||||
setIsMining(false);
|
||||
};
|
||||
|
||||
// Renders one slice of the hash: a few hex characters with the bits they
|
||||
// encode lined up directly underneath them.
|
||||
const renderChunk = (chunkIndex) => {
|
||||
const hexOffset = chunkIndex * HEX_PER_CHUNK;
|
||||
const binOffset = chunkIndex * BITS_PER_CHUNK;
|
||||
const hexChunk = hashHex.slice(hexOffset, hexOffset + HEX_PER_CHUNK);
|
||||
const binChunk = hashBin.slice(binOffset, binOffset + BITS_PER_CHUNK);
|
||||
|
||||
return (
|
||||
<div key={chunkIndex} className={styles.chunk}>
|
||||
{chunkIndex === 0 && (
|
||||
<div className={styles.sectionLabel}>Hexadecimal</div>
|
||||
)}
|
||||
<div className={styles.hexRow}>
|
||||
{hexChunk.split("").map((char, localIndex) => {
|
||||
const index = hexOffset + localIndex;
|
||||
const isTarget = mode === "nibble" && index < difficulty;
|
||||
return (
|
||||
<div
|
||||
key={`hex-${index}`}
|
||||
className={clsx(
|
||||
styles.hexCell,
|
||||
isTarget && (char === "0" ? styles.cellHit : styles.cellBad),
|
||||
)}
|
||||
>
|
||||
{char}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{chunkIndex === 0 && (
|
||||
<div className={styles.sectionLabel}>Binary ({HASH_BITS} bits)</div>
|
||||
)}
|
||||
<div className={styles.binRow}>
|
||||
{binChunk.split("").map((bit, localIndex) => {
|
||||
const index = binOffset + localIndex;
|
||||
const isBitTarget = mode === "bit" && index < difficulty;
|
||||
const isNibbleTarget =
|
||||
mode === "nibble" && Math.floor(index / 4) < difficulty;
|
||||
const isZero = bit === "0";
|
||||
|
||||
let state = null;
|
||||
if (isBitTarget) {
|
||||
state = isZero ? styles.cellOk : styles.cellBad;
|
||||
} else if (isNibbleTarget) {
|
||||
state = isZero ? styles.cellHit : styles.cellBad;
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={`bin-${index}`} className={clsx(styles.binCell, state)}>
|
||||
{bit}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
{/* Controls */}
|
||||
<div className={styles.controls}>
|
||||
<div className={styles.controlGroup}>
|
||||
<span className={styles.label}>Measurement mode</span>
|
||||
<div className={styles.modeButtons}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleModeChange("nibble")}
|
||||
className={clsx(
|
||||
styles.modeButton,
|
||||
mode === "nibble" && styles.modeButtonActiveHit,
|
||||
)}
|
||||
>
|
||||
Nibbles (hex)
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleModeChange("bit")}
|
||||
className={clsx(
|
||||
styles.modeButton,
|
||||
mode === "bit" && styles.modeButtonActiveOk,
|
||||
)}
|
||||
>
|
||||
Bits (binary)
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.controlGroup}>
|
||||
<label
|
||||
htmlFor="dv-difficulty"
|
||||
className={clsx(styles.label, styles.labelRow)}
|
||||
>
|
||||
<span>Target difficulty</span>
|
||||
<span className={styles.difficultyValue}>
|
||||
{difficulty} {mode}
|
||||
{difficulty === 1 ? "" : "s"}
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
id="dv-difficulty"
|
||||
type="range"
|
||||
min="1"
|
||||
max={maxDifficulty}
|
||||
value={difficulty}
|
||||
onChange={handleDifficultyChange}
|
||||
className={styles.slider}
|
||||
/>
|
||||
<div className={styles.hintRow}>
|
||||
<p className={styles.hint}>
|
||||
{mode === "nibble" ? difficulty * 4 : difficulty} / {HASH_BITS}{" "}
|
||||
leading zero bits
|
||||
</p>
|
||||
{isSlow && <p className={styles.warning}>Slow</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Mining dashboard */}
|
||||
<div className={styles.dashboard}>
|
||||
{!isMining && isSolved && <div className={styles.successGlow} />}
|
||||
|
||||
<div className={styles.statusRow}>
|
||||
<div className={styles.nonce}>
|
||||
Nonce:
|
||||
<span className={styles.nonceValue}>{nonce.toLocaleString()}</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={isMining ? handleStopClick : handleMineClick}
|
||||
className={clsx(
|
||||
styles.mineButton,
|
||||
isMining && styles.mineButtonMining,
|
||||
)}
|
||||
>
|
||||
{isMining ? "Stop mining" : "Start mining"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className={styles.hashGrid}>
|
||||
{Array.from({ length: CHUNKS }, (_, i) => renderChunk(i))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
/* Theme tokens. Light values are the default, dark values override below. */
|
||||
.container {
|
||||
--dv-surface: var(--ifm-background-surface-color);
|
||||
--dv-raised: var(--ifm-color-emphasis-100);
|
||||
--dv-sunken: var(--ifm-color-emphasis-200);
|
||||
--dv-border: var(--ifm-color-emphasis-300);
|
||||
--dv-muted: var(--ifm-color-emphasis-700);
|
||||
|
||||
--dv-hit-text: var(--ifm-color-primary-dark);
|
||||
--dv-hit-border: var(--ifm-color-primary);
|
||||
--dv-hit-bg: rgb(255 86 48 / 0.12);
|
||||
|
||||
--dv-ok-text: rgb(21 128 61);
|
||||
--dv-ok-border: rgb(34 197 94);
|
||||
--dv-ok-bg: rgb(34 197 94 / 0.12);
|
||||
|
||||
--dv-bad-text: rgb(185 28 28);
|
||||
--dv-bad-border: rgb(239 68 68);
|
||||
--dv-bad-bg: rgb(239 68 68 / 0.12);
|
||||
}
|
||||
|
||||
[data-theme="dark"] .container {
|
||||
--dv-hit-text: var(--ifm-color-primary-lighter);
|
||||
--dv-hit-bg: rgb(255 86 48 / 0.18);
|
||||
|
||||
--dv-ok-text: rgb(74 222 128);
|
||||
--dv-ok-bg: rgb(34 197 94 / 0.18);
|
||||
|
||||
--dv-bad-text: rgb(248 113 113);
|
||||
--dv-bad-bg: rgb(239 68 68 / 0.18);
|
||||
}
|
||||
|
||||
/* Main container styles */
|
||||
.container {
|
||||
width: 100%;
|
||||
max-width: 40rem;
|
||||
margin: 1.5rem auto;
|
||||
overflow: hidden;
|
||||
color: var(--ifm-font-color-base);
|
||||
background-color: var(--dv-raised);
|
||||
border: 1px solid var(--dv-border);
|
||||
border-radius: var(--ifm-global-radius);
|
||||
}
|
||||
|
||||
/* Control panel styles */
|
||||
.controls {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem;
|
||||
border-bottom: 1px solid var(--dv-border);
|
||||
}
|
||||
|
||||
.controlGroup {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: block;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.375rem;
|
||||
}
|
||||
|
||||
.labelRow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.difficultyValue {
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
font-weight: 400;
|
||||
padding: 0.125rem 0.375rem;
|
||||
background-color: var(--dv-sunken);
|
||||
border-radius: var(--ifm-global-radius);
|
||||
}
|
||||
|
||||
/* Mode switch styles */
|
||||
.modeButtons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.modeButton {
|
||||
font: inherit;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
padding: 0.375rem 0.75rem;
|
||||
color: var(--ifm-font-color-base);
|
||||
background-color: var(--dv-sunken);
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--ifm-global-radius);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color 200ms,
|
||||
color 200ms;
|
||||
}
|
||||
|
||||
.modeButton:hover {
|
||||
background-color: var(--dv-border);
|
||||
}
|
||||
|
||||
.modeButtonActiveHit,
|
||||
.modeButtonActiveHit:hover {
|
||||
color: var(--ifm-button-color);
|
||||
background-color: var(--ifm-color-primary);
|
||||
}
|
||||
|
||||
.modeButtonActiveOk,
|
||||
.modeButtonActiveOk:hover {
|
||||
color: var(--ifm-button-color);
|
||||
background-color: rgb(21 128 61);
|
||||
}
|
||||
|
||||
/* Difficulty slider styles */
|
||||
.slider {
|
||||
display: block;
|
||||
width: 100%;
|
||||
accent-color: var(--ifm-color-primary);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.hintRow {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: 0.75rem;
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
color: var(--dv-muted);
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.warning {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--ifm-color-warning-darkest);
|
||||
margin-bottom: 0;
|
||||
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .warning {
|
||||
color: var(--ifm-color-warning);
|
||||
}
|
||||
|
||||
/* Mining dashboard styles */
|
||||
.dashboard {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.successGlow {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-color: var(--dv-ok-bg);
|
||||
pointer-events: none;
|
||||
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
||||
}
|
||||
|
||||
.statusRow {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
|
||||
.nonce {
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
font-size: 0.8125rem;
|
||||
color: var(--dv-muted);
|
||||
padding: 0.375rem 0.625rem;
|
||||
background-color: var(--dv-surface);
|
||||
border: 1px solid var(--dv-border);
|
||||
border-radius: var(--ifm-global-radius);
|
||||
}
|
||||
|
||||
.nonceValue {
|
||||
color: var(--ifm-font-color-base);
|
||||
margin-left: 0.375rem;
|
||||
}
|
||||
|
||||
.mineButton {
|
||||
font: inherit;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 700;
|
||||
padding: 0.5rem 1rem;
|
||||
color: var(--ifm-button-color);
|
||||
background-color: var(--ifm-color-primary);
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--ifm-global-radius);
|
||||
cursor: pointer;
|
||||
transition: background-color 200ms;
|
||||
}
|
||||
|
||||
.mineButton:hover {
|
||||
background-color: var(--ifm-color-primary-dark);
|
||||
}
|
||||
|
||||
.mineButtonMining,
|
||||
.mineButtonMining:hover {
|
||||
color: var(--dv-bad-text);
|
||||
background-color: var(--dv-bad-bg);
|
||||
border-color: var(--dv-bad-border);
|
||||
}
|
||||
|
||||
/* Hash display styles */
|
||||
.hashGrid {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
max-width: 32rem;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.chunk {
|
||||
padding: 0.5rem;
|
||||
background-color: var(--dv-surface);
|
||||
border: 1px solid var(--dv-border);
|
||||
border-radius: var(--ifm-global-radius);
|
||||
}
|
||||
|
||||
.sectionLabel {
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--dv-muted);
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
/* Both rows share one 16 column grid, and each hex cell spans four columns.
|
||||
That puts every hex character directly above the four bits it encodes
|
||||
without needing spacer elements. */
|
||||
.hexRow,
|
||||
.binRow {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(16, minmax(0, 1fr));
|
||||
gap: 2px;
|
||||
font-family: var(--ifm-font-family-monospace);
|
||||
}
|
||||
|
||||
.hexRow {
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
|
||||
.hexCell {
|
||||
grid-column: span 4;
|
||||
height: 2.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--dv-muted);
|
||||
background-color: var(--dv-sunken);
|
||||
border: 1px solid var(--dv-border);
|
||||
border-radius: var(--ifm-global-radius);
|
||||
transition: all 200ms;
|
||||
}
|
||||
|
||||
.binRow {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.binCell {
|
||||
height: 1.75rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--dv-muted);
|
||||
background-color: var(--dv-sunken);
|
||||
border-bottom: 2px solid var(--dv-border);
|
||||
transition: all 200ms;
|
||||
}
|
||||
|
||||
/* Cell highlight states */
|
||||
.cellHit {
|
||||
color: var(--dv-hit-text);
|
||||
background-color: var(--dv-hit-bg);
|
||||
border-color: var(--dv-hit-border);
|
||||
}
|
||||
|
||||
.cellOk {
|
||||
color: var(--dv-ok-text);
|
||||
background-color: var(--dv-ok-bg);
|
||||
border-color: var(--dv-ok-border);
|
||||
}
|
||||
|
||||
.cellBad {
|
||||
color: var(--dv-bad-text);
|
||||
background-color: var(--dv-bad-bg);
|
||||
border-color: var(--dv-bad-border);
|
||||
}
|
||||
|
||||
/* Glow animation */
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
/* Responsive styles */
|
||||
@media (min-width: 768px) {
|
||||
.controls {
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Every nested padding costs the bit grid 16 columns worth of width, so trim
|
||||
the padding and the type together on small screens. */
|
||||
@media (max-width: 480px) {
|
||||
.controls,
|
||||
.dashboard {
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.chunk {
|
||||
padding: 0.375rem;
|
||||
}
|
||||
|
||||
.hexRow {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.hexCell {
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.binRow {
|
||||
font-size: 0.625rem;
|
||||
}
|
||||
|
||||
.binCell {
|
||||
height: 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.warning,
|
||||
.successGlow {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.modeButton,
|
||||
.mineButton,
|
||||
.hexCell,
|
||||
.binCell {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user