Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/EdgeApps.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Here's a content section for the document:
- [Icon](#icon)
- [Author](#author)
- [Homepage URL](#homepage-url)
- [Categories](#categories)
- [Auth](#auth)
- [Ready Signal](#ready-signal)
- [Settings](#settings)
Expand Down Expand Up @@ -206,6 +207,9 @@ description: 'Displays the current weather and time'
icon: 'https://example.com/some-logo.svg'
author: 'Screenly, Inc'
homepage_url: 'https://www.screenly.io'
categories:
- Utilities
- Dashboards
settings:
google_maps_api_key:
type: secret
Expand Down Expand Up @@ -263,6 +267,10 @@ The `author` field specifies the name of the Edge App's creator.

The `homepage_url` field is a URL directing to the homepage of the Edge App.

#### Categories

The `categories` field is an optional list of category names that classify the Edge App (e.g., `Utilities`, `Dashboards`). When omitted, defaults to an empty list.

#### Auth

The `auth` field is optional and is used to configure Edge App authentication. It includes the following subfields:
Expand Down
4 changes: 3 additions & 1 deletion src/api/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct EdgeAppVersion {
#[serde(default)]
pub homepage_url: Option<String>,
#[serde(default)]
pub categories: Vec<String>,
#[serde(default)]
pub ready_signal: bool,
#[serde(default)]
pub revision: u32,
Expand All @@ -30,7 +32,7 @@ impl Api {
let response = commands::get(
&self.authentication,
&format!(
"v4.1/edge-apps/versions?select=user_version,description,icon,author,homepage_url,revision,ready_signal&app_id=eq.{app_id}&order=revision.desc&limit=1"
"v4.1/edge-apps/versions?select=user_version,description,icon,author,homepage_url,categories,revision,ready_signal&app_id=eq.{app_id}&order=revision.desc&limit=1"
),
)?;

Expand Down
16 changes: 12 additions & 4 deletions src/commands/edge_app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ impl EdgeAppCommand {
icon: manifest.icon.clone(),
author: manifest.author.clone(),
homepage_url: manifest.homepage_url.clone(),
categories: manifest.categories.clone(),
revision: _version.revision,
}),
None => Ok(false),
Expand Down Expand Up @@ -901,7 +902,7 @@ mod tests {
)
.query_param(
"select",
"user_version,description,icon,author,homepage_url,revision,ready_signal",
"user_version,description,icon,author,homepage_url,categories,revision,ready_signal",
)
.query_param("app_id", "eq.01H2QZ6Z8WXWNDC0KQ198XCZEW")
.query_param("order", "revision.desc")
Expand All @@ -913,6 +914,7 @@ mod tests {
"icon": "icon",
"author": "author",
"homepage_url": "homepage_url",
"categories": [],
"ready_signal": false,
"revision": 7,
}
Expand Down Expand Up @@ -994,6 +996,7 @@ mod tests {
"description": "asdf",
"icon": "asdf",
"homepage_url": "asdfasdf",
"categories": ["Utilities", "Dashboards"],
"file_tree": {
"index.html": "0a209f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08122086cebd0c365d241e32d5b0972c07aae3a8d6499c2a9471aa85943a35577200021a180a14a94a8fe5ccb19ba61c4c0873d391e987982fbbd31000"
},
Expand Down Expand Up @@ -1226,7 +1229,7 @@ mod tests {
)
.query_param(
"select",
"user_version,description,icon,author,homepage_url,revision,ready_signal",
"user_version,description,icon,author,homepage_url,categories,revision,ready_signal",
)
.query_param("app_id", "eq.01H2QZ6Z8WXWNDC0KQ198XCZEW")
.query_param("order", "revision.desc")
Expand All @@ -1238,6 +1241,7 @@ mod tests {
"icon": "asdf",
"author": "asdf",
"homepage_url": "asdfasdf",
"categories": ["Utilities", "Dashboards"],
"ready_signal": false,
"revision": 1
}
Expand Down Expand Up @@ -1293,7 +1297,7 @@ mod tests {
)
.query_param(
"select",
"user_version,description,icon,author,homepage_url,revision,ready_signal",
"user_version,description,icon,author,homepage_url,categories,revision,ready_signal",
)
.query_param("app_id", "eq.01H2QZ6Z8WXWNDC0KQ198XCZEW")
.query_param("order", "revision.desc")
Expand All @@ -1305,6 +1309,7 @@ mod tests {
"icon": "another_icon",
"author": "asdf",
"homepage_url": "asdfasdf",
"categories": [],
"ready_signal": false,
"revision": 1,
}
Expand Down Expand Up @@ -1360,7 +1365,7 @@ mod tests {
)
.query_param(
"select",
"user_version,description,icon,author,homepage_url,revision,ready_signal",
"user_version,description,icon,author,homepage_url,categories,revision,ready_signal",
)
.query_param("app_id", "eq.01H2QZ6Z8WXWNDC0KQ198XCZEW")
.query_param("order", "revision.desc")
Expand Down Expand Up @@ -1514,6 +1519,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down Expand Up @@ -1585,6 +1591,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec![],
entrypoint: None,
settings: vec![
Setting {
Expand Down Expand Up @@ -1700,6 +1707,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec![],
entrypoint: None,
settings: vec![
Setting {
Expand Down
25 changes: 25 additions & 0 deletions src/commands/edge_app/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub struct EdgeAppManifest {
)]
pub homepage_url: Option<String>,

#[serde(skip_serializing_if = "Vec::is_empty", default)]
pub categories: Vec<String>,

#[serde(
deserialize_with = "deserialize_entrypoint",
skip_serializing_if = "Option::is_none",
Expand Down Expand Up @@ -297,6 +300,8 @@ impl EdgeAppManifest {
json!(manifest.ready_signal.unwrap_or(false)),
);

payload.insert("categories", json!(manifest.categories));

payload
}

Expand Down Expand Up @@ -340,6 +345,7 @@ mod tests {
icon: Some("test_icon".to_string()),
author: Some("test_author".to_string()),
homepage_url: Some("test_url".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down Expand Up @@ -398,6 +404,9 @@ description: test_description
icon: test_icon
author: test_author
homepage_url: test_url
categories:
- Utilities
- Dashboards
entrypoint:
type: file
ready_signal: true
Expand Down Expand Up @@ -432,6 +441,9 @@ id: test_app
user_version: test_version
icon: test_icon
homepage_url: test_url
categories:
- Utilities
- Dashboards
entrypoint:
type: file
settings:
Expand Down Expand Up @@ -464,6 +476,9 @@ id: test_app
user_version: test_version
icon: test_icon
homepage_url: test_url
categories:
- Utilities
- Dashboards
entrypoint:
type: file
ready_signal: true
Expand Down Expand Up @@ -665,6 +680,7 @@ settings:
icon: None,
author: Some("test_author".to_string()),
homepage_url: None,
categories: vec![],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down Expand Up @@ -894,6 +910,7 @@ settings:
icon: Some("test_icon".to_string()),
author: Some("test_author".to_string()),
homepage_url: Some("test_url".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down Expand Up @@ -921,6 +938,9 @@ description: test_description
icon: test_icon
author: test_author
homepage_url: test_url
categories:
- Utilities
- Dashboards
entrypoint:
type: file
settings:
Expand Down Expand Up @@ -948,6 +968,7 @@ settings:
icon: Some("test_icon".to_string()),
author: Some("test_author".to_string()),
homepage_url: Some("test_url".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: Some("entrypoint.html".to_string()),
Expand All @@ -969,6 +990,7 @@ settings:
assert_eq!(result["icon"], json!("test_icon"));
assert_eq!(result["author"], json!("test_author"));
assert_eq!(result["homepage_url"], json!("test_url"));
assert_eq!(result["categories"], json!(["Utilities", "Dashboards"]));
assert_eq!(result["entrypoint"], json!("entrypoint.html"));
assert_eq!(result["ready_signal"], json!(false)); // Added assertion for ready_signal
}
Expand All @@ -992,6 +1014,7 @@ settings:
assert_eq!(result["icon"], json!("test_icon"));
assert!(!result.contains_key("author"));
assert_eq!(result["homepage_url"], json!("test_url"));
assert_eq!(result["categories"], json!([]));
assert!(!result.contains_key("entrypoint"));
assert_eq!(result["ready_signal"], json!(false)); // Added assertion for ready_signal
}
Expand All @@ -1006,6 +1029,7 @@ settings:
icon: Some("test_icon".to_string()),
author: Some("test_author".to_string()),
homepage_url: Some("test_url".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: Some("entrypoint.html".to_string()),
Expand All @@ -1019,6 +1043,7 @@ settings:
assert_eq!(result["icon"], json!("test_icon"));
assert_eq!(result["author"], json!("test_author"));
assert_eq!(result["homepage_url"], json!("test_url"));
assert_eq!(result["categories"], json!(["Utilities", "Dashboards"]));
assert_eq!(result["entrypoint"], json!("entrypoint.html"));
assert_eq!(result["ready_signal"], json!(true)); // Assert ready_signal is true
}
Expand Down
1 change: 1 addition & 0 deletions src/commands/edge_app/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down
5 changes: 5 additions & 0 deletions src/commands/edge_app/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: Some("entrypoint.html".to_string()),
Expand Down Expand Up @@ -569,6 +570,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: Some("entrypoint.html".to_string()),
Expand Down Expand Up @@ -1180,6 +1182,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::File,
uri: None,
Expand Down Expand Up @@ -1221,6 +1224,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::RemoteLocal,
uri: None,
Expand Down Expand Up @@ -1253,6 +1257,7 @@ mod tests {
icon: Some("asdf".to_string()),
author: Some("asdf".to_string()),
homepage_url: Some("asdfasdf".to_string()),
categories: vec!["Utilities".to_string(), "Dashboards".to_string()],
entrypoint: Some(Entrypoint {
entrypoint_type: EntrypointType::RemoteLocal,
uri: None,
Expand Down
Loading