mirror of
https://github.com/PreMiD/PreMiD.git
synced 2026-04-05 20:31:58 +02:00
Merge remote-tracking branch 'upstream/main' into stable
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"outDir": "dist/app"
|
||||
}
|
||||
11
.github/FUNDING.yml
vendored
11
.github/FUNDING.yml
vendored
@@ -1,12 +1,5 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
github: Timeraa
|
||||
patreon: Timeraa
|
||||
open_collective: #
|
||||
ko_fi: #
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: https://paypal.me/TimeraaDEV
|
||||
ko_fi: Timeraa
|
||||
|
||||
28
.github/workflows/deploy.yml
vendored
28
.github/workflows/deploy.yml
vendored
@@ -26,9 +26,9 @@ jobs:
|
||||
node util/zip dist ${{ matrix.os }}.zip --zip
|
||||
- name: Upload bundle
|
||||
env:
|
||||
SSHHOST: ${{ secrets.SSHHOST }}
|
||||
SSHUSERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSHPASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
SSHHOST: ${{ secrets.MAIN_HOST }}
|
||||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
||||
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||
run: |
|
||||
tsc util/uploadFile util/zip
|
||||
node util/uploadFile ${{ matrix.os }}.zip /home/PreMiD/download/util/${{ matrix.os }}.zip
|
||||
@@ -40,15 +40,15 @@ jobs:
|
||||
- uses: actions/setup-node@master
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm i
|
||||
npm i -g typescript
|
||||
sudo npm i
|
||||
sudo npm i -g typescript
|
||||
- name: Download InstallBuilder
|
||||
run: |
|
||||
wget https://clients.bitrock.com/installbuilder/installbuilder-enterprise-20.3.0-linux-x64-installer.run
|
||||
chmod u+x installbuilder-enterprise-20.3.0-linux-x64-installer.run
|
||||
wget https://clients.bitrock.com/installbuilder/installbuilder-enterprise-20.12.0-linux-x64-installer.run
|
||||
chmod u+x installbuilder-enterprise-20.12.0-linux-x64-installer.run
|
||||
- name: Install InstallBuilder
|
||||
run: |
|
||||
./installbuilder-enterprise-20.3.0-linux-x64-installer.run --installer-language en --prefix ./installbuilder --mode unattended
|
||||
./installbuilder-enterprise-20.12.0-linux-x64-installer.run --installer-language en --prefix ./installbuilder --mode unattended
|
||||
echo "${{ secrets.IBLICENSE }}" > ./installbuilder/license.xml
|
||||
- name: Prepare Upgrade Installer
|
||||
run: |
|
||||
@@ -62,9 +62,9 @@ jobs:
|
||||
installbuilder/bin/builder build installer_assets/PreMiD-Upgrade.xml windows
|
||||
- name: Upload files
|
||||
env:
|
||||
SSHHOST: ${{ secrets.SSHHOST }}
|
||||
SSHUSERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSHPASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
SSHHOST: ${{ secrets.MAIN_HOST }}
|
||||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
|
||||
SSH_KEY: ${{ secrets.SSH_KEY }}
|
||||
run: |
|
||||
tsc util/uploadFile util/zip
|
||||
node util/uploadFile dist/installer/upgrader.exe /home/PreMiD/download/upgrader.exe
|
||||
@@ -72,9 +72,9 @@ jobs:
|
||||
- name: Finalize build
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
host: ${{ secrets.MAIN_HOST }}
|
||||
username: ${{ secrets.SSH_USERNAME }}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
script: |
|
||||
cd /home/PreMiD/download/util
|
||||
unzip upgrader.app.zip
|
||||
|
||||
57
package.json
57
package.json
@@ -2,54 +2,55 @@
|
||||
"name": "premid",
|
||||
"productName": "PreMiD",
|
||||
"description": "Discord Rich Presence for web services.",
|
||||
"version": "2.1.3",
|
||||
"version": "2.2.0",
|
||||
"repository": "https://github.com/PreMiD/PreMiD",
|
||||
"scripts": {
|
||||
"init": "tsc --skipLibCheck && tsc pkg util/prepare util/zip && devScript --copyOnly",
|
||||
"start": "devScript --copyOnly && electron dist/app/.",
|
||||
"dev": "nodemon --exec yarn start -S --watch dist/app -e .js",
|
||||
"start": "electron dist/app/. --unhandled-rejections=strict",
|
||||
"dev": "devscript --depCheck",
|
||||
"pkg": "rimraf dist && tsc --skipLibCheck && devScript --copyOnly && cd dist/app/ && yarn && cd ../../ && node pkg",
|
||||
"deploy": "tsc --skipLibCheck .github/deploy && cd .github && node deploy.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"license": "MPL-2.0",
|
||||
"devDependencies": {
|
||||
"@timeraa/devscript": "Timeraa/DevScript",
|
||||
"@types/archiver": "3.1.1",
|
||||
"@types/archiver": "5.1.0",
|
||||
"@types/auto-launch": "5.0.1",
|
||||
"@types/discord-rpc": "3.0.4",
|
||||
"@types/electron-packager": "14.0.0",
|
||||
"@types/fs-extra": "9.0.1",
|
||||
"@types/fs-extra": "9.0.10",
|
||||
"@types/ini": "1.3.30",
|
||||
"@types/node": "14.0.23",
|
||||
"@types/prompts": "2.0.9",
|
||||
"@types/node": "14.14.37",
|
||||
"@types/prompts": "2.0.10",
|
||||
"@types/request-promise-native": "1.0.17",
|
||||
"@types/rimraf": "3.0.0",
|
||||
"@types/socket.io": "2.1.11",
|
||||
"@types/ssh2-sftp-client": "4.1.3",
|
||||
"@types/socket.io": "2.1.13",
|
||||
"@types/ssh2-sftp-client": "5.3.1",
|
||||
"@types/unzipper": "^0.10.3",
|
||||
"archiver": "4.0.2",
|
||||
"chalk": "4.0.0",
|
||||
"electron": "8.3.0",
|
||||
"electron-packager": "14.2.1",
|
||||
"fast-glob": "3.2.4",
|
||||
"fs-extra": "9.0.1",
|
||||
"nodemon": "2.0.4",
|
||||
"ora": "4.0.4",
|
||||
"prompts": "2.3.2",
|
||||
"archiver": "5.2.0",
|
||||
"chalk": "4.1.0",
|
||||
"electron": "11.3.0",
|
||||
"electron-packager": "15.2.0",
|
||||
"fast-glob": "3.2.5",
|
||||
"fs-extra": "9.1.0",
|
||||
"nodemon": "2.0.7",
|
||||
"ora": "5.3.0",
|
||||
"prompts": "2.4.1",
|
||||
"rimraf": "3.0.2",
|
||||
"ssh2-sftp-client": "5.1.3",
|
||||
"typescript": "3.9.6",
|
||||
"ssh2-sftp-client": "6.0.1",
|
||||
"ts-devscript": "^3.0.3",
|
||||
"typescript": "4.1.5",
|
||||
"unzipper": "0.10.11",
|
||||
"yarn": "1.22.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/electron": "1.3.2",
|
||||
"auto-launch": "5.0.5",
|
||||
"axios": "0.19.2",
|
||||
"chokidar": "3.4.2",
|
||||
"axios": "0.21.1",
|
||||
"chokidar": "3.5.1",
|
||||
"discord-rpc": "github:discordjs/RPC",
|
||||
"electron-store": "5.1.1",
|
||||
"socket.io": "2.3.0",
|
||||
"electron-store": "7.0.3",
|
||||
"socket.io": "3.1.2",
|
||||
"source-map-support": "^0.5.19"
|
||||
},
|
||||
"devScript": {
|
||||
"out": "dist/app"
|
||||
}
|
||||
}
|
||||
|
||||
20
src/index.ts
20
src/index.ts
@@ -1,18 +1,13 @@
|
||||
import "source-map-support/register";
|
||||
|
||||
import { app } from "electron";
|
||||
import { init as initSocket } from "./managers/socketManager";
|
||||
import { update as initAutoLaunch } from "./managers/launchManager";
|
||||
import { platform } from "os";
|
||||
import { checkForUpdate } from "./util/updateChecker";
|
||||
import { TrayManager } from "./managers/trayManager";
|
||||
import * as Sentry from "@sentry/electron";
|
||||
|
||||
if (app.isPackaged)
|
||||
Sentry.init({
|
||||
dsn:
|
||||
"https://c11e044610da45b7a4dc3bac6c006037@o357239.ingest.sentry.io/5193608"
|
||||
});
|
||||
import { update as initAutoLaunch } from "./managers/launchManager";
|
||||
import { init as initSocket } from "./managers/socketManager";
|
||||
import { TrayManager } from "./managers/trayManager";
|
||||
import { checkForUpdate } from "./util/updateChecker";
|
||||
|
||||
export let trayManager: TrayManager;
|
||||
|
||||
//* Define and set it to null
|
||||
@@ -24,8 +19,7 @@ export let updateCheckerInterval = null;
|
||||
let singleInstanceLock = app.requestSingleInstanceLock();
|
||||
|
||||
//* Application already running?
|
||||
if (!singleInstanceLock)
|
||||
app.quit();
|
||||
if (!singleInstanceLock) app.quit();
|
||||
|
||||
app.setAppUserModelId("Timeraa.PreMiD");
|
||||
app.whenReady().then(async () => {
|
||||
@@ -37,4 +31,4 @@ app.whenReady().then(async () => {
|
||||
? (updateCheckerInterval = setInterval(checkForUpdate, 15 * 1000 * 60))
|
||||
: undefined;
|
||||
if (platform() === "darwin") app.dock.hide();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Client } from "discord-rpc";
|
||||
import { app } from "electron";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
import { trayManager } from "../";
|
||||
//* Import custom types
|
||||
import PresenceData from "../../@types/PreMiD/PresenceData";
|
||||
import { trayManager } from "..";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
export let rpcClients: Array<RPCClient> = [];
|
||||
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import socketIo from "socket.io";
|
||||
import { createServer, Server } from "http";
|
||||
import { app, dialog } from "electron";
|
||||
import { success, error } from "../util/debug";
|
||||
import { update as updateSettings } from "./settingsManager";
|
||||
import { createServer, Server } from "http";
|
||||
import socketIo from "socket.io";
|
||||
|
||||
import { trayManager } from "../";
|
||||
import { error, success } from "../util/debug";
|
||||
import { clearActivity, getDiscordUser, rpcClients, setActivity } from "./discordManager";
|
||||
import { openFileDialog } from "./presenceDevManager";
|
||||
import {
|
||||
rpcClients,
|
||||
setActivity,
|
||||
clearActivity,
|
||||
getDiscordUser
|
||||
} from "./discordManager";
|
||||
import { trayManager } from "..";
|
||||
import { update as updateSettings } from "./settingsManager";
|
||||
|
||||
export let io: socketIo.Server;
|
||||
export let socket: socketIo.Socket;
|
||||
@@ -18,17 +14,17 @@ export let server: Server;
|
||||
export let connected: boolean = false;
|
||||
|
||||
export function init() {
|
||||
return new Promise(resolve => {
|
||||
return new Promise<void>(resolve => {
|
||||
//* Create server
|
||||
//* create SocketIo server, don't server client
|
||||
//* Try to listen to port 3020
|
||||
//* If that fails/some other error happens run socketError
|
||||
//* If someone connects to socket socketConnection
|
||||
server = createServer();
|
||||
io = socketIo(server, { serveClient: false });
|
||||
io.origins((o, c) => {
|
||||
if (o !== '*') c('Not a chrome extension, socket denied.', false);
|
||||
c(null, true);
|
||||
io = new socketIo.Server(server, {
|
||||
serveClient: false,
|
||||
allowEIO3: true,
|
||||
cors: { origin: "*" }
|
||||
});
|
||||
server.listen(3020, () => {
|
||||
//* Resolve promise
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Menu, Tray, app, shell } from "electron";
|
||||
import { app, Menu, shell, Tray } from "electron";
|
||||
import { platform } from "os";
|
||||
import { join } from "path";
|
||||
import { trayManager } from "..";
|
||||
|
||||
import { trayManager } from "../";
|
||||
import { checkForUpdate, update, updateAvailable } from "../util/updateChecker";
|
||||
import { connected } from "./socketManager";
|
||||
import { platform } from "os";
|
||||
|
||||
let trayIcon;
|
||||
|
||||
@@ -56,17 +57,17 @@ export class TrayManager {
|
||||
type: "separator"
|
||||
},
|
||||
{
|
||||
label: `Update ${app.name}`,
|
||||
label: `Update ${app.name}!`,
|
||||
visible: updateAvailable,
|
||||
click: () => update()
|
||||
},
|
||||
{
|
||||
label: "Check for Updates...",
|
||||
label: "Check for Updates",
|
||||
click: () => checkForUpdate(false, true),
|
||||
visible: !updateAvailable
|
||||
},
|
||||
{
|
||||
label: "Acknowledgments",
|
||||
label: "Contributors",
|
||||
click: () => shell.openExternal("https://premid.app/contributors")
|
||||
},
|
||||
{
|
||||
@@ -81,4 +82,4 @@ export class TrayManager {
|
||||
}
|
||||
}
|
||||
|
||||
app.once("quit", () => trayManager.tray.destroy());
|
||||
app.once("quit", () => trayManager?.tray.destroy());
|
||||
|
||||
@@ -5,8 +5,8 @@ let sftp = new Client();
|
||||
sftp
|
||||
.connect({
|
||||
host: process.env.SSHHOST,
|
||||
username: process.env.SSHUSERNAME,
|
||||
password: process.env.SSHPASSWORD
|
||||
username: process.env.SSH_USERNAME,
|
||||
privateKey: process.env.SSH_KEY
|
||||
})
|
||||
.then(async () => {
|
||||
sftp
|
||||
|
||||
Reference in New Issue
Block a user