Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8255e39047 | ||
|
|
8f8004c205 | ||
|
|
530676e3ac | ||
|
|
3cb810bbd5 | ||
|
|
a04b7ee37f | ||
|
|
0b43d1acb1 | ||
|
|
c12ed3e12d |
@@ -0,0 +1,32 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
One section per version, newest first.
|
||||||
|
|
||||||
|
## v0.2.1 (2026-11-04)
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- Starting a track from another album at the same position as the one playing, such as track 1 after track 1, now shows the new track and its cover. Pause works straight away instead of saying nothing is playing.
|
||||||
|
- Replaying the track that is playing counts as a new play: its position resets and the server is told it is playing.
|
||||||
|
|
||||||
|
## v0.2.0 (2026-11-04)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Remus has a logo: an R on a Roman column between sound bars. The app icon and the Steam library artwork are built from it.
|
||||||
|
- The interface takes the logo's colours and type: warm maroon backgrounds, cream text and serif headings.
|
||||||
|
- Settings in the sidebar has an option to colour the interface from the cover of the playing track, fading to the next cover when the track changes. It is off by default.
|
||||||
|
- The running version is shown at the bottom left of every screen.
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- Logging in works on servers that refuse token logins, such as Nextcloud Music. remus falls back to the password, and a wrong password on Nextcloud points at the Music app's API password.
|
||||||
|
|
||||||
|
## v0.1.0 (2026-11-04)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- A fullscreen music player for a Subsonic or OpenSubsonic library, driven with a controller and built for SteamOS.
|
||||||
|
- Browse recently added and random albums, all albums, artists and playlists, search the library, and queue albums, playlists and tracks.
|
||||||
|
- Plays through GStreamer and scrobbles to the server.
|
||||||
|
- Packaged as a Flatpak for SteamOS.
|
||||||
@@ -4385,7 +4385,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remus"
|
name = "remus"
|
||||||
version = "0.1.0"
|
version = "0.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"directories",
|
"directories",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "remus"
|
name = "remus"
|
||||||
version = "0.1.0"
|
version = "0.2.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,100 @@ flatpak-bundle: flatpak ## Build target/flatpak/remus.flatpak, a single file to
|
|||||||
flatpak build-bundle --runtime-repo=https://dl.flathub.org/repo/flathub.flatpakrepo \
|
flatpak build-bundle --runtime-repo=https://dl.flathub.org/repo/flathub.flatpakrepo \
|
||||||
$(FLATPAK_DIR)/repo $(FLATPAK_DIR)/remus.flatpak $(FLATPAK_ID)
|
$(FLATPAK_DIR)/repo $(FLATPAK_DIR)/remus.flatpak $(FLATPAK_ID)
|
||||||
|
|
||||||
|
.PHONY: branding
|
||||||
|
branding: ## Regenerate the logo SVGs and render the PNGs (needs inkscape)
|
||||||
|
python3 branding/generate.py
|
||||||
|
@mkdir -p branding/png
|
||||||
|
@render() { inkscape "branding/svg/$$1.svg" -w $$2 -h $$3 -o "branding/png/$$4.png" 2>/dev/null; }; \
|
||||||
|
render remus-square 1024 1024 remus-square-1024; \
|
||||||
|
for s in 512 256 128 64 32; do render remus-icon $$s $$s remus-icon-$$s; done; \
|
||||||
|
for v in remus-logo remus-logo-maroon remus-logo-stacked remus-logo-stacked-maroon; do \
|
||||||
|
inkscape "branding/svg/$$v.svg" -h 480 -o "branding/png/$$v.png" 2>/dev/null; done; \
|
||||||
|
render steam-capsule-portrait 600 900 steam-capsule-portrait-600x900; \
|
||||||
|
render steam-capsule-wide 920 430 steam-capsule-wide-920x430; \
|
||||||
|
render steam-hero 3840 1240 steam-hero-3840x1240; \
|
||||||
|
render steam-logo 1280 720 steam-logo-1280x720; \
|
||||||
|
render steam-icon 256 256 steam-icon-256
|
||||||
|
|
||||||
|
# Versioning. Cargo.toml's [package] version is the one source: the app shows
|
||||||
|
# it, and the bump writes it to Cargo.lock and the Flatpak metainfo too.
|
||||||
|
PACKAGE = $(shell awk -F'"' '/^\[package\]/{p=1;next} /^\[/{p=0} p && /^name *= *"/{print $$2; exit}' Cargo.toml)
|
||||||
|
CURRENT = $(shell awk -F'"' '/^\[package\]/{p=1;next} /^\[/{p=0} p && /^version *= *"/{print $$2; exit}' Cargo.toml)
|
||||||
|
METAINFO = flatpak/$(FLATPAK_ID).metainfo.xml
|
||||||
|
# Versions are only made here, so a tag never lands on a commit that is not on it.
|
||||||
|
BUMP_BRANCH = master
|
||||||
|
|
||||||
|
.PHONY: version
|
||||||
|
version: ## Print the current version
|
||||||
|
@echo $(CURRENT)
|
||||||
|
|
||||||
|
patch: BUMP = patch
|
||||||
|
minor: BUMP = minor
|
||||||
|
major: BUMP = major
|
||||||
|
|
||||||
|
.PHONY: patch minor major
|
||||||
|
patch: bump ## Bump for a bug fix: amend into the last commit and tag it
|
||||||
|
minor: bump ## Bump for a feature: amend into the last commit and tag it
|
||||||
|
major: bump ## Bump for a breaking change, decided by hand
|
||||||
|
|
||||||
|
# Folds the bump into the last commit and tags it, as one action, so there is
|
||||||
|
# never a bump without a tag or a tag without a bump. Refuses any branch but
|
||||||
|
# BUMP_BRANCH, anything that would make rewriting that commit lose work, orphan
|
||||||
|
# a tag or need a force push, and a version CHANGELOG.md does not describe yet.
|
||||||
|
.PHONY: bump
|
||||||
|
bump:
|
||||||
|
@set -e; \
|
||||||
|
if [ -z "$(BUMP)" ]; then echo "error: run make patch, make minor or make major" >&2; exit 1; fi; \
|
||||||
|
branch=$$(git symbolic-ref --quiet --short HEAD || true); \
|
||||||
|
if [ "$$branch" != "$(BUMP_BRANCH)" ]; then \
|
||||||
|
echo "error: versions are only bumped on local $(BUMP_BRANCH), and this is $${branch:-a detached HEAD}. Fast-forward $(BUMP_BRANCH) to this work, switch to it, then bump." >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
if ! git rev-parse -q --verify HEAD >/dev/null 2>&1; then \
|
||||||
|
echo "error: no commits yet, so there is no commit to fold a version bump into. Commit first." >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
if [ -n "$$(git status --porcelain)" ]; then \
|
||||||
|
echo "error: working tree is dirty. Commit or stash first, and decide whether that work belongs in this version:" >&2; \
|
||||||
|
git status --short >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
if [ -n "$$(git tag --points-at HEAD)" ]; then \
|
||||||
|
echo "error: HEAD is already tagged $$(git tag --points-at HEAD | paste -sd' '). Amending it would leave that tag on an orphaned commit. Commit something first." >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
if upstream=$$(git rev-parse --abbrev-ref --symbolic-full-name '@{u}' 2>/dev/null) && \
|
||||||
|
git merge-base --is-ancestor HEAD "$$upstream" 2>/dev/null; then \
|
||||||
|
echo "error: HEAD is already pushed to $$upstream. Amending it would need a force push. Commit something first." >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
current="$(CURRENT)"; \
|
||||||
|
if [ -z "$$current" ]; then echo "error: no version found in the [package] table of Cargo.toml" >&2; exit 1; fi; \
|
||||||
|
new=$$(echo "$$current" | awk -F. -v kind=$(BUMP) '{ \
|
||||||
|
if (NF != 3) exit 1; \
|
||||||
|
if (kind == "patch") printf "%d.%d.%d\n", $$1, $$2, $$3 + 1; \
|
||||||
|
else if (kind == "minor") printf "%d.%d.0\n", $$1, $$2 + 1; \
|
||||||
|
else printf "%d.0.0\n", $$1 + 1 }'); \
|
||||||
|
if [ -z "$$new" ]; then echo "error: cannot bump version '$$current': expected major.minor.patch" >&2; exit 1; fi; \
|
||||||
|
if git rev-parse -q --verify "refs/tags/v$$new" >/dev/null; then \
|
||||||
|
echo "error: tag v$$new already exists" >&2; exit 1; \
|
||||||
|
fi; \
|
||||||
|
if ! grep -q "^## v$$new " CHANGELOG.md 2>/dev/null; then \
|
||||||
|
echo "error: CHANGELOG.md has no '## v$$new' entry. Add one to the last commit first (git commit --amend)." >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
today=$$(date +%Y-%m-%d); \
|
||||||
|
awk -v v="$$new" '/^\[package\]/{p=1} /^\[/ && !/^\[package\]/{p=0} p && /^version *= *"/{sub(/"[^"]*"/, "\"" v "\"")} {print}' Cargo.toml > Cargo.toml.bump; \
|
||||||
|
mv Cargo.toml.bump Cargo.toml; \
|
||||||
|
awk -v v="$$new" -v pkg="$(PACKAGE)" '$$0 == "name = \"" pkg "\""{f=1} f && /^version = "/{sub(/"[^"]*"/, "\"" v "\""); f=0} {print}' Cargo.lock > Cargo.lock.bump; \
|
||||||
|
mv Cargo.lock.bump Cargo.lock; \
|
||||||
|
awk -v v="$$new" -v d="$$today" '{print} /^ *<releases>/{print " <release version=\"" v "\" date=\"" d "\"/>"}' $(METAINFO) > $(METAINFO).bump; \
|
||||||
|
mv $(METAINFO).bump $(METAINFO); \
|
||||||
|
git add Cargo.toml Cargo.lock $(METAINFO); \
|
||||||
|
git commit --quiet --amend --no-edit; \
|
||||||
|
git tag -a "v$$new" -m "v$$new"; \
|
||||||
|
echo "$$current -> $$new, tagged v$$new on $$(git rev-parse --short HEAD) ($$(git log -1 --format=%s))"
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean: ## Remove build output, screenshots and scratch config
|
clean: ## Remove build output, screenshots and scratch config
|
||||||
cargo clean
|
cargo clean
|
||||||
|
|||||||
@@ -19,8 +19,12 @@ cargo run --release -- --windowed
|
|||||||
|
|
||||||
On first start remus asks for the server address, username and password. It stores the address, the username and an auth token (md5 of password + salt) in `~/.config/remus/config.toml`, mode 0600. The token is enough to log in to that server, so treat the file as a credential. Delete it to log in again.
|
On first start remus asks for the server address, username and password. It stores the address, the username and an auth token (md5 of password + salt) in `~/.config/remus/config.toml`, mode 0600. The token is enough to log in to that server, so treat the file as a credential. Delete it to log in again.
|
||||||
|
|
||||||
|
Some servers refuse token logins (Subsonic error 41), Nextcloud Music among them. For those remus logs in with the password itself and stores that in `config.toml` instead of a token, still mode 0600. Nextcloud Music wants the API password generated in its Music settings, not the Nextcloud login password.
|
||||||
|
|
||||||
Covers are cached in `~/.cache/remus/covers`.
|
Covers are cached in `~/.cache/remus/covers`.
|
||||||
|
|
||||||
|
Preferences live apart from the login, in `~/.config/remus/settings.toml`, so logging in again keeps them. Change them under Settings in the sidebar. "Colours from album art" tints the interface with the cover of the playing track and fades to the next one when the track changes. It is off by default.
|
||||||
|
|
||||||
## Install on SteamOS
|
## Install on SteamOS
|
||||||
|
|
||||||
Build the bundle on any Linux machine with Flatpak:
|
Build the bundle on any Linux machine with Flatpak:
|
||||||
@@ -79,3 +83,12 @@ REMUS_DEV_SCRIPT="wait:3000,shot:home.png,right,activate,wait:2000,shot:album.pn
|
|||||||
```
|
```
|
||||||
|
|
||||||
A scripted run starts fullscreen like a normal one, so it also checks that startup reaches fullscreen. Add `--windowed` to capture a window instead. Steps: `size:WxH`, `size:full`, `wait:MS`, `shot:PATH`, and action names (`up`, `down`, `left`, `right`, `activate`, `back`, `queue`, `next`, `play-pause`, `section-next`, `now-playing`, `search`, `quit`). Point `XDG_CONFIG_HOME` and `XDG_CACHE_HOME` at a scratch directory to keep test runs away from your own config.
|
A scripted run starts fullscreen like a normal one, so it also checks that startup reaches fullscreen. Add `--windowed` to capture a window instead. Steps: `size:WxH`, `size:full`, `wait:MS`, `shot:PATH`, and action names (`up`, `down`, `left`, `right`, `activate`, `back`, `queue`, `next`, `play-pause`, `section-next`, `now-playing`, `search`, `quit`). Point `XDG_CONFIG_HOME` and `XDG_CACHE_HOME` at a scratch directory to keep test runs away from your own config.
|
||||||
|
|
||||||
|
### Versions
|
||||||
|
|
||||||
|
Every finished ticket bumps the version, so a build on the Deck can be matched to what it contains. The running version is shown at the bottom left of every screen.
|
||||||
|
|
||||||
|
- `make patch` for a bug fix, `make minor` for a feature, `make major` only when a breaking change has been decided.
|
||||||
|
- Before bumping, add a `## v<new> (<date>)` entry at the top of `CHANGELOG.md`, with `### Features` and `### Bug fixes` subsections (leave out an empty one), and commit it with the change. `make version` prints the current version.
|
||||||
|
- Bump on local `master` only: fast-forward `master` to the finished work, switch to it, then bump. The targets refuse any other branch.
|
||||||
|
- The bump writes the new version to `Cargo.toml`, `Cargo.lock` and the Flatpak metainfo, amends that into the last commit and tags it `v<new>`. It refuses a dirty tree, a commit that is already tagged or pushed, and a version the changelog has no entry for.
|
||||||
|
|||||||
@@ -0,0 +1,215 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Writes every Remus logo variant as SVG into branding/svg.
|
||||||
|
|
||||||
|
All variants are built from the same mark geometry below, so a change to the
|
||||||
|
mark only has to be made here. Run `make branding` to regenerate the SVGs and
|
||||||
|
render the PNGs.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
MAROON = "#5a0712"
|
||||||
|
CREAM = "#faebda"
|
||||||
|
# Slightly lifted maroon for decorative bars on the hero image.
|
||||||
|
MAROON_LIGHT = "#6b0d1b"
|
||||||
|
|
||||||
|
# The mark is drawn in the coordinates of the 1254 px source artwork.
|
||||||
|
# It is mirror-symmetric around x = 627.5.
|
||||||
|
CX = 627.5
|
||||||
|
MARK_BOX = (340.0, 313.0, 915.0, 941.5) # x0, y0, x1, y1
|
||||||
|
|
||||||
|
# Traced from the source artwork.
|
||||||
|
R_PATH = "M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"
|
||||||
|
|
||||||
|
|
||||||
|
def _column() -> str:
|
||||||
|
flutes = "".join(
|
||||||
|
f"M{fx - 11.5},855.5V738.5A11.5 11.5 0 0 1 {fx + 11.5},738.5V855.5Z"
|
||||||
|
for fx in (CX - 53.5, CX, CX + 53.5)
|
||||||
|
)
|
||||||
|
return (
|
||||||
|
# Abacus
|
||||||
|
"M453,633Q453,632 454,632H801Q802,632 802,633V653"
|
||||||
|
"A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653Z"
|
||||||
|
# Echinus
|
||||||
|
"M493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683Z"
|
||||||
|
# Shaft with flared ends
|
||||||
|
"M520,710H735Q726,714 726,724V856Q726.5,870 735,873"
|
||||||
|
"H520Q528.5,870 529,856V724Q529,714 520,710Z"
|
||||||
|
+ flutes
|
||||||
|
# Base
|
||||||
|
+ "M487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905Z"
|
||||||
|
"M460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _bars() -> str:
|
||||||
|
# (offset of the bar centre from CX, top, bottom), mirrored on both sides.
|
||||||
|
bars = [(152.5, 741, 856), (212.5, 707, 889), (272.5, 757, 856)]
|
||||||
|
out = []
|
||||||
|
for off, top, bottom in bars:
|
||||||
|
for sign in (-1, 1):
|
||||||
|
x = CX + sign * off - 15
|
||||||
|
out.append(
|
||||||
|
f'<rect x="{x}" y="{top}" width="30" height="{bottom - top}" rx="6"/>'
|
||||||
|
)
|
||||||
|
return "".join(out)
|
||||||
|
|
||||||
|
|
||||||
|
def mark(fill: str, cx: float, cy: float, height: float) -> str:
|
||||||
|
"""The mark scaled to `height`, centred on (cx, cy)."""
|
||||||
|
x0, y0, x1, y1 = MARK_BOX
|
||||||
|
s = height / (y1 - y0)
|
||||||
|
mx, my = (x0 + x1) / 2, (y0 + y1) / 2
|
||||||
|
return (
|
||||||
|
f'<g fill="{fill}" transform="translate({cx:g} {cy:g}) scale({s:.6g}) '
|
||||||
|
f'translate({-mx:g} {-my:g})">'
|
||||||
|
f'<path d="{R_PATH}"/>'
|
||||||
|
f'<path fill-rule="evenodd" d="{_column()}"/>'
|
||||||
|
f"{_bars()}</g>"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def mark_width(height: float) -> float:
|
||||||
|
x0, y0, x1, y1 = MARK_BOX
|
||||||
|
return (x1 - x0) * height / (y1 - y0)
|
||||||
|
|
||||||
|
|
||||||
|
# "REMUS" in Noto Serif SemiBold, letter-spacing 18, font-size 100, as outlines.
|
||||||
|
# Cap height runs from y = 28.6 to the baseline at y = 100.
|
||||||
|
WORDMARK = [
|
||||||
|
"m 3.2,100 v -4.9 h 3.1 q 2.5,0 4.4,-1 1.9,-1.1 1.9,-5.2 V 39.8 q 0,-4.1 -1.9,-5.2 Q 8.8,33.5 6.3,33.5 H 3.2 v -4.9 h 30.2 q 13.7,0 20.2,4.8 6.5,4.7 6.5,14 0,5.3 -2.1,9 -2,3.7 -5.3,6 -3.2,2.3 -6.6,3.6 l 12.6,21 q 2.5,4.2 4.8,6.2 2.4,1.9 5.4,1.9 h 0.3 V 100 H 66.7 Q 60.6,100 56.8,99.3 53,98.6 50.5,96.7 48.1,94.8 45.9,91 L 33.4,68.8 h -7.2 v 20.1 q 0,4.1 1.9,5.2 1.9,1 4.4,1 h 3.1 V 100 Z M 32.3,63.4 q 7.6,0 10.4,-3.7 2.9,-3.8 2.9,-11.3 0,-7.8 -3.1,-11 -3,-3.3 -10.4,-3.3 h -5.9 v 29.3 z",
|
||||||
|
"m 89.999973,100 v -4.9 h 3.1 q 2.5,0 4.4,-1 1.9,-1.1 1.9,-5.2 V 40.2 q 0,-4.4 -1.9,-5.5 -1.8,-1.2 -4.4,-1.2 h -3.1 v -4.9 h 53.499997 l 0.5,18.1 h -6.3 l -0.5,-4.6 q -0.4,-3.5 -2.1,-5.6 -1.6,-2.2 -5.2,-2.2 h -16.8 v 25.6 h 23.8 v 5.6 h -23.8 v 28.8 h 19.7 q 3.6,0 5.3,-2.2 1.7,-2.3 2.3,-5.6 l 0.7,-4.6 h 6.3 l -0.7,18.1 z",
|
||||||
|
"m 172.2,100 v -4.9 h 3.1 q 2.5,0 4.4,-1 1.9,-1.1 1.9,-5.2 V 39.8 q 0,-4.1 -1.9,-5.2 -1.9,-1.1 -4.4,-1.1 h -3.1 v -4.9 h 26.5 l 18.2,51.7 17.6,-51.7 h 26 v 4.9 h -3.1 q -2.6,0 -4.5,1.2 -1.8,1.1 -1.8,5.5 v 48.2 q 0,4.4 1.8,5.6 1.9,1.1 4.5,1.1 h 3.1 v 4.9 h -30 v -4.9 h 0.8 q 3.2,0 4.8,-1 1.7,-1 1.8,-4.8 V 37.6 L 216.7,100 h -6.3 L 188.5,37.7 v 50.7 q 0,4.4 1.9,5.6 2,1.1 5.4,1.1 h 0.5 v 4.9 z",
|
||||||
|
"m 319.50004,101 q -12.6,0 -19.7,-5.2 -7.1,-5.3 -7.1,-17.5 V 39.8 q 0,-4.1 -1.9,-5.2 -1.9,-1.1 -4.4,-1.1 h -3.1 v -4.9 h 32.4 v 4.9 h -3.1 q -2.6,0 -4.5,1.2 -1.8,1.1 -1.8,5.5 V 79 q 0,8.5 4.3,11.9 4.3,3.4 11.3,3.4 7.4,0 11.4,-3.8 4,-3.9 4,-11.2 V 39.8 q 0,-4.1 -1.9,-5.2 -1.8,-1.1 -4.4,-1.1 h -3.1 v -4.9 h 25.8 v 4.9 h -3.2 q -2.5,0 -4.4,1.2 -1.8,1.1 -1.8,5.5 v 39.3 q 0,10 -6.1,15.8 -6.1,5.7 -18.7,5.7 z",
|
||||||
|
"m 399.10005,101 q -8.1,0 -13,-2 -4.8,-2 -7,-5.2 -2.1,-3.2 -2.1,-6.8 0,-4.3 2.8,-6.3 2.9,-2.1 6.9,-2.1 0.1,7.7 3.7,12.3 3.6,4.5 10,4.5 6.1,0 9.6,-3.1 3.5,-3.2 3.5,-8.4 0,-5.2 -3.9,-8.3 -3.8,-3.2 -12.4,-6.7 -10,-4.1 -14.3,-9.2 -4.3,-5.1 -4.3,-12.8 0,-5.9 3.1,-10.2 3.1,-4.4 8.4,-6.7 5.3,-2.4 12.1,-2.4 10.2,0 15.2,3.4 5.1,3.4 5.1,8 0,3.5 -2.8,5.6 -2.7,2.1 -7.9,2.1 0,-2.9 -1.1,-6 -1,-3.2 -3.4,-5.3 -2.3,-2.1 -6.3,-2.1 -4.7,0 -7.8,2.7 -3,2.6 -3,7.3 0,3.3 1.4,5.8 1.4,2.5 4.9,4.8 3.5,2.3 9.9,4.9 9.7,3.9 14.3,8.7 4.6,4.8 4.6,12.3 0,6.4 -3.3,11.2 -3.2,4.7 -9.1,7.4 -5.8,2.6 -13.8,2.6 z",
|
||||||
|
]
|
||||||
|
WM_X0, WM_X1 = 3.2, 425.3
|
||||||
|
WM_CAP_TOP, WM_BASELINE = 28.6, 100.0
|
||||||
|
|
||||||
|
|
||||||
|
def wordmark(fill: str, cx: float, cap_top: float, cap_height: float) -> str:
|
||||||
|
"""The wordmark with its cap height box at cap_top, centred on cx."""
|
||||||
|
s = cap_height / (WM_BASELINE - WM_CAP_TOP)
|
||||||
|
mx = (WM_X0 + WM_X1) / 2
|
||||||
|
paths = "".join(f'<path d="{d}"/>' for d in WORDMARK)
|
||||||
|
return (
|
||||||
|
f'<g fill="{fill}" transform="translate({cx:g} {cap_top:g}) scale({s:.6g}) '
|
||||||
|
f'translate({-mx:g} {-WM_CAP_TOP:g})">{paths}</g>'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def wordmark_width(cap_height: float) -> float:
|
||||||
|
return (WM_X1 - WM_X0) * cap_height / (WM_BASELINE - WM_CAP_TOP)
|
||||||
|
|
||||||
|
|
||||||
|
def svg(w: float, h: float, body: str, bg: str | None = None) -> str:
|
||||||
|
back = f'<rect width="{w:g}" height="{h:g}" fill="{bg}"/>' if bg else ""
|
||||||
|
return (
|
||||||
|
f'<svg xmlns="http://www.w3.org/2000/svg" width="{w:g}" height="{h:g}" '
|
||||||
|
f'viewBox="0 0 {w:g} {h:g}">{back}{body}</svg>\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def lockup_horizontal(fill: str, cx: float, cy: float, mark_h: float) -> tuple[str, float]:
|
||||||
|
cap = mark_h * 0.3
|
||||||
|
gap = mark_h * 0.24
|
||||||
|
total = mark_width(mark_h) + gap + wordmark_width(cap)
|
||||||
|
left = cx - total / 2
|
||||||
|
body = mark(fill, left + mark_width(mark_h) / 2, cy, mark_h) + wordmark(
|
||||||
|
fill, left + mark_width(mark_h) + gap + wordmark_width(cap) / 2, cy - cap / 2, cap
|
||||||
|
)
|
||||||
|
return body, total
|
||||||
|
|
||||||
|
|
||||||
|
def lockup_stacked(fill: str, cx: float, cy: float, mark_h: float) -> tuple[str, float]:
|
||||||
|
cap = mark_h * 0.22
|
||||||
|
gap = mark_h * 0.2
|
||||||
|
total = mark_h + gap + cap
|
||||||
|
top = cy - total / 2
|
||||||
|
body = mark(fill, cx, top + mark_h / 2, mark_h) + wordmark(
|
||||||
|
fill, cx, top + mark_h + gap, cap
|
||||||
|
)
|
||||||
|
return body, total
|
||||||
|
|
||||||
|
|
||||||
|
def hero_bars(w: float, h: float) -> str:
|
||||||
|
"""A wide, quiet waveform in the mark's bar style, for the Steam hero."""
|
||||||
|
import math
|
||||||
|
|
||||||
|
bar, pitch = 36, 72
|
||||||
|
n = int(w // pitch)
|
||||||
|
x0 = (w - (n - 1) * pitch) / 2
|
||||||
|
out = []
|
||||||
|
for i in range(n):
|
||||||
|
t = i / (n - 1)
|
||||||
|
env = 0.35 + 0.65 * math.sin(math.pi * t) ** 2
|
||||||
|
wobble = 0.55 + 0.45 * abs(math.sin(i * 0.9) * math.cos(i * 0.37))
|
||||||
|
bh = h * 0.62 * env * wobble
|
||||||
|
x = x0 + i * pitch - bar / 2
|
||||||
|
out.append(
|
||||||
|
f'<rect x="{x:.1f}" y="{(h - bh) / 2:.1f}" width="{bar}" '
|
||||||
|
f'height="{bh:.1f}" rx="7"/>'
|
||||||
|
)
|
||||||
|
return f'<g fill="{MAROON_LIGHT}">{"".join(out)}</g>'
|
||||||
|
|
||||||
|
|
||||||
|
def variants() -> dict[str, str]:
|
||||||
|
x0, y0, x1, y1 = MARK_BOX
|
||||||
|
mw, mh = x1 - x0, y1 - y0
|
||||||
|
v: dict[str, str] = {}
|
||||||
|
|
||||||
|
# Bare mark, tight bounds, for use inside the app and in documents.
|
||||||
|
v["remus-mark.svg"] = svg(mw, mh, mark(CREAM, mw / 2, mh / 2, mh))
|
||||||
|
v["remus-mark-maroon.svg"] = svg(mw, mh, mark(MAROON, mw / 2, mh / 2, mh))
|
||||||
|
|
||||||
|
# Full-bleed square, the composition of the source artwork.
|
||||||
|
v["remus-square.svg"] = svg(1024, 1024, mark(CREAM, 512, 512, 512), MAROON)
|
||||||
|
|
||||||
|
# Desktop / Flatpak app icon: rounded tile with a margin, 128 grid.
|
||||||
|
v["remus-icon.svg"] = svg(
|
||||||
|
128,
|
||||||
|
128,
|
||||||
|
f'<rect x="8" y="8" width="112" height="112" rx="26" fill="{MAROON}"/>'
|
||||||
|
+ mark(CREAM, 64, 64, 74),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Lockups with the wordmark, transparent background.
|
||||||
|
for name, fill in (("", CREAM), ("-maroon", MAROON)):
|
||||||
|
body, w = lockup_horizontal(fill, 0, 0, 400)
|
||||||
|
pad = 0
|
||||||
|
v[f"remus-logo{name}.svg"] = svg(
|
||||||
|
w + 2 * pad, 400 + 2 * pad, f'<g transform="translate({w / 2 + pad:g} {200 + pad})">{body}</g>'
|
||||||
|
)
|
||||||
|
body, h = lockup_stacked(fill, 0, 0, 400)
|
||||||
|
sw = max(mark_width(400), wordmark_width(400 * 0.22))
|
||||||
|
v[f"remus-logo-stacked{name}.svg"] = svg(
|
||||||
|
sw + 2 * pad, h + 2 * pad, f'<g transform="translate({sw / 2 + pad:g} {h / 2 + pad:g})">{body}</g>'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Steam library artwork, for the non-Steam shortcut on SteamOS.
|
||||||
|
v["steam-capsule-portrait.svg"] = svg(
|
||||||
|
600, 900, lockup_stacked(CREAM, 300, 450, 330)[0], MAROON
|
||||||
|
)
|
||||||
|
v["steam-capsule-wide.svg"] = svg(
|
||||||
|
920, 430, lockup_horizontal(CREAM, 460, 215, 210)[0], MAROON
|
||||||
|
)
|
||||||
|
v["steam-hero.svg"] = svg(3840, 1240, hero_bars(3840, 1240), MAROON)
|
||||||
|
v["steam-logo.svg"] = svg(1280, 720, lockup_horizontal(CREAM, 640, 360, 300)[0])
|
||||||
|
v["steam-icon.svg"] = v["remus-square.svg"]
|
||||||
|
return v
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
here = Path(__file__).resolve().parent
|
||||||
|
out = here / "svg"
|
||||||
|
out.mkdir(exist_ok=True)
|
||||||
|
v = variants()
|
||||||
|
for name, text in v.items():
|
||||||
|
(out / name).write_text(text)
|
||||||
|
# The Flatpak manifest installs the icon from here under the app ID.
|
||||||
|
(here.parent / "flatpak" / "me.anshorei.Fettleshed.Remus.svg").write_text(v["remus-icon.svg"])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect x="8" y="8" width="112" height="112" rx="26" fill="#5a0712"/><g fill="#faebda" transform="translate(64 64) scale(0.117741) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="575" height="628.5" viewBox="0 0 575 628.5"><g fill="#5a0712" transform="translate(287.5 314.25) scale(1) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="575" height="628.5" viewBox="0 0 575 628.5"><g fill="#faebda" transform="translate(287.5 314.25) scale(1) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><rect width="1024" height="1024" fill="#5a0712"/><g fill="#faebda" transform="translate(512 512) scale(0.814638) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="3840" height="1240" viewBox="0 0 3840 1240"><rect width="3840" height="1240" fill="#5a0712"/><g fill="#6b0d1b"><rect x="30.0" y="546.0" width="36" height="148.0" rx="7"/><rect x="102.0" y="501.0" width="36" height="238.0" rx="7"/><rect x="174.0" y="499.3" width="36" height="241.4" rx="7"/><rect x="246.0" y="529.3" width="36" height="181.3" rx="7"/><rect x="318.0" y="535.4" width="36" height="169.1" rx="7"/><rect x="390.0" y="514.8" width="36" height="210.3" rx="7"/><rect x="462.0" y="493.8" width="36" height="252.3" rx="7"/><rect x="534.0" y="521.7" width="36" height="196.6" rx="7"/><rect x="606.0" y="450.1" width="36" height="339.8" rx="7"/><rect x="678.0" y="422.9" width="36" height="394.3" rx="7"/><rect x="750.0" y="467.8" width="36" height="304.4" rx="7"/><rect x="822.0" y="465.4" width="36" height="309.2" rx="7"/><rect x="894.0" y="456.5" width="36" height="326.9" rx="7"/><rect x="966.0" y="468.6" width="36" height="302.8" rx="7"/><rect x="1038.0" y="467.1" width="36" height="305.7" rx="7"/><rect x="1110.0" y="383.1" width="36" height="473.8" rx="7"/><rect x="1182.0" y="329.5" width="36" height="580.9" rx="7"/><rect x="1254.0" y="388.7" width="36" height="462.7" rx="7"/><rect x="1326.0" y="372.9" width="36" height="494.1" rx="7"/><rect x="1398.0" y="320.5" width="36" height="599.0" rx="7"/><rect x="1470.0" y="373.5" width="36" height="492.9" rx="7"/><rect x="1542.0" y="420.1" width="36" height="399.9" rx="7"/><rect x="1614.0" y="378.2" width="36" height="483.6" rx="7"/><rect x="1686.0" y="313.8" width="36" height="612.5" rx="7"/><rect x="1758.0" y="354.7" width="36" height="530.6" rx="7"/><rect x="1830.0" y="326.3" width="36" height="587.4" rx="7"/><rect x="1902.0" y="241.1" width="36" height="757.8" rx="7"/><rect x="1974.0" y="301.3" width="36" height="637.5" rx="7"/><rect x="2046.0" y="403.7" width="36" height="432.5" rx="7"/><rect x="2118.0" y="376.5" width="36" height="487.1" rx="7"/><rect x="2190.0" y="399.8" width="36" height="440.3" rx="7"/><rect x="2262.0" y="393.5" width="36" height="453.0" rx="7"/><rect x="2334.0" y="366.3" width="36" height="507.5" rx="7"/><rect x="2406.0" y="288.9" width="36" height="662.2" rx="7"/><rect x="2478.0" y="330.0" width="36" height="580.1" rx="7"/><rect x="2550.0" y="434.2" width="36" height="371.5" rx="7"/><rect x="2622.0" y="369.9" width="36" height="500.2" rx="7"/><rect x="2694.0" y="407.3" width="36" height="425.4" rx="7"/><rect x="2766.0" y="465.7" width="36" height="308.6" rx="7"/><rect x="2838.0" y="459.9" width="36" height="320.2" rx="7"/><rect x="2910.0" y="418.5" width="36" height="403.1" rx="7"/><rect x="2982.0" y="430.1" width="36" height="379.7" rx="7"/><rect x="3054.0" y="492.0" width="36" height="255.9" rx="7"/><rect x="3126.0" y="434.5" width="36" height="371.1" rx="7"/><rect x="3198.0" y="448.9" width="36" height="342.3" rx="7"/><rect x="3270.0" y="507.2" width="36" height="225.5" rx="7"/><rect x="3342.0" y="518.6" width="36" height="202.8" rx="7"/><rect x="3414.0" y="526.1" width="36" height="187.9" rx="7"/><rect x="3486.0" y="516.3" width="36" height="207.4" rx="7"/><rect x="3558.0" y="535.9" width="36" height="168.3" rx="7"/><rect x="3630.0" y="494.3" width="36" height="251.4" rx="7"/><rect x="3702.0" y="488.2" width="36" height="263.6" rx="7"/><rect x="3774.0" y="528.2" width="36" height="183.6" rx="7"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 3.3 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024"><rect width="1024" height="1024" fill="#5a0712"/><g fill="#faebda" transform="translate(512 512) scale(0.814638) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
@@ -20,6 +20,8 @@
|
|||||||
</supports>
|
</supports>
|
||||||
<content_rating type="oars-1.1"/>
|
<content_rating type="oars-1.1"/>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="0.2.1" date="2026-11-04"/>
|
||||||
|
<release version="0.2.0" date="2026-11-04"/>
|
||||||
<release version="0.1.0" date="2026-11-04"/>
|
<release version="0.1.0" date="2026-11-04"/>
|
||||||
</releases>
|
</releases>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -1,8 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
|
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect x="8" y="8" width="112" height="112" rx="26" fill="#5a0712"/><g fill="#faebda" transform="translate(64 64) scale(0.117741) translate(-627.5 -627.25)"><path d="M456.32,605.50C452.96,605.35 452.88,605.29 452.88,603.08C452.88,601.03 453.05,600.88 456.88,599.52C460.01,598.41 460.90,598.05 463.45,596.85C464.45,596.38 465.33,596.00 465.40,596.00C465.81,596.00 472.53,592.55 474.76,591.20C490.25,581.80 496.47,573.90 499.54,559.75L500.11,557.12L500.24,497.38C500.43,412.59 500.22,363.56 499.67,360.75C498.12,352.93 496.40,348.79 492.61,343.77C485.58,334.43 474.65,326.59 459.62,320.12C457.15,319.06 454.76,318.08 454.31,317.95C453.12,317.62 452.67,316.78 452.80,315.14C452.86,314.39 453.06,313.60 453.24,313.39C453.53,313.04 462.72,313.00 547.89,313.00C653.06,313.00 647.36,312.92 660.75,314.64C672.81,316.19 690.05,321.27 698.25,325.70C709.70,331.88 714.98,335.69 721.89,342.78C731.72,352.87 738.85,366.60 740.96,379.50C742.04,386.15 742.34,389.75 742.17,394.18C741.67,407.42 738.27,418.76 731.68,429.15C724.99,439.71 714.77,449.22 702.54,456.28C701.26,457.02 699.91,457.80 699.54,458.02C693.02,461.86 679.82,467.01 670.12,469.50C665.05,470.81 664.39,471.06 664.30,471.71C664.21,472.26 665.78,474.37 671.26,481.12C672.72,482.91 677.78,489.21 682.52,495.13C687.27,501.04 692.08,507.00 693.22,508.38C694.36,509.75 696.22,512.11 697.37,513.62C698.51,515.14 700.73,517.97 702.29,519.91C710.78,530.50 718.71,540.31 721.45,543.62C723.15,545.69 726.41,549.68 728.71,552.50C735.86,561.29 738.22,564.01 742.11,567.89C750.99,576.78 762.35,584.44 773.88,589.31C774.70,589.66 776.22,590.31 777.25,590.75C778.28,591.20 779.69,591.76 780.38,592.00C783.56,593.10 786.30,593.97 788.25,594.49C789.42,594.79 791.11,595.26 792.00,595.52C793.57,595.97 795.02,596.30 799.48,597.23C802.20,597.80 802.25,597.88 802.25,601.41C802.25,604.02 802.21,604.27 801.65,604.92L801.04,605.62L753.96,605.62C715.51,605.62 706.46,605.56 704.62,605.28C692.89,603.51 683.14,597.15 674.69,585.75C673.21,583.76 671.10,580.94 670.00,579.50C667.28,575.93 664.03,571.58 660.00,566.13C658.14,563.62 655.56,560.13 654.25,558.38C652.94,556.62 650.03,552.70 647.77,549.66C641.97,541.85 633.78,530.97 619.02,511.50C617.41,509.37 613.97,504.81 611.37,501.38C608.78,497.94 605.19,493.21 603.39,490.88C601.59,488.54 599.31,485.56 598.33,484.25C596.30,481.54 595.64,480.88 594.74,480.66C594.38,480.58 589.15,480.50 583.11,480.49L572.13,480.47L571.68,481.02C571.25,481.55 571.24,483.35 571.31,519.85C571.38,549.72 571.47,558.48 571.72,559.75C574.89,575.81 583.99,585.82 604.45,595.75C605.86,596.44 607.11,597.00 607.23,597.00C607.35,597.00 608.15,597.35 609.02,597.78C609.88,598.21 611.16,598.76 611.86,599.01C614.40,599.93 615.15,600.22 616.31,600.72L617.50,601.23L617.50,602.84C617.50,604.03 617.38,604.59 617.03,605.02L616.57,605.60L537.85,605.61C494.55,605.62 457.86,605.57 456.32,605.50ZM600.38,463.00C606.75,462.53 613.03,461.37 618.38,459.66C629.72,456.04 637.60,451.38 645.27,443.75C651.89,437.18 657.19,428.71 659.74,420.62C660.05,419.66 660.44,418.48 660.62,418.00C662.11,413.97 663.57,406.53 664.03,400.62C664.33,396.86 664.17,385.71 663.79,383.88C663.64,383.19 663.40,381.84 663.25,380.88C662.92,378.72 661.84,373.77 661.37,372.25C661.18,371.63 660.75,370.23 660.41,369.12C660.07,368.02 659.61,366.79 659.40,366.38C659.18,365.96 659.00,365.51 659.00,365.36C659.00,365.22 658.26,363.65 657.35,361.86C648.63,344.78 632.27,333.74 611.62,331.03C610.52,330.88 608.67,330.63 607.50,330.47C606.12,330.28 599.60,330.14 589.00,330.06L572.62,329.95L571.94,330.50L571.25,331.04L571.31,396.95L571.38,462.86L571.89,463.12C572.56,463.45 595.54,463.36 600.38,463.00Z"/><path fill-rule="evenodd" d="M453,633Q453,632 454,632H801Q802,632 802,633V653A13 12 0 0 1 789,665H466A13 12 0 0 1 453,653ZM493.5,677H761.5V683A16 16 0 0 1 745.5,699H509.5A16 16 0 0 1 493.5,683ZM520,710H735Q726,714 726,724V856Q726.5,870 735,873H520Q528.5,870 529,856V724Q529,714 520,710ZM562.5,855.5V738.5A11.5 11.5 0 0 1 585.5,738.5V855.5ZM616.0,855.5V738.5A11.5 11.5 0 0 1 639.0,738.5V855.5ZM669.5,855.5V738.5A11.5 11.5 0 0 1 692.5,738.5V855.5ZM487,905V900A16 16 0 0 1 503,884H752A16 16 0 0 1 768,900V905ZM460,941.5V930A14 14 0 0 1 474,916H781A14 14 0 0 1 795,930V941.5Z"/><rect x="460.0" y="741" width="30" height="115" rx="6"/><rect x="765.0" y="741" width="30" height="115" rx="6"/><rect x="400.0" y="707" width="30" height="182" rx="6"/><rect x="825.0" y="707" width="30" height="182" rx="6"/><rect x="340.0" y="757" width="30" height="99" rx="6"/><rect x="885.0" y="757" width="30" height="99" rx="6"/></g></svg>
|
||||||
<rect x="8" y="8" width="112" height="112" rx="26" fill="#14171d"/>
|
|
||||||
<circle cx="64" cy="64" r="40" fill="#0d0f13"/>
|
|
||||||
<circle cx="64" cy="64" r="33" fill="none" stroke="#2a2f39" stroke-width="2"/>
|
|
||||||
<circle cx="64" cy="64" r="25" fill="none" stroke="#2a2f39" stroke-width="2"/>
|
|
||||||
<circle cx="64" cy="64" r="15" fill="#8ab4ff"/>
|
|
||||||
<circle cx="64" cy="64" r="4" fill="#0d0f13"/>
|
|
||||||
</svg>
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 476 B After Width: | Height: | Size: 4.5 KiB |
@@ -8,7 +8,7 @@ use std::num::NonZeroUsize;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use lru::LruCache;
|
use lru::LruCache;
|
||||||
@@ -16,9 +16,10 @@ use slint::{Color, ComponentHandle, Image, ModelRc, Rgb8Pixel, SharedPixelBuffer
|
|||||||
use tokio::runtime::Handle;
|
use tokio::runtime::Handle;
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
|
|
||||||
use crate::config::{self, Config};
|
use crate::config::{self, Config, Settings};
|
||||||
|
use crate::palette::{Lab, Palette, Role, Tone};
|
||||||
use crate::player::{Player, PlayerEvent};
|
use crate::player::{Player, PlayerEvent};
|
||||||
use crate::subsonic::{Album, Artist, Client, Playlist, SearchResult, Song};
|
use crate::subsonic::{self, Album, Artist, Client, Playlist, SearchResult, Song};
|
||||||
use crate::{Action, AppWindow, Area, Header, Hint, Item, Screen, Theme};
|
use crate::{Action, AppWindow, Area, Header, Hint, Item, Screen, Theme};
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
@@ -70,15 +71,17 @@ enum Section {
|
|||||||
Artists,
|
Artists,
|
||||||
Playlists,
|
Playlists,
|
||||||
Search,
|
Search,
|
||||||
|
Settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
const SECTIONS: [Section; 6] = [
|
const SECTIONS: [Section; 7] = [
|
||||||
Section::Recent,
|
Section::Recent,
|
||||||
Section::Random,
|
Section::Random,
|
||||||
Section::Albums,
|
Section::Albums,
|
||||||
Section::Artists,
|
Section::Artists,
|
||||||
Section::Playlists,
|
Section::Playlists,
|
||||||
Section::Search,
|
Section::Search,
|
||||||
|
Section::Settings,
|
||||||
];
|
];
|
||||||
|
|
||||||
impl Section {
|
impl Section {
|
||||||
@@ -90,6 +93,7 @@ impl Section {
|
|||||||
Section::Artists => "Artists",
|
Section::Artists => "Artists",
|
||||||
Section::Playlists => "Playlists",
|
Section::Playlists => "Playlists",
|
||||||
Section::Search => "Search",
|
Section::Search => "Search",
|
||||||
|
Section::Settings => "Settings",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,6 +105,24 @@ enum Target {
|
|||||||
Playlist(String),
|
Playlist(String),
|
||||||
/// Index into the page's `songs`.
|
/// Index into the page's `songs`.
|
||||||
Song(usize),
|
Song(usize),
|
||||||
|
Setting(Setting),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
enum Setting {
|
||||||
|
AlbumArtColours,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How long the UI takes to change from one palette to the next.
|
||||||
|
const FADE: Duration = Duration::from_millis(800);
|
||||||
|
|
||||||
|
/// The palette on screen and the one it is fading towards.
|
||||||
|
struct Fade {
|
||||||
|
from: Palette,
|
||||||
|
to: Palette,
|
||||||
|
shown: Palette,
|
||||||
|
started: Instant,
|
||||||
|
timer: Timer,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -161,6 +183,9 @@ type CoverKey = (String, u32);
|
|||||||
|
|
||||||
struct Covers {
|
struct Covers {
|
||||||
images: LruCache<CoverKey, Image>,
|
images: LruCache<CoverKey, Image>,
|
||||||
|
/// Per cover id, whatever size it was decoded at. None for a cover with
|
||||||
|
/// too little colour to base a palette on.
|
||||||
|
tones: LruCache<String, Option<Tone>>,
|
||||||
pending: HashSet<CoverKey>,
|
pending: HashSet<CoverKey>,
|
||||||
failed: HashSet<CoverKey>,
|
failed: HashSet<CoverKey>,
|
||||||
limit: Arc<Semaphore>,
|
limit: Arc<Semaphore>,
|
||||||
@@ -191,6 +216,8 @@ pub struct App {
|
|||||||
scrobbled: bool,
|
scrobbled: bool,
|
||||||
login_focus: i32,
|
login_focus: i32,
|
||||||
toast_timer: Timer,
|
toast_timer: Timer,
|
||||||
|
settings: Settings,
|
||||||
|
fade: Fade,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
@@ -221,6 +248,7 @@ impl App {
|
|||||||
queue_range: (0, 0),
|
queue_range: (0, 0),
|
||||||
covers: Covers {
|
covers: Covers {
|
||||||
images: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
images: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
||||||
|
tones: LruCache::new(NonZeroUsize::new(400).unwrap()),
|
||||||
pending: HashSet::new(),
|
pending: HashSet::new(),
|
||||||
failed: HashSet::new(),
|
failed: HashSet::new(),
|
||||||
limit: Arc::new(Semaphore::new(6)),
|
limit: Arc::new(Semaphore::new(6)),
|
||||||
@@ -235,6 +263,14 @@ impl App {
|
|||||||
scrobbled: false,
|
scrobbled: false,
|
||||||
login_focus: 0,
|
login_focus: 0,
|
||||||
toast_timer: Timer::default(),
|
toast_timer: Timer::default(),
|
||||||
|
settings: config::load_settings(),
|
||||||
|
fade: Fade {
|
||||||
|
from: Palette::brand(),
|
||||||
|
to: Palette::brand(),
|
||||||
|
shown: Palette::brand(),
|
||||||
|
started: Instant::now(),
|
||||||
|
timer: Timer::default(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +293,7 @@ impl App {
|
|||||||
log::info!("using saved login for {} on {}", cfg.username, cfg.url);
|
log::info!("using saved login for {} on {}", cfg.username, cfg.url);
|
||||||
self.ui.set_login_server(cfg.url.clone().into());
|
self.ui.set_login_server(cfg.url.clone().into());
|
||||||
self.ui.set_login_username(cfg.username.clone().into());
|
self.ui.set_login_username(cfg.username.clone().into());
|
||||||
self.enter_browse(Client::new(&cfg.url, &cfg.username, &cfg.salt, &cfg.token));
|
self.enter_browse(cfg.client());
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
log::info!("no saved login, showing the login screen");
|
log::info!("no saved login, showing the login screen");
|
||||||
@@ -330,27 +366,22 @@ impl App {
|
|||||||
}
|
}
|
||||||
self.ui.set_login_error("".into());
|
self.ui.set_login_error("".into());
|
||||||
self.ui.set_login_busy(true);
|
self.ui.set_login_busy(true);
|
||||||
let client = Client::from_password(&url, &user, &password);
|
self.spawn(
|
||||||
let probe = client.clone();
|
async move { Client::login(&url, &user, &password).await },
|
||||||
self.spawn(async move { probe.ping().await }, move |app, r| {
|
move |app, r| {
|
||||||
app.ui.set_login_busy(false);
|
app.ui.set_login_busy(false);
|
||||||
match r {
|
match r {
|
||||||
Ok(()) => {
|
Ok(client) => {
|
||||||
app.ui.set_login_password("".into());
|
app.ui.set_login_password("".into());
|
||||||
let cfg = Config {
|
if let Err(e) = config::save(&Config::from_client(&client)) {
|
||||||
url: client.base().to_string(),
|
app.toast(format!("Could not save settings: {e:#}"));
|
||||||
username: client.user().to_string(),
|
}
|
||||||
salt: client.salt().to_string(),
|
app.enter_browse(client);
|
||||||
token: client.token().to_string(),
|
|
||||||
};
|
|
||||||
if let Err(e) = config::save(&cfg) {
|
|
||||||
app.toast(format!("Could not save settings: {e:#}"));
|
|
||||||
}
|
}
|
||||||
app.enter_browse(client);
|
Err(e) => app.ui.set_login_error(login_error(&e).into()),
|
||||||
}
|
}
|
||||||
Err(e) => app.ui.set_login_error(format!("{e:#}").into()),
|
},
|
||||||
}
|
);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn enter_browse(&mut self, client: Client) {
|
fn enter_browse(&mut self, client: Client) {
|
||||||
@@ -359,6 +390,7 @@ impl App {
|
|||||||
.set_server_label(format!("{} on {}", client.user(), host).into());
|
.set_server_label(format!("{} on {}", client.user(), host).into());
|
||||||
self.client = Some(client);
|
self.client = Some(client);
|
||||||
self.covers.images.clear();
|
self.covers.images.clear();
|
||||||
|
self.covers.tones.clear();
|
||||||
self.covers.pending.clear();
|
self.covers.pending.clear();
|
||||||
self.covers.failed.clear();
|
self.covers.failed.clear();
|
||||||
for stack in &mut self.stacks {
|
for stack in &mut self.stacks {
|
||||||
@@ -576,7 +608,7 @@ impl App {
|
|||||||
self.ui.set_section(index as i32);
|
self.ui.set_section(index as i32);
|
||||||
if self.stacks[index].is_empty() {
|
if self.stacks[index].is_empty() {
|
||||||
let section = SECTIONS[index];
|
let section = SECTIONS[index];
|
||||||
let list = matches!(section, Section::Artists | Section::Search);
|
let list = matches!(section, Section::Artists | Section::Search | Section::Settings);
|
||||||
let mut page = self.new_page(Source::Section(section), section.label().to_string(), list, None);
|
let mut page = self.new_page(Source::Section(section), section.label().to_string(), list, None);
|
||||||
if section == Section::Search {
|
if section == Section::Search {
|
||||||
page.loading = false;
|
page.loading = false;
|
||||||
@@ -744,6 +776,106 @@ impl App {
|
|||||||
let songs = page.songs.clone();
|
let songs = page.songs.clone();
|
||||||
self.play_songs(songs, index);
|
self.play_songs(songs, index);
|
||||||
}
|
}
|
||||||
|
Target::Setting(s) => self.toggle_setting(s),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- settings
|
||||||
|
|
||||||
|
fn toggle_setting(&mut self, setting: Setting) {
|
||||||
|
match setting {
|
||||||
|
Setting::AlbumArtColours => self.settings.album_art_colours = !self.settings.album_art_colours,
|
||||||
|
}
|
||||||
|
if let Err(e) = config::save_settings(&self.settings) {
|
||||||
|
self.toast(format!("Could not save settings: {e:#}"));
|
||||||
|
}
|
||||||
|
let entries = settings_data(&self.settings).entries;
|
||||||
|
let index = SECTIONS.iter().position(|s| *s == Section::Settings).unwrap_or(0);
|
||||||
|
if let Some(page) = self.stacks[index].first_mut() {
|
||||||
|
page.entries = entries;
|
||||||
|
if self.section == index {
|
||||||
|
self.sync_items(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.update_theme();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------- theme
|
||||||
|
|
||||||
|
/// The palette the UI should show: from the playing track's cover when
|
||||||
|
/// that setting is on, else the brand palette. None while the cover is
|
||||||
|
/// still loading, to keep the current palette rather than flash the brand.
|
||||||
|
fn wanted_palette(&mut self) -> Option<Palette> {
|
||||||
|
if !self.settings.album_art_colours {
|
||||||
|
return Some(Palette::brand());
|
||||||
|
}
|
||||||
|
let Some(id) = self
|
||||||
|
.current
|
||||||
|
.and_then(|i| self.queue.get(i))
|
||||||
|
.and_then(|s| s.cover_art.clone())
|
||||||
|
else {
|
||||||
|
return Some(Palette::brand());
|
||||||
|
};
|
||||||
|
match self.covers.tones.get(&id) {
|
||||||
|
Some(Some(tone)) => Some(Palette::from_tone(*tone)),
|
||||||
|
Some(None) => Some(Palette::brand()),
|
||||||
|
None if self.covers.failed.iter().any(|(f, _)| *f == id) => Some(Palette::brand()),
|
||||||
|
None => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_theme(&mut self) {
|
||||||
|
let Some(target) = self.wanted_palette() else { return };
|
||||||
|
if target == self.fade.to {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log::debug!(
|
||||||
|
"fading to a new palette, accent {:?}",
|
||||||
|
target.get(Role::Accent).to_rgb()
|
||||||
|
);
|
||||||
|
// From whatever is on screen, so a fade cut short by a skip carries on
|
||||||
|
// from where it got to instead of jumping.
|
||||||
|
self.fade.from = self.fade.shown;
|
||||||
|
self.fade.to = target;
|
||||||
|
self.fade.started = Instant::now();
|
||||||
|
if !self.fade.timer.running() {
|
||||||
|
self.fade
|
||||||
|
.timer
|
||||||
|
.start(slint::TimerMode::Repeated, Duration::from_millis(16), || {
|
||||||
|
with_app(|app| app.fade_step())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn fade_step(&mut self) {
|
||||||
|
let t = (self.fade.started.elapsed().as_secs_f32() / FADE.as_secs_f32()).min(1.0);
|
||||||
|
let eased = t * t * (3.0 - 2.0 * t);
|
||||||
|
self.fade.shown = self.fade.from.mix(&self.fade.to, eased);
|
||||||
|
self.apply_palette();
|
||||||
|
if t >= 1.0 {
|
||||||
|
self.fade.timer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn apply_palette(&self) {
|
||||||
|
let theme = self.ui.global::<Theme>();
|
||||||
|
for role in Role::ALL {
|
||||||
|
let c = color(self.fade.shown.get(role));
|
||||||
|
match role {
|
||||||
|
Role::Bg => theme.set_bg(c),
|
||||||
|
Role::Panel => theme.set_panel(c),
|
||||||
|
Role::Raised => theme.set_raised(c),
|
||||||
|
Role::Line => theme.set_line(c),
|
||||||
|
Role::Text => theme.set_text(c),
|
||||||
|
Role::Muted => theme.set_muted(c),
|
||||||
|
Role::Faint => theme.set_faint(c),
|
||||||
|
Role::Accent => theme.set_accent(c),
|
||||||
|
Role::OnAccent => theme.set_on_accent(c),
|
||||||
|
Role::Highlight => theme.set_highlight(c),
|
||||||
|
Role::Focus => theme.set_focus(c),
|
||||||
|
Role::Glow => theme.set_glow(c),
|
||||||
|
Role::LoginGlow => theme.set_login_glow(c),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -783,6 +915,11 @@ impl App {
|
|||||||
// ---------------------------------------------------------------- loading
|
// ---------------------------------------------------------------- loading
|
||||||
|
|
||||||
fn load(&mut self, page_id: u64, source: Source) {
|
fn load(&mut self, page_id: u64, source: Source) {
|
||||||
|
if matches!(source, Source::Section(Section::Settings)) {
|
||||||
|
let data = settings_data(&self.settings);
|
||||||
|
self.page_loaded(page_id, Ok(data), true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
let Some(client) = self.client.clone() else { return };
|
let Some(client) = self.client.clone() else { return };
|
||||||
match source {
|
match source {
|
||||||
Source::Section(Section::Recent) => self.spawn(
|
Source::Section(Section::Recent) => self.spawn(
|
||||||
@@ -820,7 +957,7 @@ impl App {
|
|||||||
async move { Ok(playlists_data(client.playlists().await?)) },
|
async move { Ok(playlists_data(client.playlists().await?)) },
|
||||||
move |app, r| app.page_loaded(page_id, r, true),
|
move |app, r| app.page_loaded(page_id, r, true),
|
||||||
),
|
),
|
||||||
Source::Section(Section::Search) => {}
|
Source::Section(Section::Search | Section::Settings) => {}
|
||||||
Source::Search(q) => self.spawn(
|
Source::Search(q) => self.spawn(
|
||||||
async move { Ok(search_data(client.search(&q).await?)) },
|
async move { Ok(search_data(client.search(&q).await?)) },
|
||||||
move |app, r| app.page_loaded(page_id, r, true),
|
move |app, r| app.page_loaded(page_id, r, true),
|
||||||
@@ -1116,6 +1253,7 @@ impl App {
|
|||||||
.map(|e| &e.target);
|
.map(|e| &e.target);
|
||||||
match target {
|
match target {
|
||||||
Some(Target::Song(_)) => hints.push(h("A", "Play")),
|
Some(Target::Song(_)) => hints.push(h("A", "Play")),
|
||||||
|
Some(Target::Setting(_)) => hints.push(h("A", "Change")),
|
||||||
Some(_) => hints.push(h("A", "Open")),
|
Some(_) => hints.push(h("A", "Open")),
|
||||||
None if self.current_page().is_some_and(|p| p.error.is_some()) => {
|
None if self.current_page().is_some_and(|p| p.error.is_some()) => {
|
||||||
hints.push(h("A", "Try again"))
|
hints.push(h("A", "Try again"))
|
||||||
@@ -1204,23 +1342,31 @@ impl App {
|
|||||||
b
|
b
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let buf = tokio::task::spawn_blocking(move || decode_cover(&bytes, px)).await??;
|
let decoded = tokio::task::spawn_blocking(move || decode_cover(&bytes, px)).await??;
|
||||||
Ok(buf)
|
Ok(decoded)
|
||||||
},
|
},
|
||||||
move |app, r| app.cover_loaded(key, r),
|
move |app, r| app.cover_loaded(key, r),
|
||||||
);
|
);
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cover_loaded(&mut self, key: CoverKey, result: Result<SharedPixelBuffer<Rgb8Pixel>>) {
|
fn cover_loaded(&mut self, key: CoverKey, result: Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>)>) {
|
||||||
self.covers.pending.remove(&key);
|
self.covers.pending.remove(&key);
|
||||||
match result {
|
match result {
|
||||||
Ok(buf) => {
|
Ok((buf, tone)) => {
|
||||||
self.covers.images.put(key.clone(), Image::from_rgb8(buf));
|
self.covers.images.put(key.clone(), Image::from_rgb8(buf));
|
||||||
|
// The first size decoded decides: other sizes give a tone that
|
||||||
|
// differs in the last digits, which would restart the fade.
|
||||||
|
if !self.covers.tones.contains(&key.0) {
|
||||||
|
log::debug!("cover {} tone {tone:?}", key.0);
|
||||||
|
self.covers.tones.put(key.0.clone(), tone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::debug!("cover {} failed: {e:#}", key.0);
|
log::debug!("cover {} failed: {e:#}", key.0);
|
||||||
self.covers.failed.insert(key);
|
self.covers.failed.insert(key);
|
||||||
|
// The playing track's cover failing means the brand palette.
|
||||||
|
self.update_theme();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1353,6 +1499,7 @@ impl App {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
Target::Artist(_) => self.toast("Open the artist to queue one of their albums".into()),
|
Target::Artist(_) => self.toast("Open the artist to queue one of their albums".into()),
|
||||||
|
Target::Setting(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1372,10 +1519,9 @@ impl App {
|
|||||||
self.ui.set_np_paused(p);
|
self.ui.set_np_paused(p);
|
||||||
}
|
}
|
||||||
PlayerEvent::Track(t) => {
|
PlayerEvent::Track(t) => {
|
||||||
|
// Reported once per track started, so the same index again is a
|
||||||
|
// new play: another queue started there, or the track replayed.
|
||||||
let t = t.filter(|&i| i < self.queue.len());
|
let t = t.filter(|&i| i < self.queue.len());
|
||||||
if t == self.current {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.current = t;
|
self.current = t;
|
||||||
self.position = 0.0;
|
self.position = 0.0;
|
||||||
self.scrobbled = false;
|
self.scrobbled = false;
|
||||||
@@ -1458,6 +1604,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.render_progress();
|
self.render_progress();
|
||||||
|
self.update_theme();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------- now playing
|
// ---------------------------------------------------------------- now playing
|
||||||
@@ -1640,6 +1787,23 @@ fn song_entry(s: &Song, index: usize) -> Entry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn settings_data(s: &Settings) -> PageData {
|
||||||
|
let on_off = |on: bool| if on { "On" } else { "Off" }.to_string();
|
||||||
|
PageData {
|
||||||
|
entries: vec![Entry {
|
||||||
|
title: "Colours from album art".to_string(),
|
||||||
|
subtitle: "Tint the interface with the cover of the playing track".to_string(),
|
||||||
|
detail: on_off(s.album_art_colours),
|
||||||
|
number: String::new(),
|
||||||
|
cover: None,
|
||||||
|
round: false,
|
||||||
|
show_art: false,
|
||||||
|
target: Target::Setting(Setting::AlbumArtColours),
|
||||||
|
}],
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn search_data(r: SearchResult) -> PageData {
|
fn search_data(r: SearchResult) -> PageData {
|
||||||
let mut entries: Vec<Entry> = r.artist.into_iter().map(artist_entry).collect();
|
let mut entries: Vec<Entry> = r.artist.into_iter().map(artist_entry).collect();
|
||||||
entries.extend(r.album.into_iter().map(|a| Entry {
|
entries.extend(r.album.into_iter().map(|a| Entry {
|
||||||
@@ -1678,19 +1842,27 @@ fn bucket(px: f32) -> u32 {
|
|||||||
SIZES.into_iter().find(|&s| px <= s as f32).unwrap_or(1536)
|
SIZES.into_iter().find(|&s| px <= s as f32).unwrap_or(1536)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn decode_cover(bytes: &[u8], px: u32) -> Result<SharedPixelBuffer<Rgb8Pixel>> {
|
/// Decodes a cover at `px` and works out its tone for the album art palette.
|
||||||
|
fn decode_cover(bytes: &[u8], px: u32) -> Result<(SharedPixelBuffer<Rgb8Pixel>, Option<Tone>)> {
|
||||||
let img = image::load_from_memory(bytes)?;
|
let img = image::load_from_memory(bytes)?;
|
||||||
let img = if img.width() > px || img.height() > px {
|
let img = if img.width() > px || img.height() > px {
|
||||||
img.resize(px, px, image::imageops::FilterType::Triangle)
|
img.resize(px, px, image::imageops::FilterType::Triangle)
|
||||||
} else {
|
} else {
|
||||||
img
|
img
|
||||||
};
|
};
|
||||||
|
// A small copy is plenty to find the dominant hue.
|
||||||
|
let small = img
|
||||||
|
.resize_exact(24, 24, image::imageops::FilterType::Triangle)
|
||||||
|
.to_rgb8();
|
||||||
|
let tone = crate::palette::tone(small.as_raw());
|
||||||
let rgb = img.to_rgb8();
|
let rgb = img.to_rgb8();
|
||||||
Ok(SharedPixelBuffer::clone_from_slice(
|
let buf = SharedPixelBuffer::clone_from_slice(rgb.as_raw(), rgb.width(), rgb.height());
|
||||||
rgb.as_raw(),
|
Ok((buf, tone))
|
||||||
rgb.width(),
|
}
|
||||||
rgb.height(),
|
|
||||||
))
|
fn color(lab: Lab) -> Color {
|
||||||
|
let [r, g, b] = lab.to_rgb();
|
||||||
|
Color::from_rgb_u8(r, g, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sanitize(id: &str) -> String {
|
fn sanitize(id: &str) -> String {
|
||||||
@@ -1734,6 +1906,26 @@ fn tint(seed: &str) -> Color {
|
|||||||
Color::from_rgb_u8(to(r), to(g), to(b))
|
Color::from_rgb_u8(to(r), to(g), to(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The message for a failed login, with a pointer to the fix where the
|
||||||
|
/// server's own message does not give one.
|
||||||
|
fn login_error(e: &anyhow::Error) -> String {
|
||||||
|
let msg = format!("{e:#}");
|
||||||
|
match subsonic::api_error(e) {
|
||||||
|
Some(a)
|
||||||
|
if a.code == subsonic::WRONG_CREDENTIALS
|
||||||
|
&& a.server
|
||||||
|
.as_deref()
|
||||||
|
.is_some_and(|s| s.to_lowercase().contains("nextcloud")) =>
|
||||||
|
{
|
||||||
|
format!(
|
||||||
|
"{msg}. Nextcloud Music needs the API password generated in its own \
|
||||||
|
settings, not your Nextcloud login password."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
_ => msg,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn fmt_time(secs: f64) -> String {
|
fn fmt_time(secs: f64) -> String {
|
||||||
let t = secs.max(0.0) as u64;
|
let t = secs.max(0.0) as u64;
|
||||||
let (h, m, s) = (t / 3600, (t / 60) % 60, t % 60);
|
let (h, m, s) = (t / 3600, (t / 60) % 60, t % 60);
|
||||||
@@ -1794,6 +1986,19 @@ mod tests {
|
|||||||
assert_eq!(bucket(5000.0), 1536);
|
assert_eq!(bucket(5000.0), 1536);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn nextcloud_wrong_password_points_at_the_api_password() {
|
||||||
|
let err = |server: &str| {
|
||||||
|
anyhow::Error::from(subsonic::ApiError {
|
||||||
|
code: subsonic::WRONG_CREDENTIALS,
|
||||||
|
message: "Wrong username or password".into(),
|
||||||
|
server: Some(server.into()),
|
||||||
|
})
|
||||||
|
};
|
||||||
|
assert!(login_error(&err("nextcloud music")).contains("API password"));
|
||||||
|
assert_eq!(login_error(&err("navidrome")), "Wrong username or password");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn formatting() {
|
fn formatting() {
|
||||||
assert_eq!(fmt_time(61.9), "1:01");
|
assert_eq!(fmt_time(61.9), "1:01");
|
||||||
|
|||||||
@@ -1,20 +1,54 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::os::unix::fs::OpenOptionsExt;
|
use std::os::unix::fs::OpenOptionsExt;
|
||||||
use std::path::PathBuf;
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use directories::ProjectDirs;
|
use directories::ProjectDirs;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Server credentials. `token` is md5(password + salt): not the password,
|
use crate::subsonic::{Auth, Client};
|
||||||
/// but enough to log in to this server, so the file is written 0600.
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
/// Server credentials, written 0600. Either a token, md5(password + salt),
|
||||||
|
/// which is not the password but is enough to log in to this server; or, for
|
||||||
|
/// a server that refuses tokens, the password itself.
|
||||||
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
|
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||||
pub salt: String,
|
pub salt: String,
|
||||||
|
#[serde(default, skip_serializing_if = "String::is_empty")]
|
||||||
pub token: String,
|
pub token: String,
|
||||||
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
|
pub password: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Config {
|
||||||
|
pub fn from_client(client: &Client) -> Config {
|
||||||
|
let (salt, token, password) = match client.auth() {
|
||||||
|
Auth::Token { salt, token } => (salt.clone(), token.clone(), None),
|
||||||
|
Auth::Password(p) => (String::new(), String::new(), Some(p.clone())),
|
||||||
|
};
|
||||||
|
Config {
|
||||||
|
url: client.base().to_string(),
|
||||||
|
username: client.user().to_string(),
|
||||||
|
salt,
|
||||||
|
token,
|
||||||
|
password,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn client(&self) -> Client {
|
||||||
|
let auth = match &self.password {
|
||||||
|
Some(p) => Auth::Password(p.clone()),
|
||||||
|
None => Auth::Token {
|
||||||
|
salt: self.salt.clone(),
|
||||||
|
token: self.token.clone(),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
Client::new(&self.url, &self.username, auth)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dirs() -> Option<ProjectDirs> {
|
fn dirs() -> Option<ProjectDirs> {
|
||||||
@@ -42,12 +76,53 @@ pub fn load() -> Result<Option<Config>> {
|
|||||||
|
|
||||||
pub fn save(cfg: &Config) -> Result<()> {
|
pub fn save(cfg: &Config) -> Result<()> {
|
||||||
let path = config_path().context("no config directory")?;
|
let path = config_path().context("no config directory")?;
|
||||||
|
write_atomic(&path, &toml::to_string(cfg)?)?;
|
||||||
|
log::info!("saved login to {}", path.display());
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Preferences. Kept apart from the login, so logging out does not reset them.
|
||||||
|
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
|
||||||
|
#[serde(default)]
|
||||||
|
pub struct Settings {
|
||||||
|
/// Tint the UI with the colours of the playing track's cover.
|
||||||
|
pub album_art_colours: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn settings_path() -> Option<PathBuf> {
|
||||||
|
dirs().map(|d| d.config_dir().join("settings.toml"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The saved settings, or the defaults when there are none or they cannot be read.
|
||||||
|
pub fn load_settings() -> Settings {
|
||||||
|
let Some(path) = settings_path() else {
|
||||||
|
return Settings::default();
|
||||||
|
};
|
||||||
|
match fs::read_to_string(&path) {
|
||||||
|
Ok(text) => toml::from_str(&text).unwrap_or_else(|e| {
|
||||||
|
log::warn!("ignoring {}: {e}", path.display());
|
||||||
|
Settings::default()
|
||||||
|
}),
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Settings::default(),
|
||||||
|
Err(e) => {
|
||||||
|
log::warn!("reading {}: {e}", path.display());
|
||||||
|
Settings::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn save_settings(s: &Settings) -> Result<()> {
|
||||||
|
let path = settings_path().context("no config directory")?;
|
||||||
|
write_atomic(&path, &toml::to_string(s)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Writes aside, syncs, then renames over the old file, so a power cut
|
||||||
|
/// mid-save leaves either the old file or the new one, never a torn one.
|
||||||
|
/// Owner-only, since the login file holds a token.
|
||||||
|
fn write_atomic(path: &Path, text: &str) -> Result<()> {
|
||||||
if let Some(dir) = path.parent() {
|
if let Some(dir) = path.parent() {
|
||||||
fs::create_dir_all(dir)?;
|
fs::create_dir_all(dir)?;
|
||||||
}
|
}
|
||||||
let text = toml::to_string(cfg)?;
|
|
||||||
// Write aside, sync, then rename over the old file, so a power cut
|
|
||||||
// mid-save leaves either the old login or the new one, never a torn file.
|
|
||||||
let tmp = path.with_extension("toml.tmp");
|
let tmp = path.with_extension("toml.tmp");
|
||||||
let mut f = fs::OpenOptions::new()
|
let mut f = fs::OpenOptions::new()
|
||||||
.write(true)
|
.write(true)
|
||||||
@@ -58,12 +133,66 @@ pub fn save(cfg: &Config) -> Result<()> {
|
|||||||
.with_context(|| format!("writing {}", tmp.display()))?;
|
.with_context(|| format!("writing {}", tmp.display()))?;
|
||||||
f.write_all(text.as_bytes())?;
|
f.write_all(text.as_bytes())?;
|
||||||
f.sync_all()?;
|
f.sync_all()?;
|
||||||
fs::rename(&tmp, &path).with_context(|| format!("replacing {}", path.display()))?;
|
fs::rename(&tmp, path).with_context(|| format!("replacing {}", path.display()))?;
|
||||||
if let Some(dir) = path.parent()
|
if let Some(dir) = path.parent()
|
||||||
&& let Ok(d) = fs::File::open(dir)
|
&& let Ok(d) = fs::File::open(dir)
|
||||||
{
|
{
|
||||||
let _ = d.sync_all();
|
let _ = d.sync_all();
|
||||||
}
|
}
|
||||||
log::info!("saved login to {}", path.display());
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn token_login_from_before_password_auth_still_loads() {
|
||||||
|
let old = "url = \"https://h\"\nusername = \"u\"\nsalt = \"s\"\ntoken = \"t\"\n";
|
||||||
|
let cfg: Config = toml::from_str(old).unwrap();
|
||||||
|
assert_eq!(cfg.password, None);
|
||||||
|
let auth = Auth::Token {
|
||||||
|
salt: "s".into(),
|
||||||
|
token: "t".into(),
|
||||||
|
};
|
||||||
|
assert_eq!(*cfg.client().auth(), auth);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn each_auth_method_round_trips() {
|
||||||
|
let token = Auth::Token {
|
||||||
|
salt: "s".into(),
|
||||||
|
token: "t".into(),
|
||||||
|
};
|
||||||
|
for auth in [token, Auth::Password("sesame".into())] {
|
||||||
|
let cfg = Config::from_client(&Client::new("https://h", "u", auth.clone()));
|
||||||
|
let text = toml::to_string(&cfg).unwrap();
|
||||||
|
let back: Config = toml::from_str(&text).unwrap();
|
||||||
|
assert_eq!(back, cfg);
|
||||||
|
assert_eq!(*back.client().auth(), auth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn password_login_stores_no_token_fields() {
|
||||||
|
let cfg = Config::from_client(&Client::new("https://h", "u", Auth::Password("p".into())));
|
||||||
|
let text = toml::to_string(&cfg).unwrap();
|
||||||
|
assert!(!text.contains("salt") && !text.contains("token"), "{text}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn settings_default_when_fields_are_missing() {
|
||||||
|
let s: Settings = toml::from_str("").unwrap();
|
||||||
|
assert_eq!(s, Settings::default());
|
||||||
|
assert!(!s.album_art_colours);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn settings_round_trip() {
|
||||||
|
let s = Settings {
|
||||||
|
album_art_colours: true,
|
||||||
|
};
|
||||||
|
let back: Settings = toml::from_str(&toml::to_string(&s).unwrap()).unwrap();
|
||||||
|
assert_eq!(back, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ mod app;
|
|||||||
mod config;
|
mod config;
|
||||||
mod devscript;
|
mod devscript;
|
||||||
mod input;
|
mod input;
|
||||||
|
mod palette;
|
||||||
mod player;
|
mod player;
|
||||||
mod subsonic;
|
mod subsonic;
|
||||||
|
|
||||||
@@ -21,6 +22,7 @@ fn main() -> anyhow::Result<()> {
|
|||||||
.build()?;
|
.build()?;
|
||||||
|
|
||||||
let ui = AppWindow::new()?;
|
let ui = AppWindow::new()?;
|
||||||
|
ui.set_version(env!("CARGO_PKG_VERSION").into());
|
||||||
app::install(&ui, rt.handle().clone());
|
app::install(&ui, rt.handle().clone());
|
||||||
input::spawn_gamepad(|action| {
|
input::spawn_gamepad(|action| {
|
||||||
let _ = slint::invoke_from_event_loop(move || app::with_app(move |app| app.action(action)));
|
let _ = slint::invoke_from_event_loop(move || app::with_app(move |app| app.action(action)));
|
||||||
|
|||||||
@@ -0,0 +1,452 @@
|
|||||||
|
//! The UI's colours, either the brand palette or one derived from album art.
|
||||||
|
//!
|
||||||
|
//! A cover only contributes a hue and how colourful it is. Each role keeps the
|
||||||
|
//! lightness it has in the brand palette, so text stays readable whatever the
|
||||||
|
//! cover looks like. Colours are mixed in OKLab, where equal steps look equal.
|
||||||
|
|
||||||
|
/// A colour in OKLab: lightness, then the green-red and blue-yellow axes.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub struct Lab {
|
||||||
|
pub l: f32,
|
||||||
|
pub a: f32,
|
||||||
|
pub b: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||||
|
pub enum Role {
|
||||||
|
Bg,
|
||||||
|
Panel,
|
||||||
|
Raised,
|
||||||
|
Line,
|
||||||
|
Text,
|
||||||
|
Muted,
|
||||||
|
Faint,
|
||||||
|
Accent,
|
||||||
|
OnAccent,
|
||||||
|
Highlight,
|
||||||
|
Focus,
|
||||||
|
Glow,
|
||||||
|
LoginGlow,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Role {
|
||||||
|
pub const ALL: [Role; 13] = [
|
||||||
|
Role::Bg,
|
||||||
|
Role::Panel,
|
||||||
|
Role::Raised,
|
||||||
|
Role::Line,
|
||||||
|
Role::Text,
|
||||||
|
Role::Muted,
|
||||||
|
Role::Faint,
|
||||||
|
Role::Accent,
|
||||||
|
Role::OnAccent,
|
||||||
|
Role::Highlight,
|
||||||
|
Role::Focus,
|
||||||
|
Role::Glow,
|
||||||
|
Role::LoginGlow,
|
||||||
|
];
|
||||||
|
|
||||||
|
/// The brand colour for this role. Must match the defaults of `Theme` in
|
||||||
|
/// ui/app.slint, which is what the UI shows before any palette is applied.
|
||||||
|
fn brand(self) -> u32 {
|
||||||
|
match self {
|
||||||
|
Role::Bg => 0x140b0c,
|
||||||
|
Role::Panel => 0x1d1012,
|
||||||
|
Role::Raised => 0x2b181b,
|
||||||
|
Role::Line => 0x42272b,
|
||||||
|
Role::Text | Role::OnAccent | Role::Focus => 0xfaebda,
|
||||||
|
Role::Muted => 0xbea999,
|
||||||
|
Role::Faint => 0x80685f,
|
||||||
|
Role::Accent => 0xa51d2d,
|
||||||
|
Role::Highlight => 0xe8757b,
|
||||||
|
Role::Glow => 0x2a0b11,
|
||||||
|
Role::LoginGlow => 0x3a0b13,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Cream text and focus rings stay cream on every palette.
|
||||||
|
fn follows_cover(self) -> bool {
|
||||||
|
!matches!(self, Role::Text | Role::OnAccent | Role::Focus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// What a cover contributes: its dominant hue in radians and its chroma.
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub struct Tone {
|
||||||
|
pub hue: f32,
|
||||||
|
pub chroma: f32,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The minimum contrast for text, WCAG AA for normal text.
|
||||||
|
const MIN_CONTRAST: f32 = 4.5;
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||||
|
pub struct Palette([Lab; Role::ALL.len()]);
|
||||||
|
|
||||||
|
impl Palette {
|
||||||
|
pub fn brand() -> Palette {
|
||||||
|
Palette(Role::ALL.map(|r| Lab::from_rgb(r.brand())))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The palette for a cover with this tone.
|
||||||
|
pub fn from_tone(tone: Tone) -> Palette {
|
||||||
|
let brand = Palette::brand();
|
||||||
|
// A dull cover gives a dull palette, a vivid one the brand's own vividness.
|
||||||
|
let vividness = (tone.chroma / 0.12).clamp(0.5, 1.0);
|
||||||
|
let mut roles = brand.0;
|
||||||
|
for (i, role) in Role::ALL.into_iter().enumerate() {
|
||||||
|
if !role.follows_cover() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let b = brand.0[i];
|
||||||
|
// Hue replaced outright: mixing towards the brand in OKLab would pass
|
||||||
|
// through grey for a cover on the far side of the wheel from maroon.
|
||||||
|
roles[i] = Lab::from_lch(b.l, b.chroma() * vividness, tone.hue).into_gamut();
|
||||||
|
}
|
||||||
|
let mut p = Palette(roles);
|
||||||
|
p.ensure_contrast();
|
||||||
|
p
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get(&self, role: Role) -> Lab {
|
||||||
|
self.0[role as usize]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The palette `t` of the way from `self` to `other`.
|
||||||
|
pub fn mix(&self, other: &Palette, t: f32) -> Palette {
|
||||||
|
// Exact at the ends, so a finished fade lands on the target itself.
|
||||||
|
if t <= 0.0 {
|
||||||
|
return *self;
|
||||||
|
}
|
||||||
|
if t >= 1.0 {
|
||||||
|
return *other;
|
||||||
|
}
|
||||||
|
let mut out = self.0;
|
||||||
|
for (o, (a, b)) in out.iter_mut().zip(self.0.iter().zip(other.0.iter())) {
|
||||||
|
*o = a.mix(*b, t);
|
||||||
|
}
|
||||||
|
Palette(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Darkens the accent fill and lightens the highlight until cream text on
|
||||||
|
/// the fill and the highlight on the background are both readable.
|
||||||
|
fn ensure_contrast(&mut self) {
|
||||||
|
let text = self.get(Role::OnAccent);
|
||||||
|
let bg = self.get(Role::Bg);
|
||||||
|
let accent = &mut self.0[Role::Accent as usize];
|
||||||
|
while contrast(*accent, text) < MIN_CONTRAST && accent.l > 0.2 {
|
||||||
|
*accent = accent.with_lightness(accent.l - 0.01).into_gamut();
|
||||||
|
}
|
||||||
|
let hl = &mut self.0[Role::Highlight as usize];
|
||||||
|
while contrast(*hl, bg) < MIN_CONTRAST && hl.l < 0.95 {
|
||||||
|
*hl = hl.with_lightness(hl.l + 0.01).into_gamut();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The dominant tone of an RGB image (3 bytes a pixel), or None when it has
|
||||||
|
/// too little colour to base a palette on: greyscale, black and white, sepia
|
||||||
|
/// that is nearly grey.
|
||||||
|
pub fn tone(rgb: &[u8]) -> Option<Tone> {
|
||||||
|
const BINS: usize = 24;
|
||||||
|
// Below this a pixel's hue is mostly compression noise.
|
||||||
|
const CHROMATIC: f32 = 0.04;
|
||||||
|
|
||||||
|
let mut weight = [0f32; BINS];
|
||||||
|
let mut sum_a = [0f32; BINS];
|
||||||
|
let mut sum_b = [0f32; BINS];
|
||||||
|
let mut sum_c2 = [0f32; BINS];
|
||||||
|
let (mut pixels, mut chromatic) = (0usize, 0usize);
|
||||||
|
for px in rgb.as_chunks::<3>().0 {
|
||||||
|
pixels += 1;
|
||||||
|
let lab = Lab::from_rgb(u32::from_be_bytes([0, px[0], px[1], px[2]]));
|
||||||
|
let c = lab.chroma();
|
||||||
|
// Near black and near white carry no usable hue either.
|
||||||
|
if c < CHROMATIC || lab.l < 0.12 || lab.l > 0.97 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
chromatic += 1;
|
||||||
|
let hue = lab.b.atan2(lab.a).rem_euclid(std::f32::consts::TAU);
|
||||||
|
let bin = ((hue / std::f32::consts::TAU) * BINS as f32) as usize % BINS;
|
||||||
|
// Weighted by chroma, so a small vivid logo beats a large grey field.
|
||||||
|
weight[bin] += c;
|
||||||
|
sum_a[bin] += lab.a;
|
||||||
|
sum_b[bin] += lab.b;
|
||||||
|
sum_c2[bin] += c * c;
|
||||||
|
}
|
||||||
|
if pixels == 0 || chromatic * 50 < pixels {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let around = |i: usize| [(i + BINS - 1) % BINS, i, (i + 1) % BINS];
|
||||||
|
let best = (0..BINS)
|
||||||
|
.max_by(|&x, &y| {
|
||||||
|
let wx: f32 = around(x).iter().map(|&j| weight[j]).sum();
|
||||||
|
let wy: f32 = around(y).iter().map(|&j| weight[j]).sum();
|
||||||
|
wx.total_cmp(&wy)
|
||||||
|
})
|
||||||
|
.unwrap_or(0);
|
||||||
|
let (mut a, mut b, mut w, mut c2) = (0f32, 0f32, 0f32, 0f32);
|
||||||
|
for j in around(best) {
|
||||||
|
a += sum_a[j];
|
||||||
|
b += sum_b[j];
|
||||||
|
w += weight[j];
|
||||||
|
c2 += sum_c2[j];
|
||||||
|
}
|
||||||
|
Some(Tone {
|
||||||
|
hue: b.atan2(a),
|
||||||
|
chroma: c2 / w,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// WCAG contrast ratio between two colours.
|
||||||
|
pub fn contrast(x: Lab, y: Lab) -> f32 {
|
||||||
|
let (lx, ly) = (x.luminance(), y.luminance());
|
||||||
|
(lx.max(ly) + 0.05) / (lx.min(ly) + 0.05)
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Lab {
|
||||||
|
pub fn from_rgb(rgb: u32) -> Lab {
|
||||||
|
let [_, r, g, b] = rgb.to_be_bytes();
|
||||||
|
let (r, g, b) = (to_linear(r), to_linear(g), to_linear(b));
|
||||||
|
let l = (0.412_221_46 * r + 0.536_332_55 * g + 0.051_445_995 * b).cbrt();
|
||||||
|
let m = (0.211_903_5 * r + 0.680_699_5 * g + 0.107_396_96 * b).cbrt();
|
||||||
|
let s = (0.088_302_46 * r + 0.281_718_85 * g + 0.629_978_7 * b).cbrt();
|
||||||
|
Lab {
|
||||||
|
l: 0.210_454_26 * l + 0.793_617_8 * m - 0.004_072_047 * s,
|
||||||
|
a: 1.977_998_5 * l - 2.428_592_2 * m + 0.450_593_7 * s,
|
||||||
|
b: 0.025_904_037 * l + 0.782_771_77 * m - 0.808_675_77 * s,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_lch(l: f32, c: f32, hue: f32) -> Lab {
|
||||||
|
Lab {
|
||||||
|
l,
|
||||||
|
a: c * hue.cos(),
|
||||||
|
b: c * hue.sin(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn linear(self) -> [f32; 3] {
|
||||||
|
let l = (self.l + 0.396_337_78 * self.a + 0.215_803_76 * self.b).powi(3);
|
||||||
|
let m = (self.l - 0.105_561_346 * self.a - 0.063_854_17 * self.b).powi(3);
|
||||||
|
let s = (self.l - 0.089_484_18 * self.a - 1.291_485_5 * self.b).powi(3);
|
||||||
|
[
|
||||||
|
4.076_741_7 * l - 3.307_711_6 * m + 0.230_969_94 * s,
|
||||||
|
-1.268_438 * l + 2.609_757_4 * m - 0.341_319_38 * s,
|
||||||
|
-0.004_196_086_3 * l - 0.703_418_6 * m + 1.707_614_7 * s,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The sRGB colour as 8-bit channels, clipped to the displayable range.
|
||||||
|
pub fn to_rgb(self) -> [u8; 3] {
|
||||||
|
self.linear().map(from_linear)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn chroma(self) -> f32 {
|
||||||
|
self.a.hypot(self.b)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn luminance(self) -> f32 {
|
||||||
|
let [r, g, b] = self.to_rgb().map(to_linear);
|
||||||
|
0.2126 * r + 0.7152 * g + 0.0722 * b
|
||||||
|
}
|
||||||
|
|
||||||
|
fn mix(self, other: Lab, t: f32) -> Lab {
|
||||||
|
Lab {
|
||||||
|
l: self.l + (other.l - self.l) * t,
|
||||||
|
a: self.a + (other.a - self.a) * t,
|
||||||
|
b: self.b + (other.b - self.b) * t,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn with_lightness(self, l: f32) -> Lab {
|
||||||
|
Lab { l, ..self }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn in_gamut(self) -> bool {
|
||||||
|
self.linear().iter().all(|&c| (-0.0005..=1.0005).contains(&c))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Lowers the chroma, keeping lightness and hue, until sRGB can show it.
|
||||||
|
fn into_gamut(self) -> Lab {
|
||||||
|
if self.in_gamut() {
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
let (mut lo, mut hi) = (0f32, 1f32);
|
||||||
|
for _ in 0..20 {
|
||||||
|
let mid = (lo + hi) / 2.0;
|
||||||
|
let c = Lab {
|
||||||
|
a: self.a * mid,
|
||||||
|
b: self.b * mid,
|
||||||
|
..self
|
||||||
|
};
|
||||||
|
if c.in_gamut() {
|
||||||
|
lo = mid;
|
||||||
|
} else {
|
||||||
|
hi = mid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Lab {
|
||||||
|
a: self.a * lo,
|
||||||
|
b: self.b * lo,
|
||||||
|
..self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_linear(c: u8) -> f32 {
|
||||||
|
let c = c as f32 / 255.0;
|
||||||
|
if c <= 0.040_45 {
|
||||||
|
c / 12.92
|
||||||
|
} else {
|
||||||
|
((c + 0.055) / 1.055).powf(2.4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_linear(c: f32) -> u8 {
|
||||||
|
let c = c.clamp(0.0, 1.0);
|
||||||
|
let s = if c <= 0.003_130_8 {
|
||||||
|
c * 12.92
|
||||||
|
} else {
|
||||||
|
1.055 * c.powf(1.0 / 2.4) - 0.055
|
||||||
|
};
|
||||||
|
(s * 255.0).round() as u8
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
use std::f32::consts::TAU;
|
||||||
|
|
||||||
|
fn hex(rgb: [u8; 3]) -> u32 {
|
||||||
|
u32::from_be_bytes([0, rgb[0], rgb[1], rgb[2]])
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A 24x24 image filled by `f(x, y)`.
|
||||||
|
fn image(f: impl Fn(usize, usize) -> [u8; 3]) -> Vec<u8> {
|
||||||
|
(0..24 * 24).flat_map(|i| f(i % 24, i / 24)).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hue_distance(a: f32, b: f32) -> f32 {
|
||||||
|
let d = (a - b).rem_euclid(TAU);
|
||||||
|
d.min(TAU - d)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn brand_palette_round_trips_exactly() {
|
||||||
|
let p = Palette::brand();
|
||||||
|
for role in Role::ALL {
|
||||||
|
assert_eq!(hex(p.get(role).to_rgb()), role.brand(), "{role:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn contrast_holds_for_every_hue_and_chroma() {
|
||||||
|
for step in 0..72 {
|
||||||
|
for chroma in [0.02, 0.06, 0.12, 0.25, 0.4] {
|
||||||
|
let tone = Tone {
|
||||||
|
hue: step as f32 * TAU / 72.0,
|
||||||
|
chroma,
|
||||||
|
};
|
||||||
|
let p = Palette::from_tone(tone);
|
||||||
|
let cases = [
|
||||||
|
(Role::Text, Role::Bg),
|
||||||
|
(Role::Text, Role::Panel),
|
||||||
|
(Role::Text, Role::Raised),
|
||||||
|
(Role::OnAccent, Role::Accent),
|
||||||
|
(Role::Highlight, Role::Bg),
|
||||||
|
(Role::Muted, Role::Bg),
|
||||||
|
];
|
||||||
|
for (fg, bg) in cases {
|
||||||
|
let c = contrast(p.get(fg), p.get(bg));
|
||||||
|
assert!(c >= MIN_CONTRAST, "{fg:?} on {bg:?} is {c:.2} for {tone:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cover_palette_keeps_cream_text() {
|
||||||
|
let p = Palette::from_tone(Tone { hue: 4.0, chroma: 0.2 });
|
||||||
|
for role in [Role::Text, Role::OnAccent, Role::Focus] {
|
||||||
|
assert_eq!(p.get(role), Palette::brand().get(role));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cover_palette_takes_the_cover_hue() {
|
||||||
|
let blue = Lab::from_rgb(0x2050d0);
|
||||||
|
let tone = Tone {
|
||||||
|
hue: blue.b.atan2(blue.a),
|
||||||
|
chroma: blue.chroma(),
|
||||||
|
};
|
||||||
|
let accent = Palette::from_tone(tone).get(Role::Accent);
|
||||||
|
let brand = Palette::brand().get(Role::Accent);
|
||||||
|
let hue = |l: Lab| l.b.atan2(l.a);
|
||||||
|
assert!(hue_distance(hue(accent), tone.hue) < hue_distance(hue(brand), tone.hue));
|
||||||
|
assert!(hue_distance(hue(accent), tone.hue) < 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn cover_opposite_the_brand_hue_stays_colourful() {
|
||||||
|
let cyan = Lab::from_rgb(0x30b8d8);
|
||||||
|
let tone = Tone {
|
||||||
|
hue: cyan.b.atan2(cyan.a),
|
||||||
|
chroma: cyan.chroma(),
|
||||||
|
};
|
||||||
|
let accent = Palette::from_tone(tone).get(Role::Accent);
|
||||||
|
assert!(accent.chroma() > 0.08, "accent went grey: {accent:?}");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn saturated_cover_gives_its_hue() {
|
||||||
|
let t = tone(&image(|_, _| [200, 30, 40])).expect("red has a tone");
|
||||||
|
let red = Lab::from_rgb(0xc81e28);
|
||||||
|
assert!(hue_distance(t.hue, red.b.atan2(red.a)) < 0.15);
|
||||||
|
assert!(t.chroma > 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn dark_and_light_covers_still_give_a_tone() {
|
||||||
|
assert!(tone(&image(|_, _| [40, 20, 70])).is_some());
|
||||||
|
assert!(tone(&image(|_, _| [240, 220, 160])).is_some());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn greyscale_cover_has_no_tone() {
|
||||||
|
let grey = image(|x, y| {
|
||||||
|
let v = ((x * 7 + y * 3) % 256) as u8;
|
||||||
|
[v, v, v]
|
||||||
|
});
|
||||||
|
assert_eq!(tone(&grey), None);
|
||||||
|
assert_eq!(tone(&image(|x, _| if x < 12 { [0; 3] } else { [255; 3] })), None);
|
||||||
|
assert_eq!(tone(&[]), None);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn small_vivid_area_beats_a_grey_field() {
|
||||||
|
let img = image(|x, y| if x < 5 && y < 5 { [220, 40, 40] } else { [128, 128, 128] });
|
||||||
|
let t = tone(&img).expect("the red patch is enough");
|
||||||
|
let red = Lab::from_rgb(0xdc2828);
|
||||||
|
assert!(hue_distance(t.hue, red.b.atan2(red.a)) < 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn dominant_hue_wins_over_a_minority() {
|
||||||
|
let img = image(|x, _| if x < 18 { [30, 60, 200] } else { [220, 40, 40] });
|
||||||
|
let t = tone(&img).unwrap();
|
||||||
|
let blue = Lab::from_rgb(0x1e3cc8);
|
||||||
|
assert!(hue_distance(t.hue, blue.b.atan2(blue.a)) < 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn mixing_palettes_hits_both_ends() {
|
||||||
|
let a = Palette::brand();
|
||||||
|
let b = Palette::from_tone(Tone { hue: 2.5, chroma: 0.15 });
|
||||||
|
assert_eq!(a.mix(&b, 0.0), a);
|
||||||
|
assert_eq!(a.mix(&b, 1.0), b);
|
||||||
|
let mid = a.mix(&b, 0.5).get(Role::Accent);
|
||||||
|
let (x, y) = (a.get(Role::Accent), b.get(Role::Accent));
|
||||||
|
assert!((mid.l - (x.l + y.l) / 2.0).abs() < 1e-6);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -182,10 +182,12 @@ fn watch_bus(playbin: &gst::Element, queue: &Mutex<Queue>, stop: &AtomicBool, em
|
|||||||
let Some(bus) = playbin.bus() else { return };
|
let Some(bus) = playbin.bus() else { return };
|
||||||
let mut last_tick = Instant::now();
|
let mut last_tick = Instant::now();
|
||||||
let mut duration = 0.0;
|
let mut duration = 0.0;
|
||||||
// playbin can post stream-start more than once for one track.
|
// playbin can post stream-start more than once for one track, so a repeat
|
||||||
|
// of the last report is dropped. A track that was just started is always
|
||||||
|
// reported, even at the same index: a new queue, or the same track again.
|
||||||
let mut last_track: Option<Option<usize>> = None;
|
let mut last_track: Option<Option<usize>> = None;
|
||||||
let mut report_track = |t: Option<usize>| {
|
let mut report_track = |t: Option<usize>, started: bool| {
|
||||||
if last_track != Some(t) {
|
if started || last_track != Some(t) {
|
||||||
last_track = Some(t);
|
last_track = Some(t);
|
||||||
emit(PlayerEvent::Track(t));
|
emit(PlayerEvent::Track(t));
|
||||||
emit(PlayerEvent::Position(0.0));
|
emit(PlayerEvent::Position(0.0));
|
||||||
@@ -196,15 +198,19 @@ fn watch_bus(playbin: &gst::Element, queue: &Mutex<Queue>, stop: &AtomicBool, em
|
|||||||
use gst::MessageView;
|
use gst::MessageView;
|
||||||
match msg.view() {
|
match msg.view() {
|
||||||
MessageView::StreamStart(_) => {
|
MessageView::StreamStart(_) => {
|
||||||
let current = {
|
let (current, started) = {
|
||||||
let mut q = lock(queue);
|
let mut q = lock(queue);
|
||||||
if let Some(p) = q.pending.take() {
|
let started = match q.pending.take() {
|
||||||
q.current = Some(p);
|
Some(p) => {
|
||||||
}
|
q.current = Some(p);
|
||||||
q.current
|
true
|
||||||
|
}
|
||||||
|
None => false,
|
||||||
|
};
|
||||||
|
(q.current, started)
|
||||||
};
|
};
|
||||||
duration = 0.0;
|
duration = 0.0;
|
||||||
report_track(current);
|
report_track(current, started);
|
||||||
}
|
}
|
||||||
MessageView::StateChanged(s) if s.src() == Some(playbin.upcast_ref()) => match s.current() {
|
MessageView::StateChanged(s) if s.src() == Some(playbin.upcast_ref()) => match s.current() {
|
||||||
gst::State::Playing => emit(PlayerEvent::Paused(false)),
|
gst::State::Playing => emit(PlayerEvent::Paused(false)),
|
||||||
@@ -218,7 +224,7 @@ fn watch_bus(playbin: &gst::Element, queue: &Mutex<Queue>, stop: &AtomicBool, em
|
|||||||
q.pending = None;
|
q.pending = None;
|
||||||
}
|
}
|
||||||
let _ = playbin.set_state(gst::State::Ready);
|
let _ = playbin.set_state(gst::State::Ready);
|
||||||
report_track(None);
|
report_track(None, false);
|
||||||
}
|
}
|
||||||
MessageView::Error(err) => {
|
MessageView::Error(err) => {
|
||||||
let detail = err.debug().map(|d| d.to_string()).unwrap_or_default();
|
let detail = err.debug().map(|d| d.to_string()).unwrap_or_default();
|
||||||
@@ -239,7 +245,7 @@ fn watch_bus(playbin: &gst::Element, queue: &Mutex<Queue>, stop: &AtomicBool, em
|
|||||||
start(playbin, &url);
|
start(playbin, &url);
|
||||||
} else {
|
} else {
|
||||||
let _ = playbin.set_state(gst::State::Ready);
|
let _ = playbin.set_state(gst::State::Ready);
|
||||||
report_track(None);
|
report_track(None, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
@@ -301,6 +307,8 @@ mod tests {
|
|||||||
assert_eq!(s, "Not Found (404), URL: https://h/rest/stream?…, Redirect to: (NULL)");
|
assert_eq!(s, "Not Found (404), URL: https://h/rest/stream?…, Redirect to: (NULL)");
|
||||||
assert!(!strip_queries("\"http://x/y?t=secret\" next").contains("secret"));
|
assert!(!strip_queries("\"http://x/y?t=secret\" next").contains("secret"));
|
||||||
assert_eq!(strip_queries("what? no url here"), "what? no url here");
|
assert_eq!(strip_queries("what? no url here"), "what? no url here");
|
||||||
|
let s = strip_queries("URL: https://h/rest/stream?u=a&p=enc%3A736573616d65&v=1 failed");
|
||||||
|
assert!(!s.contains("736573616d65"), "{s}");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes `secs` of silence as a 16-bit mono WAV and returns its file:// URI.
|
/// Writes `secs` of silence as a 16-bit mono WAV and returns its file:// URI.
|
||||||
@@ -355,4 +363,36 @@ mod tests {
|
|||||||
let _ = std::fs::remove_dir_all(&dir);
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
assert_eq!(tracks, vec![Some(0), Some(1), None]);
|
assert_eq!(tracks, vec![Some(0), Some(1), None]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn starting_at_the_playing_index_reports_the_track_again() {
|
||||||
|
// SAFETY: set before any thread reads the environment in this test.
|
||||||
|
unsafe { std::env::set_var("REMUS_AUDIO_SINK", "fakesink") };
|
||||||
|
let dir = std::env::temp_dir().join(format!("remus-player-restart-{}", std::process::id()));
|
||||||
|
std::fs::create_dir_all(&dir).unwrap();
|
||||||
|
// Long enough that nothing finishes while the test runs.
|
||||||
|
let album_a = vec![silent_wav(&dir, "a1.wav", 10.0), silent_wav(&dir, "a2.wav", 10.0)];
|
||||||
|
let album_b = vec![silent_wav(&dir, "b1.wav", 10.0), silent_wav(&dir, "b2.wav", 10.0)];
|
||||||
|
|
||||||
|
let (tx, rx) = mpsc::channel();
|
||||||
|
let player = Player::spawn(move |ev| {
|
||||||
|
if let PlayerEvent::Track(t) = ev {
|
||||||
|
let _ = tx.send(t);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.unwrap();
|
||||||
|
let next = || rx.recv_timeout(Duration::from_secs(3)).ok();
|
||||||
|
|
||||||
|
player.play_list(&album_a, 0);
|
||||||
|
assert_eq!(next(), Some(Some(0)), "first album started");
|
||||||
|
// Another album, started at the same index as the track playing.
|
||||||
|
player.play_list(&album_b, 0);
|
||||||
|
assert_eq!(next(), Some(Some(0)), "second album started at the same index");
|
||||||
|
// The playing track started again from the queue.
|
||||||
|
player.play_index(0);
|
||||||
|
assert_eq!(next(), Some(Some(0)), "the same track restarted");
|
||||||
|
|
||||||
|
drop(player);
|
||||||
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,17 +10,53 @@ use serde::de::{DeserializeOwned, Deserializer};
|
|||||||
const API_VERSION: &str = "1.16.1";
|
const API_VERSION: &str = "1.16.1";
|
||||||
const CLIENT_NAME: &str = "remus";
|
const CLIENT_NAME: &str = "remus";
|
||||||
|
|
||||||
|
/// Subsonic error 41: the server does not accept token authentication.
|
||||||
|
const TOKEN_AUTH_NOT_SUPPORTED: i64 = 41;
|
||||||
|
/// Subsonic error 40: wrong username or password.
|
||||||
|
pub const WRONG_CREDENTIALS: i64 = 40;
|
||||||
|
|
||||||
|
/// How requests prove who is asking.
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
pub enum Auth {
|
||||||
|
/// `t` = md5(password + `s`). The password itself is not kept.
|
||||||
|
Token { salt: String, token: String },
|
||||||
|
/// The password, sent hex-encoded on every request. For servers that
|
||||||
|
/// refuse tokens, such as Nextcloud Music.
|
||||||
|
Password(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// An error reported by the server inside a Subsonic response.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct ApiError {
|
||||||
|
pub code: i64,
|
||||||
|
pub message: String,
|
||||||
|
/// The `type` the server reports about itself, such as "nextcloud music".
|
||||||
|
pub server: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::fmt::Display for ApiError {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
f.write_str(&self.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl std::error::Error for ApiError {}
|
||||||
|
|
||||||
|
/// The server's error code, if `e` is an error reported by the server.
|
||||||
|
pub fn api_error(e: &anyhow::Error) -> Option<&ApiError> {
|
||||||
|
e.downcast_ref::<ApiError>()
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
http: reqwest::Client,
|
http: reqwest::Client,
|
||||||
base: String,
|
base: String,
|
||||||
user: String,
|
user: String,
|
||||||
salt: String,
|
auth: Auth,
|
||||||
token: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
pub fn new(base: &str, user: &str, salt: &str, token: &str) -> Self {
|
pub fn new(base: &str, user: &str, auth: Auth) -> Self {
|
||||||
let http = reqwest::Client::builder()
|
let http = reqwest::Client::builder()
|
||||||
.user_agent(concat!("remus/", env!("CARGO_PKG_VERSION")))
|
.user_agent(concat!("remus/", env!("CARGO_PKG_VERSION")))
|
||||||
.timeout(std::time::Duration::from_secs(30))
|
.timeout(std::time::Duration::from_secs(30))
|
||||||
@@ -30,8 +66,7 @@ impl Client {
|
|||||||
http,
|
http,
|
||||||
base: normalize_base(base),
|
base: normalize_base(base),
|
||||||
user: user.to_string(),
|
user: user.to_string(),
|
||||||
salt: salt.to_string(),
|
auth,
|
||||||
token: token.to_string(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +75,23 @@ impl Client {
|
|||||||
pub fn from_password(base: &str, user: &str, password: &str) -> Self {
|
pub fn from_password(base: &str, user: &str, password: &str) -> Self {
|
||||||
let salt = random_salt();
|
let salt = random_salt();
|
||||||
let token = format!("{:x}", md5::compute(format!("{password}{salt}")));
|
let token = format!("{:x}", md5::compute(format!("{password}{salt}")));
|
||||||
Client::new(base, user, &salt, &token)
|
Client::new(base, user, Auth::Token { salt, token })
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Logs in with a token, or with the password itself when the server
|
||||||
|
/// refuses tokens. Returns the client that worked.
|
||||||
|
pub async fn login(base: &str, user: &str, password: &str) -> Result<Client> {
|
||||||
|
let client = Client::from_password(base, user, password);
|
||||||
|
match client.ping().await {
|
||||||
|
Ok(()) => Ok(client),
|
||||||
|
Err(e) if api_error(&e).is_some_and(|a| a.code == TOKEN_AUTH_NOT_SUPPORTED) => {
|
||||||
|
log::info!("server does not accept token auth, logging in with the password");
|
||||||
|
let client = Client::new(base, user, Auth::Password(password.to_string()));
|
||||||
|
client.ping().await?;
|
||||||
|
Ok(client)
|
||||||
|
}
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn base(&self) -> &str {
|
pub fn base(&self) -> &str {
|
||||||
@@ -49,22 +100,32 @@ impl Client {
|
|||||||
pub fn user(&self) -> &str {
|
pub fn user(&self) -> &str {
|
||||||
&self.user
|
&self.user
|
||||||
}
|
}
|
||||||
pub fn salt(&self) -> &str {
|
pub fn auth(&self) -> &Auth {
|
||||||
&self.salt
|
&self.auth
|
||||||
}
|
}
|
||||||
pub fn token(&self) -> &str {
|
|
||||||
&self.token
|
/// The query parameters every request starts with.
|
||||||
|
fn auth_params(&self) -> Vec<(&'static str, String)> {
|
||||||
|
let mut params = vec![("u", self.user.clone())];
|
||||||
|
match &self.auth {
|
||||||
|
Auth::Token { salt, token } => {
|
||||||
|
params.push(("t", token.clone()));
|
||||||
|
params.push(("s", salt.clone()));
|
||||||
|
}
|
||||||
|
Auth::Password(password) => {
|
||||||
|
// Hex keeps the password out of plain sight in URLs; it is not encryption.
|
||||||
|
let hex: String = password.bytes().map(|b| format!("{b:02x}")).collect();
|
||||||
|
params.push(("p", format!("enc:{hex}")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params.push(("v", API_VERSION.to_string()));
|
||||||
|
params.push(("c", CLIENT_NAME.to_string()));
|
||||||
|
params.push(("f", "json".to_string()));
|
||||||
|
params
|
||||||
}
|
}
|
||||||
|
|
||||||
fn endpoint_url(&self, endpoint: &str, params: &[(&str, String)]) -> Result<reqwest::Url> {
|
fn endpoint_url(&self, endpoint: &str, params: &[(&str, String)]) -> Result<reqwest::Url> {
|
||||||
let mut all: Vec<(&str, String)> = vec![
|
let mut all = self.auth_params();
|
||||||
("u", self.user.clone()),
|
|
||||||
("t", self.token.clone()),
|
|
||||||
("s", self.salt.clone()),
|
|
||||||
("v", API_VERSION.to_string()),
|
|
||||||
("c", CLIENT_NAME.to_string()),
|
|
||||||
("f", "json".to_string()),
|
|
||||||
];
|
|
||||||
all.extend(params.iter().cloned());
|
all.extend(params.iter().cloned());
|
||||||
reqwest::Url::parse_with_params(&format!("{}/rest/{endpoint}", self.base), &all)
|
reqwest::Url::parse_with_params(&format!("{}/rest/{endpoint}", self.base), &all)
|
||||||
.with_context(|| format!("invalid server url {}", self.base))
|
.with_context(|| format!("invalid server url {}", self.base))
|
||||||
@@ -83,22 +144,12 @@ impl Client {
|
|||||||
if !status.is_success() {
|
if !status.is_success() {
|
||||||
bail!("{endpoint}: server returned {status}");
|
bail!("{endpoint}: server returned {status}");
|
||||||
}
|
}
|
||||||
let mut body: serde_json::Value = resp
|
let body: serde_json::Value = resp
|
||||||
.json()
|
.json()
|
||||||
.await
|
.await
|
||||||
.map_err(redact)
|
.map_err(redact)
|
||||||
.with_context(|| format!("{endpoint}: invalid json"))?;
|
.with_context(|| format!("{endpoint}: invalid json"))?;
|
||||||
let inner = body
|
let inner = unwrap_response(endpoint, body)?;
|
||||||
.get_mut("subsonic-response")
|
|
||||||
.map(serde_json::Value::take)
|
|
||||||
.ok_or_else(|| anyhow!("{endpoint}: not a subsonic response"))?;
|
|
||||||
if inner.get("status").and_then(|s| s.as_str()) != Some("ok") {
|
|
||||||
let msg = inner
|
|
||||||
.pointer("/error/message")
|
|
||||||
.and_then(|m| m.as_str())
|
|
||||||
.unwrap_or("unknown error");
|
|
||||||
bail!("{msg}");
|
|
||||||
}
|
|
||||||
serde_json::from_value(inner).with_context(|| format!("{endpoint}: unexpected response shape"))
|
serde_json::from_value(inner).with_context(|| format!("{endpoint}: unexpected response shape"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +297,27 @@ impl Client {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The payload of a Subsonic response, or the server's error as an `ApiError`.
|
||||||
|
fn unwrap_response(endpoint: &str, mut body: serde_json::Value) -> Result<serde_json::Value> {
|
||||||
|
let inner = body
|
||||||
|
.get_mut("subsonic-response")
|
||||||
|
.map(serde_json::Value::take)
|
||||||
|
.ok_or_else(|| anyhow!("{endpoint}: not a subsonic response"))?;
|
||||||
|
if inner.get("status").and_then(|s| s.as_str()) == Some("ok") {
|
||||||
|
return Ok(inner);
|
||||||
|
}
|
||||||
|
Err(ApiError {
|
||||||
|
code: inner.pointer("/error/code").and_then(|c| c.as_i64()).unwrap_or(0),
|
||||||
|
message: inner
|
||||||
|
.pointer("/error/message")
|
||||||
|
.and_then(|m| m.as_str())
|
||||||
|
.unwrap_or("unknown error")
|
||||||
|
.to_string(),
|
||||||
|
server: inner.get("type").and_then(|s| s.as_str()).map(str::to_string),
|
||||||
|
}
|
||||||
|
.into())
|
||||||
|
}
|
||||||
|
|
||||||
/// Request URLs carry the auth token, so they must never reach an error
|
/// Request URLs carry the auth token, so they must never reach an error
|
||||||
/// message: those end up on screen and in the logs.
|
/// message: those end up on screen and in the logs.
|
||||||
fn redact(e: reqwest::Error) -> reqwest::Error {
|
fn redact(e: reqwest::Error) -> reqwest::Error {
|
||||||
@@ -425,8 +497,18 @@ mod tests {
|
|||||||
#[ignore]
|
#[ignore]
|
||||||
async fn live_server() {
|
async fn live_server() {
|
||||||
let var = |k| std::env::var(k).unwrap_or_else(|_| panic!("{k} not set"));
|
let var = |k| std::env::var(k).unwrap_or_else(|_| panic!("{k} not set"));
|
||||||
let c = Client::from_password(&var("REMUS_TEST_URL"), &var("REMUS_TEST_USER"), &var("REMUS_TEST_PASS"));
|
let (url, user, pass) = (var("REMUS_TEST_URL"), var("REMUS_TEST_USER"), var("REMUS_TEST_PASS"));
|
||||||
c.ping().await.unwrap();
|
let Ok(c) = Client::login(&url, &user, &pass).await else {
|
||||||
|
panic!("login to {url} failed");
|
||||||
|
};
|
||||||
|
println!(
|
||||||
|
"auth: {}",
|
||||||
|
if matches!(c.auth(), Auth::Token { .. }) {
|
||||||
|
"token"
|
||||||
|
} else {
|
||||||
|
"password"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
let albums = c.album_list("newest", 10, 0).await.unwrap();
|
let albums = c.album_list("newest", 10, 0).await.unwrap();
|
||||||
assert!(!albums.is_empty(), "no albums");
|
assert!(!albums.is_empty(), "no albums");
|
||||||
@@ -467,7 +549,11 @@ mod tests {
|
|||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn errors_never_contain_the_token() {
|
async fn errors_never_contain_the_token() {
|
||||||
// Port 1 on loopback refuses the connection, so the request fails.
|
// Port 1 on loopback refuses the connection, so the request fails.
|
||||||
let c = Client::new("http://127.0.0.1:1", "u", "somesalt", "secrettoken");
|
let auth = Auth::Token {
|
||||||
|
salt: "somesalt".into(),
|
||||||
|
token: "secrettoken".into(),
|
||||||
|
};
|
||||||
|
let c = Client::new("http://127.0.0.1:1", "u", auth);
|
||||||
let err = format!("{:#}", c.ping().await.unwrap_err());
|
let err = format!("{:#}", c.ping().await.unwrap_err());
|
||||||
assert!(!err.contains("secrettoken"), "token leaked: {err}");
|
assert!(!err.contains("secrettoken"), "token leaked: {err}");
|
||||||
assert!(!err.contains("somesalt"), "salt leaked: {err}");
|
assert!(!err.contains("somesalt"), "salt leaked: {err}");
|
||||||
@@ -475,10 +561,118 @@ mod tests {
|
|||||||
assert!(!err.contains("secrettoken"), "token leaked: {err}");
|
assert!(!err.contains("secrettoken"), "token leaked: {err}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn errors_never_contain_the_password() {
|
||||||
|
let c = Client::new("http://127.0.0.1:1", "u", Auth::Password("sesame".into()));
|
||||||
|
let hex = "736573616d65";
|
||||||
|
for err in [
|
||||||
|
format!("{:#}", c.ping().await.unwrap_err()),
|
||||||
|
format!("{:#}", c.cover_art("al-1", 256).await.unwrap_err()),
|
||||||
|
] {
|
||||||
|
assert!(!err.contains("sesame") && !err.contains(hex), "password leaked: {err}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn token_is_md5_of_password_and_salt() {
|
fn token_is_md5_of_password_and_salt() {
|
||||||
let c = Client::from_password("http://x", "u", "sesame");
|
let c = Client::from_password("http://x", "u", "sesame");
|
||||||
let expected = format!("{:x}", md5::compute(format!("sesame{}", c.salt())));
|
let Auth::Token { salt, token } = c.auth() else {
|
||||||
assert_eq!(c.token(), expected);
|
panic!("from_password should use a token");
|
||||||
|
};
|
||||||
|
assert_eq!(*token, format!("{:x}", md5::compute(format!("sesame{salt}"))));
|
||||||
|
}
|
||||||
|
|
||||||
|
fn query(c: &Client) -> Vec<(String, String)> {
|
||||||
|
c.endpoint_url("ping", &[])
|
||||||
|
.unwrap()
|
||||||
|
.query_pairs()
|
||||||
|
.map(|(k, v)| (k.into_owned(), v.into_owned()))
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn token_auth_sends_token_and_salt_only() {
|
||||||
|
let c = Client::new(
|
||||||
|
"http://x",
|
||||||
|
"u",
|
||||||
|
Auth::Token {
|
||||||
|
salt: "s1".into(),
|
||||||
|
token: "t1".into(),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
let q = query(&c);
|
||||||
|
assert!(q.contains(&("t".into(), "t1".into())));
|
||||||
|
assert!(q.contains(&("s".into(), "s1".into())));
|
||||||
|
assert!(!q.iter().any(|(k, _)| k == "p"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn password_auth_sends_the_password_hex_encoded() {
|
||||||
|
let c = Client::new("http://x", "u", Auth::Password("sesame".into()));
|
||||||
|
let q = query(&c);
|
||||||
|
assert!(q.contains(&("u".into(), "u".into())));
|
||||||
|
assert!(q.contains(&("p".into(), "enc:736573616d65".into())));
|
||||||
|
assert!(!q.iter().any(|(k, _)| k == "t" || k == "s"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn server_errors_keep_their_code() {
|
||||||
|
// As Nextcloud Music answers a token login.
|
||||||
|
let body = serde_json::json!({"subsonic-response": {
|
||||||
|
"error": {"code": 41, "message": "Token-based authentication not supported"},
|
||||||
|
"status": "failed", "version": "1.16.1", "type": "nextcloud music", "openSubsonic": true
|
||||||
|
}});
|
||||||
|
let e = unwrap_response("ping", body).unwrap_err();
|
||||||
|
let api = api_error(&e).expect("an ApiError");
|
||||||
|
assert_eq!(api.code, 41);
|
||||||
|
assert_eq!(api.server.as_deref(), Some("nextcloud music"));
|
||||||
|
assert_eq!(e.to_string(), "Token-based authentication not supported");
|
||||||
|
let ok = serde_json::json!({"subsonic-response": {"status": "ok", "version": "1.16.1"}});
|
||||||
|
assert!(unwrap_response("ping", ok).is_ok());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A one-request-per-connection HTTP server on loopback that answers like
|
||||||
|
/// Nextcloud Music: tokens refused, the password "sesame" accepted.
|
||||||
|
fn fake_tokenless_server() -> String {
|
||||||
|
use std::io::{BufRead, BufReader, Write};
|
||||||
|
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
|
||||||
|
let addr = listener.local_addr().unwrap();
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
for stream in listener.incoming() {
|
||||||
|
let Ok(mut stream) = stream else { continue };
|
||||||
|
let mut line = String::new();
|
||||||
|
let mut reader = BufReader::new(stream.try_clone().unwrap());
|
||||||
|
let _ = reader.read_line(&mut line);
|
||||||
|
let error = |code: i64, msg: &str| {
|
||||||
|
format!(
|
||||||
|
r#"{{"subsonic-response":{{"status":"failed","error":{{"code":{code},"message":"{msg}"}}}}}}"#
|
||||||
|
)
|
||||||
|
};
|
||||||
|
let body = if line.contains("t=") {
|
||||||
|
error(41, "Token-based authentication not supported")
|
||||||
|
} else if line.contains("p=enc%3A736573616d65") || line.contains("p=enc:736573616d65") {
|
||||||
|
r#"{"subsonic-response":{"status":"ok"}}"#.to_string()
|
||||||
|
} else {
|
||||||
|
error(40, "Wrong username or password")
|
||||||
|
};
|
||||||
|
let _ = write!(
|
||||||
|
stream,
|
||||||
|
"HTTP/1.1 200 OK\r\ncontent-type: application/json\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}",
|
||||||
|
body.len()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
format!("http://{addr}")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn login_falls_back_to_the_password_when_tokens_are_refused() {
|
||||||
|
let base = fake_tokenless_server();
|
||||||
|
let c = Client::login(&base, "u", "sesame").await.unwrap();
|
||||||
|
assert_eq!(*c.auth(), Auth::Password("sesame".into()));
|
||||||
|
let Err(e) = Client::login(&base, "u", "wrong").await else {
|
||||||
|
panic!("a wrong password logged in");
|
||||||
|
};
|
||||||
|
assert_eq!(api_error(&e).map(|a| a.code), Some(WRONG_CREDENTIALS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
// (800px = 1.0, the Steam Deck). The UI keeps the same proportions on a Deck
|
// (800px = 1.0, the Steam Deck). The UI keeps the same proportions on a Deck
|
||||||
// and on a 4K TV, whatever scale factor the compositor reports.
|
// and on a 4K TV, whatever scale factor the compositor reports.
|
||||||
|
|
||||||
|
// Bundled so headings look the same on every machine. Licence in fonts/OFL.txt.
|
||||||
|
import "fonts/NotoSerif-SemiBold.ttf";
|
||||||
|
|
||||||
export enum Action {
|
export enum Action {
|
||||||
none, up, down, left, right, page-up, page-down, activate, back,
|
none, up, down, left, right, page-up, page-down, activate, back,
|
||||||
play-pause, next, prev, queue, section-next, section-prev,
|
play-pause, next, prev, queue, section-next, section-prev,
|
||||||
@@ -43,21 +46,35 @@ export struct Hint { key: string, label: string }
|
|||||||
|
|
||||||
export global Theme {
|
export global Theme {
|
||||||
in-out property <float> s: 1.0;
|
in-out property <float> s: 1.0;
|
||||||
out property <color> bg: #0d0f13;
|
// The brand palette: warm darks and cream text, from the logo's maroon
|
||||||
out property <color> panel: #14171d;
|
// (#5a0712) and cream. The app replaces these with colours from the album
|
||||||
out property <color> raised: #1e222a;
|
// art when that setting is on; src/palette.rs must keep the same defaults.
|
||||||
out property <color> line: #2a2f39;
|
in-out property <color> bg: #140b0c;
|
||||||
out property <color> text: #f3f4f6;
|
in-out property <color> panel: #1d1012;
|
||||||
out property <color> muted: #a0a7b4;
|
in-out property <color> raised: #2b181b;
|
||||||
out property <color> faint: #626a78;
|
in-out property <color> line: #42272b;
|
||||||
out property <color> accent: #8ab4ff;
|
in-out property <color> text: #faebda;
|
||||||
out property <color> on-accent: #0d0f13;
|
in-out property <color> muted: #bea999;
|
||||||
|
in-out property <color> faint: #80685f;
|
||||||
|
// Filled surfaces: the current section, buttons, the playing badge.
|
||||||
|
in-out property <color> accent: #a51d2d;
|
||||||
|
in-out property <color> on-accent: #faebda;
|
||||||
|
// Accent for text and thin lines, where the fill colour is too dark to read.
|
||||||
|
in-out property <color> highlight: #e8757b;
|
||||||
|
// Ring around whatever has focus.
|
||||||
|
in-out property <color> focus: #faebda;
|
||||||
|
// Tops of the sidebar and login backgrounds.
|
||||||
|
in-out property <color> glow: #2a0b11;
|
||||||
|
in-out property <color> login-glow: #3a0b13;
|
||||||
|
// Not part of the palette: errors stay red whatever the album art.
|
||||||
|
out property <color> error: #f0605d;
|
||||||
|
out property <string> serif: "Noto Serif";
|
||||||
}
|
}
|
||||||
|
|
||||||
component Art inherits Rectangle {
|
component Art inherits Rectangle {
|
||||||
in property <image> source;
|
in property <image> source;
|
||||||
in property <bool> has-image;
|
in property <bool> has-image;
|
||||||
in property <color> tint: #39404d;
|
in property <color> tint: Theme.raised;
|
||||||
in property <string> letter;
|
in property <string> letter;
|
||||||
in property <bool> round;
|
in property <bool> round;
|
||||||
in property <length> letter-size: 64px * Theme.s;
|
in property <length> letter-size: 64px * Theme.s;
|
||||||
@@ -71,8 +88,9 @@ component Art inherits Rectangle {
|
|||||||
text: root.letter;
|
text: root.letter;
|
||||||
// Not derived from the art's own height: that feeds back into layout.
|
// Not derived from the art's own height: that feeds back into layout.
|
||||||
font-size: root.letter-size;
|
font-size: root.letter-size;
|
||||||
font-weight: 800;
|
font-family: Theme.serif;
|
||||||
color: #ffffff60;
|
font-weight: 600;
|
||||||
|
color: Theme.text.with-alpha(0.4);
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
visible: !root.has-image;
|
visible: !root.has-image;
|
||||||
@@ -104,7 +122,7 @@ component Card inherits Rectangle {
|
|||||||
height: root.art + 2 * root.ring;
|
height: root.art + 2 * root.ring;
|
||||||
border-radius: root.item.round ? self.width / 2 : 13px * Theme.s;
|
border-radius: root.item.round ? self.width / 2 : 13px * Theme.s;
|
||||||
border-width: 3px * Theme.s;
|
border-width: 3px * Theme.s;
|
||||||
border-color: root.selected ? (root.active ? Theme.accent : Theme.faint) : transparent;
|
border-color: root.selected ? (root.active ? Theme.focus : Theme.faint) : transparent;
|
||||||
animate border-color { duration: 120ms; }
|
animate border-color { duration: 120ms; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,7 +189,7 @@ component Row inherits Rectangle {
|
|||||||
border-radius: 10px * Theme.s;
|
border-radius: 10px * Theme.s;
|
||||||
background: root.selected ? (root.active ? Theme.raised : Theme.panel) : transparent;
|
background: root.selected ? (root.active ? Theme.raised : Theme.panel) : transparent;
|
||||||
border-width: root.selected && root.active ? 2px * Theme.s : 0;
|
border-width: root.selected && root.active ? 2px * Theme.s : 0;
|
||||||
border-color: Theme.accent;
|
border-color: Theme.focus;
|
||||||
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
padding-left: 16px * Theme.s;
|
padding-left: 16px * Theme.s;
|
||||||
@@ -195,7 +213,7 @@ component Row inherits Rectangle {
|
|||||||
width: 34px * Theme.s;
|
width: 34px * Theme.s;
|
||||||
text: root.item.playing ? "▶" : root.item.number;
|
text: root.item.playing ? "▶" : root.item.number;
|
||||||
font-size: 15px * Theme.s;
|
font-size: 15px * Theme.s;
|
||||||
color: root.item.playing ? Theme.accent : Theme.faint;
|
color: root.item.playing ? Theme.highlight : Theme.faint;
|
||||||
horizontal-alignment: right;
|
horizontal-alignment: right;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
@@ -208,7 +226,7 @@ component Row inherits Rectangle {
|
|||||||
text: root.item.title;
|
text: root.item.title;
|
||||||
font-size: 17px * Theme.s;
|
font-size: 17px * Theme.s;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: root.item.playing ? Theme.accent : Theme.text;
|
color: root.item.playing ? Theme.highlight : Theme.text;
|
||||||
overflow: elide;
|
overflow: elide;
|
||||||
}
|
}
|
||||||
if root.item.subtitle != "": Text {
|
if root.item.subtitle != "": Text {
|
||||||
@@ -334,15 +352,17 @@ component PageHeader inherits Rectangle {
|
|||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
Text {
|
Text {
|
||||||
text: root.h.kind;
|
text: root.h.kind;
|
||||||
font-size: 13px * Theme.s;
|
font-size: 14px * Theme.s;
|
||||||
font-weight: 700;
|
font-family: Theme.serif;
|
||||||
letter-spacing: 2px * Theme.s;
|
font-weight: 600;
|
||||||
color: Theme.accent;
|
letter-spacing: 3px * Theme.s;
|
||||||
|
color: Theme.highlight;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: root.h.title;
|
text: root.h.title;
|
||||||
font-size: 40px * Theme.s;
|
font-size: 40px * Theme.s;
|
||||||
font-weight: 800;
|
font-family: Theme.serif;
|
||||||
|
font-weight: 600;
|
||||||
color: Theme.text;
|
color: Theme.text;
|
||||||
overflow: elide;
|
overflow: elide;
|
||||||
}
|
}
|
||||||
@@ -368,7 +388,7 @@ component Sidebar inherits Rectangle {
|
|||||||
in property <string> footer;
|
in property <string> footer;
|
||||||
callback clicked(int);
|
callback clicked(int);
|
||||||
|
|
||||||
background: Theme.panel;
|
background: @linear-gradient(180deg, Theme.glow 0%, Theme.panel 55%);
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 26px * Theme.s;
|
padding: 26px * Theme.s;
|
||||||
@@ -376,11 +396,15 @@ component Sidebar inherits Rectangle {
|
|||||||
spacing: 6px * Theme.s;
|
spacing: 6px * Theme.s;
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
|
||||||
Text {
|
HorizontalLayout {
|
||||||
text: "remus";
|
alignment: start;
|
||||||
font-size: 30px * Theme.s;
|
padding-left: 6px * Theme.s;
|
||||||
font-weight: 800;
|
Image {
|
||||||
color: Theme.text;
|
source: @image-url("../branding/svg/remus-logo.svg");
|
||||||
|
height: 44px * Theme.s;
|
||||||
|
// The lockup's aspect ratio, so the image box hugs the logo.
|
||||||
|
width: self.height * 2.93;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Rectangle { height: 26px * Theme.s; }
|
Rectangle { height: 26px * Theme.s; }
|
||||||
|
|
||||||
@@ -426,7 +450,7 @@ component SearchBox inherits Rectangle {
|
|||||||
border-radius: 12px * Theme.s;
|
border-radius: 12px * Theme.s;
|
||||||
background: Theme.raised;
|
background: Theme.raised;
|
||||||
border-width: 2px * Theme.s;
|
border-width: 2px * Theme.s;
|
||||||
border-color: input.has-focus || root.highlighted ? Theme.accent : Theme.line;
|
border-color: input.has-focus || root.highlighted ? Theme.focus : Theme.line;
|
||||||
|
|
||||||
input := TextInput {
|
input := TextInput {
|
||||||
x: 18px * Theme.s;
|
x: 18px * Theme.s;
|
||||||
@@ -472,7 +496,7 @@ component NowBar inherits Rectangle {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
x: 0;
|
x: 0;
|
||||||
width: parent.width * root.progress;
|
width: parent.width * root.progress;
|
||||||
background: Theme.accent;
|
background: Theme.highlight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +546,7 @@ component NowBar inherits Rectangle {
|
|||||||
if root.has-track: Text {
|
if root.has-track: Text {
|
||||||
text: root.paused ? "❚❚" : "▶";
|
text: root.paused ? "❚❚" : "▶";
|
||||||
font-size: 18px * Theme.s;
|
font-size: 18px * Theme.s;
|
||||||
color: Theme.accent;
|
color: Theme.highlight;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,6 +554,7 @@ component NowBar inherits Rectangle {
|
|||||||
|
|
||||||
component HintBar inherits Rectangle {
|
component HintBar inherits Rectangle {
|
||||||
in property <[Hint]> hints;
|
in property <[Hint]> hints;
|
||||||
|
in property <string> version;
|
||||||
|
|
||||||
pure function key-color(k: string) -> color {
|
pure function key-color(k: string) -> color {
|
||||||
if (k == "A") { return #3fb950; }
|
if (k == "A") { return #3fb950; }
|
||||||
@@ -576,6 +601,16 @@ component HintBar inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Which build is running, so a report from the Deck can be matched to it.
|
||||||
|
Text {
|
||||||
|
x: 28px * Theme.s;
|
||||||
|
height: parent.height;
|
||||||
|
text: "remus " + root.version;
|
||||||
|
font-size: 12px * Theme.s;
|
||||||
|
color: Theme.faint;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component Field inherits VerticalLayout {
|
component Field inherits VerticalLayout {
|
||||||
@@ -599,7 +634,7 @@ component Field inherits VerticalLayout {
|
|||||||
border-radius: 10px * Theme.s;
|
border-radius: 10px * Theme.s;
|
||||||
background: Theme.raised;
|
background: Theme.raised;
|
||||||
border-width: 2px * Theme.s;
|
border-width: 2px * Theme.s;
|
||||||
border-color: input.has-focus || root.highlighted ? Theme.accent : Theme.line;
|
border-color: input.has-focus || root.highlighted ? Theme.focus : Theme.line;
|
||||||
input := TextInput {
|
input := TextInput {
|
||||||
x: 16px * Theme.s;
|
x: 16px * Theme.s;
|
||||||
width: parent.width - 32px * Theme.s;
|
width: parent.width - 32px * Theme.s;
|
||||||
@@ -634,6 +669,8 @@ component LoginView inherits Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
background: @radial-gradient(circle, Theme.login-glow 0%, Theme.bg 70%);
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: min(560px * Theme.s, parent.width - 40px * Theme.s);
|
width: min(560px * Theme.s, parent.width - 40px * Theme.s);
|
||||||
height: col.preferred-height;
|
height: col.preferred-height;
|
||||||
@@ -644,11 +681,14 @@ component LoginView inherits Rectangle {
|
|||||||
padding: 40px * Theme.s;
|
padding: 40px * Theme.s;
|
||||||
spacing: 20px * Theme.s;
|
spacing: 20px * Theme.s;
|
||||||
|
|
||||||
Text {
|
HorizontalLayout {
|
||||||
text: "remus";
|
alignment: start;
|
||||||
font-size: 38px * Theme.s;
|
Image {
|
||||||
font-weight: 800;
|
source: @image-url("../branding/svg/remus-logo.svg");
|
||||||
color: Theme.text;
|
height: 68px * Theme.s;
|
||||||
|
// The lockup's aspect ratio, so the image box hugs the logo.
|
||||||
|
width: self.height * 2.93;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: "Connect to your Subsonic server";
|
text: "Connect to your Subsonic server";
|
||||||
@@ -691,7 +731,7 @@ component LoginView inherits Rectangle {
|
|||||||
if root.error != "": Text {
|
if root.error != "": Text {
|
||||||
text: root.error;
|
text: root.error;
|
||||||
font-size: 15px * Theme.s;
|
font-size: 15px * Theme.s;
|
||||||
color: #f0605d;
|
color: Theme.error;
|
||||||
wrap: word-wrap;
|
wrap: word-wrap;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
@@ -734,7 +774,7 @@ component NowPlayingView inherits Rectangle {
|
|||||||
opacity: 0.16;
|
opacity: 0.16;
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
background: @linear-gradient(90deg, #0d0f13aa, #0d0f13f2);
|
background: @linear-gradient(90deg, Theme.bg.with-alpha(0.67), Theme.bg.with-alpha(0.95));
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
@@ -761,8 +801,9 @@ component NowPlayingView inherits Rectangle {
|
|||||||
Rectangle { height: 14px * Theme.s; }
|
Rectangle { height: 14px * Theme.s; }
|
||||||
Text {
|
Text {
|
||||||
text: root.has-track ? root.title : "Nothing playing";
|
text: root.has-track ? root.title : "Nothing playing";
|
||||||
font-size: 30px * Theme.s;
|
font-size: 32px * Theme.s;
|
||||||
font-weight: 800;
|
font-family: Theme.serif;
|
||||||
|
font-weight: 600;
|
||||||
color: Theme.text;
|
color: Theme.text;
|
||||||
overflow: elide;
|
overflow: elide;
|
||||||
}
|
}
|
||||||
@@ -787,7 +828,7 @@ component NowPlayingView inherits Rectangle {
|
|||||||
x: 0;
|
x: 0;
|
||||||
width: parent.width * root.progress;
|
width: parent.width * root.progress;
|
||||||
border-radius: 3px * Theme.s;
|
border-radius: 3px * Theme.s;
|
||||||
background: Theme.accent;
|
background: Theme.highlight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
@@ -800,7 +841,7 @@ component NowPlayingView inherits Rectangle {
|
|||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
text: root.has-track ? (root.paused ? "Paused" : "Playing") : "";
|
text: root.has-track ? (root.paused ? "Paused" : "Playing") : "";
|
||||||
font-size: 14px * Theme.s;
|
font-size: 14px * Theme.s;
|
||||||
color: Theme.accent;
|
color: Theme.highlight;
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
@@ -816,8 +857,9 @@ component NowPlayingView inherits Rectangle {
|
|||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
Text {
|
Text {
|
||||||
text: "Queue";
|
text: "Queue";
|
||||||
font-size: 26px * Theme.s;
|
font-size: 28px * Theme.s;
|
||||||
font-weight: 800;
|
font-family: Theme.serif;
|
||||||
|
font-weight: 600;
|
||||||
color: Theme.text;
|
color: Theme.text;
|
||||||
}
|
}
|
||||||
ItemView {
|
ItemView {
|
||||||
@@ -902,6 +944,7 @@ export component AppWindow inherits Window {
|
|||||||
|
|
||||||
in property <[Hint]> hints;
|
in property <[Hint]> hints;
|
||||||
in property <string> toast;
|
in property <string> toast;
|
||||||
|
in property <string> version;
|
||||||
|
|
||||||
public function focus-main() {
|
public function focus-main() {
|
||||||
fs.focus();
|
fs.focus();
|
||||||
@@ -999,8 +1042,9 @@ export component AppWindow inherits Window {
|
|||||||
visible: !root.header.visible;
|
visible: !root.header.visible;
|
||||||
Text {
|
Text {
|
||||||
text: root.page-title;
|
text: root.page-title;
|
||||||
font-size: 30px * Theme.s;
|
font-size: 32px * Theme.s;
|
||||||
font-weight: 800;
|
font-family: Theme.serif;
|
||||||
|
font-weight: 600;
|
||||||
color: Theme.text;
|
color: Theme.text;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
}
|
}
|
||||||
@@ -1096,6 +1140,7 @@ export component AppWindow inherits Window {
|
|||||||
HintBar {
|
HintBar {
|
||||||
height: 46px * Theme.s;
|
height: 46px * Theme.s;
|
||||||
hints: root.hints;
|
hints: root.hints;
|
||||||
|
version: root.version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
Noto Serif SemiBold (NotoSerif-SemiBold.ttf), version 2.004
|
||||||
|
Copyright 2015 Google LLC. All Rights Reserved.
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
This license is copied below, and is also available with a FAQ at:
|
||||||
|
https://openfontlicense.org
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||||