Repository navigation
release: Awake Modpack Manager 1.3.1 view images on the Files page - #10
Merged
Merged
Conversation
Files opens pictures in a built-in viewer, the way 1.3.0 opens text files in the editor. Clicking a .png, .jpg, .jpeg, .gif, .webp, .bmp or .ico used to answer "This is not a text file". The host reads the picture through the same path checks as the editor and hands it to the page as a data URL, the only form the content policy lets an <img> load. The first bytes decide whether a file is a picture, never its name. Pictures over 16 MB are refused. The viewer shows the size in pixels and on disk, fits large pictures to the panel, enlarges small textures in whole steps with sharp pixels and draws transparency over a checkerboard. Nothing is ever written. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The Files page opens pictures in a built-in viewer, the same way 1.3.0 opens text files in the editor. Clicking a
.png,.jpg,.jpeg,.gif,.webp,.bmpor.icoused to answer "This is not a text file".src-tauri/src/desktop.rs): newworkspace_read_imagecommand. It goes through the samechecked_pathas the editor (six content folders only, no links followed), caps the file at 16 MB, and decides the format from the first bytes, never the name. The picture is returned as adata:URL, which the existing content policy already allows, so the CSP is unchanged. No new crate.readContentImageonManagerBackend, wired throughHostApi,HelperClient, the composite backend and the demo backend.src/views/FilesView.vue): a viewer panel beside the editor. It shows the size in pixels and on disk, fits large pictures to the panel, enlarges small textures with sharp pixels, and draws transparency over a checkerboard. Image rows get their own icon and say "View". A picture that will not decode shows an error.docs/releases/v1.3.1.md.Testing
npm test: 217 passed, 28 skipped (the live/real-helper suites).npm run typecheck: clean.cargo test --manifest-path src-tauri/Cargo.toml --lib: 52 passed, including the new viewer test.