diff --git a/src/components/AppIcon.js b/src/components/AppIcon.js
index d6dd74e..ca24c3e 100644
--- a/src/components/AppIcon.js
+++ b/src/components/AppIcon.js
@@ -113,7 +113,8 @@ export default function AppIcon({ app, cell, grid, onMove }) {
const isInvalidArea = drag !== null && drag.target === null;
const shown = drag ? { x: drag.x, y: drag.y } : home;
- const isImagePath = app.icon.startsWith('/');
+ // icon is optional for store packages (orbit.schema.json).
+ const isImagePath = typeof app.icon === 'string' && app.icon.startsWith('/');
return (
<>
@@ -213,7 +214,7 @@ export default function AppIcon({ app, cell, grid, onMove }) {
/>
) : (
- {app.icon}
+ {app.icon || '📱'}
)}
{/* Shortcut indicator */}
diff --git a/src/components/Taskbar.js b/src/components/Taskbar.js
index 426bafd..8514b5b 100644
--- a/src/components/Taskbar.js
+++ b/src/components/Taskbar.js
@@ -20,12 +20,13 @@ const separatorStyle = 'w-px h-8 bg-white/20';
* A helper component to display either a PNG icon or an emoji.
*/
const IconDisplay = ({ icon, alt, className }) => {
- const isImagePath = icon.startsWith('/');
+ // icon is optional for store packages (orbit.schema.json).
+ const isImagePath = typeof icon === 'string' && icon.startsWith('/');
return isImagePath ? (
) : (
- {icon}
+ {icon || '📱'}
);
};
diff --git a/src/pages/api/packages/approved.js b/src/pages/api/packages/approved.js
index 04faafb..970dde1 100644
--- a/src/pages/api/packages/approved.js
+++ b/src/pages/api/packages/approved.js
@@ -1,20 +1,30 @@
// src/pages/api/packages/approved.js
+const DEFAULT_PACKAGES_REPO = 'codehubbers/OrbitOSPackages';
+
+// GITHUB_TOKEN is optional (.env.example): without it the public repo is read
+// unauthenticated. Sending "token undefined" makes GitHub answer 401.
+function githubHeaders() {
+ const headers = { Accept: 'application/vnd.github.v3+json' };
+ if (process.env.GITHUB_TOKEN) {
+ headers.Authorization = `token ${process.env.GITHUB_TOKEN}`;
+ }
+ return headers;
+}
+
export default async function handler(req, res) {
if (req.method !== 'GET') {
return res.status(405).json({ error: 'Method not allowed' });
}
+ const repo = process.env.ORBIT_PACKAGES_REPO || DEFAULT_PACKAGES_REPO;
+ const headers = githubHeaders();
+
try {
- console.log('Fetching from repo:', process.env.ORBIT_PACKAGES_REPO);
+ console.log('Fetching from repo:', repo);
const response = await fetch(
- `https://api.github.com/repos/${process.env.ORBIT_PACKAGES_REPO}/contents`,
- {
- headers: {
- Authorization: `token ${process.env.GITHUB_TOKEN}`,
- Accept: 'application/vnd.github.v3+json',
- },
- },
+ `https://api.github.com/repos/${repo}/contents`,
+ { headers },
);
if (!response.ok) {
@@ -38,13 +48,8 @@ export default async function handler(req, res) {
console.log(`Processing folder: ${folder.name}`);
// Get orbit.lock.json
const lockResponse = await fetch(
- `https://api.github.com/repos/${process.env.ORBIT_PACKAGES_REPO}/contents/${folder.name}/orbit.lock.json`,
- {
- headers: {
- Authorization: `token ${process.env.GITHUB_TOKEN}`,
- Accept: 'application/vnd.github.v3+json',
- },
- },
+ `https://api.github.com/repos/${repo}/contents/${folder.name}/orbit.lock.json`,
+ { headers },
);
if (lockResponse.ok) {
@@ -56,7 +61,7 @@ export default async function handler(req, res) {
if (lockData.signature === 'orbit-signed') {
packages.push({
- id: folder.name,
+ id: lockData.manifest?.id || folder.name,
manifest: lockData.manifest,
signature: lockData.signature,
downloadUrl: lockData.downloadUrl,
diff --git a/src/pages/apps/appstore.js b/src/pages/apps/appstore.js
index 1cbfcb1..32519a6 100644
--- a/src/pages/apps/appstore.js
+++ b/src/pages/apps/appstore.js
@@ -29,12 +29,16 @@ const AppCard = ({
v{app.manifest.version}
-
- {app.manifest.category}
-
-
- {app.manifest.author}
-
+ {app.manifest.category && (
+
+ {app.manifest.category}
+
+ )}
+ {app.manifest.author && (
+
+ {app.manifest.author}
+
+ )}
@@ -110,7 +114,9 @@ const AppModal = ({
{app.manifest.icon || '📱'}
{app.manifest.name}
-
by {app.manifest.author}
+ {app.manifest.author && (
+
by {app.manifest.author}
+ )}