@geminilight/mindos 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/components/SettingsModal.tsx +8 -7
- package/bin/cli.js +15 -2
- package/package.json +1 -1
|
@@ -26,19 +26,20 @@ export default function SettingsModal({ open, onClose }: SettingsModalProps) {
|
|
|
26
26
|
const [status, setStatus] = useState<'idle' | 'saved' | 'error' | 'load-error'>('idle');
|
|
27
27
|
const { t, locale, setLocale } = useLocale();
|
|
28
28
|
|
|
29
|
-
// Appearance state (localStorage-based)
|
|
30
|
-
const [font, setFont] = useState(
|
|
31
|
-
const [contentWidth, setContentWidth] = useState(
|
|
32
|
-
const [dark, setDark] = useState(
|
|
33
|
-
const stored = localStorage.getItem('theme');
|
|
34
|
-
return stored ? stored === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
35
|
-
});
|
|
29
|
+
// Appearance state (localStorage-based)
|
|
30
|
+
const [font, setFont] = useState('lora');
|
|
31
|
+
const [contentWidth, setContentWidth] = useState('780px');
|
|
32
|
+
const [dark, setDark] = useState(true);
|
|
36
33
|
// Plugin enabled state
|
|
37
34
|
const [pluginStates, setPluginStates] = useState<Record<string, boolean>>({});
|
|
38
35
|
|
|
39
36
|
useEffect(() => {
|
|
40
37
|
if (!open) return;
|
|
41
38
|
apiFetch<SettingsData>('/api/settings').then(setData).catch(() => setStatus('load-error'));
|
|
39
|
+
setFont(localStorage.getItem('prose-font') ?? 'lora');
|
|
40
|
+
setContentWidth(localStorage.getItem('content-width') ?? '780px');
|
|
41
|
+
const stored = localStorage.getItem('theme');
|
|
42
|
+
setDark(stored ? stored === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
42
43
|
loadDisabledState();
|
|
43
44
|
const initial: Record<string, boolean> = {};
|
|
44
45
|
for (const r of getAllRenderers()) initial[r.id] = isRendererEnabled(r.id);
|
package/bin/cli.js
CHANGED
|
@@ -240,6 +240,7 @@ const systemd = {
|
|
|
240
240
|
install() {
|
|
241
241
|
if (!existsSync(SYSTEMD_DIR)) mkdirSync(SYSTEMD_DIR, { recursive: true });
|
|
242
242
|
ensureMindosDir();
|
|
243
|
+
const currentPath = process.env.PATH ?? '/usr/local/bin:/usr/bin:/bin';
|
|
243
244
|
const unit = [
|
|
244
245
|
'[Unit]',
|
|
245
246
|
'Description=MindOS app + MCP server',
|
|
@@ -251,6 +252,7 @@ const systemd = {
|
|
|
251
252
|
'Restart=on-failure',
|
|
252
253
|
'RestartSec=3',
|
|
253
254
|
`Environment=HOME=${homedir()}`,
|
|
255
|
+
`Environment=PATH=${currentPath}`,
|
|
254
256
|
`EnvironmentFile=-${resolve(MINDOS_DIR, 'env')}`,
|
|
255
257
|
`StandardOutput=append:${LOG_PATH}`,
|
|
256
258
|
`StandardError=append:${LOG_PATH}`,
|
|
@@ -324,6 +326,9 @@ const launchd = {
|
|
|
324
326
|
install() {
|
|
325
327
|
if (!existsSync(LAUNCHD_DIR)) mkdirSync(LAUNCHD_DIR, { recursive: true });
|
|
326
328
|
ensureMindosDir();
|
|
329
|
+
// Capture current PATH so the daemon can find npm/node even when launched by
|
|
330
|
+
// launchd (which only sets a minimal PATH and doesn't source shell profiles).
|
|
331
|
+
const currentPath = process.env.PATH ?? '/usr/local/bin:/usr/bin:/bin';
|
|
327
332
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
328
333
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
329
334
|
<plist version="1.0">
|
|
@@ -342,6 +347,7 @@ const launchd = {
|
|
|
342
347
|
<key>EnvironmentVariables</key>
|
|
343
348
|
<dict>
|
|
344
349
|
<key>HOME</key><string>${homedir()}</string>
|
|
350
|
+
<key>PATH</key><string>${currentPath}</string>
|
|
345
351
|
</dict>
|
|
346
352
|
</dict>
|
|
347
353
|
</plist>
|
|
@@ -349,8 +355,15 @@ const launchd = {
|
|
|
349
355
|
writeFileSync(LAUNCHD_PLIST, plist, 'utf-8');
|
|
350
356
|
console.log(green(`✔ Wrote ${LAUNCHD_PLIST}`));
|
|
351
357
|
try {
|
|
352
|
-
execSync(`launchctl bootstrap gui/${launchctlUid()} ${LAUNCHD_PLIST}`, { stdio: '
|
|
353
|
-
} catch {
|
|
358
|
+
execSync(`launchctl bootstrap gui/${launchctlUid()} ${LAUNCHD_PLIST}`, { stdio: 'pipe' });
|
|
359
|
+
} catch (e) {
|
|
360
|
+
const msg = e.stderr?.toString() ?? e.message ?? '';
|
|
361
|
+
// Error 5 (ENOENT / already loaded) is benign — service is already bootstrapped
|
|
362
|
+
if (!msg.includes('5:') && !msg.includes('already')) {
|
|
363
|
+
console.error(yellow(` ⚠ launchctl bootstrap: ${msg.trim()}`));
|
|
364
|
+
console.error(dim(' If this persists, try: launchctl bootout gui/$(id -u)/com.mindos.app'));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
354
367
|
console.log(green('✔ Service installed'));
|
|
355
368
|
},
|
|
356
369
|
|
package/package.json
CHANGED