Skip to content

Commit

Permalink
Fixed problem with HTML escaping for Waybar.
Browse files Browse the repository at this point in the history
Reported here too: Alexays/Waybar#2067
  • Loading branch information
AndreasBackx committed May 20, 2023
1 parent 18cf2b7 commit f9e4a5d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.4] - 2023-05-20
### Changed
- Fixed Waybar output problem with HTML escaping.

## [0.2.3] - 2022-05-29
### Changed
Expand Down
18 changes: 17 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ homepage = "https://github.com/AndreasBackx/spotifatius"
keywords = ["spotify", "waybar", "polybar"]
license = "MIT"
name = "spotifatius"
version = "0.2.3"
version = "0.2.4"

[dependencies]
anyhow = "1.0.41"
clap = {version = "3.1.18", features = ["derive"]}
futures = {version = "0.3", default-features = false}
html-escape = "0.2.13"
# Don't use prost's `prost-derive` because it's unused.
prost = {version = "0.10.4", default-features = false, features = ["std"]}
rspotify = {version = "0.11.0", features = [
Expand Down
6 changes: 5 additions & 1 deletion src/commands/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ impl OutputFormatter {
pub fn print(&self, output: Output) -> Result<()> {
match self.output_type {
OutputType::Waybar => {
let json = serde_json::to_string(&output)?;
let json = serde_json::to_string(&Output {
text: html_escape::encode_text(&output.text.to_string())
.into(),
..output
})?;
println!("{}", json);
}
OutputType::Polybar => {
Expand Down

0 comments on commit f9e4a5d

Please sign in to comment.