chore: point app at self-hosted mithraic.space instance
- Hardcode BUILD_URL and Discord RPC to mithraic.space - Replace update-electron-app with custom Forgejo release checker - Restructure forge makers for CI (PLATFORM=linux/win32 env var) - Remove GitHub publisher, add Forgejo CI workflow - Update repository field to self-hosted git instance Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d1a46defd5
commit
45f45dc4b9
7 changed files with 80 additions and 110 deletions
|
|
@ -6,14 +6,13 @@ import { MakerSquirrel } from "@electron-forge/maker-squirrel";
|
|||
import { MakerZIP } from "@electron-forge/maker-zip";
|
||||
import { FusesPlugin } from "@electron-forge/plugin-fuses";
|
||||
import { VitePlugin } from "@electron-forge/plugin-vite";
|
||||
import { PublisherGithub } from "@electron-forge/publisher-github";
|
||||
import type { ForgeConfig } from "@electron-forge/shared-types";
|
||||
import { FuseV1Options, FuseVersion } from "@electron/fuses";
|
||||
|
||||
// import { globSync } from "node:fs";
|
||||
|
||||
const STRINGS = {
|
||||
author: "Revolt Platforms LTD",
|
||||
author: "MiTHRAL",
|
||||
name: "Stoat",
|
||||
execName: "stoat-desktop",
|
||||
description: "Open source user-first chat platform.",
|
||||
|
|
@ -21,37 +20,47 @@ const STRINGS = {
|
|||
|
||||
const ASSET_DIR = "assets/desktop";
|
||||
|
||||
/**
|
||||
* Build targets for the desktop app
|
||||
*/
|
||||
// PLATFORM env var controls which makers are active:
|
||||
// unset → local dev (all makers)
|
||||
// linux → CI Linux build (deb + zip)
|
||||
// win32 → CI Windows build (zip only, no Wine needed)
|
||||
const CI_PLATFORM = process.env.PLATFORM;
|
||||
|
||||
const makers: ForgeConfig["makers"] = [
|
||||
new MakerSquirrel({
|
||||
name: STRINGS.name,
|
||||
authors: STRINGS.author,
|
||||
// todo: hoist this
|
||||
iconUrl: `https://stoat.chat/app/assets/icon-DUSNE-Pb.ico`,
|
||||
// todo: loadingGif
|
||||
setupIcon: `${ASSET_DIR}/icon.ico`,
|
||||
description: STRINGS.description,
|
||||
exe: `${STRINGS.execName}.exe`,
|
||||
setupExe: `${STRINGS.execName}-setup.exe`,
|
||||
copyright: "Copyright (C) 2025 Revolt Platforms LTD",
|
||||
}),
|
||||
new MakerZIP({}),
|
||||
];
|
||||
|
||||
// skip these makers in CI/CD
|
||||
if (!process.env.PLATFORM) {
|
||||
if (CI_PLATFORM === "linux") {
|
||||
makers.push(
|
||||
// must be manually built (freezes CI process)
|
||||
// not much use in being published anyhow
|
||||
new MakerDeb({
|
||||
options: {
|
||||
productName: STRINGS.name,
|
||||
productDescription: STRINGS.description,
|
||||
categories: ["Network"],
|
||||
icon: `${ASSET_DIR}/icon.png`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (!CI_PLATFORM) {
|
||||
// local dev: include everything
|
||||
makers.push(
|
||||
new MakerSquirrel({
|
||||
name: STRINGS.name,
|
||||
authors: STRINGS.author,
|
||||
iconUrl: `https://mithraic.space/app/assets/icon-DUSNE-Pb.ico`,
|
||||
setupIcon: `${ASSET_DIR}/icon.ico`,
|
||||
description: STRINGS.description,
|
||||
exe: `${STRINGS.execName}.exe`,
|
||||
setupExe: `${STRINGS.execName}-setup.exe`,
|
||||
copyright: `Copyright (C) 2025 ${STRINGS.author}`,
|
||||
}),
|
||||
new MakerAppX({
|
||||
certPass: "",
|
||||
packageExecutable: `app\\${STRINGS.execName}.exe`,
|
||||
publisher: "CN=B040CC7E-0016-4AF5-957F-F8977A6CFA3B",
|
||||
}),
|
||||
// flatpak publishing should occur through flathub repos.
|
||||
// this is just for testing purposes
|
||||
new MakerFlatpak({
|
||||
options: {
|
||||
id: "chat.stoat.stoat-desktop",
|
||||
|
|
@ -69,7 +78,6 @@ if (!process.env.PLATFORM) {
|
|||
} as unknown,
|
||||
categories: ["Network"],
|
||||
modules: [
|
||||
// use the latest zypak -- Electron sandboxing for Flatpak
|
||||
{
|
||||
name: "zypak",
|
||||
sources: [
|
||||
|
|
@ -82,8 +90,6 @@ if (!process.env.PLATFORM) {
|
|||
},
|
||||
],
|
||||
finishArgs: [
|
||||
// default arguments found by running
|
||||
// DEBUG=electron-installer-flatpak* pnpm make
|
||||
"--socket=fallback-x11",
|
||||
"--share=ipc",
|
||||
"--device=dri",
|
||||
|
|
@ -92,32 +98,11 @@ if (!process.env.PLATFORM) {
|
|||
"--env=TMPDIR=/var/tmp",
|
||||
"--share=network",
|
||||
"--talk-name=org.freedesktop.Notifications",
|
||||
// add Unity talk name for badges
|
||||
"--talk-name=com.canonical.Unity",
|
||||
],
|
||||
// files: [
|
||||
// // is this necessary?
|
||||
// // https://stackoverflow.com/q/79745700
|
||||
// ...[16, 32, 64, 128, 256, 512].map(
|
||||
// (size) =>
|
||||
// [
|
||||
// `assets/desktop/hicolor/${size}x${size}.png`,
|
||||
// `/app/share/icons/hicolor/${size}x${size}/apps/chat.stoat.stoat-desktop.png`,
|
||||
// ] as [string, string],
|
||||
// ),
|
||||
// [
|
||||
// `assets/desktop/icon.svg`,
|
||||
// `/app/share/icons/hicolor/scalable/apps/chat.stoat.stoat-desktop.svg`,
|
||||
// ] as [string, string],
|
||||
// ],
|
||||
files: [],
|
||||
} as MakerFlatpakOptionsConfig,
|
||||
/* as Omit<
|
||||
MakerFlatpakOptionsConfig,
|
||||
"files"
|
||||
> */
|
||||
}),
|
||||
// testing purposes
|
||||
new MakerDeb({
|
||||
options: {
|
||||
productName: STRINGS.name,
|
||||
|
|
@ -135,20 +120,13 @@ const config: ForgeConfig = {
|
|||
name: STRINGS.name,
|
||||
executableName: STRINGS.execName,
|
||||
icon: `${ASSET_DIR}/icon`,
|
||||
// extraResource: [
|
||||
// // include all the asset files
|
||||
// ...globSync(ASSET_DIR + "/**/*"),
|
||||
// ],
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers,
|
||||
plugins: [
|
||||
new VitePlugin({
|
||||
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
|
||||
// If you are familiar with Vite configuration, it will look really familiar.
|
||||
build: [
|
||||
{
|
||||
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
|
||||
entry: "src/main.ts",
|
||||
config: "vite.main.config.ts",
|
||||
target: "main",
|
||||
|
|
@ -161,8 +139,6 @@ const config: ForgeConfig = {
|
|||
],
|
||||
renderer: [],
|
||||
}),
|
||||
// Fuses are used to enable/disable various Electron functionality
|
||||
// at package time, before code signing the application
|
||||
new FusesPlugin({
|
||||
version: FuseVersion.V1,
|
||||
[FuseV1Options.RunAsNode]: false,
|
||||
|
|
@ -173,14 +149,6 @@ const config: ForgeConfig = {
|
|||
[FuseV1Options.OnlyLoadAppFromAsar]: true,
|
||||
}),
|
||||
],
|
||||
publishers: [
|
||||
new PublisherGithub({
|
||||
repository: {
|
||||
owner: "stoatchat",
|
||||
name: "for-desktop",
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"productName": "stoat-desktop",
|
||||
"version": "1.3.0",
|
||||
"main": ".vite/build/main.js",
|
||||
"repository": "stoatchat/desktop",
|
||||
"repository": "https://git.mithraic.cloud/ad3laid3/stoat-desktop",
|
||||
"scripts": {
|
||||
"start": "electron-forge start",
|
||||
"package": "electron-forge package",
|
||||
|
|
@ -52,7 +52,6 @@
|
|||
"discord-rpc": "^4.0.1",
|
||||
"electron-squirrel-startup": "^1.0.1",
|
||||
"electron-store": "^10.1.0",
|
||||
"update-electron-app": "^3.1.1",
|
||||
"utf-8-validate": "^6.0.5"
|
||||
},
|
||||
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34"
|
||||
|
|
|
|||
29
pnpm-lock.yaml
generated
29
pnpm-lock.yaml
generated
|
|
@ -29,9 +29,6 @@ importers:
|
|||
electron-store:
|
||||
specifier: ^10.1.0
|
||||
version: 10.1.0
|
||||
update-electron-app:
|
||||
specifier: ^3.1.1
|
||||
version: 3.1.1
|
||||
utf-8-validate:
|
||||
specifier: ^6.0.5
|
||||
version: 6.0.5
|
||||
|
|
@ -907,6 +904,7 @@ packages:
|
|||
'@xmldom/xmldom@0.8.11':
|
||||
resolution: {integrity: sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
deprecated: this version has critical issues, please update to the latest version
|
||||
|
||||
abbrev@1.1.1:
|
||||
resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==}
|
||||
|
|
@ -1702,9 +1700,6 @@ packages:
|
|||
resolution: {integrity: sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
github-url-to-object@4.0.6:
|
||||
resolution: {integrity: sha512-NaqbYHMUAlPcmWFdrAB7bcxrNIiiJWJe8s/2+iOc9vlcHlwHqSGrPk+Yi3nu6ebTwgsZEa7igz+NH2vEq3gYwQ==}
|
||||
|
||||
glob-parent@5.1.2:
|
||||
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
|
||||
engines: {node: '>= 6'}
|
||||
|
|
@ -1715,12 +1710,12 @@ packages:
|
|||
|
||||
glob@7.2.3:
|
||||
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
|
||||
deprecated: Glob versions prior to v9 are no longer supported
|
||||
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
|
||||
|
||||
glob@8.1.0:
|
||||
resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==}
|
||||
engines: {node: '>=12'}
|
||||
deprecated: Glob versions prior to v9 are no longer supported
|
||||
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
|
||||
|
||||
global-agent@3.0.0:
|
||||
resolution: {integrity: sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==}
|
||||
|
|
@ -1992,9 +1987,6 @@ packages:
|
|||
resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
is-url@1.2.4:
|
||||
resolution: {integrity: sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==}
|
||||
|
||||
is-weakmap@2.0.2:
|
||||
resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
|
@ -2876,6 +2868,7 @@ packages:
|
|||
tar@6.2.1:
|
||||
resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==}
|
||||
engines: {node: '>=10'}
|
||||
deprecated: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
|
||||
|
||||
temp@0.9.4:
|
||||
resolution: {integrity: sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==}
|
||||
|
|
@ -3006,9 +2999,6 @@ packages:
|
|||
resolution: {integrity: sha512-iSk/J8efr8uPT/Z4eSUywnqyrQU7DSdMfdqK4iWEaUVVmcP5JcnpRqmVMwcwcnmI1ATFNgC5V90u09tBynNFKA==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
update-electron-app@3.1.1:
|
||||
resolution: {integrity: sha512-7duRr6sYn014tifhKgT/5i8N+6xLzmJVJ8hVtNrHXlIDNP6QbRe6VxZ1hSi2UH5oJPzhor/PH7yKU9em5xjRzQ==}
|
||||
|
||||
uri-js@4.4.1:
|
||||
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
|
||||
|
||||
|
|
@ -5289,10 +5279,6 @@ snapshots:
|
|||
es-errors: 1.3.0
|
||||
get-intrinsic: 1.3.0
|
||||
|
||||
github-url-to-object@4.0.6:
|
||||
dependencies:
|
||||
is-url: 1.2.4
|
||||
|
||||
glob-parent@5.1.2:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
|
|
@ -5600,8 +5586,6 @@ snapshots:
|
|||
|
||||
is-unicode-supported@0.1.0: {}
|
||||
|
||||
is-url@1.2.4: {}
|
||||
|
||||
is-weakmap@2.0.2: {}
|
||||
|
||||
is-weakref@1.1.1:
|
||||
|
|
@ -6654,11 +6638,6 @@ snapshots:
|
|||
|
||||
untildify@3.0.3: {}
|
||||
|
||||
update-electron-app@3.1.1:
|
||||
dependencies:
|
||||
github-url-to-object: 4.0.6
|
||||
ms: 2.1.3
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
punycode: 2.3.1
|
||||
|
|
|
|||
19
src/main.ts
19
src/main.ts
|
|
@ -1,12 +1,11 @@
|
|||
import { IUpdateInfo, updateElectronApp } from "update-electron-app";
|
||||
|
||||
import { BrowserWindow, Notification, app, shell } from "electron";
|
||||
import { BrowserWindow, app, shell } from "electron";
|
||||
import started from "electron-squirrel-startup";
|
||||
|
||||
import { autoLaunch } from "./native/autoLaunch";
|
||||
import { config } from "./native/config";
|
||||
import { initDiscordRpc } from "./native/discordRpc";
|
||||
import { initTray } from "./native/tray";
|
||||
import { checkForUpdates } from "./native/updater";
|
||||
import { BUILD_URL, createMainWindow, mainWindow } from "./native/window";
|
||||
|
||||
// Squirrel-specific logic
|
||||
|
|
@ -24,20 +23,7 @@ if (!config.hardwareAcceleration) {
|
|||
// ensure only one copy of the application can run
|
||||
const acquiredLock = app.requestSingleInstanceLock();
|
||||
|
||||
const onNotifyUser = (_info: IUpdateInfo) => {
|
||||
const notification = new Notification({
|
||||
title: "Update Available",
|
||||
body: "Restart the app to install the update.",
|
||||
silent: true,
|
||||
});
|
||||
|
||||
notification.show();
|
||||
};
|
||||
|
||||
if (acquiredLock) {
|
||||
// start auto update logic
|
||||
updateElectronApp({ onNotifyUser });
|
||||
|
||||
// create and configure the app when electron is ready
|
||||
app.on("ready", () => {
|
||||
// create window and application contexts
|
||||
|
|
@ -53,6 +39,7 @@ if (acquiredLock) {
|
|||
|
||||
initTray();
|
||||
initDiscordRpc();
|
||||
checkForUpdates();
|
||||
|
||||
// Windows specific fix for notifications
|
||||
if (process.platform === "win32") {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,14 @@ export async function initDiscordRpc() {
|
|||
|
||||
rpc.on("ready", () =>
|
||||
rpc.setActivity({
|
||||
state: "stoat.chat",
|
||||
state: "mithraic.space",
|
||||
details: "Chatting with others",
|
||||
largeImageKey: "qr",
|
||||
largeImageText: "Join Stoat!",
|
||||
buttons: [
|
||||
{
|
||||
label: "Join Stoat",
|
||||
url: "https://stoat.chat/",
|
||||
url: "https://mithraic.space/",
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
|
|
|||
37
src/native/updater.ts
Normal file
37
src/native/updater.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import { Notification, app, shell } from "electron";
|
||||
|
||||
const RELEASES_URL =
|
||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/stoat-desktop/releases/latest";
|
||||
|
||||
export async function checkForUpdates() {
|
||||
try {
|
||||
const res = await fetch(RELEASES_URL);
|
||||
if (!res.ok) return;
|
||||
|
||||
const release = (await res.json()) as { tag_name: string; html_url: string };
|
||||
const latest = release.tag_name.replace(/^v/, "");
|
||||
const current = app.getVersion();
|
||||
|
||||
if (!isNewer(latest, current)) return;
|
||||
|
||||
const notification = new Notification({
|
||||
title: "Update Available",
|
||||
body: `Version ${latest} is available. Click to download.`,
|
||||
silent: true,
|
||||
});
|
||||
|
||||
notification.on("click", () => shell.openExternal(release.html_url));
|
||||
notification.show();
|
||||
} catch {
|
||||
// non-critical — silently ignore network/parse errors
|
||||
}
|
||||
}
|
||||
|
||||
function isNewer(latest: string, current: string): boolean {
|
||||
const parse = (v: string) => v.split(".").map(Number);
|
||||
const [lA, lB, lC] = parse(latest);
|
||||
const [cA, cB, cC] = parse(current);
|
||||
if (lA !== cA) return lA > cA;
|
||||
if (lB !== cB) return lB > cB;
|
||||
return lC > cC;
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ export let mainWindow: BrowserWindow;
|
|||
export const BUILD_URL = new URL(
|
||||
app.commandLine.hasSwitch("force-server")
|
||||
? app.commandLine.getSwitchValue("force-server")
|
||||
: /*MAIN_WINDOW_VITE_DEV_SERVER_URL ??*/ "https://stoat.chat/app",
|
||||
: /*MAIN_WINDOW_VITE_DEV_SERVER_URL ??*/ "https://mithraic.space/app",
|
||||
);
|
||||
|
||||
// internal window state
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue