Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nmattia committed Nov 30, 2023
1 parent 6fe5ba3 commit 69cc9f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,9 @@ jobs:
- uses: ./.github/actions/setup-node
- name: "Build test app canister"
working-directory: demos/test-app
run: ./build.sh
run: |
npm ci
./build.sh
- name: 'Upload test app'
uses: actions/upload-artifact@v3
with:
Expand Down
14 changes: 13 additions & 1 deletion demos/test-app/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum ContentType {
HTML,
JS,
JSON,
CSS,
}

impl ContentType {
Expand All @@ -32,6 +33,7 @@ impl ContentType {
ContentType::HTML => "text/html".to_string(),
ContentType::JS => "text/javascript".to_string(),
ContentType::JSON => "application/json".to_string(),
ContentType::CSS => "text/css".to_string(),
}
}
}
Expand Down Expand Up @@ -227,16 +229,26 @@ lazy_static! {

// Get all the assets. Duplicated assets like index.html are shared and generally all assets are
// prepared only once (like injecting the canister ID).
fn get_assets() -> [(&'static str, &'static [u8], ContentType); 5] {
fn get_assets() -> [(&'static str, &'static [u8], ContentType); 7] {
let index_html: &[u8] = INDEX_HTML_STR.as_bytes();
[
("/", index_html, ContentType::HTML),
("/index.html", index_html, ContentType::HTML),
(
"/index.css",
include_bytes!("dist/index.css"),
ContentType::CSS,
),
(
"/index.js",
include_bytes!("dist/index.js"),
ContentType::JS,
),
(
"/index2.js",
include_bytes!("dist/index2.js"),
ContentType::JS,
),
// initially empty alternative origins, but can be populated using the update_alternative_origins call
(
"/.well-known/ii-alternative-origins",
Expand Down

0 comments on commit 69cc9f0

Please sign in to comment.