Skip to content

Commit 2a4636f

Browse files
committed
0.5.0
1 parent bf17e6c commit 2a4636f

File tree

6 files changed

+50
-14
lines changed

6 files changed

+50
-14
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "ahqstore_cli_rs"
4-
version = "0.4.3"
4+
version = "0.5.0"
55
description = "AHQ Store CLI"
66
repository = "https://github.com/ahqstore/cli"
77
homepage = "https://github.com/ahqstore/cli"
@@ -32,7 +32,7 @@ chalk_rs = "1"
3232
lazy_static = "1"
3333
serde = { version = "1", features = ["derive"] }
3434
serde_json = "1"
35-
ahqstore-types = "2.3.0"
35+
ahqstore-types = "3.1.0"
3636
reqwest = { version = "0.12", features = ["json", "blocking"] }
3737
sha2 = "0.10"
3838
base64 = "0.22"
@@ -43,7 +43,7 @@ image = { version = "0.25", default-features = false, features = [
4343
rand = "0.8"
4444

4545
[target.'cfg(unix)'.dependencies]
46-
openssl-sys = { version = "0.9.102", features = ["vendored"] }
46+
openssl-sys = { version = "0.9.103", features = ["vendored"] }
4747

4848
[build-dependencies]
4949
napi-build = { version = "2", optional = true }

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# AHQ Store CLI
2+
3+
Read more about it [here](https://ahqstore.github.io)
4+
5+
# Changelog
6+
7+
## 0.5.0 **(I)** 23-Aug-2024 10:05PM IST
8+
9+
- Update to the new resources scheme (ahqstore-types v3.1.0)
10+
- Update Dependencies
11+
12+
## 0.4.x **(m)**
13+
14+
- Update to ahqstore-types 2.3.0
15+
16+
**NOTE:**
17+
18+
- **I** Internal Breaking Changes
19+
- **m** Minor Breaking / Minor Addition Changes
20+
- **B** Breaking Changes
21+
- **P** Patch Changes

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@ahqstore/cli",
3-
"version": "0.4.3",
3+
"version": "0.5.0",
4+
"readme": "./README.md",
45
"napi": {
56
"name": "cli",
67
"triples": {
@@ -16,7 +17,7 @@
1617
},
1718
"license": "MIT",
1819
"devDependencies": {
19-
"@napi-rs/cli": "^2.18.3"
20+
"@napi-rs/cli": "^2.18.4"
2021
},
2122
"ava": {
2223
"timeout": "3m"

src/app/build/icon.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use image::{load_from_memory_with_format as load_img, ImageFormat};
44
use std::fs;
55
use std::process;
66

7-
pub fn get_icon(uid: &str) -> String {
7+
pub fn get_icon(uid: &str) -> Vec<u8> {
88
let base_img = format!("./.ahqstore/images/{uid}/icon.png");
99

1010
let Ok(icon) = fs::read(&base_img) else {
@@ -14,10 +14,10 @@ pub fn get_icon(uid: &str) -> String {
1414

1515
validate_png(&icon);
1616

17-
STANDARD.encode(&icon)
17+
icon
1818
}
1919

20-
pub fn get_images(uid: &str) -> Vec<String> {
20+
pub fn get_images(uid: &str) -> Vec<Vec<u8>> {
2121
let base_img = format!("./.ahqstore/images/{uid}");
2222

2323
let Ok(image_dir) = fs::read_dir(&base_img) else {
@@ -31,7 +31,7 @@ pub fn get_images(uid: &str) -> Vec<String> {
3131
.map(|res| fs::read(res).expect("Unable to read bytes"))
3232
.map(|img| {
3333
validate_png(&img);
34-
return STANDARD.encode(&img);
34+
return img;
3535
})
3636
.collect::<Vec<_>>();
3737

src/app/build/macros.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ macro_rules! windowsPlatform {
4343
$num,
4444
DownloadUrl {
4545
installerType: platform,
46-
url: assets[0].browser_download_url.clone(),
46+
asset: assets[0].name.clone(),
47+
url: "".into(),
4748
},
4849
);
4950

@@ -83,7 +84,8 @@ macro_rules! linuxPlatform {
8384
$num,
8485
DownloadUrl {
8586
installerType: platform,
86-
url: assets[0].browser_download_url.clone(),
87+
asset: assets[0].name.clone(),
88+
url: "".into()
8789
},
8890
);
8991

src/app/build/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ lazy_static! {
3030

3131
#[derive(Debug, Deserialize, Serialize)]
3232
struct GHRelease {
33+
pub tag_name: String,
3334
pub upload_url: String,
3435
pub assets: Vec<GHAsset>,
3536
}
@@ -79,20 +80,30 @@ pub fn build_config(upload: bool, gh_action: bool) {
7980
let (version, gh_r) = fetch_release(&repo, &r_id, &gh_token);
8081

8182
let icon = get_icon(&config.appId);
83+
let dspl_images = get_images(&config.appId);
84+
85+
let mut resources = HashMap::new();
86+
resources.insert(0, icon);
87+
8288
#[allow(non_snake_case)]
83-
let displayImages = get_images(&config.appId);
89+
let displayImages = dspl_images.into_iter().enumerate().map(|(uid, icon)| {
90+
resources.insert(uid as u8 + 1u8, icon);
91+
92+
uid as u8
93+
}).collect();
8494

8595
let app_id = config.appId.clone();
8696

8797
let mut final_config: AHQStoreApplication = AHQStoreApplication {
98+
releaseTagName: gh_r.tag_name.clone(),
8899
appDisplayName: config.appDisplayName,
89100
appId: config.appId,
90101
appShortcutName: config.appShortcutName,
91102
authorId: config.authorId,
92103
description: config.description,
93104
downloadUrls: HashMap::default(),
94-
icon,
95105
displayImages,
106+
resources: Some(resources),
96107
app_page: config.source,
97108
license_or_tos: config.license_or_tos,
98109
install: InstallerOptions {
@@ -149,7 +160,8 @@ pub fn build_config(upload: bool, gh_action: bool) {
149160
num,
150161
DownloadUrl {
151162
installerType: platform,
152-
url: assets[0].browser_download_url.clone(),
163+
asset: assets[0].name.clone(),
164+
url: "".into()
153165
},
154166
);
155167

0 commit comments

Comments
 (0)