Compare commits

65 Commits

Author SHA1 Message Date
GitHub Actions
d4d4c73c2b chore: bump version to 4.11.163 [skip ci] 2026-07-24 06:01:21 +00:00
73fbc1c77a Bump cinny: hide Jump to Latest when scrolled to live bottom.
Some checks failed
Build / increment-version (push) Successful in 12s
Build / build-windows (push) Successful in 3m30s
Build / build-linux (push) Failing after 7m44s
Build / create-release (push) Has been cancelled
2026-07-24 16:01:06 +10:00
GitHub Actions
3dc732521f chore: bump version to 4.11.162 [skip ci] 2026-07-23 05:18:40 +00:00
b76aa3fe4a Add mock auto-updater in dev and title-bar download progress.
All checks were successful
Build / increment-version (push) Successful in 11s
Build / build-linux (push) Successful in 1m54s
Build / build-windows (push) Successful in 3m36s
Build / create-release (push) Successful in 1m13s
2026-07-23 15:18:25 +10:00
GitHub Actions
c0d1e87b8d chore: bump version to 4.11.161 [skip ci] 2026-07-23 05:14:07 +00:00
04d4026e78 Fix Linux SSO return via paarrot://desktop and protocol handler repair.
Some checks failed
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m55s
Build / build-windows (push) Successful in 3m35s
Build / create-release (push) Has been cancelled
2026-07-23 15:13:54 +10:00
GitHub Actions
cfbc59d6a9 chore: bump version to 4.11.160 [skip ci] 2026-07-23 04:58:11 +00:00
dfe42fa942 Sync cinny: remove editor autocorrect workaround.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m54s
Build / build-windows (push) Successful in 3m35s
Build / create-release (push) Successful in 1m12s
2026-07-23 14:57:58 +10:00
GitHub Actions
6a8397425e chore: bump version to 4.11.159 [skip ci] 2026-07-23 04:52:37 +00:00
641ec26142 Sync cinny: Shared Media drawer and same-room navigation fixes.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m59s
Build / build-windows (push) Successful in 3m47s
Build / create-release (push) Successful in 1m12s
2026-07-23 14:52:23 +10:00
GitHub Actions
1eaf246806 chore: bump version to 4.11.158 [skip ci] 2026-07-22 14:24:31 +00:00
0e97e4d3b6 Sync cinny: Stationery and Stationery Dark themes.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m58s
Build / build-windows (push) Successful in 3m37s
Build / create-release (push) Successful in 1m13s
2026-07-23 00:24:17 +10:00
GitHub Actions
1636a8d0c6 chore: bump version to 4.11.157 [skip ci] 2026-07-22 10:29:14 +00:00
ac236750aa Sync cinny: fix jumbo emoji regex for production builds.
All checks were successful
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Successful in 1m52s
Build / build-windows (push) Successful in 3m40s
Build / create-release (push) Successful in 1m12s
2026-07-22 20:29:00 +10:00
GitHub Actions
7e747e6c36 chore: bump version to 4.11.156 [skip ci] 2026-07-22 10:14:27 +00:00
1b2cae5b12 Sync cinny: fix jumbo emoji in production builds.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m56s
Build / build-windows (push) Successful in 3m42s
Build / create-release (push) Successful in 1m11s
2026-07-22 20:14:15 +10:00
GitHub Actions
76921c4e79 chore: bump version to 4.11.155 [skip ci] 2026-07-22 10:00:52 +00:00
688efff7c9 Sync cinny submodule and stop Vite from opening a browser on dev.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m55s
Build / build-windows (push) Successful in 3m36s
Build / create-release (push) Successful in 1m13s
Pull in timeline scroll memory, media height reservation, avatar caching, jumbo emoji, and Unicode 15 emoji font coverage.
2026-07-22 20:00:38 +10:00
GitHub Actions
9bc377b62a chore: bump version to 4.11.154 [skip ci] 2026-07-22 09:11:11 +00:00
836ccce7a3 Revert cinny to pre-jumbo emoji baseline.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m57s
Build / build-windows (push) Successful in 3m37s
Build / create-release (push) Successful in 1m13s
Roll back submodule to 154f4dfd before jumbo emoji and related styling regressions.
2026-07-22 19:10:58 +10:00
GitHub Actions
34c8e6e38c chore: bump version to 4.11.153 [skip ci] 2026-07-22 09:03:00 +00:00
e69bda3aa6 Bump cinny: fix production chat text color in Electron builds.
All checks were successful
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Successful in 1m51s
Build / build-windows (push) Successful in 3m43s
Build / create-release (push) Successful in 1m13s
2026-07-22 19:02:46 +10:00
GitHub Actions
5d55e5d826 chore: bump version to 4.11.152 [skip ci] 2026-07-22 08:37:39 +00:00
b5902b9fc3 Bump cinny: fix production CSS loading in Electron build.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m51s
Build / build-windows (push) Successful in 3m34s
Build / create-release (push) Successful in 1m12s
2026-07-22 18:37:26 +10:00
GitHub Actions
f60cf0bd3c chore: bump version to 4.11.151 [skip ci] 2026-07-22 08:21:32 +00:00
83dec0ef54 Bump cinny: fix black chat pane and jumbo emoji rendering.
All checks were successful
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Successful in 1m50s
Build / build-windows (push) Successful in 3m35s
Build / create-release (push) Successful in 1m12s
2026-07-22 18:21:18 +10:00
GitHub Actions
40a76f02cd chore: bump version to 4.11.150 [skip ci] 2026-07-22 08:02:08 +00:00
3def3cc456 Bump cinny: instant room switches, perf cleanup, members drawer prefs.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m53s
Build / build-windows (push) Successful in 3m42s
Build / create-release (push) Successful in 1m13s
2026-07-22 18:01:53 +10:00
GitHub Actions
30bd67d43a chore: bump version to 4.11.149 [skip ci] 2026-07-22 06:16:20 +00:00
ffeccee680 Bump cinny: media placeholders, avatar blob cache, jumbo emoji.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / build-linux (push) Successful in 1m58s
Build / build-windows (push) Successful in 3m50s
Build / create-release (push) Successful in 1m13s
2026-07-22 14:42:19 +10:00
GitHub Actions
facbeee024 chore: bump version to 4.11.148 [skip ci] 2026-07-21 06:21:51 +00:00
09102c7903 Bump cinny: fix jumbo emoji actually rendering at 100px.
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m55s
Build / build-windows (push) Successful in 5m42s
Build / create-release (push) Successful in 1m13s
2026-07-21 16:21:37 +10:00
GitHub Actions
fa33ec7ac8 chore: bump version to 4.11.147 [skip ci] 2026-07-21 05:56:18 +00:00
c44f5cf14a Bump cinny: fix jumbo standalone emoji sizing.
All checks were successful
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Successful in 1m57s
Build / build-windows (push) Successful in 5m21s
Build / create-release (push) Successful in 1m14s
2026-07-21 15:56:03 +10:00
GitHub Actions
27793d7c4f chore: bump version to 4.11.146 [skip ci] 2026-07-21 05:38:44 +00:00
32b2902ef7 Bump cinny: fix jumbo emoji vanilla-extract build.
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 2m2s
Build / build-windows (push) Successful in 3m33s
Build / create-release (push) Successful in 1m13s
2026-07-21 15:38:29 +10:00
GitHub Actions
5cdb318854 chore: bump version to 4.11.145 [skip ci] 2026-07-21 05:34:16 +00:00
a28f05bb88 Bump cinny: theme polish, jumbo emoji, and Windows autocorrect fix.
Some checks failed
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Failing after 44s
Build / build-windows (push) Failing after 1m4s
Build / create-release (push) Has been skipped
2026-07-21 15:34:00 +10:00
GitHub Actions
cecfe73b2e chore: bump version to 4.11.144 [skip ci] 2026-07-14 17:31:07 +00:00
b458c7918c chore: bump cinny submodule for emoji font spacing fix
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 2m3s
Build / build-windows (push) Successful in 5m10s
Build / create-release (push) Successful in 1m13s
2026-07-15 03:30:53 +10:00
GitHub Actions
d8660f4822 chore: bump version to 4.11.143 [skip ci] 2026-07-12 16:40:22 +00:00
dad83773a6 Bump cinny: Twemoji digit fix and Slate emoji focus crash
All checks were successful
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Successful in 1m55s
Build / build-windows (push) Successful in 4m48s
Build / create-release (push) Successful in 1m12s
2026-07-13 02:40:08 +10:00
GitHub Actions
d2d35de46b chore: bump version to 4.11.142 [skip ci] 2026-07-12 16:25:25 +00:00
c752ec0b38 Bump cinny: fix noise/echo cancellation settings
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m57s
Build / build-windows (push) Successful in 5m5s
Build / create-release (push) Successful in 1m13s
2026-07-13 02:25:10 +10:00
GitHub Actions
28752eb56e chore: bump version to 4.11.141 [skip ci] 2026-07-12 08:15:59 +00:00
4f243a0fcf Bump cinny: fix vanilla-extract presence CSS build failure.
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m57s
Build / build-windows (push) Successful in 4m48s
Build / create-release (push) Successful in 1m13s
2026-07-12 18:15:44 +10:00
GitHub Actions
9bce616f26 chore: bump version to 4.11.140 [skip ci] 2026-07-11 22:19:18 +00:00
f16ab73c9a Allow git deps in npm and bump cinny submodule.
Some checks failed
Build / increment-version (push) Successful in 13s
Build / build-linux (push) Failing after 42s
Build / build-windows (push) Failing after 1m47s
Build / create-release (push) Has been skipped
2026-07-12 08:19:03 +10:00
GitHub Actions
c29a15e073 chore: bump version to 4.11.139 [skip ci] 2026-07-11 21:52:03 +00:00
f5fe61e3eb hidden shit, and online status bars, search settings
Some checks failed
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Failing after 42s
Build / build-windows (push) Failing after 1m29s
Build / create-release (push) Has been skipped
2026-07-12 07:51:47 +10:00
GitHub Actions
a1a752b0fb chore: bump version to 4.11.138 [skip ci] 2026-07-11 21:15:56 +00:00
7769250875 Removed invalid channels
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m56s
Build / build-windows (push) Successful in 4m36s
Build / create-release (push) Successful in 1m13s
2026-07-12 07:15:28 +10:00
GitHub Actions
b3af9f3185 chore: bump version to 4.11.137 [skip ci] 2026-07-10 11:40:45 +00:00
7906326790 update base
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m56s
Build / build-windows (push) Successful in 4m56s
Build / create-release (push) Successful in 1m13s
2026-07-10 21:40:27 +10:00
GitHub Actions
3b4babb9d7 chore: bump version to 4.11.136 [skip ci] 2026-07-08 18:22:44 +00:00
4b284ec747 Merge branch 'main' of http://synbox.ruv.wtf:8418/litruv/cinny-desktop
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 2m0s
Build / build-windows (push) Successful in 3m28s
Build / create-release (push) Successful in 1m12s
2026-07-09 04:22:28 +10:00
e1b4cfb9c8 chore: bump cinny submodule for compact nav and back routing fixes 2026-07-09 04:22:14 +10:00
GitHub Actions
c0266903ec chore: bump version to 4.11.135 [skip ci] 2026-07-08 16:35:39 +00:00
81964d6f14 chore: bump cinny submodule for React Router 7 routing fixes
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 1m57s
Build / build-windows (push) Successful in 4m33s
Build / create-release (push) Successful in 1m15s
2026-07-09 02:35:18 +10:00
GitHub Actions
47e025cf55 chore: bump version to 4.11.134 [skip ci] 2026-07-08 15:56:06 +00:00
b400070ad0 chore: bump cinny submodule for sync recovery and toolchain upgrades
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 2m19s
Build / build-windows (push) Successful in 3m48s
Build / create-release (push) Successful in 1m14s
2026-07-09 01:55:21 +10:00
529694ce66 chore: update dependencies and improve external link handling in main.js 2026-07-09 01:52:52 +10:00
GitHub Actions
791c3ab4df chore: bump version to 4.11.133 [skip ci] 2026-07-06 06:07:10 +00:00
de8d9db795 chore: update subproject commit reference in cinny to indicate dirty state
All checks were successful
Build / increment-version (push) Successful in 14s
Build / build-linux (push) Successful in 2m52s
Build / build-windows (push) Successful in 4m32s
Build / create-release (push) Successful in 1m15s
2026-07-06 16:06:52 +10:00
GitHub Actions
ffaf9ff66a chore: bump version to 4.11.132 [skip ci] 2026-07-06 05:35:44 +00:00
6 changed files with 1627 additions and 2364 deletions

3
.npmrc
View File

@@ -1 +1,2 @@
save-exact=true
save-exact=true
allow-git=all

2
cinny

Submodule cinny updated: 3ee95a295d...f62200ecd1

View File

@@ -3,8 +3,10 @@ const path = require('path');
const fs = require('fs');
const { exec, execFile, execFileSync } = require('child_process');
const { promisify } = require('util');
const Store = require('electron-store');
const open = require('open');
const Store = require('electron-store').default;
const openPkg = require('open');
const open = openPkg.default;
const openApps = openPkg.apps;
const PaarrotAPIServer = require('./api-server');
const https = require('https');
const http = require('http');
@@ -14,8 +16,91 @@ const { autoUpdater } = require('electron-updater');
// Development mode detection - MUST be declared before any code that might use it
const isDev = process.env.NODE_ENV === 'development' || !app.isPackaged;
const VITE_DEV_SERVER = 'http://localhost:38347';
const VITE_DEV_PORT = '38347';
const PORT = 44548;
function isLoopbackHost(hostname) {
return hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';
}
/**
* Open http(s) links in a real browser.
* On Linux, Electron's shell.openExternal / xdg-open often hit xdg-desktop-portal
* which can hand https:// to Discover instead of Firefox. Always launch a browser
* binary first; only fall back to the portal as a last resort.
*/
async function openExternalUrl(url) {
if (!url || (!url.startsWith('http://') && !url.startsWith('https://'))) {
await shell.openExternal(url);
return;
}
if (process.platform === 'linux') {
const browserCandidates = [
openApps?.browser,
openApps?.firefox,
openApps?.chrome,
openApps?.edge,
openApps?.brave,
'firefox',
'firefox-esr',
'google-chrome',
'google-chrome-stable',
'chromium',
'chromium-browser',
'brave-browser',
'microsoft-edge',
'microsoft-edge-stable',
].filter(Boolean);
let lastError;
for (const name of browserCandidates) {
try {
await open(url, { app: { name } });
return;
} catch (err) {
lastError = err;
}
}
console.warn('[openExternalUrl] Browser candidates failed, falling back to shell.openExternal', lastError);
await shell.openExternal(url);
return;
}
try {
await open(url);
} catch (err) {
console.warn('[openExternalUrl] open() failed, falling back to shell.openExternal', err);
await shell.openExternal(url);
}
}
/** Keep Vite HMR / same-origin navigations inside Electron; only true externals go to the OS browser. */
function isAppOwnedUrl(targetUrl, currentUrl) {
try {
const next = new URL(targetUrl);
if (currentUrl) {
const current = new URL(currentUrl);
if (current.origin === next.origin) return true;
// localhost ↔ 127.0.0.1 on the same Vite port after a full reload
if (
isDev &&
isLoopbackHost(current.hostname) &&
isLoopbackHost(next.hostname) &&
current.port === next.port
) {
return true;
}
}
if (isDev && isLoopbackHost(next.hostname) && next.port === VITE_DEV_PORT) {
return true;
}
} catch {
return false;
}
return false;
}
const execAsync = promisify(exec);
const execFileAsync = promisify(execFile);
const store = new Store();
@@ -162,6 +247,10 @@ function extractDeepLinkFromArgv(argv) {
/**
* Converts a paarrot:// deep link into an in-app hash route.
* Supports:
* - Hash routes: paarrot://anything/#/login/server/
* - Path routes (SSO-safe): paarrot://desktop/login/server/?loginToken=...
* Preserves SSO loginToken from the URL query (Synapse inserts it before `#`).
* @param {string} deepLink - The incoming protocol URL.
* @returns {string|null} Hash route value without leading #.
*/
@@ -174,17 +263,63 @@ function deepLinkToHashRoute(deepLink) {
return null;
}
const hashIndex = deepLink.indexOf('#');
if (hashIndex === -1) {
return null;
let hashRoute = null;
let loginToken = null;
try {
const parsed = new URL(deepLink);
loginToken = parsed.searchParams.get('loginToken');
if (parsed.hash && parsed.hash.length > 1) {
const hashValue = parsed.hash.slice(1);
hashRoute = hashValue.startsWith('/') ? hashValue : `/${hashValue}`;
} else if (parsed.pathname && parsed.pathname !== '/') {
// paarrot://desktop/login/... → /login/...
hashRoute = parsed.pathname;
if (parsed.search && parsed.search.length > 1) {
// Keep non-loginToken query on the route; loginToken merged below
const params = new URLSearchParams(parsed.search);
params.delete('loginToken');
const rest = params.toString();
if (rest) {
hashRoute += `?${rest}`;
}
}
}
} catch {
const hashIndex = deepLink.indexOf('#');
if (hashIndex !== -1) {
const hashValue = deepLink.slice(hashIndex + 1);
if (hashValue) {
hashRoute = hashValue.startsWith('/') ? hashValue : `/${hashValue}`;
}
}
const match = deepLink.match(/[?&]loginToken=([^&#]+)/i);
if (match) {
try {
loginToken = decodeURIComponent(match[1]);
} catch {
loginToken = match[1];
}
}
}
const hashValue = deepLink.slice(hashIndex + 1);
if (!hashValue) {
return null;
if (loginToken) {
if (!hashRoute) {
hashRoute = '/';
}
const queryIndex = hashRoute.indexOf('?');
const pathPart = queryIndex === -1 ? hashRoute : hashRoute.slice(0, queryIndex);
const params = new URLSearchParams(queryIndex === -1 ? '' : hashRoute.slice(queryIndex + 1));
if (!params.has('loginToken')) {
params.set('loginToken', loginToken);
}
const query = params.toString();
hashRoute = query ? `${pathPart}?${query}` : pathPart;
}
return hashValue.startsWith('/') ? hashValue : `/${hashValue}`;
return hashRoute;
}
/**
@@ -304,6 +439,129 @@ function syncProtocolRegistrationState() {
console.log(`[Protocol] ${PROTOCOL_SCHEME}:// before=${protocolRegistrationState.before} registerCall=${protocolRegistrationState.registerCall} after=${protocolRegistrationState.after}${protocolRegistrationState.error ? ` error=${protocolRegistrationState.error}` : ''}`);
}
/**
* Refresh Linux xdg-mime association for paarrot:// to the current app desktop file.
* AppImage upgrades often leave a stale desktop id in mimeapps.list.
*/
async function ensureLinuxProtocolHandler() {
const home = app.getPath('home');
const searchDirs = [
path.join(home, '.local', 'share', 'applications'),
'/usr/share/applications',
'/var/lib/flatpak/exports/share/applications',
];
let desktopId = null;
for (const dir of searchDirs) {
try {
if (!fs.existsSync(dir)) continue;
const entries = fs.readdirSync(dir);
// Prefer the newest AppImageLauncher desktop entry when several exist.
const matches = entries
.filter((name) => /paarrot/i.test(name) && name.endsWith('.desktop'))
.map((name) => {
try {
return { name, mtime: fs.statSync(path.join(dir, name)).mtimeMs };
} catch {
return { name, mtime: 0 };
}
})
.sort((a, b) => b.mtime - a.mtime);
if (matches.length > 0) {
desktopId = matches[0].name;
break;
}
} catch {
// keep looking
}
}
if (!desktopId) {
desktopId = 'paarrot.desktop';
}
// Rewrite mimeapps.list so stale AppImage ids cannot win over xdg-mime default.
try {
const mimeappsPath = path.join(home, '.config', 'mimeapps.list');
let content = '';
try {
content = fs.readFileSync(mimeappsPath, 'utf8');
} catch {
content = '';
}
const schemeLine = `x-scheme-handler/${PROTOCOL_SCHEME}=${desktopId}`;
const lines = content ? content.split(/\r?\n/) : [];
let section = null;
const next = [];
let wroteDefault = false;
let wroteAdded = false;
for (const line of lines) {
const trimmed = line.trim();
if (trimmed === '[Default Applications]' || trimmed === '[Added Associations]') {
section = trimmed;
next.push(line);
continue;
}
if (trimmed.startsWith('x-scheme-handler/paarrot=')) {
if (section === '[Default Applications]') {
next.push(schemeLine);
wroteDefault = true;
} else if (section === '[Added Associations]') {
next.push(`${schemeLine};`);
wroteAdded = true;
}
continue;
}
next.push(line);
}
if (!next.some((l) => l.trim() === '[Default Applications]')) {
next.push('', '[Default Applications]');
}
if (!wroteDefault) {
const idx = next.findIndex((l) => l.trim() === '[Default Applications]');
next.splice(idx + 1, 0, schemeLine);
}
if (!next.some((l) => l.trim() === '[Added Associations]')) {
next.unshift('[Added Associations]');
}
if (!wroteAdded) {
const idx = next.findIndex((l) => l.trim() === '[Added Associations]');
next.splice(idx + 1, 0, `${schemeLine};`);
}
fs.mkdirSync(path.dirname(mimeappsPath), { recursive: true });
fs.writeFileSync(mimeappsPath, `${next.join('\n').replace(/\n{3,}/g, '\n\n').trim()}\n`);
console.log(`[Protocol] mimeapps.list → ${desktopId} for x-scheme-handler/${PROTOCOL_SCHEME}`);
} catch (error) {
console.warn('[Protocol] Failed to rewrite mimeapps.list:', error);
}
await new Promise((resolve) => {
execFile(
'xdg-mime',
['default', desktopId, `x-scheme-handler/${PROTOCOL_SCHEME}`],
{ timeout: 5000 },
(error, _stdout, stderr) => {
if (error) {
console.warn(`[Protocol] xdg-mime default failed (${desktopId}):`, error.message, stderr);
} else {
console.log(`[Protocol] xdg-mime default → ${desktopId} for x-scheme-handler/${PROTOCOL_SCHEME}`);
}
resolve();
}
);
});
await new Promise((resolve) => {
execFile('update-desktop-database', [path.join(home, '.local', 'share', 'applications')], { timeout: 5000 }, () => {
resolve();
});
});
}
/**
* Reads a named Windows registry value.
* @param {string} keyPath - Registry key path.
@@ -733,15 +991,10 @@ function createWindow() {
mainWindow = null;
});
// Open external links in default browser
mainWindow.webContents.setWindowOpenHandler(({ url, features }) => {
if (url.startsWith('http://') || url.startsWith('https://')) {
shell.openExternal(url);
return { action: 'deny' };
}
// Allow blank windows for screen share pop-outs with custom features
// Open external links in default browser (keep same-origin / Vite in Electron)
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url === '' || url === 'about:blank') {
return {
return {
action: 'allow',
overrideBrowserWindowOptions: {
frame: false,
@@ -751,16 +1004,24 @@ function createWindow() {
contextIsolation: true,
nodeIntegration: false,
backgroundThrottling: false,
}
}
},
},
};
}
if (isAppOwnedUrl(url, mainWindow.webContents.getURL())) {
return { action: 'allow' };
}
if (url.startsWith('http://') || url.startsWith('https://')) {
openExternalUrl(url);
return { action: 'deny' };
}
return { action: 'allow' };
});
// Navigation handler - open external links in browser.
// Same-host navigations (e.g. Vite HMR full reload) must stay in-app;
// a hardcoded origin list breaks when the dev server port changes.
// Same-origin / local Vite navigations (HMR full reload) must stay in-app.
mainWindow.webContents.on('will-navigate', (event, url) => {
if (url.startsWith('blob:') || url.startsWith('data:')) {
return;
@@ -770,19 +1031,12 @@ function createWindow() {
return;
}
try {
const requestedHost = new URL(url).host;
const currentUrl = mainWindow.webContents.getURL();
const currentHost = currentUrl ? new URL(currentUrl).host : '';
if (requestedHost && requestedHost !== currentHost) {
event.preventDefault();
shell.openExternal(url);
}
} catch {
event.preventDefault();
shell.openExternal(url);
if (isAppOwnedUrl(url, mainWindow.webContents.getURL())) {
return;
}
event.preventDefault();
openExternalUrl(url);
});
return mainWindow;
@@ -839,6 +1093,12 @@ app.whenReady().then(() => {
syncProtocolRegistrationState();
if (process.platform === 'linux') {
ensureLinuxProtocolHandler().catch((error) => {
console.warn('[Protocol] Startup Linux protocol ensure failed:', error);
});
}
createWindow();
createTray();
@@ -852,18 +1112,27 @@ app.whenReady().then(() => {
console.error('Failed to start API server:', err);
});
// Check for updates on startup (not in development mode)
if (!isDev) {
// Check for updates on start (after 3 seconds)
setTimeout(() => {
autoUpdater.checkForUpdates().catch(err => {
console.error('Failed to check for updates:', err);
// Check for updates on startup
setTimeout(() => {
if (isDev) {
// Exercise the title-bar updater UI with a mock update.
sendUpdaterEvent('update-available', {
version: '99.0.0-dev',
releaseNotes: 'Mock update for development — download to preview the title-bar progress UI.',
releaseDate: new Date().toISOString(),
mock: true,
});
}, 3000);
return;
}
autoUpdater.checkForUpdates().catch((err) => {
console.error('Failed to check for updates:', err);
});
}, 2500);
if (!isDev) {
// Check for updates every 6 hours
setInterval(() => {
autoUpdater.checkForUpdates().catch(err => {
autoUpdater.checkForUpdates().catch((err) => {
console.error('Failed to check for updates:', err);
});
}, 6 * 60 * 60 * 1000);
@@ -972,6 +1241,14 @@ ipcMain.handle('protocol:repair', async () => {
syncProtocolRegistrationState();
if (process.platform === 'linux') {
try {
await ensureLinuxProtocolHandler();
} catch (error) {
console.warn('[Protocol] Failed to refresh Linux protocol handler:', error);
}
}
const status = await getProtocolStatusPayload();
return {
success: true,
@@ -991,7 +1268,7 @@ ipcMain.handle('plugin:app|version', () => {
// Open external URL
ipcMain.handle('open-external-url', async (event, url) => {
try {
await shell.openExternal(url);
await openExternalUrl(url);
return { success: true };
} catch (error) {
return { success: false, error: error.message };
@@ -1114,10 +1391,61 @@ ipcMain.handle('get-background-sync-state', async () => {
return { success: true, data: 'NotApplicable' };
});
// Auto-updater IPC handlers
// Auto-updater IPC handlers (mock in development so title-bar UI can be exercised)
let mockDownloadTimer = null;
let mockDownloadPercent = 0;
function sendUpdaterEvent(channel, payload) {
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.webContents.send(channel, payload);
}
}
function startMockDownload() {
if (mockDownloadTimer) {
clearInterval(mockDownloadTimer);
}
mockDownloadPercent = 0;
sendUpdaterEvent('update-download-progress', {
percent: 0,
transferred: 0,
total: 100,
mock: true,
});
mockDownloadTimer = setInterval(() => {
mockDownloadPercent = Math.min(100, mockDownloadPercent + 4 + Math.random() * 6);
const percent = Math.round(mockDownloadPercent);
sendUpdaterEvent('update-download-progress', {
percent,
transferred: percent,
total: 100,
mock: true,
});
if (percent >= 100) {
clearInterval(mockDownloadTimer);
mockDownloadTimer = null;
sendUpdaterEvent('update-downloaded', {
version: '99.0.0-dev',
releaseNotes: 'Mock update for development.',
mock: true,
});
}
}, 180);
}
ipcMain.handle('check-for-updates', async () => {
if (isDev) {
return { success: false, error: 'Updates are not available in development mode' };
sendUpdaterEvent('update-checking', { mock: true });
await new Promise((resolve) => setTimeout(resolve, 600));
sendUpdaterEvent('update-available', {
version: '99.0.0-dev',
releaseNotes: 'Mock update for development — download to preview the title-bar progress UI.',
releaseDate: new Date().toISOString(),
mock: true,
});
return { success: true, data: { updateInfo: { version: '99.0.0-dev' }, mock: true } };
}
try {
const result = await autoUpdater.checkForUpdates();
@@ -1129,7 +1457,8 @@ ipcMain.handle('check-for-updates', async () => {
ipcMain.handle('download-update', async () => {
if (isDev) {
return { success: false, error: 'Updates are not available in development mode' };
startMockDownload();
return { success: true, data: { mock: true } };
}
try {
await autoUpdater.downloadUpdate();
@@ -1141,7 +1470,12 @@ ipcMain.handle('download-update', async () => {
ipcMain.handle('install-update', () => {
if (isDev) {
return { success: false, error: 'Updates are not available in development mode' };
sendUpdaterEvent('update-not-available', {
version: app.getVersion(),
mock: true,
message: 'Mock install — restart skipped in development.',
});
return { success: true, data: { mock: true } };
}
autoUpdater.quitAndInstall();
return { success: true };
@@ -1149,7 +1483,8 @@ ipcMain.handle('install-update', () => {
ipcMain.handle('download-and-install-update', async () => {
if (isDev) {
return { success: false, error: 'Updates are not available in development mode' };
startMockDownload();
return { success: true, data: { mock: true } };
}
try {
await autoUpdater.downloadUpdate();
@@ -1160,6 +1495,8 @@ ipcMain.handle('download-and-install-update', async () => {
}
});
ipcMain.handle('updater-is-mock', () => ({ success: true, data: { mock: isDev } }));
// Screen capture / desktopCapturer handler
ipcMain.handle('get-desktop-sources', async (event, opts) => {
try {

View File

@@ -130,6 +130,7 @@ contextBridge.exposeInMainWorld('electron', {
updater: {
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
downloadAndInstallUpdate: () => ipcRenderer.invoke('download-and-install-update'),
isMock: () => ipcRenderer.invoke('updater-is-mock'),
onUpdateAvailable: (callback) => {
ipcRenderer.on('update-available', (_, info) => callback(info));
},
@@ -139,6 +140,9 @@ contextBridge.exposeInMainWorld('electron', {
onUpdateDownloaded: (callback) => {
ipcRenderer.on('update-downloaded', (_, info) => callback(info));
},
onUpdateNotAvailable: (callback) => {
ipcRenderer.on('update-not-available', (_, info) => callback(info));
},
downloadUpdate: () => ipcRenderer.invoke('download-update'),
installUpdate: () => ipcRenderer.invoke('install-update'),
},

3521
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "paarrot",
"version": "4.11.131",
"version": "4.11.163",
"description": "Paarrot - A Matrix client based on Cinny",
"homepage": "https://github.com/Paarrot/Paarrot-Desktop",
"repository": {
@@ -13,7 +13,7 @@
},
"scripts": {
"dev": "concurrently \"npm run dev:vite\" \"npm run dev:electron\"",
"dev:vite": "cd cinny && npm start",
"dev:vite": "cross-env BROWSER=none sh -c 'cd cinny && npm start'",
"dev:electron": "wait-on http://localhost:38347 && cross-env NODE_ENV=development electron .",
"build": "node -e \"require('fs').copyFileSync('config.json', 'cinny/config.json')\" && cd cinny && npm run build && cd .. && electron-builder --publish always",
"build:local": "node -e \"require('fs').copyFileSync('config.json', 'cinny/config.json')\" && cd cinny && npm run build && cd .. && electron-builder",
@@ -28,24 +28,28 @@
},
"license": "AGPL-3.0-only",
"dependencies": {
"adm-zip": "^0.5.16",
"body-parser": "2.2.2",
"adm-zip": "^0.5.18",
"body-parser": "2.3.0",
"cors": "2.8.6",
"electron-store": "^8.2.0",
"electron-updater": "^6.3.9",
"electron-store": "^11.0.2",
"electron-updater": "^6.8.9",
"express": "5.2.1",
"open": "11.0.0"
},
"devDependencies": {
"@actions/github": "6.0.0",
"@electron/rebuild": "4.0.3",
"concurrently": "9.2.1",
"@actions/github": "9.1.1",
"@electron/rebuild": "4.2.0",
"concurrently": "10.0.3",
"cross-env": "10.1.0",
"electron": "40.6.0",
"electron-builder": "26.8.1",
"electron": "43.1.0",
"electron-builder": "26.15.3",
"node-fetch": "3.3.2",
"png2icons": "2.0.1",
"sharp": "0.34.5",
"wait-on": "9.0.4"
"sharp": "0.35.3",
"wait-on": "9.0.10"
},
"allowScripts": {
"electron-winstaller@5.4.0": true,
"electron@43.1.0": true
}
}