Files
moho/package.json
T
Salastil 0143e41355 Make the frontend agree with the daemon on every system
Four things assumed Linux, and two of them would have failed silently
rather than loudly, which is the worse kind.

The socket path is the contract's other half. Node needs no help with the
difference beyond the name - net.createConnection speaks Unix sockets or
named pipes according to what it is handed - so only the string changes,
but it has to match nobilis's ipc::default_endpoint exactly. A
disagreement here is a client that never finds a daemon that is running
perfectly well.

The media allowlist computed XDG paths unconditionally. This is the
predicate deciding which local files the renderer may load, and it has to
agree with Rust's `dirs` crate, which is what actually wrote the files -
not with Electron's own getPath, which answers for this application and
points somewhere nobilis never writes. On Windows the XDG guess resolves
to a .cache directory under the profile that nothing writes to, so the
check would have failed closed and blanked every avatar and every
attachment the daemon fetched, with nothing in the UI to say why.

Two path bugs went with it. A Windows absolute path starts at a drive
letter rather than a slash, so a bare C:\... arrived looking like a
remote URL and was handed to the renderer unresolved - which under
contextIsolation shows nothing at all. And file:///C:/x leaves a leading
slash that Windows reads as a path relative to the current drive. Both
mean the same file; both are accepted now.

Path comparison in the allowlist is case-insensitive where the filesystem
is. C:\Users and c:\users name the same file while startsWith calls them
different - failing closed, so it leaks nothing, but a media allowlist
that silently blanks half the avatars is still broken.

Quitting now asks over the socket on every platform instead of
signalling. A signal is not a portable way to say "shut down cleanly":
Windows has no SIGTERM and Node maps it onto TerminateProcess, which
would skip the QUITs whose absence leaves a ghost session holding the
nick until the network times it out. The shutdown RPC means the same
thing everywhere, and is a request rather than an end that cannot be
refused.

Packaging gains a Windows target - NSIS, not one-click, installing per
user - and the daemon binary is named per platform in both the packaged
and the development lookup.

Submodule moves to the matching daemon.
2026-08-28 18:33:44 -04:00

98 lines
2.6 KiB
JSON

{
"name": "moho",
"version": "0.1.0",
"description": "Unified desktop chat client for IRC, Discord, Sneedchat and Matrix",
"author": "Salastil",
"license": "GPL-3.0-or-later",
"homepage": "https://git.salastil.com/Salastil/moho",
"main": "./out/main/index.js",
"scripts": {
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"start": "electron-vite preview",
"typecheck": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.web.json",
"pack": "npm run daemon && npm run build && electron-builder --linux AppImage",
"pack:dir": "npm run daemon && npm run build && electron-builder --linux dir",
"daemon": "cargo build --release --manifest-path nobilis/Cargo.toml",
"deploy": "npm run pack && ./scripts/install-desktop.sh",
"pack:win": "npm run daemon && npm run build && electron-builder --win nsis"
},
"dependencies": {
"@electron-toolkit/preload": "^3.0.1",
"@electron-toolkit/utils": "^3.0.0"
},
"devDependencies": {
"@types/node": "^22.10.2",
"@types/react": "^18.3.17",
"@types/react-dom": "^18.3.5",
"@vitejs/plugin-react": "^4.3.4",
"electron": "^33.2.1",
"electron-builder": "^25.1.8",
"electron-vite": "^2.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.7.2",
"vite": "^5.4.11"
},
"build": {
"appId": "com.salastil.moho",
"productName": "moho",
"files": [
"out/**/*"
],
"extraResources": [
{
"from": "nobilis/resources/sockchat-smilies",
"to": "sockchat-smilies"
},
{
"from": "resources/icons",
"to": "icons"
}
],
"linux": {
"target": [
"AppImage"
],
"category": "Network",
"icon": "resources/icons/moho.png",
"desktop": {
"Name": "moho",
"Comment": "Unified chat client for IRC, Discord, Sneedchat and Matrix"
},
"extraResources": [
{
"from": "nobilis/target/release/nobilis",
"to": "nobilis"
}
]
},
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
],
"icon": "resources/icons/moho.png",
"extraResources": [
{
"from": "nobilis/target/release/nobilis.exe",
"to": "nobilis.exe"
}
]
},
"nsis": {
"oneClick": false,
"allowToChangeInstallationDirectory": true,
"perMachine": false
}
},
"allowScripts": {
"[email protected]": true,
"[email protected]": true
}
}