Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Store: app-center look (sectioned sidebar with category counts, toolbar with title/back/search, card grid with Get/Open/View, shelves, facts row), For this computer as its own page, and a featured banner published signed in LordOS's repository (apt/featured, main/featured/{Featured,Banner}, lord.pkg.featured()) with a skeleton while it is missing

Federico Pereirab042e9dfb560
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fce0030..3188537 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,24 @@ of the matching [GitHub release](https://github.com/lordbasex/LordOS/releases),
downloaded the model on first run and answered over its HTTP API on the CPU (about 33 tokens/s, no
Vulkan device); on VM 116, Cursor's and VS Code's sources added, Cursor installed (its own script
rewrote the same file), `apt update` and the Store's own update both clean, then removed.
+- **The Store's new look.** A sidebar in three groups (Store: Discover, For this computer, Installed,
+ Updates; Categories: Artificial Intelligence and Debian's ten categories, each with its count; LordOS
+ apps), the page's title, a back button and the search in a toolbar, and apps as cards in a grid
+ that fills the window: icon, name, category, two lines of summary, the download size and a Get,
+ Open or View button. Discover opens with a featured banner, then the AI shelf and a shelf per
+ category with "See all"; an app's page has a larger icon and a row of facts (version, size,
+ category, distribution). The hardware suggestions moved to their own page, For this computer,
+ which keeps the badge for new ones.
+- **A featured banner LordOS can change without a release.** Discover's banner comes from
+ `apt/featured/featured.json` and `apt/featured/banner.png` in the repository: `apt-repo.sh` checks
+ them (a schema 1 JSON object of at most 64 KB, a PNG of at most 2 MB) and publishes them signed with
+ the indexes (`main/featured/`), and the package engine takes them only from a source whose signed
+ Release says `Origin: LordOS`, checks their hashes, parses the JSON and the PNG signature, and keeps
+ them in `/var/lib/lordos/pkg/` (`lord.pkg.featured()`, read-only). The picture fills the banner
+ under a shade; while it isn't there yet the Store draws a skeleton of the banner (it pulses, unless
+ Reduce motion is on), and a system whose repository has no banner shows a catalog app instead.
+ Tested on VM 116 against lordos.org/apt-staging: the banner, its skeleton without the image, For
+ this computer, the categories and the cards.
- **Root over SSH, as an advanced option.** Settings → Sharing → Advanced lets an administrator allow
root to log in over SSH with a public key only, or with a key or a password, for tests and
administration: the keys are pasted or imported from a `.pub` file and listed with their
diff --git a/apps/store/ai.js b/apps/store/ai.js
index 0ea35f3..1995344 100644
--- a/apps/store/ai.js
+++ b/apps/store/ai.js
@@ -6,9 +6,10 @@
// verified sources (docs/UPDATES.md, "Mirrored apps (catalog)"). Installing goes through the package
// engine like any Debian package: the plan first, then pkg-install.
import { createElement as h, useState } from 'react';
-import { View, Text, Button, GroupBox, useTheme, useStore, useSystemInfo, admin, locale, typeScale, spacing, t } from '@lordos/sdk';
+import { View, Text, Image, Button, LetterIcon, useTheme, useStore, useSystemInfo, admin, locale, formatBytes, typeScale, spacing, t } from '@lordos/sdk';
import catalog from '../../apt/catalog.json';
import { debian } from './debian.js';
+import { Card, CardGrid, Featured, FeaturedSkeleton, Pill, Shelf, nameColor } from './ui.js';
const lang2 = () => (locale.get().lang || 'en').split('-')[0];
// the kernel's machine name as Debian names the architecture
@@ -17,25 +18,29 @@ const summary = (a) => (a.summary && (a.summary[lang2()] || a.summary.en)) || ''
const installed = (pkg) => { try { return !!(lord.pkg.info(pkg, {}) || {}).installed; } catch (e) { return false; } };
const offered = (pkg) => { try { return !!lord.pkg.info(pkg, {}); } catch (e) { return false; } };
-function Row({ a, onOpen, here }) {
- const th = useTheme();
- const fits = !here || !a.arches || a.arches.includes(here);
+// The icon of a catalog app: the package's own icon once it is in the lists, else its initial.
+function AiIcon({ a, size }) {
+ let icon = null;
+ try { icon = offered(a.package) ? lord.pkg.icon(a.package) : null; } catch (e) { icon = null; }
+ return icon ? h(Image, { src: icon, style: { width: size, height: size, objectFit: 'contain' } }) : h(LetterIcon, { size, name: a.name.replace(/\.[a-z]+$/i, '') });
+}
+
+const kindOf = (a) => t(`store.ai.kind.${a.kind}`);
+const sizeOf = (a) => { try { const i = lord.pkg.info(a.package, {}); return i && i.installedSize ? formatBytes(i.installedSize) : ''; } catch (e) { return ''; } };
+const fitsHere = (a, here) => !here || !a.arches || a.arches.includes(here);
+
+function AiCard({ a, here, onOpen }) {
+ const fits = fitsHere(a, here);
const inst = installed(a.package);
- return h(View, { onClick: () => fits && onOpen(a.package), style: { flexDirection: 'row', alignItems: 'center', gap: spacing.m, paddingVertical: spacing.s, opacity: fits ? 1 : 0.5 } },
- h(View, { style: { width: 40, height: 40, borderRadius: 10, backgroundColor: th.accent, alignItems: 'center', justifyContent: 'center' } },
- h(Text, { style: { fontSize: 18, fontWeight: 700, color: '#fff' } }, (a.name || '?').slice(0, 1))),
- h(View, { style: { flex: 1, minWidth: 0, gap: 2 } },
- h(Text, { style: { fontSize: typeScale.body, fontWeight: 600, color: th.text, textAlign: 'start' } }, a.name),
- h(Text, { style: { fontSize: typeScale.callout, color: th.textDim, textAlign: 'start' } }, summary(a)),
- h(Text, { style: { fontSize: typeScale.caption, color: th.textDim, textAlign: 'start' } },
- [t(`store.ai.kind.${a.kind}`), a.vendor, a.license, !fits ? t('store.ai.notForArch', { arch: here }) : null].filter(Boolean).join(' · '))),
- inst ? h(Text, { style: { fontSize: typeScale.caption, fontWeight: 500, color: '#30d158' } }, t('store.installedBadge'))
- : h(Button, { small: true, label: t('store.ai.view'), disabled: !fits, onClick: () => onOpen(a.package) }));
+ return h(Card, { icon: h(AiIcon, { a, size: 56 }), name: a.name, kind: `${kindOf(a)} · ${a.vendor || ''}`, summary: summary(a), dim: !fits,
+ note: !fits ? t('store.ai.notForArch', { arch: here }) : sizeOf(a),
+ action: fits ? h(Pill, { label: inst ? t('store.ai.view') : t('store.get'), onClick: () => onOpen(a.package) }) : null,
+ onClick: () => fits && onOpen(a.package) });
}
// An app from its maker's repository that isn't in the package lists yet: say whose repository is
// added, then add it and fetch the lists (both admin actions), and show the usual details.
-function AddSource({ a, onDone, onBack }) {
+function AddSource({ a, onDone }) {
const th = useTheme();
const [busy, setBusy] = useState(false);
const [err, setErr] = useState('');
@@ -45,7 +50,6 @@ function AddSource({ a, onDone, onBack }) {
admin.run('pkg-source-add', a.id).then(() => admin.run('pkg-update')).then(onDone, (e) => setErr(e.message)).finally(() => setBusy(false));
};
return h(View, { style: { gap: spacing.l, maxWidth: 640 } },
- h(Button, { plain: true, small: true, label: `‹ ${t('store.back')}`, onClick: onBack, style: { alignSelf: 'flex-start' } }),
h(Text, { style: { fontSize: typeScale.largeTitle, fontWeight: 600, color: th.text, textAlign: 'start' } }, a.name),
h(Text, { style: { fontSize: typeScale.body, color: th.text, lineHeight: 1.45, textAlign: 'start' } },
t('store.ai.sourceIntro', { name: a.name, vendor: a.vendor || '', url: (a.source && a.source.url) || '' })),
@@ -58,7 +62,7 @@ function AddSource({ a, onDone, onBack }) {
// A LordOS-built app that isn't in the package lists yet (they were fetched before the catalog had it):
// fetching them again (pkg-update) brings it, instead of the package page's "not found".
-function NotListed({ a, onDone, onBack }) {
+function NotListed({ a, onDone }) {
const th = useTheme();
const [busy, setBusy] = useState(false);
const [err, setErr] = useState('');
@@ -68,7 +72,6 @@ function NotListed({ a, onDone, onBack }) {
admin.run('pkg-update').then(onDone, (e) => setErr(e.message)).finally(() => setBusy(false));
};
return h(View, { style: { gap: spacing.l, maxWidth: 640 } },
- h(Button, { plain: true, small: true, label: `‹ ${t('store.back')}`, onClick: onBack, style: { alignSelf: 'flex-start' } }),
h(Text, { style: { fontSize: typeScale.largeTitle, fontWeight: 600, color: th.text, textAlign: 'start' } }, a.name),
h(Text, { style: { fontSize: typeScale.body, color: th.text, lineHeight: 1.45, textAlign: 'start' } }, t('store.ai.notListed', { name: a.name })),
err ? h(Text, { style: { fontSize: typeScale.caption, color: '#ff453a', textAlign: 'start' } }, err) : null,
@@ -76,33 +79,85 @@ function NotListed({ a, onDone, onBack }) {
h(Button, { primary: true, label: busy ? t('store.ai.updating') : t('store.ai.updateLists'), disabled: busy || !admin.available(), onClick: update })));
}
-export function AiPage({ query }) {
- const th = useTheme();
+const useHere = () => { const info = useSystemInfo(60000); return DEB_ARCH[info.arch] || info.arch || ''; };
+export const catalogApps = () => catalog.apps || [];
+export const catalogApp = (pkg) => (catalog.apps || []).find((x) => x.package === pkg);
+
+// A catalog app's page: add its maker's repository first, fetch the lists when LordOS's own package
+// isn't in them yet, else the usual package page.
+export function AiDetail({ pkg }) {
useStore(locale);
- const [open, setOpen] = useState(null);
- const info = useSystemInfo(60000);
- const here = DEB_ARCH[info.arch] || info.arch || '';
const [, setTick] = useState(0);
- if (open) {
- const a = (catalog.apps || []).find((x) => x.package === open);
- const direct = a && a.source && a.source.delivery === 'direct';
- if (direct && !offered(open)) return h(AddSource, { a, onBack: () => setOpen(null), onDone: () => setTick((x) => x + 1) });
- if (a && !direct && !offered(open)) return h(NotListed, { a, onBack: () => setOpen(null), onDone: () => setTick((x) => x + 1) });
- // removing an app from its maker's repository also removes that repository, unless another
- // installed catalog app uses the same one (Claude Code and Claude Desktop share a key, not a repo)
- const onRemoved = () => {
- if (!direct) return;
- const sameRepo = (catalog.apps || []).some((x) => x.id !== a.id && x.source && x.source.url === a.source.url && installed(x.package));
- if (!sameRepo) admin.run('pkg-source-remove', a.id).catch(() => {});
- };
- return h(debian.Details, { name: open, onBack: () => setOpen(null), onRemoved });
- }
+ const a = catalogApp(pkg);
+ const direct = a && a.source && a.source.delivery === 'direct';
+ if (direct && !offered(pkg)) return h(AddSource, { a, onDone: () => setTick((x) => x + 1) });
+ if (a && !direct && !offered(pkg)) return h(NotListed, { a, onDone: () => setTick((x) => x + 1) });
+ // removing an app from its maker's repository also removes that repository, unless another
+ // installed catalog app uses the same one (Claude Code and Claude Desktop share a key, not a repo)
+ const onRemoved = () => {
+ if (!direct) return;
+ const sameRepo = (catalog.apps || []).some((x) => x.id !== a.id && x.source && x.source.url === a.source.url && installed(x.package));
+ if (!sameRepo) admin.run('pkg-source-remove', a.id).catch(() => {});
+ };
+ return h(debian.Details, { name: pkg, onRemoved });
+}
+
+// The Artificial Intelligence page: the catalog as cards (the search narrows it).
+export function AiPage({ query, onOpen }) {
+ const th = useTheme();
+ useStore(locale);
+ const here = useHere();
const q = (query || '').trim().toLowerCase();
const apps = (catalog.apps || []).filter((a) => !q || `${a.name} ${summary(a)} ${a.vendor || ''}`.toLowerCase().includes(q));
const missing = apps.some((a) => !offered(a.package) && !(a.source && a.source.delivery === 'direct'));
return h(View, { style: { gap: spacing.l } },
- h(Text, { style: { fontSize: typeScale.largeTitle, fontWeight: 600, color: th.text, textAlign: 'start' } }, t('store.ai.title')),
- h(Text, { style: { fontSize: typeScale.body, color: th.textDim, lineHeight: 1.45, maxWidth: 640, textAlign: 'start' } }, t('store.ai.intro')),
+ h(Text, { style: { fontSize: typeScale.body, color: th.textDim, lineHeight: 1.45, maxWidth: 680, textAlign: 'start' } }, t('store.ai.intro')),
missing ? h(Text, { style: { fontSize: typeScale.caption, color: '#ff9f0a', textAlign: 'start' } }, t('store.ai.refresh')) : null,
- h(GroupBox, null, ...apps.map((a) => h(Row, { key: a.id, a, here, onOpen: setOpen }))));
+ h(debian.Progress),
+ h(CardGrid, null, ...apps.map((a) => h(AiCard, { key: a.id, a, here, onOpen }))));
+}
+
+// The banner LordOS publishes in its repository (apt/featured/featured.json and banner.png, signed with
+// the indexes and verified by the package engine; lord.pkg.featured()), or null.
+function published() {
+ try { return typeof lord.pkg.featured === 'function' ? lord.pkg.featured() : null; } catch (e) { return null; }
+}
+const loc = (v) => (v && typeof v === 'object' ? v[lang2()] || v.en || '' : typeof v === 'string' ? v : '');
+
+// For Discover: the banner, always (the published one; without package lists yet its skeleton;
+// without a published one, a catalog app not installed here, a different one each day), then the AI
+// shelf.
+export function AiDiscover({ onOpen, onOpenDeb, onMore }) {
+ useStore(locale);
+ const here = useHere();
+ const apps = (catalog.apps || []).filter((a) => fitsHere(a, here));
+ const fresh = apps.filter((a) => !installed(a.package));
+ const pool = fresh.length ? fresh : apps;
+ let ready = false;
+ try { ready = lord.pkg.available(); } catch (e) { ready = false; }
+ const pub = ready ? published() : null;
+ let banner;
+ if (pub && pub.data) {
+ const d = pub.data;
+ const a = d.catalog ? (catalog.apps || []).find((x) => x.id === d.catalog) : null;
+ const pkg = a ? a.package : typeof d.package === 'string' ? d.package : null;
+ const open = () => pkg && (a ? onOpen(pkg) : onOpenDeb(pkg));
+ const colors = Array.isArray(d.colors) && d.colors.every((c) => /^#[0-9a-f]{6}$/i.test(c)) ? d.colors : null;
+ banner = pub.image || !ready
+ ? h(Featured, { image: pub.image, colors, kicker: loc(d.kicker), title: loc(d.title) || (a && a.name) || pkg || '', text: loc(d.text) || (a ? summary(a) : ''),
+ action: pkg ? h(Pill, { big: true, onDark: true, label: installed(pkg) ? t('store.ai.view') : t('store.get'), onClick: open }) : null, onClick: open })
+ : h(FeaturedSkeleton);
+ } else if (!ready) {
+ banner = h(FeaturedSkeleton);
+ } else if (pool.length) {
+ const f = pool[Math.floor(Date.now() / 86400000) % pool.length];
+ banner = h(Featured, { icon: h(AiIcon, { a: f, size: 96 }), glow: nameColor(f.name.replace(/\.[a-z]+$/i, '')),
+ kicker: t('store.featured', { category: t('store.page.ai') }), title: f.name, text: summary(f),
+ action: h(Pill, { big: true, onDark: true, label: installed(f.package) ? t('store.ai.view') : t('store.get'), onClick: () => onOpen(f.package) }),
+ onClick: () => onOpen(f.package) });
+ }
+ return h(View, { style: { gap: 26 } },
+ banner || null,
+ apps.length ? h(Shelf, { title: t('store.page.ai'), more: t('store.seeAll', { count: apps.length }), onMore },
+ h(CardGrid, null, ...apps.slice(0, 4).map((a) => h(AiCard, { key: a.id, a, here, onOpen })))) : null);
}
diff --git a/apps/store/debian.js b/apps/store/debian.js
index aefaacd..8aa941b 100644
--- a/apps/store/debian.js
+++ b/apps/store/debian.js
@@ -9,6 +9,7 @@ import {
Markdown, Toggle, LordOSLogo, session, lordosUpdate, restartNeeded, updatePrefs, setUpdatePrefs,
} from '@lordos/sdk';
import { Suggested } from './suggested.js';
+import { Card, CardGrid, Facts, Pill, Shelf } from './ui.js';
const available = () => typeof lord.pkg !== 'undefined';
const ready = () => available() && lord.pkg.available();
@@ -125,11 +126,11 @@ function Details({ name, onBack, onRemoved }) {
? h(Button, { primary: true, label: t('store.install'), disabled: !isAdmin || busy, onClick: () => isAdmin && !job && doInstall() })
: desk ? h(Button, { primary: true, label: t('store.open'), onClick: () => launchApp(desk.id) }) : null;
return h(View, { style: { gap: spacing.xl } },
- h(Button, { plain: true, small: true, label: `‹ ${t('store.back')}`, onClick: onBack, style: { alignSelf: 'flex-start', [direction() === 'rtl' ? 'marginRight' : 'marginLeft']: -6 } }),
+ onBack ? h(Button, { plain: true, small: true, label: `‹ ${t('store.back')}`, onClick: onBack, style: { alignSelf: 'flex-start', [direction() === 'rtl' ? 'marginRight' : 'marginLeft']: -6 } }) : null,
h(Progress),
// header: icon, name, summary and the actions under them (App Store style)
h(View, { style: { flexDirection: 'row', gap: spacing.l, alignItems: 'flex-start' } },
- h(View, { style: { borderRadius: 16, overflow: 'hidden', boxShadow: '0 2px 8px rgba(0,0,0,0.25)' } }, h(PkgIcon, { app, name, size: 72 })),
+ h(View, { style: { borderRadius: 22, overflow: 'hidden', boxShadow: '0 6px 14px rgba(0,0,0,0.22)' } }, h(PkgIcon, { app, name, size: 96 })),
h(View, { style: { flex: 1, minWidth: 0, gap: spacing.xs } },
h(Text, { style: { ...titleStyle(th), textAlign: 'start' } }, app?.name || name),
h(Text, { style: { fontSize: typeScale.body, color: th.textDim, lineHeight: 1.35, textAlign: 'start' } }, app?.summary || info.summary),
@@ -139,6 +140,12 @@ function Details({ name, onBack, onRemoved }) {
info.installed && !info.essential && h(Button, { label: t('store.remove'), disabled: !isAdmin || busy, onClick: () => isAdmin && !job && doRemove() }),
info.installed ? h(Text, { style: { fontSize: typeScale.caption, fontWeight: 500, color: '#30d158', marginLeft: spacing.xs } }, t('store.installedBadge')) : null))),
!isAdmin && h(Text, { style: { fontSize: typeScale.caption, color: '#ff9f0a', textAlign: 'start' } }, t('store.debian.needAdmin')),
+ h(Facts, { items: [
+ [t('store.info.version'), info.version],
+ [t('store.info.size'), formatBytes(info.installedSize)],
+ [t('store.info.category'), catOf(app || {}) ? t(`store.cat.${catOf(app)}`) : ''],
+ [t('store.info.suite'), info.suite ? `Debian ${info.suite}` : ''],
+ ] }),
plan && h(View, { style: boxStyle(th) },
h(Text, { style: { fontSize: typeScale.headline, fontWeight: 600, color: th.text, textAlign: 'start' } }, t(plan.kind === 'install' ? 'store.plan.titleInstall' : 'store.plan.titleRemove')),
h(PlanView, { plan: plan.p }),
@@ -152,30 +159,30 @@ function Details({ name, onBack, onRemoved }) {
h(Header, { th }, t('store.info.title')),
h(GroupBox, null,
h(InfoRow, { th, label: t('store.info.package'), value: name }),
- h(InfoRow, { th, label: t('store.info.version'), value: info.version }),
info.installed ? h(InfoRow, { th, label: t('store.info.installed'), value: info.installed }) : null,
- h(InfoRow, { th, label: t('store.info.size'), value: formatBytes(info.installedSize) }),
- info.suite ? h(InfoRow, { th, label: t('store.info.suite'), value: `Debian ${info.suite}` }) : null,
info.homepage ? h(InfoRow, { th, label: t('store.info.homepage'), value: info.homepage }) : null)));
}
// ---- app grid ----
-function Card({ a, onOpen }) {
- const th = useTheme();
- return h(View, { onClick: onOpen, style: { width: 200, padding: 12, gap: 10, borderRadius: 10, backgroundColor: th.hover, border: `1px solid ${th.separator}`,
- flexDirection: 'row', alignItems: 'center' } },
- h(PkgIcon, { app: a.app || a, name: a.package || a.name, size: 44 }),
- h(View, { style: { flex: 1, minWidth: 0, gap: 2 } },
- h(Text, { style: { fontSize: 13, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden' } }, (a.app || a).name || a.name),
- h(Text, { style: { fontSize: 11, color: th.textDim, maxHeight: 28, overflow: 'hidden', lineHeight: 1.25 } }, (a.app || a).summary || a.summary || ''),
- a.installed ? h(Text, { style: { fontSize: 11, fontWeight: 500, color: '#30d158' } }, t('store.installedBadge')) : null));
-}
+// The category a card names: the first of the Store's categories the app is in.
+const catOf = (a) => (a.categories || []).find((c) => CATS.includes(c));
-const Grid = ({ items, onOpen }) => h(View, { style: { flexDirection: 'row', flexWrap: 'wrap', gap: 12 } },
- ...items.map((a) => h(Card, { key: `${a.package || a.name}:${a.id || ''}`, a, onOpen: () => onOpen(a.package || a.name) })));
+// A Debian app's card: Get (the app page and its plan), Open when it is installed and has a window,
+// View otherwise.
+function DebCard({ a, onOpen }) {
+ const launcher = useLauncherApps();
+ const app = a.app || a;
+ const name = a.package || a.name;
+ const desk = a.installed && launcher.find((l) => l.kind === 'linux' && app.id && (`${l.desktopId}.desktop` === app.id || l.desktopId === app.id));
+ const cat = catOf(app);
+ const action = desk ? h(Pill, { label: t('store.open'), onClick: () => launchApp(desk.id) })
+ : h(Pill, { label: a.installed ? t('store.ai.view') : t('store.get'), onClick: () => onOpen(name) });
+ return h(Card, { icon: h(PkgIcon, { app, name, size: 56 }), name: app.name || name, kind: cat ? t(`store.cat.${cat}`) : '',
+ summary: app.summary || a.summary || '', note: a.size ? formatBytes(a.size) : '', action, onClick: () => onOpen(name) });
+}
-const Chips = ({ items }) => h(View, { style: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 } }, ...items);
+const Grid = ({ items, onOpen }) => h(CardGrid, null, ...items.map((a) => h(DebCard, { key: `${a.package || a.name}:${a.id || ''}`, a, onOpen })));
// A drawn bag, monochrome, for the Store's empty states.
function StoreGlyph() {
@@ -186,51 +193,70 @@ function StoreGlyph() {
h(View, { style: { position: 'absolute', left: 4, top: 12, width: 40, height: 34, borderRadius: 7, backgroundColor: c } }));
}
-const CATS = ['AudioVideo', 'Development', 'Education', 'Game', 'Graphics', 'Network', 'Office', 'Science', 'System', 'Utility'];
+export const CATS = ['AudioVideo', 'Development', 'Education', 'Game', 'Graphics', 'Network', 'Office', 'Science', 'System', 'Utility'];
+const categoryCounts = () => (ready() ? lord.pkg.categories() : {});
+
+// No index yet (or no engine): say so, with the button that fetches the lists.
+function NoIndex() {
+ if (!available()) return h(EmptyState, { mascot: 'confused', title: t('store.debian.unavailable'), style: { minHeight: 360 } });
+ return h(View, { style: { gap: 12 } }, h(Progress),
+ h(EmptyState, { icon: h(StoreGlyph), title: t('store.debian.noIndexTitle'), hint: t('store.debian.noIndex'), style: { minHeight: 380 },
+ action: h(Button, { primary: true, label: t('store.debian.update'), onClick: () => runJob('pkg-update', '', t('store.job.update')) }) }));
+}
-function Discover({ query }) {
+// Search results: apps as cards, other packages as rows.
+function Results({ q, onOpen }) {
const th = useTheme();
+ const res = lord.pkg.search(q, { limit: 60, lang: lang2() });
+ const apps = res.filter((r) => r.app), others = res.filter((r) => !r.app);
+ return h(View, { style: { gap: spacing.l } },
+ h(Progress),
+ apps.length ? h(Shelf, { title: t('store.debian.results', { q }) }, h(Grid, { items: apps.map((r) => ({ ...r, package: r.name })), onOpen })) : null,
+ others.length ? h(View, { style: { marginTop: spacing.s } },
+ h(Header, { th }, t('store.debian.otherPackages')),
+ h(GroupBox, null, ...others.slice(0, 30).map((r) => h(View, { key: r.name, onClick: () => onOpen(r.name),
+ style: { flexDirection: 'row', alignItems: 'center', gap: spacing.m, minHeight: 44, paddingVertical: 6 } },
+ h(View, { style: { flex: 1, minWidth: 0, gap: 2 } },
+ h(Text, { style: { fontSize: typeScale.body, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, r.name),
+ h(Text, { style: { fontSize: typeScale.callout, color: th.textDim, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, r.summary)),
+ r.installed ? h(Text, { style: { fontSize: typeScale.caption, fontWeight: 500, color: '#30d158' } }, t('store.installedBadge')) : null,
+ h(Text, { style: { fontSize: 15, color: th.textDim } }, direction() === 'rtl' ? '‹' : '›'))))) : null,
+ res.length === 0 ? h(EmptyState, { icon: h(StoreGlyph), title: t('store.debian.none'), hint: t('store.debian.noneHint'), style: { minHeight: 300 } }) : null);
+}
+
+// Discover: what the page above it brings (`top`: the featured app and the AI shelf), the
+// suggestions for this computer, then a shelf per category with its first apps and "See all".
+function Discover({ query, onOpen, onCategory, top }) {
const { gen } = useStore(state);
- const [cat, setCat] = useState('Utility');
- const [open, setOpen] = useState(null);
- useEffect(() => setOpen(null), [query]);
- if (!available()) return h(EmptyState, { mascot: 'confused', title: t('store.debian.unavailable'), style: { minHeight: 360 } });
- if (!ready()) {
- return h(View, { style: { gap: 12 } }, h(Progress),
- h(EmptyState, { icon: h(StoreGlyph), title: t('store.debian.noIndexTitle'), hint: t('store.debian.noIndex'), style: { minHeight: 380 },
- action: h(Button, { primary: true, label: t('store.debian.update'), onClick: () => runJob('pkg-update', '', t('store.job.update')) }) }));
- }
- if (open) return h(Details, { name: open, onBack: () => setOpen(null) });
+ void gen;
const q = query.trim();
+ if (!ready()) return h(View, { style: { gap: 26 } }, top, h(NoIndex));
+ if (q) return h(Results, { q, onOpen });
+ const counts = categoryCounts();
+ return h(View, { style: { gap: 26 } },
+ h(Progress),
+ top,
+ ...CATS.filter((c) => counts[c]).map((c) => h(Shelf, { key: c, title: t(`store.cat.${c}`), more: t('store.seeAll', { count: counts[c] }), onMore: () => onCategory(c) },
+ h(Grid, { items: lord.pkg.apps({ category: c, limit: 4, lang: lang2() }), onOpen }))));
+}
+
+// Store → For this computer: the hardware suggestions on their own page.
+function SuggestedPage() {
+ return h(View, { style: { gap: spacing.l } }, h(Progress), h(Suggested, { deb: { state, runJob, PlanView, boxStyle }, page: true }));
+}
+
+// One category: all its apps (the search narrows them).
+function Category({ cat, query, onOpen }) {
+ const { gen } = useStore(state);
void gen;
- if (q) {
- const res = lord.pkg.search(q, { limit: 60, lang: lang2() });
- const apps = res.filter((r) => r.app), others = res.filter((r) => !r.app);
- return h(View, { style: { gap: spacing.l } },
- h(Progress),
- h(Text, { style: { ...titleStyle(th), textAlign: 'start' } }, t('store.debian.results', { q })),
- apps.length ? h(Grid, { items: apps.map((r) => ({ ...r, package: r.name })), onOpen: setOpen }) : null,
- others.length ? h(View, { style: { marginTop: spacing.s } },
- h(Header, { th }, t('store.debian.otherPackages')),
- h(GroupBox, null, ...others.slice(0, 30).map((r) => h(View, { key: r.name, onClick: () => setOpen(r.name),
- style: { flexDirection: 'row', alignItems: 'center', gap: spacing.m, minHeight: 44, paddingVertical: 6 } },
- h(View, { style: { flex: 1, minWidth: 0, gap: 2 } },
- h(Text, { style: { fontSize: typeScale.body, fontWeight: 600, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, r.name),
- h(Text, { style: { fontSize: typeScale.callout, color: th.textDim, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, r.summary)),
- r.installed ? h(Text, { style: { fontSize: typeScale.caption, fontWeight: 500, color: '#30d158' } }, t('store.installedBadge')) : null,
- h(Text, { style: { fontSize: 15, color: th.textDim } }, direction() === 'rtl' ? '‹' : '›'))))) : null,
- res.length === 0 ? h(EmptyState, { icon: h(StoreGlyph), title: t('store.debian.none'), hint: t('store.debian.noneHint'), style: { minHeight: 300 } }) : null);
- }
- const counts = lord.pkg.categories();
- const list = lord.pkg.apps({ category: cat, limit: 60, lang: lang2() });
- return h(View, { style: { gap: 16 } },
+ if (!ready()) return h(NoIndex);
+ const q = query.trim().toLowerCase();
+ const list = lord.pkg.apps({ category: cat, limit: 2000, lang: lang2() })
+ .filter((a) => !q || `${a.name} ${a.summary || ''} ${a.package}`.toLowerCase().includes(q));
+ return h(View, { style: { gap: spacing.l } },
h(Progress),
- h(Suggested, { deb: { state, runJob, PlanView, boxStyle } }),
- h(Text, { style: titleStyle(th) }, t('store.discover.title')),
- h(Chips, { items: CATS.filter((c) => counts[c]).map((c) => h(View, { key: c, onClick: () => setCat(c), style: {
- paddingHorizontal: 12, height: 26, justifyContent: 'center', borderRadius: 13, backgroundColor: c === cat ? th.accent : th.control } },
- h(Text, { style: { fontSize: 12, color: c === cat ? '#fff' : th.text } }, `${t(`store.cat.${c}`)} · ${counts[c]}`))) }),
- h(Grid, { items: list, onOpen: setOpen }));
+ list.length ? h(Grid, { items: list.slice(0, q ? 200 : 400), onOpen })
+ : h(EmptyState, { icon: h(StoreGlyph), title: t('store.debian.none'), hint: t('store.debian.noneHint'), style: { minHeight: 300 } }));
}
// LordOS itself (docs/UPDATES.md): "LordOS <version> is available", its release notes and Update.
@@ -312,7 +338,7 @@ function Updates() {
const auto = (on) => { setUpdatePrefs({ autoCheck: on }); setPrefs(updatePrefs()); };
return h(View, { style: { gap: 12 } },
h(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8 } },
- h(Text, { style: { flex: 1, ...titleStyle(th), textAlign: 'start' } }, t('store.updates.title')),
+ h(View, { style: { flex: 1 } }),
h(Button, { label: t('store.debian.update'), disabled: !!job, onClick: () => !job && runJob('pkg-update', '', t('store.job.update')) }),
ups.length ? h(Button, { primary: !own?.available, label: t('store.updates.all'), disabled: !!job,
onClick: () => !job && setPlan(lord.pkg.plan({ upgrade: true })) }) : null),
@@ -364,8 +390,11 @@ function packageOfApp(a) {
export const debian = {
available: ready,
+ categoryCounts,
Details,
Discover,
+ Category,
+ SuggestedPage,
Updates,
Status,
installFile: (path) => runJob('pkg-install-file', path, t('store.job.installFile')).then((ok) => { if (!ok) throw new Error(state.get().msg?.text || ''); }),
diff --git a/apps/store/index.jsx b/apps/store/index.jsx
index fea1e17..1a547e7 100644
--- a/apps/store/index.jsx
+++ b/apps/store/index.jsx
@@ -1,13 +1,14 @@
// Store: LordOS apps (.lpk packages, no root) and Debian apps (our own package engine,
// server/src/pkg; install and remove go through the administration helper).
import {
- View, Text, Image, useTheme, useLocale, useAppWindow, useStore, Button, ScrollView, SidebarItem, SectionTitle, SearchField, Hairline, EmptyState, GroupBox,
+ View, Text, Image, useTheme, useLocale, useAppWindow, useStore, Button, ScrollView, SidebarItem, SectionTitle, SearchField, Hairline, EmptyState, GroupBox, Toolbar, ToolbarButton,
packages, packageList, refreshPackages, useLauncherApps, launchApp, fs, formatBytes, wm, direction, typeScale, spacing, isSystemApp,
suggestions, unseenSuggestions, refreshSuggestions,
} from '@lordos/sdk';
import { useEffect, useMemo, useState } from 'react';
-import { AiPage } from './ai.js';
-import { debian, useDebian } from './debian.js';
+import { AiDetail, AiDiscover, AiPage, catalogApp, catalogApps } from './ai.js';
+import { CATS, debian, useDebian } from './debian.js';
+import { GLYPH } from './ui.js';
// The user's Downloads folder relative to home ("Downloads/"), from xdg-user-dirs; without it, the
// first of the usual names that exists, or the home folder itself.
@@ -207,7 +208,7 @@ function LordOSPage({ query }) {
const shown = list.filter((p) => !q || `${p.name} ${p.description} ${p.id}`.toLowerCase().includes(q));
return (
<View>
- <PageTitle title={tr('store.lordos.title')} subtitle={tr('store.lordos.subtitle')} />
+ <Text style={{ fontSize: typeScale.body, color: t.textDim, lineHeight: 1.45, maxWidth: 680, marginBottom: spacing.xl, textAlign: 'start' }}>{tr('store.lordos.subtitle')}</Text>
{pick && <InstallFile path={pick} onDone={(cancel) => { if (cancel) setPick(null); setFiles(findPackageFiles().filter((f) => /\.lpk$/i.test(f.name))); }} />}
<Message msg={msg} />
<List title={tr('store.lordos.installedTitle')} count={shown.length || null} empty={tr('store.lordos.none')}>
@@ -285,7 +286,6 @@ function InstalledPage({ query }) {
const kind = (a) => (a.version && a.kind !== 'linux' ? tr('store.kindVersion', { kind: tr(`store.kind.${a.kind}`), v: a.version }) : tr(`store.kind.${a.kind}`));
return (
<View>
- <PageTitle title={tr('store.installed.title')} />
<List count={null} empty={tr('store.debian.none')}>
{shown.map((a) => (
<AppRow key={a.id} icon={<a.Icon size={32} />} name={a.name} detail={a.comment || a.genericName || ''} extra={kind(a)}>
@@ -302,45 +302,83 @@ function InstalledPage({ query }) {
// ---- window ----
+// Where the window is: a page ('discover', 'installed', 'updates', 'ai', 'lordos' or 'cat:<Category>')
+// and, over it, an app page (`app`: a Debian package; `ai`: true for a catalog app). Back returns to
+// the page.
+const PAGE_GLYPH = { suggested: GLYPH.suggested, discover: GLYPH.discover, installed: GLYPH.installed, updates: GLYPH.updates, ai: GLYPH.ai, lordos: GLYPH.lordos };
+
export default function Store() {
const t = useTheme();
const { t: tr } = useLocale();
const { args } = useAppWindow();
const [page, setPage] = useState('discover');
+ const [app, setApp] = useState(null);
const [query, setQuery] = useState('');
const [file, setFile] = useState(null);
const deb = useDebian();
+ const launcher = useLauncherApps();
+ const go = (p) => { setApp(null); setPage(p); };
useEffect(() => {
if (args?.install) setFile(args.install);
- if (args?.page) setPage(args.page);
- if (args?.search) { setQuery(args.search); setPage('discover'); } // from Search
+ if (args?.page) go(args.page);
+ if (args?.search) { setQuery(args.search); go('discover'); } // from Search
}, [args?.nonce]);
const sug = useStore(suggestions);
useEffect(() => { refreshSuggestions(); }, []); // the hardware may have changed since the last look
- const unseen = page === 'discover' ? 0 : unseenSuggestions(sug.list).length; // new suggestions (Discover's badge)
- const pages = [
- ['discover', tr('store.page.discover'), unseen || null],
- ['lordos', tr('store.page.lordos')],
- ['ai', tr('store.page.ai')],
- ['installed', tr('store.page.installed')],
- ['updates', deb.upgrades?.length ? tr('store.page.updatesCount', { count: deb.upgrades.length }) : tr('store.page.updates')],
- ];
- const Page = { discover: debian.Discover, lordos: LordOSPage, ai: AiPage, installed: InstalledPage, updates: debian.Updates }[page];
+ const unseen = page === 'suggested' ? 0 : unseenSuggestions(sug.list).length; // new suggestions (the page's badge)
+ const counts = debian.categoryCounts();
+ const cat = page.startsWith('cat:') ? page.slice(4) : null;
+ const openDeb = (name) => setApp({ name, ai: false });
+ const openAi = (name) => setApp({ name, ai: true });
+ const pageTitle = cat ? tr(`store.cat.${cat}`) : tr(`store.page.${page}`);
+ const appTitle = app && (app.ai ? catalogApp(app.name)?.name : (lord.pkg?.info?.(app.name, {})?.app?.name)) || app?.name;
+ const searchable = !app && page !== 'updates' && page !== 'suggested';
+ const onSearch = (v) => { setQuery(v); if (v && !searchable) go('discover'); };
+ let body;
+ if (app) body = app.ai ? <AiDetail pkg={app.name} /> : <debian.Details name={app.name} />;
+ else if (cat) body = <debian.Category cat={cat} query={query} onOpen={openDeb} />;
+ else if (page === 'discover') body = <debian.Discover query={query} onOpen={openDeb} onCategory={(c) => go(`cat:${c}`)} top={query.trim() ? null : <AiDiscover onOpen={openAi} onOpenDeb={openDeb} onMore={() => go('ai')} />} />;
+ else if (page === 'suggested') body = <debian.SuggestedPage />;
+ else if (page === 'ai') body = <AiPage query={query} onOpen={openAi} />;
+ else if (page === 'lordos') body = <LordOSPage query={query} />;
+ else if (page === 'installed') body = <InstalledPage query={query} />;
+ else body = <debian.Updates />;
+ const item = (id, label, detail, glyph) => (
+ <SidebarItem key={id} icon={glyph} label={label} detail={detail || null} selected={!app && page === id} onClick={() => go(id)} />
+ );
return (
<View style={{ flex: 1, flexDirection: 'row' }}>
- <View style={{ width: 210, backgroundColor: t.sidebarBg, paddingHorizontal: 10, paddingTop: 10, paddingBottom: 12, gap: 2 }}>
+ <View style={{ width: 210, backgroundColor: t.sidebarBg }}>
<Hairline edge="end" />
- <SearchField value={query} onChange={(v) => { setQuery(v); if (v && page !== 'discover' && page !== 'installed' && page !== 'lordos' && page !== 'ai') setPage('discover'); }}
- placeholder={tr('store.search')} style={{ marginBottom: 10 }} />
- {pages.map(([id, label, detail]) => <SidebarItem key={id} label={label} detail={detail} selected={page === id} onClick={() => setPage(id)} />)}
- <View style={{ flex: 1 }} />
- <View style={{ paddingHorizontal: 10 }}><debian.Status /></View>
+ <ScrollView style={{ flex: 1, paddingHorizontal: 10, paddingTop: 4 }}>
+ <SectionTitle>{tr('store.section.store')}</SectionTitle>
+ {item('discover', tr('store.page.discover'), null, PAGE_GLYPH.discover)}
+ {item('suggested', tr('store.page.suggested'), unseen, PAGE_GLYPH.suggested)}
+ {item('installed', tr('store.page.installed'), launcher.length, PAGE_GLYPH.installed)}
+ {item('updates', tr('store.page.updates'), deb.upgrades?.length, PAGE_GLYPH.updates)}
+ <SectionTitle>{tr('store.section.categories')}</SectionTitle>
+ {item('ai', tr('store.page.ai'), catalogApps().length, PAGE_GLYPH.ai)}
+ {CATS.filter((c) => counts[c]).map((c) => item(`cat:${c}`, tr(`store.cat.${c}`), counts[c], GLYPH[c]))}
+ <SectionTitle>LordOS</SectionTitle>
+ {item('lordos', tr('store.page.lordos'), null, PAGE_GLYPH.lordos)}
+ <View style={{ height: 12 }} />
+ </ScrollView>
+ <View style={{ paddingHorizontal: 20, paddingBottom: 12, paddingTop: 6 }}><debian.Status /></View>
+ </View>
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Toolbar>
+ {app ? <ToolbarButton icon={direction() === 'rtl' ? '›' : '‹'} iconSize={20} small title={tr('store.back')} onClick={() => setApp(null)} /> : null}
+ <View style={{ flex: 1, minWidth: 0 }}>
+ <Text style={{ fontSize: typeScale.headline, fontWeight: 600, color: t.text, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' }}>{app ? appTitle : pageTitle}</Text>
+ </View>
+ {!app ? <SearchField value={query} onChange={onSearch} placeholder={tr('store.search')} width={200} /> : null}
+ </Toolbar>
+ <ScrollView style={{ flex: 1, paddingHorizontal: 24, paddingTop: 20 }}>
+ {file && <InstallFile path={file} onDone={(cancel) => cancel && setFile(null)} />}
+ {body}
+ <View style={{ height: 24 }} />
+ </ScrollView>
</View>
- <ScrollView style={{ flex: 1, paddingHorizontal: 20, paddingTop: 20 }}>
- {file && <InstallFile path={file} onDone={(cancel) => cancel && setFile(null)} />}
- <Page query={query} onPage={setPage} />
- <View style={{ height: 20 }} />
- </ScrollView>
</View>
);
}
diff --git a/apps/store/manifest.json b/apps/store/manifest.json
index a3bf622..9c2f6cf 100644
--- a/apps/store/manifest.json
+++ b/apps/store/manifest.json
@@ -4,12 +4,12 @@
"name": "Store",
"description": "LordOS and Debian apps: search, install, update and remove",
"size": [
- 880,
- 580
+ 1080,
+ 700
],
"minSize": [
- 640,
- 420
+ 720,
+ 460
],
"dock": true,
"permissions": [
diff --git a/apps/store/suggested.js b/apps/store/suggested.js
index 34c1257..020bcaf 100644
--- a/apps/store/suggested.js
+++ b/apps/store/suggested.js
@@ -4,7 +4,7 @@
// that isn't free says so before anything is installed, and is never preselected.
import { createElement as h, useEffect, useState } from 'react';
import {
- View, Text, Button, useTheme, useStore, admin, typeScale, spacing, t, direction,
+ View, Text, Button, EmptyState, useTheme, useStore, admin, typeScale, spacing, t, direction,
suggestions, refreshSuggestions, reevaluateSuggestions, dismissSuggestion, markSuggestionsSeen,
} from '@lordos/sdk';
@@ -121,17 +121,19 @@ function Card({ s, deb }) {
// ---- the section ----
-export function Suggested({ deb }) {
+// `page`: the Store's own page for it (0.8.5): no heading (the toolbar names it) and an empty state.
+export function Suggested({ deb, page }) {
const th = useTheme();
const { list, fixture, ready } = useStore(suggestions);
const { gen } = useStore(deb.state);
useEffect(() => { if (!suggestions.get().ready) refreshSuggestions(); }, []);
useEffect(() => { if (ready) markSuggestionsSeen(list); }, [ready, list]);
useEffect(() => { if (gen) reevaluateSuggestions(); }, [gen]); // installed or removed something
+ if (page && ready && !list.length) return h(EmptyState, { mascot: 'celebrate', title: t('store.suggest.none'), hint: t('store.suggest.subtitle'), style: { minHeight: 320 } });
if (!ready || !list.length) return null;
return h(View, { style: { gap: spacing.s, marginBottom: spacing.s } },
h(View, { style: { flexDirection: 'row', alignItems: 'baseline', gap: spacing.s, flexWrap: 'wrap' } },
- h(Text, { style: { fontSize: typeScale.title, fontWeight: 600, color: th.text, textAlign: 'start' } }, t('store.suggest.title')),
+ page ? null : h(Text, { style: { fontSize: typeScale.title, fontWeight: 600, color: th.text, textAlign: 'start' } }, t('store.suggest.title')),
fixture ? h(View, { style: { paddingHorizontal: 8, height: 20, borderRadius: 10, justifyContent: 'center', backgroundColor: '#ff453a' } },
h(Text, { style: { fontSize: 11, fontWeight: 700, color: '#fff' } }, t('store.suggest.fixture'))) : null),
h(Text, { style: { fontSize: typeScale.callout, color: th.textDim, lineHeight: 1.4, textAlign: 'start', marginBottom: 2 } }, t('store.suggest.subtitle')),
diff --git a/apps/store/ui.js b/apps/store/ui.js
new file mode 100644
index 0000000..33ee125
--- /dev/null
+++ b/apps/store/ui.js
@@ -0,0 +1,156 @@
+// ui.js — the Store's look (0.8.5, modelled on an app center): cards in a fluid grid with a "Get"
+// pill, the featured banner, the facts row of an app page and the sidebar glyphs. Data comes from the
+// pages (debian.js, ai.js, index.jsx); these pieces only draw.
+import { createElement as h, useEffect, useState } from 'react';
+import { View, Text, Image, useTheme, useStore, settings, typeScale, spacing } from '@lordos/sdk';
+
+export const CARD_BASIS = 250;
+
+// Sidebar glyphs: monochrome symbols drawn in the accent color (docs/DESIGN.md, "Icons").
+export const GLYPH = {
+ discover: '✦', suggested: '◫', installed: '▣', updates: '↻', lordos: '◆', ai: '✧',
+ AudioVideo: '♪', Development: '⌘', Education: 'ⓘ', Game: '♟', Graphics: '◐', Network: '⇄', Office: '▤',
+ Science: '⚛', System: '⚙', Utility: '⚒',
+};
+
+// #rrggbb + alpha → rgba() (the theme's accent tinted for the pill and the hover)
+export function tint(hex, a) {
+ const m = /^#?([0-9a-f]{6})$/i.exec(String(hex || ''));
+ if (!m) return `rgba(10,132,255,${a})`;
+ const n = parseInt(m[1], 16);
+ return `rgba(${n >> 16},${(n >> 8) & 255},${n & 255},${a})`;
+}
+
+// The action of a card or an app page: Get / Open / View, a tinted pill (white on the banner).
+export function Pill({ label, onClick, big, onDark, disabled }) {
+ const th = useTheme();
+ const [hover, setHover] = useState(false);
+ const hgt = big ? 30 : 24;
+ return h(View, {
+ onClick: (e) => { e?.stopPropagation?.(); if (!disabled) onClick?.(); },
+ onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false),
+ style: { height: hgt, paddingHorizontal: big ? 20 : 14, borderRadius: hgt / 2, alignItems: 'center', justifyContent: 'center', flexShrink: 0,
+ opacity: disabled ? 0.45 : 1,
+ backgroundColor: onDark ? (hover ? '#ffffff' : 'rgba(255,255,255,0.92)') : tint(th.accent, hover && !disabled ? 0.2 : 0.12) },
+ }, h(Text, { style: { fontSize: big ? 13.5 : 12.5, fontWeight: 650, color: onDark ? '#1d1d3a' : th.accent, whiteSpace: 'nowrap' } }, label));
+}
+
+// A card: icon, name, kind, two lines of summary, and a foot with a note (the size) and the action.
+export function Card({ icon, name, kind, summary, note, action, onClick, dim }) {
+ const th = useTheme();
+ const [hover, setHover] = useState(false);
+ const bg = th.mode === 'dark' ? 'rgba(255,255,255,0.045)' : 'rgba(0,0,0,0.025)';
+ return h(View, {
+ onClick, onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false),
+ style: { flexGrow: 1, flexBasis: CARD_BASIS, minWidth: 220, padding: 14, gap: 8, borderRadius: 12, opacity: dim ? 0.55 : 1,
+ backgroundColor: hover ? th.hover : bg, border: `1px solid ${th.separator}` },
+ },
+ h(View, { style: { flexDirection: 'row', gap: 14, alignItems: 'flex-start' } },
+ h(View, { style: { width: 56, height: 56, alignItems: 'center', justifyContent: 'center', flexShrink: 0 } }, icon),
+ h(View, { style: { flex: 1, minWidth: 0, gap: 1 } },
+ h(Text, { style: { fontSize: 14, fontWeight: 650, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', textAlign: 'start' } }, name),
+ kind ? h(Text, { style: { fontSize: 11.5, color: th.textDim, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, kind) : null,
+ summary ? h(Text, { style: { fontSize: 12, lineHeight: 1.42, color: th.textDim, marginTop: 5, numberOfLines: 2, overflow: 'hidden', textAlign: 'start' } }, summary) : null)),
+ h(View, { style: { flex: 1 } }),
+ h(View, { style: { flexDirection: 'row', alignItems: 'center', gap: spacing.s, minHeight: 24 } },
+ h(Text, { style: { flex: 1, minWidth: 0, fontSize: 11.5, color: th.textDim, whiteSpace: 'nowrap', overflow: 'hidden', textAlign: 'start' } }, note || ''),
+ action || null));
+}
+
+// The grid: cards wrap and grow to fill each row; empty fillers keep the last row's cards the same
+// width as the others (a CSS auto-fill grid, which the engine doesn't have).
+export function CardGrid({ children }) {
+ const items = (Array.isArray(children) ? children.flat() : [children]).filter(Boolean);
+ const fill = [0, 1, 2, 3].map((i) => h(View, { key: `fill${i}`, style: { flexGrow: 1, flexBasis: CARD_BASIS, minWidth: 220, height: 0 } }));
+ return h(View, { style: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'stretch', gap: 12 } }, ...items, ...fill);
+}
+
+// A section heading over a grid, with an optional "See all" at the end.
+export function Shelf({ title, more, onMore, children }) {
+ const th = useTheme();
+ return h(View, { style: { gap: 12 } },
+ h(View, { style: { flexDirection: 'row', alignItems: 'baseline', gap: spacing.s } },
+ h(Text, { style: { flex: 1, fontSize: 17, fontWeight: 700, color: th.text, textAlign: 'start' } }, title),
+ onMore ? h(Text, { onClick: onMore, style: { fontSize: typeScale.callout, fontWeight: 600, color: th.accent } }, more) : null),
+ children);
+}
+
+// A color from a name (the same hue the letter icons use), for the banner's glow.
+export function nameColor(name, l = 0.55) {
+ let hsh = 0;
+ for (const ch of String(name)) hsh = (hsh * 31 + ch.codePointAt(0)) >>> 0;
+ const hue = hsh % 360, a = 0.6 * Math.min(l, 1 - l);
+ const f = (n) => { const k = (n + hue / 30) % 12; return l - a * Math.max(-1, Math.min(k - 3, 9 - k, 1)); };
+ return '#' + [0, 8, 4].map((n) => Math.round(f(n) * 255).toString(16).padStart(2, '0')).join('');
+}
+
+// The featured banner: a dark gradient with two soft lights in the app's color behind (its glow;
+// the engine has no blur filter, so a wide shadow does it), then the icon, a kicker, the name, the
+// summary and the action.
+// With `image` (the banner published in LordOS's repository) the picture fills it, under a shade
+// that keeps the text readable; `colors` replaces the default gradient.
+export function Featured({ icon, glow, image, colors, kicker, title, text, action, onClick }) {
+ const light = (size, right, top, alpha) => h(View, { style: { position: 'absolute', right, top, width: size, height: size, borderRadius: size / 2, pointerEvents: 'none',
+ backgroundColor: glow, opacity: alpha, boxShadow: `0 0 ${size * 0.6}px ${glow}` } });
+ return h(View, {
+ onClick,
+ style: { minHeight: 168, paddingVertical: 26, paddingHorizontal: 28, borderRadius: 16, overflow: 'hidden', flexDirection: 'row', alignItems: 'center', gap: 22,
+ background: `linear-gradient(120deg, ${(colors && colors[0]) || '#1c1638'}, ${(colors && colors[1]) || '#3a2f8a'})`, border: '1px solid rgba(255,255,255,0.12)' },
+ },
+ image ? h(Image, { src: image, style: { position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, width: '100%', height: '100%', objectFit: 'cover', pointerEvents: 'none' } }) : null,
+ image ? h(View, { style: { position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, pointerEvents: 'none',
+ background: 'linear-gradient(90deg, rgba(10,8,30,0.82), rgba(10,8,30,0.15))' } }) : null,
+ glow && !image ? light(260, 40, -60, 0.22) : null,
+ glow && !image ? light(180, 260, 60, 0.12) : null,
+ icon ? h(View, { style: { width: 96, height: 96, alignItems: 'center', justifyContent: 'center', flexShrink: 0,
+ boxShadow: '0 8px 18px rgba(0,0,0,0.35)', borderRadius: 22 } }, icon) : null,
+ h(View, { style: { flex: 1, minWidth: 0, gap: 4 } },
+ h(Text, { style: { fontSize: 11.5, fontWeight: 600, color: 'rgba(255,255,255,0.75)', textAlign: 'start' } }, kicker),
+ h(Text, { style: { fontSize: 26, fontWeight: 750, color: '#fff', textAlign: 'start' } }, title),
+ h(Text, { style: { fontSize: 13.5, lineHeight: 1.5, color: 'rgba(255,255,255,0.86)', maxWidth: 520, numberOfLines: 3, overflow: 'hidden', textAlign: 'start' } }, text)),
+ action || null);
+}
+
+// The facts row of an app page: up to four label/value columns between hairlines.
+export function Facts({ items }) {
+ const th = useTheme();
+ const list = items.filter((x) => x && x[1]);
+ return h(View, { style: { flexDirection: 'row', borderTop: `1px solid ${th.separator}`, borderBottom: `1px solid ${th.separator}` } },
+ ...list.map(([label, value], i) => h(View, { key: label, style: { flex: 1, minWidth: 0, paddingVertical: 12, paddingHorizontal: 10, gap: 2, alignItems: 'center',
+ ...(i ? { borderStart: `1px solid ${th.separator}` } : {}) } },
+ h(Text, { style: { fontSize: 11, color: th.textDim, whiteSpace: 'nowrap' } }, label),
+ h(Text, { style: { fontSize: 13, fontWeight: 650, color: th.text, whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', maxWidth: '100%' } }, value))));
+}
+
+// A placeholder while something isn't there yet (the banner before the first package list): grey
+// shapes in its layout that pulse slowly, still with "Reduce motion".
+function usePulse() {
+ const still = useStore(settings, (st) => !!st.reduceMotion);
+ const [on, setOn] = useState(false);
+ useEffect(() => {
+ if (still) return undefined;
+ const id = setInterval(() => setOn((v) => !v), 900);
+ return () => clearInterval(id);
+ }, [still]);
+ return still ? 0.75 : on ? 0.5 : 1;
+}
+
+export function Skeleton({ width, height, radius = 6, style }) {
+ const th = useTheme();
+ const op = usePulse();
+ return h(View, { style: [{ width, height, borderRadius: radius, opacity: op, backgroundColor: th.mode === 'dark' ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.07)' }, style] });
+}
+
+// The banner's skeleton: the same size and layout, no content.
+export function FeaturedSkeleton() {
+ const th = useTheme();
+ return h(View, { style: { minHeight: 168, paddingVertical: 26, paddingHorizontal: 28, borderRadius: 16, flexDirection: 'row', alignItems: 'center', gap: 22,
+ border: `1px solid ${th.separator}` } },
+ h(Skeleton, { width: 96, height: 96, radius: 22 }),
+ h(View, { style: { flex: 1, gap: 10 } },
+ h(Skeleton, { width: 180, height: 11 }),
+ h(Skeleton, { width: 280, height: 24 }),
+ h(Skeleton, { width: '80%', height: 12 }),
+ h(Skeleton, { width: '60%', height: 12 })),
+ h(Skeleton, { width: 96, height: 30, radius: 15 }));
+}
diff --git a/apt/featured/banner.png b/apt/featured/banner.png
new file mode 100644
index 0000000..1873251
Binary files /dev/null and b/apt/featured/banner.png differ
diff --git a/apt/featured/featured.json b/apt/featured/featured.json
new file mode 100644
index 0000000..26fbba2
--- /dev/null
+++ b/apt/featured/featured.json
@@ -0,0 +1,20 @@
+{
+ "schema": 1,
+ "catalog": "llama.cpp",
+ "kicker": {
+ "en": "Featured · Artificial Intelligence",
+ "es": "Destacada · Inteligencia Artificial",
+ "pt": "Destaque · Inteligência Artificial"
+ },
+ "title": {
+ "en": "Language models on your computer",
+ "es": "Modelos de lenguaje en tu equipo",
+ "pt": "Modelos de linguagem no seu computador"
+ },
+ "text": {
+ "en": "llama.cpp runs GGUF models on the CPU or a Vulkan GPU, with a chat in the terminal and an HTTP API with its own web page. It downloads the model the first time you run it.",
+ "es": "llama.cpp corre modelos GGUF en la CPU o en una GPU Vulkan, con un chat en la terminal y una API HTTP con su propia página web. Baja el modelo la primera vez que lo ejecutás.",
+ "pt": "O llama.cpp roda modelos GGUF na CPU ou numa GPU Vulkan, com um chat no terminal e uma API HTTP com sua própria página web. Ele baixa o modelo na primeira vez que você o executa."
+ },
+ "colors": ["#1c1638", "#3a2f8a"]
+}
diff --git a/assets/locales/en/store.json b/assets/locales/en/store.json
index f1c07ee..2d5b745 100644
--- a/assets/locales/en/store.json
+++ b/assets/locales/en/store.json
@@ -44,6 +44,7 @@
"debian.update": "Check for updates",
"discover.title": "Debian apps",
"done.installed": "Installed.",
+ "featured": "Featured · {category}",
"file.deb": "Debian package: installed system-wide, together with what it needs.",
"file.noPermissions": "none",
"file.permissions": "Declared permissions: {list}",
@@ -51,6 +52,8 @@
"file.size": "{size} in {files} files",
"file.title": "Install from a file",
"file.trust": "Only install apps from people you trust: for now they run with the same permissions as the included apps.",
+ "get": "Get",
+ "info.category": "Category",
"info.description": "Description",
"info.homepage": "Website",
"info.installed": "Installed version",
@@ -100,6 +103,7 @@
"page.discover": "Discover",
"page.installed": "Installed",
"page.lordos": "LordOS apps",
+ "page.suggested": "For this computer",
"page.updates": "Updates",
"page.updatesCount": {
"one": "Updates ({count})",
@@ -140,6 +144,9 @@
"restart.title": "Restart required",
"restore.done": "“{name}” restored to the original.",
"search": "Search apps",
+ "section.categories": "Categories",
+ "section.store": "Store",
+ "seeAll": "See all ({count})",
"share.done": "Signed package written to {path} (your key {key}…)",
"suggest.confirmNonfree": "This is not free software: its source code isn't available, and Debian can't fix or audit it. You can remove it later like any other package.",
"suggest.dismiss": "Don't suggest again",
@@ -170,6 +177,7 @@
"suggest.ippUsb.unavailable": "{packages} isn't in this computer's package sources.",
"suggest.ippUsb.why": "We detected a USB printer that can print and scan without a vendor driver (IPP over USB).",
"suggest.job": "Installing {name}",
+ "suggest.none": "Nothing to suggest for this computer",
"suggest.nonfreeBadge": "Not free software",
"suggest.note.firmware": "Firmware is a small program that runs inside the device itself, not on the computer's processor; its license doesn't allow changing it.",
"suggest.note.nonfree": "Not free software: it comes from Debian's {component} component, under its vendor's license.",
diff --git a/assets/locales/es/store.json b/assets/locales/es/store.json
index ce8fdee..e4fadd2 100644
--- a/assets/locales/es/store.json
+++ b/assets/locales/es/store.json
@@ -44,6 +44,7 @@
"debian.update": "Buscar actualizaciones",
"discover.title": "Apps de Debian",
"done.installed": "Instalado.",
+ "featured": "Destacada · {category}",
"file.deb": "Paquete de Debian: se instala para todo el sistema, junto con lo que necesite.",
"file.noPermissions": "ninguno",
"file.permissions": "Permisos que declara: {list}",
@@ -51,6 +52,8 @@
"file.size": "{size} en {files} archivos",
"file.title": "Instalar desde un archivo",
"file.trust": "Instalá solo apps de quien confíes: por ahora corren con los mismos permisos que las apps incluidas.",
+ "get": "Obtener",
+ "info.category": "Categoría",
"info.description": "Descripción",
"info.homepage": "Sitio web",
"info.installed": "Versión instalada",
@@ -100,6 +103,7 @@
"page.discover": "Descubrir",
"page.installed": "Instaladas",
"page.lordos": "Apps LordOS",
+ "page.suggested": "Para tu equipo",
"page.updates": "Actualizaciones",
"page.updatesCount": {
"one": "Actualizaciones ({count})",
@@ -140,6 +144,9 @@
"restart.title": "Hay que reiniciar",
"restore.done": "«{name}» restaurada al original.",
"search": "Buscar apps",
+ "section.categories": "Categorías",
+ "section.store": "Tienda",
+ "seeAll": "Ver todas ({count})",
"share.done": "Paquete firmado escrito en {path} (tu clave {key}…)",
"suggest.confirmNonfree": "Esto no es software libre: su código fuente no está disponible y Debian no puede corregirlo ni auditarlo. Podés quitarlo después como cualquier otro paquete.",
"suggest.dismiss": "No sugerir de nuevo",
@@ -170,6 +177,7 @@
"suggest.ippUsb.unavailable": "{packages} no está en los orígenes de paquetes de este equipo.",
"suggest.ippUsb.why": "Detectamos una impresora USB que puede imprimir y escanear sin driver del fabricante (IPP por USB).",
"suggest.job": "Instalando {name}",
+ "suggest.none": "No hay nada para sugerir en este equipo",
"suggest.nonfreeBadge": "No es software libre",
"suggest.note.firmware": "El firmware es un pequeño programa que corre dentro del propio dispositivo, no en el procesador del equipo; su licencia no permite modificarlo.",
"suggest.note.nonfree": "No es software libre: viene del componente {component} de Debian, con la licencia de su fabricante.",
diff --git a/assets/locales/pt/store.json b/assets/locales/pt/store.json
index 473628a..66a304e 100644
--- a/assets/locales/pt/store.json
+++ b/assets/locales/pt/store.json
@@ -44,6 +44,7 @@
"debian.update": "Procurar atualizações",
"discover.title": "Apps do Debian",
"done.installed": "Instalado.",
+ "featured": "Destaque · {category}",
"file.deb": "Pacote do Debian: instalado para todo o sistema, junto com o que precisar.",
"file.noPermissions": "nenhuma",
"file.permissions": "Permissões declaradas: {list}",
@@ -51,6 +52,8 @@
"file.size": "{size} em {files} arquivos",
"file.title": "Instalar a partir de um arquivo",
"file.trust": "Instale apenas apps de quem você confia: por enquanto eles rodam com as mesmas permissões dos apps incluídos.",
+ "get": "Obter",
+ "info.category": "Categoria",
"info.description": "Descrição",
"info.homepage": "Site",
"info.installed": "Versão instalada",
@@ -100,6 +103,7 @@
"page.discover": "Descobrir",
"page.installed": "Instalados",
"page.lordos": "Apps LordOS",
+ "page.suggested": "Para este computador",
"page.updates": "Atualizações",
"page.updatesCount": {
"one": "Atualizações ({count})",
@@ -140,6 +144,9 @@
"restart.title": "É preciso reiniciar",
"restore.done": "“{name}” restaurada ao original.",
"search": "Buscar apps",
+ "section.categories": "Categorias",
+ "section.store": "Loja",
+ "seeAll": "Ver todos ({count})",
"share.done": "Pacote assinado escrito em {path} (sua chave {key}…)",
"suggest.confirmNonfree": "Isto não é software livre: o código-fonte não está disponível e o Debian não pode corrigi-lo nem auditá-lo. Você pode removê-lo depois como qualquer outro pacote.",
"suggest.dismiss": "Não sugerir de novo",
@@ -170,6 +177,7 @@
"suggest.ippUsb.unavailable": "{packages} não está nas fontes de pacotes deste computador.",
"suggest.ippUsb.why": "Detectamos uma impressora USB que pode imprimir e digitalizar sem driver do fabricante (IPP por USB).",
"suggest.job": "Instalando {name}",
+ "suggest.none": "Nada a sugerir para este computador",
"suggest.nonfreeBadge": "Não é software livre",
"suggest.note.firmware": "Firmware é um pequeno programa que roda dentro do próprio dispositivo, não no processador do computador; a licença não permite modificá-lo.",
"suggest.note.nonfree": "Não é software livre: vem do componente {component} do Debian, com a licença do fabricante.",
diff --git a/docs/UPDATES.md b/docs/UPDATES.md
index e5f2ddd..6ca3461 100644
--- a/docs/UPDATES.md
+++ b/docs/UPDATES.md
@@ -331,6 +331,33 @@ under the vendor's own names (the key dearmored because the name ends in `.gpg`)
come only from the root-owned catalog and pass a strict character set (`lordos*` source names are
refused).
+## The Store's banner
+
+Store → Discover opens with a banner LordOS can change between releases. Its source is in the
+repository: `apt/featured/featured.json` and `apt/featured/banner.png` (1400 × 340 works; the picture
+is drawn with `objectFit: cover` under a shade on the text side). The JSON:
+
+```json
+{
+ "schema": 1,
+ "catalog": "llama.cpp", // a catalog app id (apt/catalog.json), or "package": "<Debian package>"
+ "kicker": { "en": "…", "es": "…", "pt": "…" },
+ "title": { "en": "…", "es": "…", "pt": "…" },
+ "text": { "en": "…", "es": "…", "pt": "…" },
+ "colors": ["#1c1638", "#3a2f8a"] // the gradient under the picture
+}
+```
+
+`tools/release/apt-repo.sh build` checks both (a schema 1 object of at most 64 KB; a PNG of at most
+2 MB) and publishes them as `dists/stable/main/featured/Featured` and `…/Banner`, listed in the
+signed Release. The package engine (`server/src/pkg/pkg.c`, `featured_valid`/`banner_valid`) fetches
+them on each list update only from a source whose signed Release says `Origin: LordOS`, checks their
+hashes like every index, parses the JSON and the PNG signature, and writes
+`/var/lib/lordos/pkg/featured.json` and `featured.png`; `lord.pkg.featured()` reads them, with no
+arguments. Without them the Store shows a skeleton until the first list update, and a catalog app
+when the repository publishes no banner. To change it: edit the two files, rebuild and publish the
+repository; machines see it at their next list update.
+
## The Raspberry Pi kernel
The LordOS kernel for the Pi 5 (`linux-image-<version>-lordos-rpi-2712`, from
diff --git a/server/Makefile b/server/Makefile
index 30a54c8..5e920bd 100644
--- a/server/Makefile
+++ b/server/Makefile
@@ -225,7 +225,7 @@ build/wasm-js-test: tests/wasm_js_test.c src/ui/js_wasm.c src/ui/js_wasm.h $(WAS
build/wasm-test: tests/wasm_test.c $(WASM_SRC) src/wasm/wasm.h src/wasm/wasm_int.h
@mkdir -p build
$(CC) $(CPPFLAGS) $(CFLAGS) $(WARN) -std=c11 -o $@ tests/wasm_test.c $(WASM_SRC) -lm
-PKG_SRC := src/pkg/crypto.c src/pkg/pgp.c src/pkg/xz.c src/pkg/deb.c src/pkg/idx.c src/pkg/pin.c src/pkg/status.c src/pkg/resolve.c src/pkg/http.c src/pkg/pkg.c
+PKG_SRC := src/pkg/crypto.c src/pkg/pgp.c src/pkg/xz.c src/pkg/deb.c src/pkg/idx.c src/pkg/pin.c src/pkg/status.c src/pkg/resolve.c src/pkg/http.c src/pkg/pkg.c src/sec/json.c
build/pkg-test: tests/pkg_test.c $(PKG_SRC) src/sec/cgroup.c build/obj/ui/stb.o src/admin.h $(wildcard src/pkg/*.h)
@mkdir -p build
$(CC) $(CPPFLAGS) $(CFLAGS) $(WARN) -std=c11 -o $@ tests/pkg_test.c $(PKG_SRC) src/sec/cgroup.c build/obj/ui/stb.o -lm
diff --git a/server/src/pkg/pkg.c b/server/src/pkg/pkg.c
index 55d3bca..35007b4 100644
--- a/server/src/pkg/pkg.c
+++ b/server/src/pkg/pkg.c
@@ -15,6 +15,7 @@
* (phases: lists, index, download, unpack, configure, remove) and "plan <action> <package>
* <version> <bytes>" before starting; the rest of the LOGs are text to display. */
#include "pkg.h"
+#include "../sec/json.h"
#include "crypto.h"
#include "deb.h"
#include "http.h"
@@ -450,7 +451,38 @@ static void write_notes(const char *notes, size_t len) {
if (!ok || rename(PKG_DIR "/.notes.new", PKG_DIR "/notes")) unlink(PKG_DIR "/.notes.new");
}
-typedef struct { char path[PATH_MAX]; char ext[4]; int kind, src; char comp[48]; } Wanted; /* kind 0 Packages, 1 Translation, 2 DEP-11, 3 icons, 4 release notes */
+/* The Store's banner (Store → Discover, apt/featured/ in the repository): a small JSON object and a
+ * PNG, both listed in LordOS's signed InRelease. The JSON is checked to parse here and again by the
+ * Store; the PNG only by its signature and size (it is drawn like the DEP-11 icons). Without them the
+ * Store shows its own banner. */
+#define FEATURED_MAX (64u << 10)
+#define BANNER_MAX (2u << 20)
+static int featured_valid(const uint8_t *t, size_t n) {
+ if (!n || n > FEATURED_MAX) return 0;
+ JDoc d;
+ if (json_parse((const char *)t, n, &d, NULL, 0)) return 0;
+ int ok = d.root && d.root->type == J_OBJ;
+ json_free(&d);
+ return ok;
+}
+static int banner_valid(const uint8_t *t, size_t n) {
+ static const uint8_t png[8] = { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n' };
+ return n > 8 && n <= BANNER_MAX && !memcmp(t, png, 8);
+}
+static void write_one(const char *path, const char *tmp, const uint8_t *d, size_t n) {
+ if (!d || !n) { unlink(path); return; }
+ int fd = open(tmp, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW, 0644);
+ if (fd < 0) return;
+ int ok = write(fd, d, n) == (ssize_t)n;
+ if (close(fd)) ok = 0;
+ if (!ok || rename(tmp, path)) unlink(tmp);
+}
+static void write_featured(const uint8_t *feat, size_t fl, const uint8_t *img, size_t il) {
+ write_one(PKG_DIR "/featured.json", PKG_DIR "/.featured.json.new", feat, fl);
+ write_one(PKG_DIR "/featured.png", PKG_DIR "/.featured.png.new", feat ? img : NULL, il);
+}
+
+typedef struct { char path[PATH_MAX]; char ext[4]; int kind, src; char comp[48]; } Wanted; /* kind 0 Packages, 1 Translation, 2 DEP-11, 3 icons, 4 release notes, 5 featured, 6 banner */
static int file_ok(const char *path, uint64_t size) {
struct stat st;
@@ -594,12 +626,15 @@ void pkg_act_update(const AdminReq *r, const char *arg, size_t len) {
for (int c = 0; c < src[i].ncomp; c++) {
char base[200];
const char *ext;
- for (int k = 0; k < 5; k++) {
+ for (int k = 0; k < 7; k++) {
+ if (k >= 5 && strcmp(R[i].origin, "LordOS")) continue; /* the Store's banner: LordOS's repository only */
if (k == 0) snprintf(base, sizeof base, "%s/binary-%s/Packages", src[i].comps[c], arch);
else if (k == 1) snprintf(base, sizeof base, "%s/i18n/Translation-en", src[i].comps[c]);
else if (k == 2) snprintf(base, sizeof base, "%s/dep11/Components-%s.yml", src[i].comps[c], arch);
else if (k == 3) snprintf(base, sizeof base, "%s/dep11/icons-64x64.tar", src[i].comps[c]);
- else snprintf(base, sizeof base, "%s/notes/ReleaseNotes", src[i].comps[c]); /* LordOS's release notes */
+ else if (k == 4) snprintf(base, sizeof base, "%s/notes/ReleaseNotes", src[i].comps[c]); /* LordOS's release notes */
+ else if (k == 5) snprintf(base, sizeof base, "%s/featured/Featured", src[i].comps[c]); /* the Store's banner (JSON) */
+ else snprintf(base, sizeof base, "%s/featured/Banner", src[i].comps[c]); /* and its image (PNG) */
const RelFile *f = rel_pick(&R[i], base, &ext);
if (k == 2 && f && !strcmp(ext, "")) f = NULL; /* the uncompressed YAML is huge */
if (!f) { if (k == 0) admin_log("pkg.sourceMissingFile", "uri", src[i].uri, "suite", src[i].suite, "file", base, NULL); continue; }
@@ -638,6 +673,7 @@ void pkg_act_update(const AdminReq *r, const char *arg, size_t len) {
progress("lists", (uint64_t)ns, (uint64_t)ns);
/* release notes listed but not stored yet (an index built before LordOS read them): rebuild */
for (int k = 0; k < nw && !changed; k++) if (w[k].kind == 4 && access(PKG_DIR "/notes", F_OK)) changed = 1;
+ for (int k = 0; k < nw && !changed; k++) if (w[k].kind == 5 && access(PKG_DIR "/featured.json", F_OK)) changed = 1;
/* a component or source added or removed: the same InRelease files, other lists */
char sum[65];
wanted_sum(w, nw, sum);
@@ -715,16 +751,27 @@ void pkg_act_update(const AdminReq *r, const char *arg, size_t len) {
int pk_files = 0, pk_missing = 0;
char *notes = NULL; /* every source's ReleaseNotes, one after the other */
size_t notes_len = 0;
- for (int pass = 0; pass < 5; pass++)
+ uint8_t *feat = NULL, *banner = NULL; /* the Store's banner: its JSON and its PNG */
+ size_t feat_len = 0, banner_len = 0;
+ for (int pass = 0; pass < 7; pass++)
for (int k = 0; k < nw; k++) {
Wanted *x = &w[k];
if (x->kind != pass || !good[x->src]) continue;
- progress("index", (uint64_t)(pass * nw + k), (uint64_t)(5 * nw));
+ progress("index", (uint64_t)(pass * nw + k), (uint64_t)(7 * nw));
if (srcid[x->src] < 0) {
Release *rr = &R[x->src];
int prio = rr->not_auto ? (rr->but_auto ? 100 : 1) : 500;
srcid[x->src] = idxb_source(b, src[x->src].uri, src[x->src].suite, x->comp, rr->codename, rr->origin, rr->label, rr->date, rr->valid_until, prio);
}
+ if (pass >= 5) { /* the banner: one of each, checked here; drawn by the Store */
+ size_t tl;
+ uint8_t *t = load_index_file(x->path, x->ext, &tl);
+ int okf = t && (pass == 5 ? featured_valid(t, tl) : banner_valid(t, tl));
+ if (okf && pass == 5 && !feat) { feat = t; feat_len = tl; t = NULL; }
+ else if (okf && pass == 6 && !banner) { banner = t; banner_len = tl; t = NULL; }
+ free(t);
+ continue;
+ }
if (pass == 4) {
size_t tl;
uint8_t *t = load_index_file(x->path, x->ext, &tl);
@@ -764,6 +811,9 @@ void pkg_act_update(const AdminReq *r, const char *arg, size_t len) {
int wrote = pk_files && !idxb_write(b, PKG_DIR, arch, err, sizeof err);
if (wrote) icons_cleanup(b);
if (wrote) write_notes(notes, notes_len);
+ if (wrote) write_featured(feat, feat_len, banner, banner_len);
+ free(feat);
+ free(banner);
if (wrote && !failures) sources_save(sum);
free(notes);
uint32_t count = idxb_count(b);
diff --git a/server/src/ui/js_pkg.c b/server/src/ui/js_pkg.c
index 31e0e58..b74cdc5 100644
--- a/server/src/ui/js_pkg.c
+++ b/server/src/ui/js_pkg.c
@@ -550,6 +550,37 @@ static JSValue f_icon(JSContext *c, JSValueConst this_val, int argc, JSValueCons
/* lord.pkg.releaseNotes(name, version) → Markdown text or null: the release notes a source publishes
* for that version (ReleaseNotes in its signed Release, stored by pkg-update; docs/UPDATES.md). */
+/* lord.pkg.featured(): the Store's banner the last update verified (pkg.c, featured_valid), as
+ * { data: <the JSON object>, image: path or null }, or null without one. No arguments, read-only. */
+static JSValue f_featured(JSContext *c, JSValueConst this_val, int argc, JSValueConst *argv) {
+ (void)this_val; (void)argc; (void)argv;
+ int fd = open(PKG_DIR "/featured.json", O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
+ if (fd < 0) return JS_NULL;
+ struct stat st;
+ char *buf = NULL;
+ size_t got = 0;
+ if (!fstat(fd, &st) && S_ISREG(st.st_mode) && st.st_size > 0 && st.st_size <= (64 << 10) && (buf = malloc((size_t)st.st_size + 1))) {
+ while (got < (size_t)st.st_size) {
+ ssize_t r = read(fd, buf + got, (size_t)st.st_size - got);
+ if (r <= 0) break;
+ got += (size_t)r;
+ }
+ buf[got] = 0;
+ }
+ close(fd);
+ if (!buf || got != (size_t)st.st_size) { free(buf); return JS_NULL; }
+ JSValue data = JS_ParseJSON(c, buf, got, "featured.json");
+ free(buf);
+ if (JS_IsException(data)) { JS_FreeValue(c, JS_GetException(c)); return JS_NULL; }
+ if (!JS_IsObject(data)) { JS_FreeValue(c, data); return JS_NULL; }
+ JSValue o = JS_NewObject(c);
+ JS_SetPropertyStr(c, o, "data", data);
+ struct stat is;
+ int img = !lstat(PKG_DIR "/featured.png", &is) && S_ISREG(is.st_mode);
+ JS_SetPropertyStr(c, o, "image", img ? JS_NewString(c, PKG_DIR "/featured.png") : JS_NULL);
+ return o;
+}
+
static JSValue f_release_notes(JSContext *c, JSValueConst this_val, int argc, JSValueConst *argv) {
(void)this_val;
char name[129], ver[129];
@@ -609,6 +640,7 @@ static JSValue f_reboot_required(JSContext *c, JSValueConst this_val, int argc,
static const JSCFunctionListEntry pkg_funcs[] = {
JS_CFUNC_DEF("releaseNotes", 2, f_release_notes),
+ JS_CFUNC_DEF("featured", 0, f_featured),
JS_CFUNC_DEF("rebootRequired", 0, f_reboot_required),
JS_CFUNC_DEF("available", 0, f_available),
JS_CFUNC_DEF("lastUpdate", 0, f_last_update),
diff --git a/tools/release/apt-repo.sh b/tools/release/apt-repo.sh
index 1e17eda..018de37 100755
--- a/tools/release/apt-repo.sh
+++ b/tools/release/apt-repo.sh
@@ -327,6 +327,24 @@ do_build() {
done
xz -9 -k -f "$TREE/$D/main/notes/ReleaseNotes"
+ # the Store's banner (Store → Discover): apt/featured/featured.json and apt/featured/banner.png,
+ # edited in the repository and signed here with the indexes (the engine reads them only from this
+ # repository, docs/UPDATES.md "The Store's banner")
+ rm -rf "$TREE/$D/main/featured"
+ if [ -f "$ROOT/apt/featured/featured.json" ]; then
+ python3 -I -c 'import json,sys; d=json.load(open(sys.argv[1])); assert isinstance(d,dict) and d.get("schema")==1' "$ROOT/apt/featured/featured.json" ||
+ die "apt/featured/featured.json is not a schema 1 JSON object"
+ [ "$(wc -c < "$ROOT/apt/featured/featured.json")" -le 65536 ] || die "apt/featured/featured.json is over 64 KB"
+ mkdir -p "$TREE/$D/main/featured"
+ cp "$ROOT/apt/featured/featured.json" "$TREE/$D/main/featured/Featured"
+ if [ -f "$ROOT/apt/featured/banner.png" ]; then
+ [ "$(head -c 8 "$ROOT/apt/featured/banner.png" | od -An -tx1 | tr -d ' \n')" = 89504e470d0a1a0a ] || die "apt/featured/banner.png is not a PNG"
+ [ "$(wc -c < "$ROOT/apt/featured/banner.png")" -le 2097152 ] || die "apt/featured/banner.png is over 2 MB"
+ cp "$ROOT/apt/featured/banner.png" "$TREE/$D/main/featured/Banner"
+ fi
+ echo " featured banner: $(python3 -I -c 'import json,sys; d=json.load(open(sys.argv[1])); print(d.get("catalog") or d.get("package") or "?")' "$ROOT/apt/featured/featured.json")"
+ fi
+
debtool apt-ftparchive \
-o APT::FTPArchive::Release::Origin=LordOS \
-o APT::FTPArchive::Release::Label=LordOS \
@@ -336,6 +354,7 @@ do_build() {
-o APT::FTPArchive::Release::Components=main \
-o APT::FTPArchive::Release::Description="LordOS updates for Debian 13 (trixie)" \
-o APT::FTPArchive::Release::Patterns::=ReleaseNotes -o APT::FTPArchive::Release::Patterns::=ReleaseNotes.xz \
+ -o APT::FTPArchive::Release::Patterns::=Featured -o APT::FTPArchive::Release::Patterns::=Banner \
release "$D" > "$TREE/Release.new"
mv "$TREE/Release.new" "$TREE/$D/Release"