Add Discord collectibles IPC and bump cinny for profile overlays.
All checks were successful
Build / increment-version (push) Successful in 12s
Build / prepare-release (push) Successful in 15s
Build / build-windows (push) Successful in 6m55s
Build / build-linux (push) Successful in 3m10s
Build / finalize-release (push) Successful in 4s

Wire electron-side catalog fetch and asset download, exposing collectibles APIs to the renderer for live Discord shop browsing and Matrix profile uploads.
This commit is contained in:
2026-08-24 00:54:54 +10:00
parent 8ca7be8b42
commit 608cbaf682
4 changed files with 488 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ const openPkg = require('open');
const open = openPkg.default;
const openApps = openPkg.apps;
const PaarrotAPIServer = require('./api-server');
const { createDiscordCollectiblesService } = require('./discord-collectibles');
const https = require('https');
const http = require('http');
const AdmZip = require('adm-zip');
@@ -104,6 +105,7 @@ function isAppOwnedUrl(targetUrl, currentUrl) {
const execAsync = promisify(exec);
const execFileAsync = promisify(execFile);
const store = new Store();
const discordCollectibles = createDiscordCollectiblesService(store);
const PROTOCOL_SCHEME = 'paarrot';
let mainWindow = null;
@@ -1901,6 +1903,55 @@ ipcMain.handle('plugin:read-code', async (event, pluginId) => {
}
});
ipcMain.handle('discord-collectibles:has-token', () => {
return { success: true, data: discordCollectibles.hasToken() };
});
ipcMain.handle('discord-collectibles:set-token', (event, { token }) => {
try {
return discordCollectibles.setToken(token);
} catch (error) {
return { success: false, error: error.message };
}
});
ipcMain.handle('discord-collectibles:clear-token', () => {
try {
return discordCollectibles.clearToken();
} catch (error) {
return { success: false, error: error.message };
}
});
ipcMain.handle('discord-collectibles:fetch-catalog', async (event, { force } = {}) => {
try {
return await discordCollectibles.getCatalog({ force: Boolean(force) });
} catch (error) {
return { success: false, error: error.message };
}
});
ipcMain.handle('discord-collectibles:download-assets', async (event, { assets }) => {
try {
if (!Array.isArray(assets) || assets.length === 0) {
return { success: false, error: 'No assets to download' };
}
const downloaded = await discordCollectibles.downloadAssets(assets);
return {
success: true,
data: downloaded.map((item) => ({
role: item.role,
url: item.url,
filename: item.filename,
mimeType: item.mimeType,
data: item.data,
})),
};
} catch (error) {
return { success: false, error: error.message };
}
});
console.log('Paarrot Electron main process started');
console.log('Development mode:', isDev);
console.log('Platform:', process.platform);