Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamable output refresh is size limited to 4k, won't allow | image=(base64data) #371

Closed
1 task done
peanball opened this issue Apr 7, 2023 · 0 comments · Fixed by #372
Closed
1 task done
Milestone

Comments

@peanball
Copy link
Contributor

peanball commented Apr 7, 2023

Describe the bug
The streamable plugin option reads data from the script's output stream and forwards it to the streamable output processing, which checks for ~~~. The reading is buffered and by system defaults limited to ca. 4k, while the rest of the stream may not be read.

To Reproduce
Produce an image output:

echo "~~~
some image | image=$(base64 -b 0 -o - -i img.png)
"

This should produce a complete image but the image is broken.

Expected behavior
The image is loaded properly

Screenshots

Environment:

  • macOS version: 13.0
  • SwiftBar version: 1.4.4

Plugin Example:
Sample plugin to reproduce the issue, link or code.

(not tested. I will test later and in more detail)

echo "~~~
some image | image=$(base64 -b 0 -o - -i img.png)
"

Additional Context:

  • I don't run Bartender/Dozer/etc. or tested the issue without it running

I am currently working on a streaming version of the iTunes / Music status "Now Playing" plugin and wanted to add album art. The script works fine but the album art doesn't load.

If I find time before you, I might open a PR with a fix. I can test changes and have the above now playing script that is an extensive "test suite".

I found the edge case that wasn't handled in the stream output processing and propose a simple fix in #372.

peanball added a commit to peanball/SwiftBar that referenced this issue Apr 8, 2023
…ng items

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes swiftbar#371.
peanball added a commit to peanball/SwiftBar that referenced this issue Apr 8, 2023
…ng items

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes swiftbar#371.
peanball added a commit to peanball/SwiftBar that referenced this issue Apr 8, 2023
…ng items

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes swiftbar#371.
peanball added a commit to peanball/SwiftBar that referenced this issue Apr 8, 2023
…ng items

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes swiftbar#371.
@melonamin melonamin added this to the 2.0 milestone Apr 8, 2023
melonamin pushed a commit that referenced this issue Apr 14, 2023
…ng items (#372)

Process output is streamed into a buffer. By default this buffer fits 4k characters, which is too short for image data.
With this change, if this block does not contain a stream separator, the complete block is appended to the in-progress content stored so far.
Fixes #371.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants