Skip to content

fix(appstore): load packages without GITHUB_TOKEN and tolerate optional manifest fields - #180

Merged
dailker merged 1 commit into
codehubbers:mainfrom
jeffersongoncalves:fix/appstore-optional-token
Dec 4, 2026
Merged

dailker merged 1 commit into
codehubbers:mainfrom
jeffersongoncalves:fix/appstore-optional-token

Conversation

@jeffersongoncalves

Copy link
Copy Markdown
Contributor

Closes #177

What and why

Without GITHUB_TOKEN (it's optional in .env.example) the App Store sent Authorization: token undefined and GitHub answered 401, so local setups saw no packages. And a package that only has the fields orbit.schema.json requires (id, name, version, entry) crashed the store and the icons.

  • api/packages/approved.js: the Authorization header is only sent when GITHUB_TOKEN is set; ORBIT_PACKAGES_REPO defaults to codehubbers/OrbitOSPackages; the package id is manifest.id, falling back to the folder name.
  • apps/appstore.js: search no longer calls .toLowerCase() on a missing description/author; empty categories are left out of the category list (this one crashed the whole store with category.charAt on undefined, which the issue didn't list); empty category/author badges and the "by" line are hidden; opening an app without an icon passes the 📱 fallback.
  • Taskbar.js / AppIcon.js: same guard as the launcher, typeof icon === 'string' && icon.startsWith('/'), with 📱 when there's no icon.

One thing to be aware of: the example package's id changes from example-app (folder name) to orbit-terminal (its manifest.id), so anyone who installed it under the old id would see it as not installed and need to install it again.

How I tested it

New tests, each failing on main and passing here:

  • tests/approvedPackages.api.test.js: no Authorization header and the default repo when GITHUB_TOKEN is unset; the token and custom repo when set; manifest.id kept. On main: Received string: "https://api.github.com/repos/undefined/contents" and Expected: "orbit-terminal", Received: "example-app".
  • tests/AppStore.test.js: renders and searches a package without description, author, category or icon. On main: TypeError: Cannot read properties of undefined (reading 'charAt').
  • tests/Taskbar.hydration.test.js: an open app without an icon renders the fallback. On main: Cannot read properties of undefined (reading 'startsWith').

Locally: npm test (37 suites, 423 tests) passes, npm run lint has 0 errors (only warnings that were already there), npx prettier --check passes on the changed files, and npm run build succeeds.

Checklist

  • I read CONTRIBUTING.md
  • Commits follow type(scope): summary, for example fix(calculator): keep history after reload
  • Tests added or updated, and npm test passes
  • npx prettier --check passes on the files I changed
  • CI is green

…al manifest fields

Only send the Authorization header when GITHUB_TOKEN is set, default
ORBIT_PACKAGES_REPO to codehubbers/OrbitOSPackages and keep manifest.id
instead of the folder name. Guard the optional description, author,
category and icon fields in the App Store, Taskbar and desktop icons.

Closes codehubbers#177

@Ziqian-Huang0607 Ziqian-Huang0607 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid fix, verified against the schema and the code.

What I checked:

  • orbit.schema.json really does require only id, name, version and entry, so a minimal package crashing the store (category.charAt on undefined) was a real break, not a corner case.
  • approved.js: no more 'Authorization: token undefined' (which GitHub 401s), the default repo fallback matches what the README now documents, and manifest.id with folder-name fallback is the right precedence.
  • The icon guards in Taskbar and AppIcon match the pattern the launcher already uses, with the same fallback emoji.
  • The new tests are honest: each one fails on main for the stated reason and passes here, including the API test asserting no Authorization header when GITHUB_TOKEN is unset.
  • CI green, prettier and lint clean.

Thanks for flagging the id change (folder name to manifest.id) explicitly. Existing installs of the example package showing as not installed is acceptable breakage for a dev-stage store, and it is called out clearly for anyone who hits it.

Approve.

@dailker dailker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks. Defaulting the repo and only sending the header when the token is set is the right fix, and catching the category.charAt crash was a nice extra. Noted the example package id change to orbit-terminal, that's fine.

@dailker
dailker merged commit dd21d29 into codehubbers:main Dec 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 App Store returns 401 when GITHUB_TOKEN is unset and crashes on optional manifest fields

3 participants