diff --git a/.gitattributes b/.gitattributes index 3c09e01..1ee55ba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,3 @@ *.glb binary *.mesh binary *.png binary -prebuilt/* binary diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3f24fd9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly + open-pull-requests-limit: 5 + + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..8012b94 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,86 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + - name: Verify tag matches Cone version + run: | + source_version=$(sed -n 's/^[[:space:]]*Version = "\([^"]*\)"/\1/p' utils/glb.go) + test "${GITHUB_REF_NAME}" = "v${source_version}" + - run: go test -race ./... + - run: go vet ./... + + build: + needs: verify + runs-on: ubuntu-latest + strategy: + matrix: + include: + - target: arm64 + goarch: arm64 + goarm: "" + - target: armv7 + goarch: arm + goarm: "7" + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: true + - name: Build release archive + env: + BUILD_GOARCH: ${{ matrix.goarch }} + BUILD_GOARM: ${{ matrix.goarm }} + TARGET: ${{ matrix.target }} + run: | + version="${GITHUB_REF_NAME#v}" + package="cone-v${version}-linux-${TARGET}" + mkdir -p "dist/${package}" + CGO_ENABLED=0 GOOS=linux GOARCH="${BUILD_GOARCH}" GOARM="${BUILD_GOARM}" \ + go build -buildvcs=false -trimpath -ldflags='-s -w' -o "dist/${package}/cone" . + go run github.com/google/go-licenses@v1.6.0 save ./... --save_path="dist/${package}/licenses" + mkdir -p "dist/${package}/licenses/fonts" + cp web/fonts/*.txt web/fonts/FONTS.md "dist/${package}/licenses/fonts/" + cp LICENSE README.md THIRD_PARTY_NOTICES.md "dist/${package}/" + tar -C dist -czf "dist/${package}.tar.gz" "${package}" + - uses: actions/upload-artifact@v4 + with: + name: cone-${{ matrix.target }} + path: dist/*.tar.gz + if-no-files-found: error + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + pattern: cone-* + path: dist + merge-multiple: true + - name: Create checksums + run: cd dist && sha256sum ./*.tar.gz > SHA256SUMS + - name: Publish GitHub release + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "${GITHUB_REF_NAME}" dist/*.tar.gz dist/SHA256SUMS \ + --repo "${GITHUB_REPOSITORY}" \ + --verify-tag \ + --generate-notes \ + --title "Cone ${GITHUB_REF_NAME}" diff --git a/.gitignore b/.gitignore index 2a7afa0..2825f96 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ /output/ /batch-output/ /data/ +/dist/ *~ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb2ddf8..228ea56 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,4 +8,6 @@ Cone welcomes focused bug fixes and performance improvements. 4. Run `go test -race ./...`, `go vet ./...`, and `go build ./...`. 5. Open a pull request explaining the behavior change and how it was tested. -For mesh-output changes, include a small synthetic regression test. Do not commit copyrighted texture packs or generated Roblox assets. +For mesh-output changes, include a small synthetic regression test. Do not +commit copyrighted texture packs, generated Roblox assets, or compiled release +binaries. Tagged-release automation builds binaries from the reviewed source. diff --git a/README.md b/README.md index 13c4c0e..5b43c9e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Cone +[![CI](https://github.com/qaustria/AutoPack-Go/actions/workflows/ci.yml/badge.svg)](https://github.com/qaustria/AutoPack-Go/actions/workflows/ci.yml) +[![Latest release](https://img.shields.io/github/v/release/qaustria/AutoPack-Go)](https://github.com/qaustria/AutoPack-Go/releases/latest) +[![License: MIT](https://img.shields.io/badge/license-MIT-orange.svg)](LICENSE) + Cone ports Minecraft 1.8.9 texture packs to Roblox. It finds supported item and block textures, resizes them to 512×512, creates edge-expanded texture variants, builds greedy-meshed item geometry, uploads the assets through Roblox Open Cloud, and returns the compressed JSON used by the game. ![Cone web interface](docs/cone-ui.png) @@ -76,9 +80,15 @@ uses the same port-history database and Discord notification path as a normal website conversion. ```bash +export CONE_BATCH_TOKEN="$(openssl rand -hex 32)" go run . batch 'https://docs.google.com/spreadsheets/d/SHEET_ID/edit#gid=0' ``` +The web server and batch command must receive the same `CONE_BATCH_TOKEN`. +Without it, administrative batch metadata is rejected so public clients cannot +forge batch progress in Discord notifications. Keep the token private and use a +separate value from every Roblox or Discord credential. + The sheet must be shared as **Anyone with the link → Viewer**, and download-link cells must contain their complete `https://...` URL. `ROBLOX_API_KEY` and `ROBLOX_USER_ID` select the Roblox account used for the import. The command @@ -125,8 +135,25 @@ go build ./... ## Raspberry Pi -The repository includes ARMv7 and ARM64 builds used by `deploy-pi.sh`. Install -nginx once, then deploy without compiling on the Pi: +Tagged releases provide ARMv7 and ARM64 archives with SHA-256 checksums and all +required third-party license files. `deploy-pi.sh` downloads and verifies the +release matching its configured Cone version, so the Pi does not compile Go. + +Store server-only values outside the checkout: + +```bash +sudo install -d -m 0700 /etc/cone +sudoedit /etc/cone/cone.env +``` + +Example `/etc/cone/cone.env`: + +```bash +CONE_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/REPLACE_ME +CONE_BATCH_TOKEN=REPLACE_WITH_OPENSSL_RAND_HEX_32 +``` + +Then install nginx once and deploy: ```bash sudo apt-get update && sudo apt-get install -y nginx @@ -135,10 +162,16 @@ git pull --ff-only origin master ./deploy-pi.sh ``` +Set `CONE_VERSION` only when intentionally deploying a different published +version, for example `sudo CONE_VERSION=1.5.0 ./deploy-pi.sh`. + ## Security Never commit `.env.go`. See [SECURITY.md](SECURITY.md) for credential handling and private vulnerability reporting. +Release archives include dependency licenses described in +[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). + ## License [MIT](LICENSE) diff --git a/SECURITY.md b/SECURITY.md index 8ca8d7e..f818fc4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -9,8 +9,12 @@ Please report security issues through a [private GitHub security advisory](https - The public web interface sends Roblox credentials only with the active conversion request. - Cone does not write request credentials to server storage or logs. - “Remember on this device” uses the browser's local storage and can be turned off. +- Browser local storage is not appropriate on shared or untrusted devices; turn + remembering off there and remove saved site data afterward. - Self-hosted CLI credentials belong in the ignored `.env.go` file or environment variables. - Always deploy Cone behind HTTPS before accepting credentials over a network. +- Administrative batch labels require a separate `CONE_BATCH_TOKEN`; never + reuse a Roblox API key or Discord webhook token for it. Rotate a credential immediately if it is accidentally committed, pasted into an issue, or exposed in logs. diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..88be200 --- /dev/null +++ b/THIRD_PARTY_NOTICES.md @@ -0,0 +1,18 @@ +# Third-party notices + +Cone depends on open-source packages under MIT, BSD-2-Clause, +BSD-3-Clause, and Apache-2.0 licenses. Every GitHub release archive includes +the exact dependency license files generated from the released Go dependency +graph under its `licenses/` directory. + +Direct dependencies include: + +- `github.com/klauspost/compress` — Apache-2.0 +- `github.com/robloxapi/rbxfile` — MIT +- `go.etcd.io/bbolt` — MIT + +Transitive dependencies and their license files are included automatically in +each release archive. Bundled web-font notices and full license texts are in +`web/fonts/`. + +Cone's own source code is licensed under the MIT License in `LICENSE`. diff --git a/batch.go b/batch.go index 05aa6c5..d509f24 100644 --- a/batch.go +++ b/batch.go @@ -98,6 +98,10 @@ func runBatch(ctx context.Context, args []string) error { if err := validateBatchEndpoint(endpoint); err != nil { return err } + batchToken := strings.TrimSpace(os.Getenv("CONE_BATCH_TOKEN")) + if len(batchToken) < 32 || len(batchToken) > 256 { + return errors.New("CONE_BATCH_TOKEN must contain between 32 and 256 characters") + } if err := os.MkdirAll(outputDir, 0o750); err != nil { return fmt.Errorf("create batch output directory: %w", err) } @@ -133,7 +137,7 @@ func runBatch(ctx context.Context, args []string) error { fmt.Printf("[%d/%d] FAILED %s: %v\n", index+1, len(queue), entry.Name, err) continue } - result, err := submitBatchPackWhenAvailable(ctx, client, endpoint, credentials, zipPath, filename, index+1, len(queue), func(progress ProgressEvent) { + result, err := submitBatchPackWhenAvailable(ctx, client, endpoint, credentials, batchToken, zipPath, filename, index+1, len(queue), func(progress ProgressEvent) { message := progress.Message if message == "" { message = progress.Name @@ -150,6 +154,12 @@ func runBatch(ctx context.Context, args []string) error { }) _ = os.Remove(zipPath) if err != nil { + if batchAuthenticationFailed(err) { + return fmt.Errorf( + "batch paused at [%d/%d] %s because Roblox rejected the credentials: %w; replace the API key or use an unmoderated owner, then rerun the same command to resume", + index+1, len(queue), entry.Name, err, + ) + } failed++ fmt.Printf("[%d/%d] FAILED %s: %v\n", index+1, len(queue), entry.Name, err) continue @@ -201,10 +211,22 @@ func (err *batchServerError) Error() string { return "Cone returned " + err.Status + ": " + err.Message } -func submitBatchPackWhenAvailable(ctx context.Context, client *http.Client, endpoint string, credentials robloxCredentials, zipPath, filename string, batchIndex, batchTotal int, progress ProgressFunc) (batchSubmitResult, error) { +// Authentication failures affect every remaining pack, so continuing would +// only hammer Roblox and hide the real problem behind hundreds of failures. +// The completed checkpoint stays intact and the same command can resume once +// working credentials are supplied. +func batchAuthenticationFailed(err error) bool { + var serverError *batchServerError + if !errors.As(err, &serverError) { + return false + } + return serverError.StatusCode == http.StatusUnauthorized || serverError.StatusCode == http.StatusForbidden +} + +func submitBatchPackWhenAvailable(ctx context.Context, client *http.Client, endpoint string, credentials robloxCredentials, batchToken, zipPath, filename string, batchIndex, batchTotal int, progress ProgressFunc) (batchSubmitResult, error) { deadline := time.Now().Add(30 * time.Minute) for { - result, err := submitBatchPack(ctx, client, endpoint, credentials, zipPath, filename, batchIndex, batchTotal, progress) + result, err := submitBatchPack(ctx, client, endpoint, credentials, batchToken, zipPath, filename, batchIndex, batchTotal, progress) var serverError *batchServerError if !errors.As(err, &serverError) || serverError.StatusCode != http.StatusTooManyRequests { return result, err @@ -227,7 +249,7 @@ func submitBatchPackWhenAvailable(ctx context.Context, client *http.Client, endp } } -func submitBatchPack(ctx context.Context, client *http.Client, endpoint string, credentials robloxCredentials, zipPath, filename string, batchIndex, batchTotal int, progress ProgressFunc) (batchSubmitResult, error) { +func submitBatchPack(ctx context.Context, client *http.Client, endpoint string, credentials robloxCredentials, batchToken, zipPath, filename string, batchIndex, batchTotal int, progress ProgressFunc) (batchSubmitResult, error) { file, err := os.Open(zipPath) if err != nil { return batchSubmitResult{}, fmt.Errorf("open queued pack: %w", err) @@ -265,6 +287,7 @@ func submitBatchPack(ctx context.Context, client *http.Client, endpoint string, request.Header.Set(robloxUserIDHeader, credentials.UserID) request.Header.Set(batchIndexHeader, strconv.Itoa(batchIndex)) request.Header.Set(batchTotalHeader, strconv.Itoa(batchTotal)) + request.Header.Set(batchTokenHeader, batchToken) response, err := client.Do(request) if err != nil { _ = reader.CloseWithError(err) diff --git a/batch_test.go b/batch_test.go index bc4dc71..59b2ae4 100644 --- a/batch_test.go +++ b/batch_test.go @@ -5,6 +5,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -67,6 +68,26 @@ func TestMediaFireFolderKeyAndSourceIdentity(t *testing.T) { } } +func TestBatchAuthenticationFailed(t *testing.T) { + tests := []struct { + name string + err error + want bool + }{ + {name: "unauthorized", err: &batchServerError{StatusCode: http.StatusUnauthorized}, want: true}, + {name: "forbidden", err: fmt.Errorf("submit pack: %w", &batchServerError{StatusCode: http.StatusForbidden}), want: true}, + {name: "bad pack", err: &batchServerError{StatusCode: http.StatusBadRequest}, want: false}, + {name: "download", err: errors.New("download failed"), want: false}, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if got := batchAuthenticationFailed(test.err); got != test.want { + t.Fatalf("batchAuthenticationFailed() = %t, want %t", got, test.want) + } + }) + } +} + func TestRunBatchQueuesSequentiallyAndResumes(t *testing.T) { zipBytes := testBatchZIP(t) zipPath := filepath.Join(t.TempDir(), "pack.zip") @@ -95,6 +116,10 @@ func TestRunBatchQueuesSequentiallyAndResumes(t *testing.T) { http.Error(response, "bad credentials", http.StatusUnauthorized) return } + if request.Header.Get(batchTokenHeader) != "test-batch-token-with-at-least-32-characters" { + http.Error(response, "bad batch token", http.StatusForbidden) + return + } current := active.Add(1) defer active.Add(-1) for { @@ -126,6 +151,7 @@ func TestRunBatchQueuesSequentiallyAndResumes(t *testing.T) { t.Setenv("ROBLOX_API_KEY", "test-api-key") t.Setenv("ROBLOX_USER_ID", "12345") t.Setenv("ROBLOX_GROUP_ID", "") + t.Setenv("CONE_BATCH_TOKEN", "test-batch-token-with-at-least-32-characters") t.Setenv("CONE_BATCH_ENDPOINT", server.URL+"/api/convert") temporary := t.TempDir() statePath := filepath.Join(temporary, "state", "queue.json") diff --git a/deploy-pi.sh b/deploy-pi.sh index 0ed64e7..c750fd6 100755 --- a/deploy-pi.sh +++ b/deploy-pi.sh @@ -6,12 +6,13 @@ if [ "$(id -u)" -ne 0 ]; then fi repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +cone_version=${CONE_VERSION:-1.5.0} case "$(uname -m)" in aarch64|arm64) - source_binary="$repo_dir/prebuilt/cone-linux-arm64" + release_target=arm64 ;; armv7l|armv7*) - source_binary="$repo_dir/prebuilt/cone-linux-armv7" + release_target=armv7 ;; *) echo "Unsupported Raspberry Pi architecture: $(uname -m)" >&2 @@ -19,14 +20,30 @@ case "$(uname -m)" in ;; esac -if [ ! -f "$source_binary" ]; then - echo "Missing prebuilt Cone binary: $source_binary" >&2 +for command in curl sha256sum tar nginx; do + if ! command -v "$command" >/dev/null 2>&1; then + echo "$command is required for the Cone Pi deployment." >&2 + echo "Install dependencies with: sudo apt-get update && sudo apt-get install -y nginx curl" >&2 + exit 1 + fi +done + +archive="cone-v${cone_version}-linux-${release_target}.tar.gz" +release_url="https://github.com/qaustria/AutoPack-Go/releases/download/v${cone_version}" +release_dir=$(mktemp -d /tmp/cone-release.XXXXXX) +trap 'rm -rf -- "$release_dir"' EXIT HUP INT TERM +curl -fsSL "$release_url/$archive" -o "$release_dir/$archive" +curl -fsSL "$release_url/SHA256SUMS" -o "$release_dir/SHA256SUMS" +checksum=$(awk -v archive="$archive" '$2 == "./" archive || $2 == archive { print; exit }' "$release_dir/SHA256SUMS") +if [ -z "$checksum" ]; then + echo "Release checksum is missing for $archive." >&2 exit 1 fi - -if ! command -v nginx >/dev/null 2>&1; then - echo "nginx is required for the Cone Pi deployment." >&2 - echo "Install it with: sudo apt-get update && sudo apt-get install -y nginx" >&2 +printf '%s\n' "$checksum" | (cd "$release_dir" && sha256sum -c -) +tar -xzf "$release_dir/$archive" -C "$release_dir" +source_binary="$release_dir/cone-v${cone_version}-linux-${release_target}/cone" +if [ ! -x "$source_binary" ]; then + echo "Release archive does not contain an executable Cone binary." >&2 exit 1 fi @@ -84,7 +101,7 @@ while [ "$i" -lt 20 ]; do if health=$(curl -fsS http://127.0.0.1:8080/healthz 2>/dev/null); then printf '%s\n' "$health" case "$health" in - *'"version":"1.4.9"'*) break ;; + *'"version":"'"$cone_version"'"'*) break ;; esac fi i=$((i + 1)) @@ -92,7 +109,7 @@ while [ "$i" -lt 20 ]; do done if [ "$i" -ge 20 ]; then - echo "Cone started, but its private healthz did not report version 1.4.9." >&2 + echo "Cone started, but its private healthz did not report version $cone_version." >&2 journalctl -u cone -n 30 --no-pager >&2 || true exit 1 fi @@ -102,12 +119,12 @@ systemctl restart nginx health=$(curl -fsS -H 'Host: qstr.xyz' http://127.0.0.1/healthz) printf '%s\n' "$health" case "$health" in - *'"version":"1.4.9"'*) ;; + *'"version":"'"$cone_version"'"'*) ;; *) - echo "nginx is running, but the proxied healthz did not report version 1.4.9." >&2 + echo "nginx is running, but the proxied healthz did not report version $cone_version." >&2 journalctl -u nginx -n 30 --no-pager >&2 || true exit 1 ;; esac -echo "Cone 1.4.9 is running through nginx on localhost:80." +echo "Cone $cone_version is running through nginx on localhost:80." diff --git a/deploy/systemd/cone-pi.conf b/deploy/systemd/cone-pi.conf index 5247ca9..97d61c6 100644 --- a/deploy/systemd/cone-pi.conf +++ b/deploy/systemd/cone-pi.conf @@ -1,3 +1,4 @@ [Service] Environment=AUTOPACK_ADDR=127.0.0.1:8080 Environment=CONE_MAX_CONCURRENT_PORTS=1 +EnvironmentFile=-/etc/cone/cone.env diff --git a/main.go b/main.go index 8a06143..f760fc1 100644 --- a/main.go +++ b/main.go @@ -160,6 +160,7 @@ func runWeb(ctx context.Context) error { } handler, err := NewCredentialWebHandlerWithOptions(newWebRequestProcessor, WebHandlerOptions{ Notifier: notifier, Store: store, MaxConcurrentPorts: maxConcurrentPorts, + BatchToken: strings.TrimSpace(os.Getenv("CONE_BATCH_TOKEN")), }) if err != nil { return err diff --git a/prebuilt/cone-linux-arm64 b/prebuilt/cone-linux-arm64 deleted file mode 100755 index ca94361..0000000 Binary files a/prebuilt/cone-linux-arm64 and /dev/null differ diff --git a/prebuilt/cone-linux-armv7 b/prebuilt/cone-linux-armv7 deleted file mode 100755 index 4e492e8..0000000 Binary files a/prebuilt/cone-linux-armv7 and /dev/null differ diff --git a/utils/glb.go b/utils/glb.go index 475a428..d5f7438 100644 --- a/utils/glb.go +++ b/utils/glb.go @@ -11,7 +11,7 @@ import ( const ( // Version identifies the AutoPack library in generated GLB metadata. - Version = "1.4.9" + Version = "1.5.0" glbMagic = 0x46546c67 glbVersion = 2 diff --git a/web.go b/web.go index 525a887..4f0910b 100644 --- a/web.go +++ b/web.go @@ -3,6 +3,7 @@ package main import ( "context" "crypto/sha256" + "crypto/subtle" "embed" "encoding/json" "errors" @@ -35,13 +36,17 @@ const ( robloxUserIDHeader = "X-Cone-Roblox-User-Id" batchIndexHeader = "X-Cone-Batch-Index" batchTotalHeader = "X-Cone-Batch-Total" + batchTokenHeader = "X-Cone-Batch-Token" defaultMaxConcurrentPorts = 2 ) +var errBatchAuthorization = errors.New("administrative batch credentials are invalid") + type WebHandlerOptions struct { Notifier PortNotifier Store *packstore.Store MaxConcurrentPorts int + BatchToken string } type webHandler struct { @@ -53,6 +58,7 @@ type webHandler struct { activeJobsMu sync.Mutex activeJobs map[[sha256.Size]byte]struct{} jobSlots chan struct{} + batchToken string } type webStreamEvent struct { @@ -72,7 +78,7 @@ func NewWebHandler(processor uploadProcessor) (http.Handler, error) { if err != nil { return nil, fmt.Errorf("load embedded web files: %w", err) } - handler := newWebHandler(assets, defaultMaxConcurrentPorts) + handler := newWebHandler(assets, defaultMaxConcurrentPorts, "") handler.processor = processor return handler.routes(), nil } @@ -105,22 +111,27 @@ func NewCredentialWebHandlerWithOptions(factory requestProcessorFactory, options if options.MaxConcurrentPorts < 1 || options.MaxConcurrentPorts > 32 { return nil, errors.New("maximum concurrent ports must be between 1 and 32") } + options.BatchToken = strings.TrimSpace(options.BatchToken) + if options.BatchToken != "" && (len(options.BatchToken) < 32 || len(options.BatchToken) > 256) { + return nil, errors.New("administrative batch token must be between 32 and 256 characters") + } assets, err := fs.Sub(embeddedWebFiles, "web") if err != nil { return nil, fmt.Errorf("load embedded web files: %w", err) } - handler := newWebHandler(assets, options.MaxConcurrentPorts) + handler := newWebHandler(assets, options.MaxConcurrentPorts, options.BatchToken) handler.processorFactory = factory handler.notifier = options.Notifier handler.packStore = options.Store return handler.routes(), nil } -func newWebHandler(assets fs.FS, maxConcurrentPorts int) *webHandler { +func newWebHandler(assets fs.FS, maxConcurrentPorts int, batchToken string) *webHandler { return &webHandler{ static: http.FileServer(http.FS(assets)), activeJobs: make(map[[sha256.Size]byte]struct{}), jobSlots: make(chan struct{}, maxConcurrentPorts), + batchToken: batchToken, } } @@ -149,9 +160,13 @@ func (h *webHandler) convert(response http.ResponseWriter, request *http.Request return } processor := h.processor - batchIndex, batchTotal, err := batchPositionFromHeaders(request.Header) + batchIndex, batchTotal, err := batchPositionFromHeaders(request.Header, h.batchToken) if err != nil { - http.Error(response, err.Error(), http.StatusBadRequest) + status := http.StatusBadRequest + if errors.Is(err, errBatchAuthorization) { + status = http.StatusForbidden + } + http.Error(response, err.Error(), status) return } jobKey := sha256.Sum256([]byte("cone-shared-web-processor")) @@ -256,15 +271,23 @@ func (h *webHandler) convert(response http.ResponseWriter, request *http.Request }) } -func batchPositionFromHeaders(headers http.Header) (int, int, error) { +func batchPositionFromHeaders(headers http.Header, configuredToken string) (int, int, error) { indexValue := strings.TrimSpace(headers.Get(batchIndexHeader)) totalValue := strings.TrimSpace(headers.Get(batchTotalHeader)) + providedToken := strings.TrimSpace(headers.Get(batchTokenHeader)) if indexValue == "" && totalValue == "" { + if providedToken != "" { + return 0, 0, errors.New("administrative batch token requires batch position headers") + } return 0, 0, nil } if indexValue == "" || totalValue == "" { return 0, 0, errors.New("batch index and total headers must be provided together") } + if configuredToken == "" || providedToken == "" || len(configuredToken) != len(providedToken) || + subtle.ConstantTimeCompare([]byte(configuredToken), []byte(providedToken)) != 1 { + return 0, 0, errBatchAuthorization + } index, indexErr := strconv.Atoi(indexValue) total, totalErr := strconv.Atoi(totalValue) if indexErr != nil || totalErr != nil || index < 1 || total < index || total > maxBatchQueueEntries { diff --git a/web/fonts/APACHE-2.0.txt b/web/fonts/APACHE-2.0.txt new file mode 100644 index 0000000..87d5574 --- /dev/null +++ b/web/fonts/APACHE-2.0.txt @@ -0,0 +1,304 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2019 Klaus Post. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------ + +Files: gzhttp/* + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2016-2017 The New York Times Company + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------ + +Files: s2/cmd/internal/readahead/* + +The MIT License (MIT) + +Copyright (c) 2015 Klaus Post + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--------------------- +Files: snappy/* +Files: internal/snapref/* + +Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----------------- + +Files: s2/cmd/internal/filepathx/* + +Copyright 2016 The filepathx Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/web/fonts/FONTS.md b/web/fonts/FONTS.md new file mode 100644 index 0000000..4e1cc48 --- /dev/null +++ b/web/fonts/FONTS.md @@ -0,0 +1,14 @@ +# Bundled fonts + +- `inter-var.woff2` — Inter, copyright 2016 The Inter Project Authors, + licensed under the SIL Open Font License 1.1. See `OFL.txt`. +- `FredokaOne-Regular.ttf` — Fredoka One, copyright 2011 Milena B Brandao, + licensed under the SIL Open Font License 1.1. The font reserves the name + “Fredoka.” See `OFL.txt`. +- `LuckiestGuy-Regular.ttf` — Luckiest Guy, copyright 2010 Brian J. + Bonislawsky DBA Astigmatic (AOETI), licensed under Apache License 2.0. See + `APACHE-2.0.txt`. + +The font files retain their embedded copyright and licensing metadata. Inter +and Fredoka One may not be sold by themselves, and modified Fredoka builds may +not use its reserved font name without permission. diff --git a/web/fonts/FredokaOne-Regular.ttf b/web/fonts/FredokaOne-Regular.ttf new file mode 100644 index 0000000..ac68bcf Binary files /dev/null and b/web/fonts/FredokaOne-Regular.ttf differ diff --git a/web/fonts/LuckiestGuy-Regular.ttf b/web/fonts/LuckiestGuy-Regular.ttf new file mode 100644 index 0000000..3020a35 Binary files /dev/null and b/web/fonts/LuckiestGuy-Regular.ttf differ diff --git a/web/index.html b/web/index.html index 1623fac..14e31de 100644 --- a/web/index.html +++ b/web/index.html @@ -3,12 +3,13 @@ - + Cone - - - + + + +
@@ -21,58 +22,66 @@
-
-

Cone

-

Minecraft 1.8.9 to BridgeDuel

-
+

Cone

+

Minecraft 1.8.9 to BridgeDuel

+
-
- Roblox API setup +
+ First time? Set up a Roblox API key
  1. Create an API key in Creator Dashboard.
  2. Add Assets: Read + Write, Asset Permissions: Write, and Legacy Assets: Manage.
  3. -
  4. Generate the key, then paste it and your numeric Roblox user ID below.
  5. +
  6. Generate the key, then paste it below with your numeric user ID.

Leave IP restriction off.

-
- - -
-
- - Stored only in this browser; never in Cone’s server storage. -
+
+

1Roblox credentials

- +
+ + +
- +
+ + Stored only in this browser, never on Cone’s server. +
+
+ +
+

2Texture pack

+ + + + +
@@ -97,6 +106,7 @@

Minecraft 1.8.9 to BridgeDuel

Cone is fully open-source. GitHub

+ - + + diff --git a/web/styles.css b/web/styles.css index 33d91b3..d3eee30 100644 --- a/web/styles.css +++ b/web/styles.css @@ -1,30 +1,106 @@ +/* Cone — Cartoon Chunky, dark. + Flat fills, thick outlines, hard unblurred shadows, one accent with one job. + On a dark ground the outline rule inverts: light-filled surfaces get an ink + outline, dark-filled surfaces get a light one. Everything stays bounded. */ + +@font-face { + font-family: "Cone Display"; + src: url("/fonts/LuckiestGuy-Regular.ttf?v=150") format("truetype"); + font-weight: 400; + font-display: swap; +} + @font-face { font-family: "Cone Sans"; - src: url("/fonts/inter-var.woff2?v=148") format("woff2"); - font-style: normal; + src: url("/fonts/FredokaOne-Regular.ttf?v=150") format("truetype"); + font-weight: 400; + font-display: swap; +} + +@font-face { + font-family: "Cone Fallback"; + src: url("/fonts/inter-var.woff2?v=150") format("woff2"); font-weight: 100 900; font-display: swap; } +/* ============================================================== tokens === */ :root { color-scheme: dark; - --page: #0c0c0c; - --panel: #1d1d1d; - --surface: #292929; - --surface-hover: #303030; - --line: #454545; - --text: #f6f4f0; - --muted: #aaa6a0; + + /* surfaces — warm dark, not neutral grey */ + --page: #17120d; + --panel: #221b14; + --surface: #2b2219; + --surface-hover: #362b20; + --surface-sunken: #1a1510; + + /* outlines */ + --ink: #100c08; /* on light fills */ + --edge: #4b3c2c; /* on dark fills */ + --edge-strong: #6b5540; + + /* text */ + --text: #fdf6ea; + --muted: #b7a894; + --faint: #857663; + + /* the accent — primary action, live state, focus. Nothing else. */ --orange: #ff7900; - --orange-hover: #ff8b22; - --danger: #ff7b72; - font-family: "Cone Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; + --orange-hover: #ff9526; + --orange-press: #d96500; + --orange-ink: #2a1400; + --orange-glow: rgb(255 121 0 / 26%); + + --paper: #fdf3e2; /* light slabs: confirmations, badges */ + --paper-shade: #efe2cb; + + --danger: #ff6f5e; + --success: #6fd88b; + + /* spacing */ + --space-3xs: 4px; + --space-2xs: 8px; + --space-xs: 12px; + --space-sm: 16px; + --space-md: 24px; + --space-lg: 32px; + --space-xl: 48px; + + /* radius — generous, part of the voice */ + --radius-sm: 10px; + --radius-md: 16px; + --radius-lg: 22px; + --radius-xl: 30px; + + /* chunk */ + --border: 3px; + --border-thick: 4px; + --depth: 6px; /* hard shadow offset, never blurred */ + + /* controls */ + --control: 48px; + --control-lg: 60px; + --control-sm: 34px; + + /* type */ + --text-caption: 12px; + --text-body: 14px; + --text-label: 15px; + --text-subtitle: 16px; + --text-title: 20px; + --text-display: clamp(46px, 6vw, 68px); + + --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace; + --ease: cubic-bezier(0.34, 1.56, 0.64, 1); /* overshoot */ + --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1); + + font-family: "Cone Sans", "Cone Fallback", ui-sans-serif, system-ui, sans-serif; font-synthesis: none; } -* { - box-sizing: border-box; -} +/* ================================================================ base === */ +* { box-sizing: border-box; } html, body { @@ -35,14 +111,23 @@ body { body { margin: 0; background: - radial-gradient(circle at 50% 15%, rgb(255 121 0 / 7%), transparent 34rem), + radial-gradient(60rem 34rem at 50% -6%, var(--orange-glow), transparent 72%), var(--page); color: var(--text); + -webkit-font-smoothing: antialiased; } +body.modal-open { overflow: hidden; } + button, -input { - font: inherit; +input { font: inherit; } + +a { color: inherit; } + +:where(button, input, summary, a):focus-visible { + outline: var(--border) solid var(--orange); + outline-offset: 3px; + border-radius: var(--radius-sm); } .sr-only { @@ -50,197 +135,273 @@ input { width: 1px; height: 1px; overflow: hidden; - clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; } +/* ============================================================== layout === */ .page { display: flex; min-height: 100svh; justify-content: center; - padding: 24px; + padding: var(--space-md); } .workspace { display: grid; - width: min(1040px, 100%); - min-height: 620px; - grid-template-columns: minmax(280px, 0.82fr) minmax(420px, 1.18fr); + width: min(1080px, 100%); + grid-template-columns: minmax(240px, 0.8fr) minmax(420px, 1.2fr); grid-template-rows: 1fr auto; align-items: center; - gap: 22px 48px; + gap: var(--space-md) var(--space-xl); margin-block: auto; - border: 1px solid #2e2b28; - border-radius: 28px; - padding: 32px 48px 24px; + padding: var(--space-xl) var(--space-xl) var(--space-md); + border: var(--border-thick) solid var(--edge); + border-radius: var(--radius-xl); background: var(--panel); - box-shadow: 0 28px 72px rgb(0 0 0 / 28%); - animation: workspace-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both; + box-shadow: 0 var(--depth) 0 #0d0906, 0 26px 60px rgb(0 0 0 / 55%); + animation: workspace-in 420ms var(--ease) both; } +/* ================================================================ cone === */ .cone-side { display: grid; - min-width: 0; place-items: center; } .cone-art { - width: min(310px, 100%); + position: relative; + display: grid; + place-items: center; + width: min(300px, 100%); + padding-bottom: var(--space-md); + animation: cone-in 620ms var(--ease) both; +} + +.cone-art::before { + content: ""; + position: absolute; + inset: 4% 2% 16%; + border-radius: 50%; + background: radial-gradient(circle at 50% 45%, var(--orange-glow), transparent 66%); + z-index: 0; +} + +/* A chunky ground slab with hazard stripes — the cone gets something to stand + on, and the stripes are the one piece of drawn scenery this tool needs. */ +.cone-art::after { + content: ""; + position: absolute; + right: 6%; + bottom: 0; + left: 6%; + height: 18px; + border: var(--border) solid var(--ink); + border-radius: var(--radius-sm); + background: repeating-linear-gradient( + -45deg, + var(--orange) 0 10px, + #2b2219 10px 20px + ); + box-shadow: 0 var(--depth) 0 #0d0906; + z-index: 0; } .cone-art img { + position: relative; + z-index: 1; display: block; width: 100%; height: auto; - filter: drop-shadow(0 18px 16px rgb(0 0 0 / 25%)); - animation: cone-in 650ms cubic-bezier(0.2, 0.9, 0.25, 1.15) 80ms both; + filter: drop-shadow(0 10px 0 rgb(13 9 6 / 55%)); } -.cone-art[data-state="accepted"] img { - filter: drop-shadow(0 18px 16px rgb(0 0 0 / 25%)) drop-shadow(0 0 18px rgb(0 177 45 / 13%)); -} +.cone-art.is-changing img { animation: cone-state-in 360ms var(--ease) both; } -.cone-art[data-state="error"] img { - filter: drop-shadow(0 18px 16px rgb(0 0 0 / 25%)) drop-shadow(0 0 18px rgb(198 42 0 / 14%)); +.cone-art[data-state="accepted"]::before { + background: radial-gradient(circle at 50% 45%, rgb(111 216 139 / 24%), transparent 66%); } -.cone-art.is-changing img { - animation: cone-state-in 360ms cubic-bezier(0.18, 0.85, 0.28, 1.2) both; +.cone-art[data-state="error"]::before { + background: radial-gradient(circle at 50% 45%, rgb(255 111 94 / 24%), transparent 66%); } +/* =========================================================== converter === */ .converter { + display: flex; + flex-direction: column; + gap: var(--space-md); min-width: 0; } -.converter-intro { - margin-bottom: 16px; -} - -.converter-intro p, -.converter-intro h1 { - margin: 0; -} - +/* Wordmark: flat orange, hard ink shadow, no outline. The letterforms are + already chunky enough to carry it — a stroke only muddied the counters. + Caps because Luckiest Guy's lowercase sits at almost cap height. */ .converter-intro p { - margin-bottom: 2px; - color: transparent; - background: linear-gradient(105deg, var(--orange) 28%, #ffd0a3 48%, var(--orange) 68%); - background-clip: text; - background-size: 220% 100%; - font-family: "Cone Sans", ui-sans-serif, system-ui, sans-serif; - font-size: 30px; - font-weight: 900; - letter-spacing: 0.02em; - animation: shiny-text 4.2s linear infinite; + margin: 0; + font-family: "Cone Display", "Cone Sans", sans-serif; + font-size: var(--text-display); + line-height: 1.1; + text-transform: uppercase; + letter-spacing: 0.04em; + color: var(--orange); + text-shadow: 0 5px 0 var(--ink); } .converter-intro h1 { + margin: var(--space-xs) 0 0; + font-size: var(--text-subtitle); + font-weight: 400; + line-height: 1.4; color: var(--muted); - font-size: 13px; - font-weight: 650; - letter-spacing: 0.02em; - line-height: 1.35; } -.converter-intro h1 span { - margin-inline: 0.28em; - color: var(--orange); - font-size: 0.88em; - font-weight: 800; -} +.converter-intro h1 span { color: var(--faint); } #convert-form { + display: flex; + flex-direction: column; + gap: var(--space-md); margin: 0; } +/* ========================================================= setup guide === + Prerequisite reference, not the task: quiet, collapsed, out of the way. */ .setup-guide { - margin-bottom: 12px; - border: 1px solid var(--line); - border-radius: 14px; - overflow: hidden; - background: #242424; - transition: border-color 160ms ease, background 160ms ease; -} - -.setup-guide:hover { - border-color: #5b534b; + border-top: var(--border) solid var(--surface); + border-bottom: var(--border) solid var(--surface); + padding: var(--space-xs) 0; + font-size: var(--text-body); + color: var(--muted); } .setup-guide summary { - padding: 13px 15px; + display: flex; + align-items: center; + gap: var(--space-2xs); cursor: pointer; - color: var(--text); - font-size: 13px; - font-weight: 760; + list-style: none; + color: var(--muted); + transition: color 140ms ease; } -.setup-guide summary::marker { - color: var(--orange); +.setup-guide summary::marker, +.setup-guide summary::-webkit-details-marker { display: none; } + +.setup-guide summary::before { + content: ""; + width: 7px; + height: 7px; + border-right: var(--border) solid currentColor; + border-bottom: var(--border) solid currentColor; + transform: rotate(-45deg); + transition: transform 160ms var(--ease-out); } +.setup-guide[open] summary::before { transform: rotate(45deg); } +.setup-guide summary:hover, +.setup-guide:hover summary { color: var(--text); } + .setup-guide ol { - margin: 0; - padding: 0 22px 0 38px; - color: var(--muted); - font-size: 11px; + margin: var(--space-xs) 0 0; + padding-left: var(--space-md); + display: grid; + gap: var(--space-2xs); line-height: 1.55; } -.setup-guide li + li { - margin-top: 5px; -} +.setup-guide li + li { margin: 0; } +.setup-guide strong { color: var(--text); } .setup-guide a { - color: var(--orange); -} - -.setup-guide strong { color: var(--text); - font-weight: 680; + text-decoration: underline; + text-decoration-thickness: 2px; + text-decoration-color: var(--orange); + text-underline-offset: 3px; } +.setup-guide a:hover { color: var(--orange); } + .setup-guide p { - margin: 10px 15px 14px; - color: #8f8b84; - font-size: 10px; - line-height: 1.45; + margin: var(--space-2xs) 0 0; + font-size: var(--text-caption); + color: var(--faint); +} + +/* =============================================================== steps === */ +.step { + display: flex; + flex-direction: column; + gap: var(--space-xs); } +.step-head { + display: flex; + align-items: center; + gap: var(--space-2xs); + margin: 0; + font-size: var(--text-caption); + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--muted); +} + +.step-num { + display: grid; + place-items: center; + width: 26px; + height: 26px; + border: var(--border) solid var(--ink); + border-radius: 50%; + background: var(--paper); + box-shadow: 0 3px 0 var(--ink); + color: var(--ink); + font-size: 13px; + letter-spacing: 0; +} + +/* ============================================================== fields === */ .credential-fields { display: grid; - grid-template-columns: minmax(130px, 0.72fr) minmax(210px, 1.28fr); - gap: 10px; + grid-template-columns: minmax(130px, 0.8fr) minmax(200px, 1.2fr); + gap: var(--space-xs); } .credential-fields label { - display: grid; - gap: 7px; + display: flex; + flex-direction: column; + gap: var(--space-3xs); + min-width: 0; + font-size: var(--text-caption); color: var(--muted); - font-size: 10px; - font-weight: 700; - letter-spacing: 0.06em; - text-transform: uppercase; } .credential-fields input { - min-width: 0; + height: var(--control); width: 100%; - height: 44px; - border: 1px solid var(--line); - border-radius: 11px; - outline: 0; - padding: 0 12px; - background: #202020; + padding: 0 var(--space-sm); + border: var(--border) solid var(--edge); + border-radius: var(--radius-md); + background: var(--surface-sunken); color: var(--text); - font-size: 13px; - letter-spacing: normal; + font-size: var(--text-label); + transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease; } +.credential-fields input::placeholder { color: var(--faint); } +.credential-fields input:hover { border-color: var(--edge-strong); } + .credential-fields input:focus { + outline: none; border-color: var(--orange); - background: #242321; - box-shadow: 0 0 0 3px rgb(255 121 0 / 10%); + background: var(--surface); + box-shadow: 0 0 0 4px rgb(255 121 0 / 22%); +} + +.credential-fields input:read-only { + color: var(--muted); + background: var(--surface-sunken); } .secret-field { @@ -248,762 +409,589 @@ input { display: block; } -.secret-field input { - padding-right: 61px; -} +.secret-field input { padding-right: 76px; } .secret-toggle { position: absolute; top: 50%; - right: 5px; - min-width: 48px; - border: 0; - padding: 7px 8px; - transform: translateY(-50%); - cursor: pointer; - background: transparent; + right: var(--space-2xs); + translate: 0 -50%; + height: var(--control-sm); + padding: 0 var(--space-xs); + border: 2px solid var(--edge); + border-radius: var(--radius-sm); + background: var(--surface); color: var(--muted); - font-size: 10px; - font-weight: 760; - letter-spacing: 0.03em; + font-size: var(--text-caption); + cursor: pointer; + transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease; } .secret-toggle:hover { color: var(--text); + background: var(--surface-hover); + border-color: var(--edge-strong); } .secret-toggle:disabled { - cursor: default; - opacity: 0.45; + color: var(--faint); + cursor: not-allowed; + background: transparent; } +/* ------------------------------------------------------------- options --- */ .credential-options { display: flex; + flex-wrap: wrap; align-items: center; justify-content: space-between; - gap: 12px; - margin: 8px 0 13px; + gap: var(--space-2xs) var(--space-sm); } .remember-option { - display: inline-flex; - flex: 0 0 auto; - cursor: pointer; + display: flex; align-items: center; - gap: 7px; + gap: var(--space-2xs); + font-size: var(--text-caption); color: var(--muted); - font-size: 10px; + cursor: pointer; } .remember-option input { - width: 14px; - height: 14px; + width: 18px; + height: 18px; margin: 0; accent-color: var(--orange); + cursor: pointer; } +.remember-option:hover { color: var(--text); } + .credential-note { - color: #85817b; - font-size: 10px; - text-align: right; + font-size: var(--text-caption); + color: var(--faint); } +/* ============================================================ dropzone === */ .drop-zone { position: relative; display: flex; - min-height: 230px; - cursor: pointer; + flex-direction: column; align-items: center; justify-content: center; - flex-direction: column; - border: 2px solid var(--orange); - border-radius: 22px; - overflow: hidden; - padding: 36px 44px; - background: - radial-gradient(circle 260px at var(--spot-x, 50%) var(--spot-y, 115%), rgb(255 156 68 / 16%), transparent 66%), - var(--surface); + gap: var(--space-3xs); + min-height: 168px; + padding: var(--space-md); + border: var(--border-thick) dashed var(--edge-strong); + border-radius: var(--radius-lg); + background: var(--surface-sunken); text-align: center; - transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease; + cursor: pointer; + transition: border-color 160ms ease, background-color 160ms ease, + transform 160ms var(--ease), box-shadow 160ms ease; } -.drop-zone > * { - position: relative; - z-index: 1; -} +.drop-zone > * { position: relative; } -.drop-zone:hover, -.drop-zone.is-dragging { - border-color: var(--orange-hover); - background: var(--surface-hover); +.drop-zone input { + position: absolute; + inset: 0; + opacity: 0; + cursor: pointer; } .drop-zone:hover { - box-shadow: 0 10px 32px rgb(0 0 0 / 18%), inset 0 0 0 1px rgb(255 255 255 / 3%); + border-color: var(--muted); + background: var(--surface); transform: translateY(-2px); } -.drop-zone.is-dragging { - box-shadow: 0 0 0 6px rgb(255 121 0 / 12%); - transform: translateY(-3px) scale(1.006); +.drop-zone:focus-within, +.drop-zone:has(input:focus-visible) { + border-color: var(--orange); + box-shadow: 0 0 0 4px rgb(255 121 0 / 22%); } -.drop-zone:focus-within { - outline: 3px solid rgba(255, 121, 0, 0.28); - outline-offset: 4px; +.drop-zone.is-dragging { + border-style: solid; + border-color: var(--orange); + background: rgb(255 121 0 / 10%); + transform: translateY(-2px) scale(1.008); + box-shadow: 0 var(--depth) 0 rgb(217 101 0 / 45%); } -.drop-zone input { - position: absolute; - width: 1px; - height: 1px; - overflow: hidden; - clip: rect(0 0 0 0); - clip-path: inset(50%); - white-space: nowrap; +.drop-title { + font-size: 22px; + color: var(--text); } -.drop-title { - max-width: 360px; - font-size: clamp(25px, 2.7vw, 34px); - font-weight: 780; - letter-spacing: 0.12em; - line-height: 1.35; - text-transform: lowercase; +.drop-copy { + font-size: var(--text-body); + color: var(--muted); } .drop-kicker { - margin-bottom: 13px; - color: var(--orange); - font-size: 9px; - font-weight: 800; - letter-spacing: 0.16em; + margin-top: var(--space-2xs); + padding: var(--space-3xs) var(--space-2xs); + border: 2px solid var(--edge); + border-radius: var(--radius-sm); + background: var(--surface); + font-size: 11px; + letter-spacing: 0.08em; text-transform: uppercase; -} - -.drop-copy { - margin-top: 16px; color: var(--muted); - font-size: 14px; - letter-spacing: 0.04em; } +/* ------------------------------------------------------- selected file --- + A light slab: the pack is in, and the screen should say so. */ .selected-file { display: flex; align-items: center; - gap: 12px; - margin-top: 12px; - padding: 12px 14px; - border: 1px solid var(--line); - border-radius: 14px; - background: #242424; - animation: item-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both; + gap: var(--space-xs); + padding: var(--space-2xs) var(--space-xs); + border: var(--border) solid var(--ink); + border-radius: var(--radius-md); + background: var(--paper); + color: var(--ink); + box-shadow: 0 var(--depth) 0 var(--ink); + animation: item-in 220ms var(--ease) both; } -.selected-file[hidden], -.progress-panel[hidden], -.result-panel[hidden], -.result-modal[hidden] { - display: none; -} +.selected-file[hidden] { display: none; } .file-badge { display: grid; - width: 38px; - height: 38px; - flex: 0 0 auto; place-items: center; - border-radius: 10px; - background: #3a2412; - color: var(--orange); - font-size: 10px; - font-weight: 850; - letter-spacing: 0.08em; + min-width: 48px; + height: 30px; + border: 2px solid var(--ink); + border-radius: var(--radius-sm); + background: var(--orange); + color: var(--orange-ink); + font-size: 12px; + letter-spacing: 0.06em; } .file-info { + display: flex; + flex-direction: column; min-width: 0; flex: 1; } -.file-info strong, -.file-info small { - display: block; -} - .file-info strong { overflow: hidden; - font-size: 13px; + font-size: var(--text-body); + font-weight: 400; text-overflow: ellipsis; white-space: nowrap; } .file-info small { - margin-top: 3px; - color: var(--muted); - font-size: 11px; + font-size: var(--text-caption); + color: #6d5c48; } .text-button { - border: 0; - border-radius: 8px; - padding: 8px; - cursor: pointer; + padding: var(--space-3xs) var(--space-2xs); + border: 2px solid transparent; + border-radius: var(--radius-sm); background: transparent; - color: var(--muted); - font-size: 12px; + color: #7a6753; + font-size: var(--text-caption); + cursor: pointer; + transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease; } .text-button:hover { - background: #30302f; - color: var(--text); -} - -.primary-button, -.copy-button, -.secondary-button { - display: inline-flex; - min-height: 46px; - align-items: center; - justify-content: center; - border: 0; - border-radius: 12px; - background: var(--orange); - color: #170b00; - font-weight: 760; - text-decoration: none; - transition: transform 130ms ease, background 150ms ease, box-shadow 150ms ease; + color: #b8362a; + background: rgb(184 54 42 / 10%); + border-color: rgb(184 54 42 / 35%); } +/* ============================================================= buttons === + The signature: hard shadow, and pressing sinks the face into it. */ .primary-button { - width: 100%; - margin-top: 12px; + height: var(--control-lg); + border: var(--border-thick) solid var(--ink); + border-radius: var(--radius-md); + background: var(--orange); + color: var(--orange-ink); + font-size: 20px; + letter-spacing: 0.01em; cursor: pointer; + box-shadow: 0 var(--depth) 0 var(--ink); + transition: background-color 140ms ease, transform 120ms var(--ease), + box-shadow 120ms ease; } -.primary-button:not(:disabled):hover, -.copy-button:hover { +.primary-button:not(:disabled):hover { background: var(--orange-hover); - box-shadow: 0 9px 24px rgb(255 121 0 / 18%); transform: translateY(-2px); + box-shadow: 0 calc(var(--depth) + 2px) 0 var(--ink); } -.primary-button:not(:disabled):active, -.copy-button:active, -.secondary-button:active { - transform: translateY(1px); +.primary-button:not(:disabled):active { + background: var(--orange-press); + transform: translateY(var(--depth)); + box-shadow: 0 0 0 var(--ink); } .primary-button:disabled { + border-color: var(--edge); + background: var(--surface); + color: var(--faint); + box-shadow: 0 var(--depth) 0 #16110c; cursor: not-allowed; - opacity: 0.32; } +.secondary-button, +.copy-button { + height: var(--control); + padding: 0 var(--space-md); + border-radius: var(--radius-md); + font-size: var(--text-label); + cursor: pointer; + transition: background-color 140ms ease, transform 120ms var(--ease), + box-shadow 120ms ease; +} + +.secondary-button { + border: var(--border) solid var(--ink); + background: var(--paper); + color: var(--ink); + box-shadow: 0 var(--depth) 0 var(--ink); +} + +.secondary-button:hover { background: var(--paper-shade); } + +.secondary-button:active { + transform: translateY(var(--depth)); + box-shadow: 0 0 0 var(--ink); +} + +.copy-button { + border: var(--border) solid var(--ink); + background: var(--orange); + color: var(--orange-ink); + box-shadow: 0 var(--depth) 0 var(--ink); +} + +.copy-button:hover { background: var(--orange-hover); } + +.copy-button:active { + transform: translateY(var(--depth)); + box-shadow: 0 0 0 var(--ink); +} + +/* ============================================================ progress === */ .progress-panel { - margin-top: 12px; - padding: 18px; - border: 1px solid var(--line); - border-radius: 16px; - background: #242424; - animation: panel-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both; + display: flex; + flex-direction: column; + gap: var(--space-xs); + padding-top: var(--space-md); + border-top: var(--border) solid var(--surface); + animation: panel-in 260ms var(--ease-out) both; } +.progress-panel[hidden] { display: none; } + .status-row { display: flex; - align-items: center; + align-items: flex-start; justify-content: space-between; - gap: 18px; -} - -.status-label, -.status-detail { - margin: 0; + gap: var(--space-sm); } .status-label { - font-size: 13px; - font-weight: 740; + margin: 0; + font-size: var(--text-label); } .status-detail { - overflow: hidden; - margin-top: 4px; + margin: var(--space-3xs) 0 0; + font-size: var(--text-caption); color: var(--muted); - font-size: 12px; - text-overflow: ellipsis; - white-space: nowrap; } .status-percent { - color: var(--orange); - font-size: 12px; + font-family: "Cone Display", "Cone Sans", sans-serif; + font-size: 30px; font-variant-numeric: tabular-nums; - font-weight: 760; + letter-spacing: 0.02em; + color: var(--orange); + text-shadow: 0 3px 0 var(--ink); } .progress-track { - height: 4px; + height: 18px; overflow: hidden; - margin-top: 15px; + border: var(--border) solid var(--ink); border-radius: 999px; - background: #3a3a3a; + background: var(--surface-sunken); + box-shadow: 0 3px 0 rgb(13 9 6 / 60%); } .progress-track span { display: block; width: 0; height: 100%; - border-radius: inherit; background: var(--orange); - transition: width 180ms ease; + transition: width 260ms var(--ease-out); } .activity-log { display: flex; - max-height: 132px; flex-direction: column; - gap: 5px; + gap: var(--space-3xs); + max-height: 132px; overflow-y: auto; - margin-top: 14px; - padding: 11px 12px; - border-radius: 11px; - background: #191919; - color: #c7c3bc; - font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; - font-size: 10px; - line-height: 1.45; - scrollbar-color: #555 #191919; + padding: var(--space-2xs) var(--space-xs); + border: var(--border) solid var(--edge); + border-radius: var(--radius-md); + background: var(--surface-sunken); + font-family: var(--mono); + font-size: var(--text-caption); + line-height: 1.5; + scrollbar-width: thin; + scrollbar-color: var(--edge-strong) transparent; } .activity-log p { + display: flex; + gap: var(--space-2xs); margin: 0; - overflow-wrap: anywhere; - animation: log-in 180ms ease both; + color: var(--muted); + animation: item-in 180ms var(--ease-out) both; } .activity-log p::before { - content: "> "; - color: var(--orange); + content: "›"; + color: var(--faint); } -.activity-log p.is-error { - color: var(--danger); -} +.activity-log p.is-error { color: var(--danger); } +.activity-log p.is-error::before { content: "!"; color: var(--danger); } .status-error { - margin: 13px 0 0; + margin: 0; + padding: var(--space-2xs) var(--space-xs); + border: var(--border) solid var(--danger); + border-radius: var(--radius-md); + background: rgb(255 111 94 / 12%); color: var(--danger); - font-size: 12px; - line-height: 1.5; + font-size: var(--text-body); } -.copy-button { - flex: 0 0 auto; - padding-inline: 15px; - cursor: pointer; - font-size: 12px; -} +.status-error[hidden] { display: none; } +/* =============================================================== modal === */ .result-modal { position: fixed; - z-index: 900; - display: grid; inset: 0; + z-index: 20; + display: grid; place-items: center; - padding: 20px; + padding: var(--space-md); } +.result-modal[hidden] { display: none; } + .result-backdrop { position: absolute; - border: 0; inset: 0; - cursor: default; - background: rgb(5 5 5 / 74%); - backdrop-filter: blur(7px); - animation: modal-backdrop-in 180ms ease both; + border: 0; + padding: 0; + background: rgb(10 7 5 / 68%); + cursor: pointer; } +/* Light slab for the celebratory moment. */ .result-card { position: relative; - display: grid; - width: min(410px, 100%); - grid-template-columns: auto 1fr; - gap: 14px 16px; - border: 1px solid #4a443e; - border-radius: 20px; - padding: 22px; - background: #242424; - box-shadow: 0 28px 90px rgb(0 0 0 / 60%); - animation: result-modal-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both; + display: flex; + flex-direction: column; + gap: var(--space-sm); + width: min(430px, 100%); + padding: var(--space-lg); + border: var(--border-thick) solid var(--ink); + border-radius: var(--radius-xl); + background: var(--paper); + color: var(--ink); + box-shadow: 0 10px 0 var(--ink), 0 40px 70px rgb(0 0 0 / 55%); + animation: result-modal-in 260ms var(--ease) both; } .result-mark { display: grid; - width: 44px; - height: 44px; place-items: center; + width: 54px; + height: 54px; + border: var(--border) solid var(--ink); border-radius: 50%; - background: var(--orange); - color: #170b00; - font-size: 23px; - font-weight: 900; -} - -.result-kicker, -.result-card h2, -.result-copy { - margin: 0; + background: var(--success); + box-shadow: 0 4px 0 var(--ink); + color: var(--ink); + font-size: 26px; } .result-kicker { - margin-bottom: 2px; - color: var(--orange); - font-size: 10px; - font-weight: 800; - letter-spacing: 0.12em; + margin: 0; + font-size: var(--text-caption); + letter-spacing: 0.1em; text-transform: uppercase; + color: #7a6753; } .result-card h2 { - font-size: 20px; - line-height: 1.15; + margin: var(--space-3xs) 0 0; + font-family: "Cone Display", "Cone Sans", sans-serif; + font-size: 30px; + font-weight: 400; + letter-spacing: 0.01em; } .result-copy { - margin-top: 5px; - color: var(--muted); - font-size: 12px; - line-height: 1.45; + margin: var(--space-2xs) 0 0; + font-size: var(--text-body); + color: #6d5c48; } .result-actions { - grid-column: 1 / -1; display: flex; justify-content: flex-end; - gap: 8px; -} - -.secondary-button { - min-height: 46px; - border: 1px solid #55504a; - padding-inline: 15px; - cursor: pointer; - background: #2d2b29; - color: var(--text); - font-size: 12px; -} - -.secondary-button:hover { - border-color: var(--orange); - background: #35312d; - transform: translateY(-2px); + gap: var(--space-xs); } .copy-fallback { - position: fixed; - width: 1px; - height: 1px; - opacity: 0; - pointer-events: none; -} - + width: 100%; + min-height: 120px; + padding: var(--space-2xs); + border: var(--border) solid var(--ink); + border-radius: var(--radius-md); + background: #fffaf0; + color: var(--ink); + font-family: var(--mono); + font-size: var(--text-caption); + resize: vertical; +} + +/* ================================================================ foot === */ .open-source-note { grid-column: 1 / -1; - justify-self: center; margin: 0; - padding: 8px; - color: var(--text); - font-size: 12px; - letter-spacing: 0.04em; + padding-top: var(--space-sm); + border-top: var(--border) solid var(--surface); text-align: center; + font-size: var(--text-caption); + color: var(--faint); } .github-link { - margin-left: 8px; - color: var(--orange); - font-weight: 760; - letter-spacing: 0.12em; - text-decoration: none; - text-transform: lowercase; + color: var(--muted); + text-decoration: underline; + text-decoration-thickness: 2px; + text-decoration-color: var(--edge-strong); + text-underline-offset: 3px; + transition: color 140ms ease, text-decoration-color 140ms ease; } .github-link:hover { - color: var(--orange-hover); + color: var(--orange); + text-decoration-color: var(--orange); } +/* ============================================================== sparks === */ .click-spark { position: fixed; - z-index: 1000; - width: 0; - height: 0; + z-index: 50; pointer-events: none; + translate: -50% -50%; } .click-spark-ray { position: absolute; - top: -1px; - left: 0; - width: 9px; - height: 2px; - border-radius: 999px; - transform: rotate(var(--spark-angle)) translateX(4px); - transform-origin: left center; + width: 3px; + height: 9px; + border-radius: 2px; background: var(--orange); - box-shadow: 0 0 7px rgb(255 121 0 / 55%); - animation: click-spark 440ms cubic-bezier(0.15, 0.75, 0.25, 1) forwards; + rotate: var(--spark-angle); + transform-origin: 50% 0; + animation: click-spark 440ms cubic-bezier(0.15, 0.7, 0.3, 1) both; } +/* ========================================================== animations === */ @keyframes workspace-in { - from { - opacity: 0; - transform: translateY(10px) scale(0.99); - } + from { opacity: 0; transform: translateY(12px) scale(0.985); } + to { opacity: 1; transform: none; } } @keyframes cone-in { - from { - opacity: 0; - transform: translateY(18px) rotate(-2deg) scale(0.94); - } + from { opacity: 0; transform: translateY(16px) scale(0.94); } + to { opacity: 1; transform: none; } } @keyframes cone-state-in { - from { - opacity: 0.45; - transform: translateY(8px) scale(0.96); - } -} - -@keyframes item-in { - from { - opacity: 0; - transform: translateY(-5px) scale(0.985); - } + from { opacity: 0.4; transform: scale(0.9); } + to { opacity: 1; transform: none; } } @keyframes panel-in { - from { - opacity: 0; - transform: translateY(8px); - } + from { opacity: 0; transform: translateY(8px); } + to { opacity: 1; transform: none; } } -@keyframes modal-backdrop-in { - from { - opacity: 0; - } +@keyframes item-in { + from { opacity: 0; transform: translateY(6px) scale(0.98); } + to { opacity: 1; transform: none; } } @keyframes result-modal-in { - from { - opacity: 0; - transform: translateY(10px) scale(0.97); - } -} - -@keyframes log-in { - from { - opacity: 0; - transform: translateX(-4px); - } -} - -@keyframes shiny-text { - to { - background-position: -220% 0; - } + from { opacity: 0; transform: translateY(16px) scale(0.94); } + to { opacity: 1; transform: none; } } @keyframes click-spark { - 65% { - opacity: 1; - } - - to { - opacity: 0; - transform: rotate(var(--spark-angle)) translateX(30px) scaleX(0.25); - } -} - -a:focus-visible, -button:focus-visible, -summary:focus-visible, -input:focus-visible, -.drop-zone:has(input:focus-visible) { - outline: 2px solid var(--orange); - outline-offset: 3px; + from { opacity: 1; translate: 0 6px; } + to { opacity: 0; translate: 0 20px; } } -@media (max-width: 820px) { - .page { - padding: 10px; - } - +/* ========================================================== responsive === */ +@media (max-width: 900px) { .workspace { - width: 100%; - min-height: calc(100svh - 20px); grid-template-columns: 1fr; grid-template-rows: auto auto auto; - align-items: start; - gap: 18px; - margin: 0; - border: 1px solid #332f2b; - border-radius: 24px; - padding: 22px 18px 18px; - box-shadow: none; + padding: var(--space-lg) var(--space-md) var(--space-md); } - .cone-art { - width: 125px; - } - - .converter { - width: min(500px, 100%); - justify-self: center; - } - - .converter-intro { - text-align: center; - } - - .drop-zone { - min-height: 190px; - padding: 28px 30px; - } - - .drop-title { - font-size: clamp(23px, 8vw, 31px); - } - - .open-source-note { - grid-column: 1; - } + .cone-art { width: min(200px, 54%); } } -@media (max-width: 480px) { - .cone-art { - width: 105px; - } - - .drop-zone { - min-height: 170px; - padding: 24px; - } - - .drop-title { - font-size: clamp(22px, 7.5vw, 29px); - } - - .drop-copy { - margin-top: 11px; - font-size: 12px; - } - - .drop-kicker { - margin-bottom: 10px; - } - - .selected-file { - padding: 10px; - } - - .setup-guide summary { - padding: 11px 12px; - } - - .setup-guide ol { - padding: 0 15px 0 31px; - font-size: 10px; - } - - .setup-guide p { - margin: 8px 12px 11px; - } - - .credential-fields { - grid-template-columns: 1fr; - } - - .credential-options { - align-items: flex-start; - flex-direction: column; - gap: 6px; - } - - .credential-note { - text-align: left; - } - - .status-detail { - overflow: visible; - text-overflow: clip; - white-space: normal; - } - - .result-actions { - width: 100%; - } - - .copy-button, - .secondary-button { - min-width: 0; - width: 100%; - flex: 1 1 0; - } -} - -@media (max-height: 760px) and (min-width: 821px) { - .page { - padding-block: 12px; - } +@media (max-width: 560px) { + .page { padding: var(--space-2xs); } .workspace { - min-height: 0; - align-items: start; - gap: 16px 40px; - padding: 22px 40px 18px; + border-radius: var(--radius-lg); + padding: var(--space-md) var(--space-sm) var(--space-sm); } - .cone-art { - width: min(270px, 100%); - } + .cone-art { width: min(150px, 46%); } - .setup-guide summary { - padding-block: 10px; - } - .converter-intro { - margin-bottom: 10px; - } + .credential-fields { grid-template-columns: 1fr; } + .credential-options { flex-direction: column; align-items: flex-start; } + .drop-zone { min-height: 140px; } - .setup-guide li + li { - margin-top: 2px; - } - - .setup-guide p { - margin-block: 7px 10px; - } - - .credential-fields input { - height: 40px; - } - - .credential-options { - margin-block: 6px 10px; - } - - .drop-zone { - min-height: 190px; - padding: 28px 38px; - } + .result-actions { flex-direction: column-reverse; } + .result-actions button { width: 100%; } } @media (prefers-reduced-motion: reduce) { *, *::before, *::after { - transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; } } diff --git a/web_test.go b/web_test.go index fcdf230..0c3a2e5 100644 --- a/web_test.go +++ b/web_test.go @@ -77,7 +77,7 @@ func TestWebHandlerServesFrontendWithSecurityHeaders(t *testing.T) { if response.Code != http.StatusOK { t.Fatalf("GET / status = %d", response.Code) } - if !strings.Contains(response.Body.String(), "Drop texture pack here") { + if !strings.Contains(response.Body.String(), "Drop your texture pack here") { t.Fatalf("frontend body is unexpected: %s", response.Body.String()) } if !strings.Contains(response.Body.String(), `id="activity-log"`) { @@ -128,6 +128,14 @@ func TestWebHandlerServesFrontendWithSecurityHeaders(t *testing.T) { if fontResponse.Code != http.StatusOK || !strings.Contains(fontResponse.Header().Get("Content-Type"), "font/woff2") { t.Fatalf("GET font = %d %q", fontResponse.Code, fontResponse.Header().Get("Content-Type")) } + for _, path := range []string{"/fonts/FredokaOne-Regular.ttf", "/fonts/LuckiestGuy-Regular.ttf"} { + fontRequest := httptest.NewRequest(http.MethodGet, path, nil) + fontResponse := httptest.NewRecorder() + handler.ServeHTTP(fontResponse, fontRequest) + if fontResponse.Code != http.StatusOK || !strings.Contains(fontResponse.Header().Get("Content-Type"), "font/ttf") { + t.Fatalf("GET %s = %d %q", path, fontResponse.Code, fontResponse.Header().Get("Content-Type")) + } + } for path, marker := range map[string]string{ "/styles.css": ".result-modal", "/app.js": `classList.add("modal-open")`, @@ -207,11 +215,12 @@ func TestCredentialWebHandlerUsesOnlyRequestCredentials(t *testing.T) { t.Fatal(err) } defer store.Close() - handler, err := NewCredentialWebHandlerWithServices(func(_ context.Context, apiKey, userID string) (uploadProcessor, error) { + const batchToken = "test-batch-token-with-at-least-32-characters" + handler, err := NewCredentialWebHandlerWithOptions(func(_ context.Context, apiKey, userID string) (uploadProcessor, error) { captured.apiKey = apiKey captured.userID = userID return processor, nil - }, notifier, store) + }, WebHandlerOptions{Notifier: notifier, Store: store, MaxConcurrentPorts: 2, BatchToken: batchToken}) if err != nil { t.Fatal(err) } @@ -233,6 +242,7 @@ func TestCredentialWebHandlerUsesOnlyRequestCredentials(t *testing.T) { request.Header.Set(robloxUserIDHeader, "123456") request.Header.Set(batchIndexHeader, "10") request.Header.Set(batchTotalHeader, "100") + request.Header.Set(batchTokenHeader, batchToken) response := httptest.NewRecorder() handler.ServeHTTP(response, request) if response.Code != http.StatusOK { @@ -260,6 +270,26 @@ func TestCredentialWebHandlerUsesOnlyRequestCredentials(t *testing.T) { } } +func TestCredentialWebHandlerRejectsForgedBatchHeaders(t *testing.T) { + const batchToken = "test-batch-token-with-at-least-32-characters" + handler, err := NewCredentialWebHandlerWithOptions(func(_ context.Context, _, _ string) (uploadProcessor, error) { + t.Fatal("processor factory ran with forged batch headers") + return nil, nil + }, WebHandlerOptions{MaxConcurrentPorts: 1, BatchToken: batchToken}) + if err != nil { + t.Fatal(err) + } + request := credentialConvertRequest(t, "request-key") + request.Header.Set(batchIndexHeader, "1") + request.Header.Set(batchTotalHeader, "10") + request.Header.Set(batchTokenHeader, "wrong-batch-token-with-at-least-32-chars") + response := httptest.NewRecorder() + handler.ServeHTTP(response, request) + if response.Code != http.StatusForbidden { + t.Fatalf("forged batch response = %d %q, want 403", response.Code, response.Body.String()) + } +} + func TestCredentialWebHandlerRejectsMissingCredentials(t *testing.T) { handler, err := NewCredentialWebHandler(func(_ context.Context, _, _ string) (uploadProcessor, error) { t.Fatal("processor factory ran without credentials")