diff --git a/.gitignore b/.gitignore index c19f64f3..a7a8d5e8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ output/ notes.txt trash/ + +appstore_backend/bundled_apps/ diff --git a/appstore_backend/apps.json b/appstore_backend/apps.json index 958277d9..2b6c104b 100644 --- a/appstore_backend/apps.json +++ b/appstore_backend/apps.json @@ -1,4 +1,34 @@ [ + { + "name": "Camera Tester", + "publisher": "ACME Inc", + "short_description": "Simple test of the camera", + "long_description": "A simple test of the camera makes it possible to validate the hardware.", + "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.1.mpk_icon_64x64.png", + "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.camtest_0.0.1.mpk", + "fullname": "com.example.camtest", + "version": "0.0.1" + }, + { + "name": "IMU Tester", + "publisher": "ACME Inc", + "short_description": "Testing the Inertial Measurement Unit", + "long_description": "It is always good to make sure the accelerometer is working properly. How else can you measure acceleration and position?", + "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk_icon_64x64.png", + "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.imutest_0.0.1.mpk", + "fullname": "com.example.imutest", + "version": "0.0.1" + }, + { + "name": "Animation Tester", + "publisher": "ACME Inc", + "short_description": "Testing on-display animations", + "long_description": "Stress testing multiple concurrent animations on the display by adding more and more spinners", + "icon_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk_icon_64x64.png", + "download_url": "http://demo.lnpiggy.com:2121/apps/com.example.lvgltest_0.0.1.mpk", + "fullname": "com.example.imutest", + "version": "0.0.1" + }, { "name": "Weather Pro", "publisher": "SkyTech", @@ -10,23 +40,23 @@ "version": "0.0.1" }, { - "name": "Task Manager", + "name": "Task Manager (broken download link)", "publisher": "Productivity Inc.", "short_description": "Organize your tasks", "long_description": "Task Manager helps you stay organized with customizable to-do lists, reminders, and progress tracking for personal and team projects.", "icon_url": "http://demo.lnpiggy.com:2121/icons/task_manager.png", - "download_url": "http://demo.lnpiggy.com:2121/zips/com.example.app2_0.0.1.zip", - "fullname": "com_example_app2", + "download_url": "httpppp://completelybrokendownloadlink", + "fullname": "com.productivityinc.taskmanager", "version": "0.0.1" }, { - "name": "Fitness Tracker", + "name": "Fitness Tracker (broken icon)", "publisher": "HealthCo", "short_description": "Track your workouts", "long_description": "Fitness Tracker monitors your daily activities, workouts, and sleep patterns, offering personalized insights to help you achieve your fitness goals.", - "icon_url": "http://demo.lnpiggy.com:2121/icons/fitness_tracker.png", + "icon_url": "httppp://completelybrokeniconurl", "download_url": "http://demo.lnpiggy.com:2121/zips/com.example.imutest_0.0.1.zip", - "fullname": "com_example_imutest", + "fullname": "com.healthco.fitnesstracker", "version": "0.0.1" } ] diff --git a/appstore_backend/bundleapps.sh b/appstore_backend/bundleapps.sh deleted file mode 100755 index d202daf5..00000000 --- a/appstore_backend/bundleapps.sh +++ /dev/null @@ -1,6 +0,0 @@ -ls -1 internal_filesystem/apps | while read appdir; do - echo "$appdir" - pushd internal_filesystem/apps/"$appdir" - zip -r0 ../../../bundled_apps/"$appdir"_0.0.1.zip . - popd -done diff --git a/internal_filesystem/apps/com.example.lvgltest/res/mipmap-mdpi/icon_64x64.png b/internal_filesystem/apps/com.example.lvgltest/res/mipmap-mdpi/icon_64x64.png new file mode 100644 index 00000000..a17fe3a4 Binary files /dev/null and b/internal_filesystem/apps/com.example.lvgltest/res/mipmap-mdpi/icon_64x64.png differ diff --git a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py index 6121d0c7..174ed815 100644 --- a/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py +++ b/internal_filesystem/builtin/apps/com.example.appstore/assets/appstore.py @@ -94,8 +94,8 @@ def download_and_unzip(zip_url, dest_folder, label): progress_bar.set_value(20, lv.ANIM.ON) time.sleep_ms(500) try: - # Step 1: Download the .zip file - print(f"Downloading .zip file from: {zip_url}") + # Step 1: Download the .mpk file + print(f"Downloading .mpk file from: {zip_url}") response = urequests.get(zip_url, timeout=10) if response.status_code != 200: print("Download failed: Status code", response.status_code) @@ -103,7 +103,7 @@ def download_and_unzip(zip_url, dest_folder, label): label.set_text(action_label_install) progress_bar.set_value(40, lv.ANIM.ON) time.sleep_ms(500) - # Save the .zip file to a temporary location + # Save the .mpk file to a temporary location try: os.remove(temp_zip_path) except Exception: @@ -112,15 +112,15 @@ def download_and_unzip(zip_url, dest_folder, label): os.mkdir("/tmp") except Exception: pass - temp_zip_path = "/tmp/temp.zip" - print(f"Writing to temporary zip path: {temp_zip_path}") + temp_zip_path = "/tmp/temp.mpk" + print(f"Writing to temporary mpk path: {temp_zip_path}") # TODO: check free available space first! with open(temp_zip_path, "wb") as f: f.write(response.content) progress_bar.set_value(60, lv.ANIM.ON) time.sleep_ms(500) response.close() - print("Downloaded .zip file, size:", os.stat(temp_zip_path)[6], "bytes") + print("Downloaded .mpk file, size:", os.stat(temp_zip_path)[6], "bytes") # Step 2: Unzip the file if zipfile is None: print("WARNING: zipfile module not available in this MicroPython build, unzip will fail!") @@ -132,7 +132,7 @@ def download_and_unzip(zip_url, dest_folder, label): print("Unzipped successfully") # Step 3: Clean up os.remove(temp_zip_path) - print("Removed temporary .zip file") + print("Removed temporary .mpk file") except Exception as e: print("Operation failed:", str(e)) finally: diff --git a/internal_filesystem/lib/shutil.mpy b/internal_filesystem/lib/shutil.mpy new file mode 100644 index 00000000..b87577e7 Binary files /dev/null and b/internal_filesystem/lib/shutil.mpy differ diff --git a/scripts/bundleapps.sh b/scripts/bundleapps.sh new file mode 100755 index 00000000..6f0e7142 --- /dev/null +++ b/scripts/bundleapps.sh @@ -0,0 +1,10 @@ +mkdir -p appstore_backend/bundled_apps +ls -1 internal_filesystem/apps | while read appdir; do + echo "Bundling $appdir" + pushd internal_filesystem/apps/"$appdir" + # TODO: get and append version from manifest instead of hardcoding: + mpkname="../../../appstore_backend/bundled_apps/"$appdir"_0.0.1.mpk" + zip -r0 "$mpkname" . + cp res/mipmap-mdpi/icon_64x64.png "$mpkname"_icon_64x64.png + popd +done