From f004ebfd176824357f73d02de3f7451fc8490ed2 Mon Sep 17 00:00:00 2001
From: awakenginexe <267649137+awakenginexe@users.noreply.github.com>
Date: Wed, 11 Nov 2026 09:37:43 +0700
Subject: [PATCH] release: Awake Modpack Manager 1.3.1
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 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
---
README.md | 8 +--
docs/HANDOFF.md | 8 +--
docs/releases/v1.3.1.md | 22 ++++++++
package-lock.json | 4 +-
package.json | 2 +-
src-tauri/Cargo.lock | 2 +-
src-tauri/Cargo.toml | 2 +-
src-tauri/src/desktop.rs | 80 ++++++++++++++++++++++++++++++
src-tauri/src/lib.rs | 1 +
src-tauri/tauri.conf.json | 2 +-
src/backend/ManagerBackend.ts | 4 +-
src/backend/composite.ts | 1 +
src/backend/contract.ts | 2 +
src/backend/helper/HelperClient.ts | 4 ++
src/backend/host.ts | 4 +-
src/backend/mock/MockBackend.ts | 15 +++++-
src/i18n/en.ts | 3 ++
src/i18n/th.ts | 3 ++
src/i18n/zh-CN.ts | 3 ++
src/i18n/zh-TW.ts | 3 ++
src/views/FilesView.vue | 59 ++++++++++++++++++++--
tests/files.test.ts | 36 ++++++++++++++
tests/v030.test.ts | 1 +
23 files changed, 246 insertions(+), 23 deletions(-)
create mode 100644 docs/releases/v1.3.1.md
diff --git a/README.md b/README.md
index 79be9ab..559f8aa 100644
--- a/README.md
+++ b/README.md
@@ -4,16 +4,16 @@ A Windows desktop app for building and maintaining Minecraft modpacks. It create
projects and installs real mods from Modrinth, with every change reviewed before it is applied.
Awake Launcher is not required.
-> **What's new in 1.3.0:** see [docs/releases/v1.3.0.md](docs/releases/v1.3.0.md).
+> **What's new in 1.3.1:** see [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md).
-**Version 1.3.0 · Windows x64 · English, ไทย, 简体中文, 繁體中文 · GPL-3.0-only**
+**Version 1.3.1 · Windows x64 · English, ไทย, 简体中文, 繁體中文 · GPL-3.0-only**
## Install
-1. Download `Awake-Modpack-Manager-v1.3.0-Windows-x64-Setup.exe` from the
+1. Download `Awake-Modpack-Manager-v1.3.1-Windows-x64-Setup.exe` from the
[latest release](https://github.com/awakenginexe/Awake-Modpack-Manager/releases/latest).
2. Optional: check it against `SHA256SUMS.txt` from the same release
- (`Get-FileHash .\Awake-Modpack-Manager-v1.3.0-Windows-x64-Setup.exe`).
+ (`Get-FileHash .\Awake-Modpack-Manager-v1.3.1-Windows-x64-Setup.exe`).
3. Run the installer. It installs for your Windows user only (no administrator rights) into
`%LOCALAPPDATA%\Awake Modpack Manager`.
The installer is **not code-signed** yet, so Windows SmartScreen may warn that it is from an
diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index cf84d69..8452f22 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -1,10 +1,10 @@
-# Development checkpoint: Manager 1.3.0 and Native Core 0.4.2
+# Development checkpoint: Manager 1.3.1 and Native Core 0.4.2
-Unreleased until the owner approves the pull request and tags `v1.3.0`.
+Unreleased until the owner approves the pull request and tags `v1.3.1`.
## Where things are
-- Manager: branch `release/1.3.0`. `npm ci`, then `npm test`, `npm run typecheck`, `cargo test --manifest-path src-tauri/Cargo.toml --lib`.
+- Manager: branch `release/1.3.1`. `npm ci`, then `npm test`, `npm run typecheck`, `cargo test --manifest-path src-tauri/Cargo.toml --lib`.
- Native Core: Awake Launcher branch `release/3.2.2`. `.github/workflows/native-core-package.yml` builds it with the recorded toolchain and commits a delivery under `native-core/redistribution//`. `scripts/helper-pin.json` pins that delivery.
- Release: pushing a version tag runs `.github/workflows/awake-beta.yml`, which builds, verifies, assembles every asset and publishes the release. `SHA256SUMS.txt` is required by in-app updates.
@@ -12,7 +12,7 @@ Unreleased until the owner approves the pull request and tags `v1.3.0`.
- `src-tauri/src/providers.rs`: five modpack catalogs, pack downloads, batched project metadata and update lookups. The CurseForge key stays in the host and the helper's environment.
- `src-tauri/src/updater.rs`: GitHub release check and checksum-verified installer run.
-- `src-tauri/src/desktop.rs`: content folders of a project or managed Launcher instance (list a folder, edit a text file, add files, Recycle Bin), shell open. Mods are never touched here.
+- `src-tauri/src/desktop.rs`: content folders of a project or managed Launcher instance (list a folder, edit a text file, view an image (1.3.1), add files, Recycle Bin), shell open. Mods are never touched here.
- `src-tauri/src/content.rs` (1.3.0): resource pack and shader search, versions and direct, checksum-verified install into `resourcepacks` / `shaderpacks`.
- `HelperClient.installPack`: one local operation over fetch, upload, create, prepare and apply. A failure removes the created project.
- FTB versions become a generated `.mrpack` manifest; ATLauncher and Technic become a CurseForge-format archive of overrides.
diff --git a/docs/releases/v1.3.1.md b/docs/releases/v1.3.1.md
new file mode 100644
index 0000000..5474d7f
--- /dev/null
+++ b/docs/releases/v1.3.1.md
@@ -0,0 +1,22 @@
+# Awake Modpack Manager 1.3.1
+
+Works with **Awake Launcher 3.2.2**. No Launcher update is needed.
+
+## Added
+
+- **View images on the Files page.** Clicking a picture (`.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.bmp`, `.ico`) now opens it inside the Manager, the same way a text file opens in the editor, instead of answering "This is not a text file". The viewer shows the picture's size in pixels and on disk, fits large pictures to the window, enlarges small textures with sharp pixels, and draws transparent areas over a checkerboard. Pictures are listed with their own icon, and the right-click menu says "View" for them.
+
+## How it behaves
+
+- Pictures are only shown, never changed: there is nothing to save, so going back to the folder never asks.
+- A file is shown only if its first bytes are those of a picture format the viewer knows, whatever its name ends in. Anything else is refused with a message.
+- Pictures over 16 MB are left to other programs. A picture that is damaged says so instead of showing an empty frame.
+- `.svg` files are text and still open in the editor.
+
+## Safety
+
+- The viewer reads through the same path checks as the editor: inside the six content folders only, and never through a link or junction.
+
+## Not verified on a real machine yet
+
+The demo data and the automated tests cover the viewer, and the host's reading and format check have their own tests. Still unverified: the viewer in the desktop app against a real instance.
diff --git a/package-lock.json b/package-lock.json
index 844036c..6f5800e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "awake-modpack-manager",
- "version": "1.3.0",
+ "version": "1.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "awake-modpack-manager",
- "version": "1.3.0",
+ "version": "1.3.1",
"license": "GPL-3.0-only",
"dependencies": {
"@lucide/vue": "1.59.0",
diff --git a/package.json b/package.json
index 17f5ecc..a970c45 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "awake-modpack-manager",
"private": true,
- "version": "1.3.0",
+ "version": "1.3.1",
"license": "GPL-3.0-only",
"type": "module",
"engines": {
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 29fe642..3f27215 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -224,7 +224,7 @@ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
[[package]]
name = "awake-modpack-manager"
-version = "1.3.0"
+version = "1.3.1"
dependencies = [
"md-5",
"serde",
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 6ab9c26..5d89067 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "awake-modpack-manager"
-version = "1.3.0"
+version = "1.3.1"
description = "Awake Modpack Manager desktop host"
license = "GPL-3.0-only"
repository = "https://github.com/awakenginexe/Awake-Modpack-Manager"
diff --git a/src-tauri/src/desktop.rs b/src-tauri/src/desktop.rs
index 052301a..ac0fec4 100644
--- a/src-tauri/src/desktop.rs
+++ b/src-tauri/src/desktop.rs
@@ -18,6 +18,8 @@ const AREAS: [&str; 6] = ["config", "defaultconfigs", "kubejs", "scripts", "reso
const LIST_MAX: usize = 20_000;
/// The largest text file the built-in editor opens or saves.
const TEXT_MAX: u64 = 2 << 20;
+/// The largest picture the built-in viewer shows.
+const IMAGE_MAX: u64 = 16 << 20;
pub fn is_uuid(id: &str) -> bool {
id.len() == 36 && id.bytes().enumerate().all(|(i, b)| if [8, 13, 18, 23].contains(&i) { b == b'-' } else { b.is_ascii_hexdigit() })
@@ -163,6 +165,57 @@ pub async fn workspace_write_text(workspace: String, area: String, path: String,
.unwrap_or_else(|e| err("internal", e.to_string()))
}
+#[derive(Serialize, Debug)]
+#[serde(rename_all = "camelCase")]
+pub struct ImageFile {
+ /// `data:image/...;base64,...`, the only form the page's content policy lets an `` load from disk.
+ data_url: String,
+ size_bytes: u64,
+}
+
+/// The picture formats the web view draws, told by their first bytes and never by the file name.
+pub fn image_mime(bytes: &[u8]) -> Option<&'static str> {
+ match bytes {
+ [0x89, b'P', b'N', b'G', 0x0d, 0x0a, 0x1a, 0x0a, ..] => Some("image/png"),
+ [0xff, 0xd8, 0xff, ..] => Some("image/jpeg"),
+ [b'G', b'I', b'F', b'8', b'7' | b'9', b'a', ..] => Some("image/gif"),
+ [b'R', b'I', b'F', b'F', _, _, _, _, b'W', b'E', b'B', b'P', ..] => Some("image/webp"),
+ [b'B', b'M', ..] => Some("image/bmp"),
+ [0, 0, 1, 0, ..] => Some("image/x-icon"),
+ _ => None,
+ }
+}
+
+fn base64(bytes: &[u8]) -> String {
+ const ALPHABET: &[u8; 64] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ let mut out = String::with_capacity(bytes.len().div_ceil(3) * 4);
+ for chunk in bytes.chunks(3) {
+ let n = u32::from(chunk[0]) << 16 | u32::from(*chunk.get(1).unwrap_or(&0)) << 8 | u32::from(*chunk.get(2).unwrap_or(&0));
+ for i in 0..4 {
+ out.push(if i <= chunk.len() { ALPHABET[(n >> (18 - 6 * i) & 63) as usize] as char } else { '=' });
+ }
+ }
+ out
+}
+
+/// A picture for the built-in viewer. Only read, never changed; anything that is not one is refused.
+pub fn read_image(path: &Path) -> HostResult {
+ let meta = regular_file(path)?;
+ if meta.len() > IMAGE_MAX {
+ return err("too-large", "This image is too large to show here (16 MB at most). Open its folder to see it in another program.");
+ }
+ let bytes = fs::read(path).or_else(|e| err("io", e.to_string()))?;
+ let Some(mime) = image_mime(&bytes) else { return err("not-image", "This is not an image the Manager can show.") };
+ Ok(ImageFile { data_url: format!("data:{mime};base64,{}", base64(&bytes)), size_bytes: bytes.len() as u64 })
+}
+
+#[tauri::command]
+pub async fn workspace_read_image(workspace: String, area: String, path: String) -> HostResult {
+ tauri::async_runtime::spawn_blocking(move || read_image(&checked_path(&game_dir(&workspace)?, &area, &path)?))
+ .await
+ .unwrap_or_else(|e| err("internal", e.to_string()))
+}
+
#[derive(Serialize, Debug, Default, PartialEq)]
pub struct AddedFiles {
added: Vec,
@@ -433,6 +486,33 @@ mod tests {
fs::remove_dir_all(&game).unwrap();
}
+ #[test]
+ fn the_viewer_shows_pictures_and_refuses_everything_else() {
+ let game = scratch("image");
+ let config = game.join("config");
+ fs::create_dir_all(config.join("sub")).unwrap();
+ let png = [0x89, b'P', b'N', b'G', 0x0d, 0x0a, 0x1a, 0x0a, 1, 2];
+ fs::write(config.join("icon.png"), png).unwrap();
+ let shown = read_image(&config.join("icon.png")).unwrap();
+ assert_eq!(shown.data_url, "data:image/png;base64,iVBORw0KGgoBAg==");
+ assert_eq!(shown.size_bytes, 10);
+ // The first bytes decide, not the name: a script renamed to .png is not handed to the page as a picture.
+ fs::write(config.join("fake.png"), "