mirror of
https://github.com/PreMiD/PreMiD.git
synced 2026-04-06 04:41:58 +02:00
Compare commits
246 Commits
v2.0.1.4
...
app-v2.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
398dedb2ae | ||
|
|
b9db443fe4 | ||
|
|
4da95c4c15 | ||
|
|
75844f00b4 | ||
|
|
e5ab4cf3b9 | ||
|
|
484f49346c | ||
|
|
7cd02f2c9a | ||
|
|
b965eb49c9 | ||
|
|
b21281678b | ||
|
|
d5046d9173 | ||
|
|
315bd4ea96 | ||
|
|
9708d78ff2 | ||
|
|
6dd8749cc4 | ||
|
|
bb222f4858 | ||
|
|
5bfb150b89 | ||
|
|
86846c6631 | ||
|
|
5c0fd897ac | ||
|
|
61ebf7207e | ||
|
|
57fcfc7377 | ||
|
|
6e35f9393d | ||
|
|
57e83f8d46 | ||
|
|
7e20dba636 | ||
|
|
ce4c61671e | ||
|
|
06a330d25e | ||
|
|
eb2a614094 | ||
|
|
a27cf3a765 | ||
|
|
26a77642a1 | ||
|
|
3191c9176e | ||
|
|
8866af8c30 | ||
|
|
a06c120b28 | ||
|
|
d5361c085d | ||
|
|
7d7573f58f | ||
|
|
55bb2f377e | ||
|
|
738a25fcc4 | ||
|
|
538888df75 | ||
|
|
a2c767181d | ||
|
|
63f954d8e7 | ||
|
|
fea67deaa3 | ||
|
|
e969d5471a | ||
|
|
b8987b279e | ||
|
|
890e0c5361 | ||
|
|
8fb9364c3a | ||
|
|
c6019e181f | ||
|
|
58a00d7eb6 | ||
|
|
c05cb798f2 | ||
|
|
fed5e453a8 | ||
|
|
68a3478301 | ||
|
|
e3704dd8e7 | ||
|
|
fb76dd7b6a | ||
|
|
9fddc7ff34 | ||
|
|
605b496a01 | ||
|
|
d1c6b957f7 | ||
|
|
5953a74e8d | ||
|
|
85b16aa6b9 | ||
|
|
e1253cadae | ||
|
|
acef51a73e | ||
|
|
82649cbfc2 | ||
|
|
c7a2c5347e | ||
|
|
eca57f9276 | ||
|
|
1ca392fb40 | ||
|
|
0cfec775b1 | ||
|
|
0d3d9472c7 | ||
|
|
9360f17c23 | ||
|
|
c0369461fc | ||
|
|
3bef8009de | ||
|
|
7c0d78ee3b | ||
|
|
9439055ebb | ||
|
|
74e3896af8 | ||
|
|
688cc2924c | ||
|
|
7049d8f0b9 | ||
|
|
ff47789095 | ||
|
|
f58079b62b | ||
|
|
08efebc87c | ||
|
|
d953ab89f4 | ||
|
|
d171c61bcc | ||
|
|
cce63f02b5 | ||
|
|
655c7babdb | ||
|
|
22703796d6 | ||
|
|
f8aeb97d6c | ||
|
|
8739d2ae42 | ||
|
|
f27fe16d8f | ||
|
|
8453db60fb | ||
|
|
18267465df | ||
|
|
a8fa434e23 | ||
|
|
11f4c3defb | ||
|
|
9e7db72b70 | ||
|
|
0c856bad5a | ||
|
|
e24b8963e6 | ||
|
|
c4ea44d025 | ||
|
|
c80b248ad4 | ||
|
|
c44f8a7ab1 | ||
|
|
02f0458e09 | ||
|
|
ff7fd622a8 | ||
|
|
1d066654b8 | ||
|
|
0b9167413e | ||
|
|
0f02624dbc | ||
|
|
f9728f1847 | ||
|
|
63488d82eb | ||
|
|
819d2e6ea0 | ||
|
|
2878b9df60 | ||
|
|
f08c695702 | ||
|
|
5d8d5b0c27 | ||
|
|
686a95514e | ||
|
|
a3eea0d968 | ||
|
|
4be969d189 | ||
|
|
5123dc58c8 | ||
|
|
12f2ea38b0 | ||
|
|
baf4a663df | ||
|
|
8fce5cd523 | ||
|
|
7eb97c0103 | ||
|
|
33e83626bf | ||
|
|
38d6b07318 | ||
|
|
e5b95f10a2 | ||
|
|
44ce8e8d09 | ||
|
|
008422434b | ||
|
|
3e3dfd5636 | ||
|
|
5838a98d2f | ||
|
|
f6be32d492 | ||
|
|
8c7fee9f6d | ||
|
|
e9a245b144 | ||
|
|
2eb2514e74 | ||
|
|
7e69bf8ac3 | ||
|
|
53dbe582ac | ||
|
|
30e94a8964 | ||
|
|
c89bfcd4f9 | ||
|
|
ed3bbc5032 | ||
|
|
855618d926 | ||
|
|
26fcdc4b6e | ||
|
|
7e9b5582c0 | ||
|
|
a850aba829 | ||
|
|
e672acac43 | ||
|
|
0e39061f1b | ||
|
|
c0ed81298d | ||
|
|
dffed32515 | ||
|
|
a679908c6b | ||
|
|
63fac649d9 | ||
|
|
78a78340a0 | ||
|
|
1f1f3efb43 | ||
|
|
4bc8ea068e | ||
|
|
a85b73b935 | ||
|
|
e4b01de2b5 | ||
|
|
b21be7d2c9 | ||
|
|
d410c4699b | ||
|
|
e7b259f764 | ||
|
|
0405098dcc | ||
|
|
6aa7b2afe7 | ||
|
|
255edefa03 | ||
|
|
32e8538e88 | ||
|
|
5bb697bb85 | ||
|
|
46d8e1ecf5 | ||
|
|
53e4615a7a | ||
|
|
7b9eae280d | ||
|
|
e5934f9e85 | ||
|
|
26fae1dd06 | ||
|
|
c0aaba73de | ||
|
|
e849d230e7 | ||
|
|
2c23822ace | ||
|
|
342e44a20f | ||
|
|
121891f825 | ||
|
|
1da64adca1 | ||
|
|
96c8fecb9d | ||
|
|
178858d67c | ||
|
|
18b2899b25 | ||
|
|
8f6c324267 | ||
|
|
9fad4423f4 | ||
|
|
f82f03a06f | ||
|
|
73b82b12a7 | ||
|
|
f49c9ea60d | ||
|
|
f0c53c54b7 | ||
|
|
ab2547cfa0 | ||
|
|
496512f84c | ||
|
|
b954427f1a | ||
|
|
aaebe5e65f | ||
|
|
7fc6cefba1 | ||
|
|
a30ed090c4 | ||
|
|
d60d22d0ec | ||
|
|
890cf02a5e | ||
|
|
af68656310 | ||
|
|
21203685ba | ||
|
|
9caca125d0 | ||
|
|
cb182ac1b2 | ||
|
|
58bebf1b33 | ||
|
|
0ee1d67122 | ||
|
|
e44da5e088 | ||
|
|
18e2801bf8 | ||
|
|
c0dc7fec56 | ||
|
|
2ceba8a949 | ||
|
|
a4b9a1f415 | ||
|
|
3bb7e12a1c | ||
|
|
1704c31a85 | ||
|
|
65cf34b3e0 | ||
|
|
c17e9238a7 | ||
|
|
e56d281631 | ||
|
|
0361dbe153 | ||
|
|
25f0ed2b29 | ||
|
|
ddae09fe85 | ||
|
|
ac9b1369da | ||
|
|
7422c27c7d | ||
|
|
ccc133046c | ||
|
|
bf0e4abece | ||
|
|
e7abd2bebe | ||
|
|
a18ec8a20f | ||
|
|
4b58daac14 | ||
|
|
e76c1ecaf1 | ||
|
|
df4a4b1dce | ||
|
|
028f155268 | ||
|
|
0ccf272a1a | ||
|
|
b2442b3702 | ||
|
|
47d50d0500 | ||
|
|
7c69006e60 | ||
|
|
38bd00212e | ||
|
|
f3a1c5f569 | ||
|
|
6961907eec | ||
|
|
5b66cdd8d4 | ||
|
|
06d5a08dd0 | ||
|
|
6cf14a099b | ||
|
|
93cee61bfb | ||
|
|
82c8262a2c | ||
|
|
b455c5aa2c | ||
|
|
df352a53bc | ||
|
|
2546d38fce | ||
|
|
68984fa817 | ||
|
|
804ff2d2c7 | ||
|
|
da5db665eb | ||
|
|
a457a69c21 | ||
|
|
0d4fb97292 | ||
|
|
b39fa254b9 | ||
|
|
8e7996424c | ||
|
|
2b10984921 | ||
|
|
ba6cb75501 | ||
|
|
d792a73dcf | ||
|
|
dc3477b4cd | ||
|
|
45655ed3cc | ||
|
|
e0a0048d39 | ||
|
|
39c842c026 | ||
|
|
d4e3b4d40f | ||
|
|
7aac2586ef | ||
|
|
fe56d63258 | ||
|
|
79d05914bd | ||
|
|
cb336f47fe | ||
|
|
c95d54c2e9 | ||
|
|
0b47b11601 | ||
|
|
eed3895f1b | ||
|
|
fd6c4d0bf6 | ||
|
|
e50d5a4a88 | ||
|
|
7770fb81d1 |
3
.devScript.json
Normal file
3
.devScript.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"outDir": "dist/app"
|
||||
}
|
||||
42
.github/deploy.ts
vendored
42
.github/deploy.ts
vendored
@@ -1,42 +0,0 @@
|
||||
import * as Client from "ssh2-sftp-client";
|
||||
import * as archiver from "archiver";
|
||||
import * as rimraf from "rimraf";
|
||||
import { platform } from "os";
|
||||
import { createWriteStream } from "fs";
|
||||
|
||||
let sftp = new Client();
|
||||
|
||||
sftp
|
||||
.connect({
|
||||
host: process.env.SSH_HOST,
|
||||
username: process.env.SSH_USERNAME,
|
||||
password: process.env.SSH_PASSWORD
|
||||
})
|
||||
.then(async () => {
|
||||
rimraf.sync("../dist/app/");
|
||||
|
||||
console.log("Zipping...");
|
||||
let output = createWriteStream("app.zip"),
|
||||
archive = archiver("zip");
|
||||
|
||||
archive.directory(`../dist/`, platform());
|
||||
|
||||
output.on("close", function() {
|
||||
console.log("Uploading...");
|
||||
sftp
|
||||
.fastPut("app.zip", `/home/PreMiD/builds/${platform()}.zip`)
|
||||
.then(() => {
|
||||
console.log("Done!");
|
||||
sftp.end();
|
||||
});
|
||||
});
|
||||
|
||||
archive.on("error", function(err) {
|
||||
sftp.end();
|
||||
throw err;
|
||||
});
|
||||
|
||||
archive.pipe(output);
|
||||
|
||||
archive.finalize();
|
||||
});
|
||||
138
.github/workflows/deploy.yml
vendored
138
.github/workflows/deploy.yml
vendored
@@ -1,9 +1,7 @@
|
||||
name: DePloY
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- "src/**/*"
|
||||
- "**.ts"
|
||||
release:
|
||||
types: [published]
|
||||
env:
|
||||
NODE_ENV: DePloY
|
||||
jobs:
|
||||
@@ -11,78 +9,90 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macOS-latest]
|
||||
os: [macOS-latest, windows-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@master
|
||||
- name: Install Dependencies
|
||||
run: npm i -g yarn
|
||||
- name: Prepare to package
|
||||
run: |
|
||||
yarn
|
||||
yarn run init
|
||||
npm i
|
||||
npm i -g typescript rimraf
|
||||
- name: Prepare to package
|
||||
run: npm run init
|
||||
- name: Package
|
||||
run: yarn pkg
|
||||
- name: Upload to server
|
||||
run: |
|
||||
npm run pkg
|
||||
rimraf dist/app
|
||||
node util/zip dist ${{ matrix.os }}.zip --zip
|
||||
- name: Upload bundle
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSHHOST }}
|
||||
SSH_USERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSH_PASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
run: yarn deploy
|
||||
installer:
|
||||
needs: package
|
||||
SSHHOST: ${{ secrets.SSHHOST }}
|
||||
SSHUSERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSHPASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
run: |
|
||||
tsc util/uploadFile util/zip
|
||||
node util/uploadFile ${{ matrix.os }}.zip /home/PreMiD/download/util/${{ matrix.os }}.zip
|
||||
createInstallers:
|
||||
runs-on: "ubuntu-latest"
|
||||
needs: package
|
||||
steps:
|
||||
- name: Prepare for installer
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@master
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm i
|
||||
npm i -g typescript
|
||||
- name: Download InstallBuilder
|
||||
run: |
|
||||
wget https://clients.bitrock.com/installbuilder/installbuilder-enterprise-19.10.0-linux-x64-installer.run
|
||||
chmod u+x installbuilder-enterprise-19.10.0-linux-x64-installer.run
|
||||
- name: Install InstallBuilder
|
||||
run: |
|
||||
./installbuilder-enterprise-19.10.0-linux-x64-installer.run --installer-language en --prefix ./installbuilder --mode unattended
|
||||
echo "${{ secrets.IBLICENSE }}" > ./installbuilder/license.xml
|
||||
- name: Prepare Upgrade Installer
|
||||
run: |
|
||||
tsc util/prepare
|
||||
node util/prepare
|
||||
- name: Create Upgrade Installer (MacOS 64bit)
|
||||
run: |
|
||||
installbuilder/bin/builder build installer_assets/PreMiD-Upgrade.xml osx
|
||||
- name: Create Upgrade Installer (Windows)
|
||||
run: |
|
||||
installbuilder/bin/builder build installer_assets/PreMiD-Upgrade.xml windows
|
||||
- name: Upload files
|
||||
env:
|
||||
SSHHOST: ${{ secrets.SSHHOST }}
|
||||
SSHUSERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSHPASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
run: |
|
||||
tsc util/uploadFile util/zip
|
||||
node util/uploadFile dist/installer/upgrader.exe /home/PreMiD/download/upgrader.exe
|
||||
node util/uploadFile dist/installer/upgrader.app.zip /home/PreMiD/download/util/upgrader.app.zip
|
||||
- name: Finalize build
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
unzip darwin.zip
|
||||
unzip win32.zip
|
||||
mv darwin/PreMiD-darwin-x64 PreMiD-darwin-x64
|
||||
mv win32/PreMiD-win32-ia32 PreMiD-win32-ia32
|
||||
mv win32/PreMiD-win32-x64 PreMiD-win32-x64
|
||||
rm -r win32.zip darwin.zip darwin win32
|
||||
- name: Create installer (Windows 32bit)
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-win32-ia32
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml windows
|
||||
- name: Create installer (Windows 64bit)
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-win32-x64
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml windows
|
||||
- name: Create installer (MacOS)
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-darwin-x64
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml osx
|
||||
- name: Cleanup
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
rm -r PreMiD-darwin-x64 PreMiD-win32-ia32 PreMiD-win32-x64
|
||||
cd /home/PreMiD/download/util
|
||||
unzip upgrader.app.zip
|
||||
tar -czvf upgrader.app.tgz upgrader.app
|
||||
mv upgrader.app.tgz ../
|
||||
rm -rf upgrader.app upgrader.app.zip
|
||||
unzip windows-latest.zip
|
||||
cd windows-latest/PreMiD-win32-x64/
|
||||
zip -r ../../PreMiD-win32-x64.zip .
|
||||
mv ../../PreMiD-win32-x64.zip /home/PreMiD/download/
|
||||
cd ../PreMiD-win32-ia32/
|
||||
zip -r ../../PreMiD-win32-x86.zip .
|
||||
mv ../../PreMiD-win32-x86.zip /home/PreMiD/download/
|
||||
cd ../..
|
||||
rm -rf windows-latest windows-latest.zip
|
||||
unzip macOS-latest.zip
|
||||
cd macOS-latest/PreMiD-darwin-x64/
|
||||
zip -r ../../PreMiD-darwin-x64.zip .
|
||||
mv ../../PreMiD-darwin-x64.zip /home/PreMiD/download/
|
||||
cd ../..
|
||||
rm -rf macOS-latest macOS-latest.zip
|
||||
|
||||
1
CODEOWNERS
Normal file
1
CODEOWNERS
Normal file
@@ -0,0 +1 @@
|
||||
* @Timeraa
|
||||
@@ -13,6 +13,7 @@
|
||||

|
||||

|
||||

|
||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2FPreMiD%2FPreMiD?ref=badge_shield)
|
||||
|
||||
<img src=".github/example.png" draggable="false"><br>
|
||||
|
||||
@@ -41,3 +42,7 @@
|
||||
<img height="75px" draggable="false" src="https://discordapp.com/api/guilds/493130730549805057/widget.png?style=banner2" alt="Join my Discord!">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
## License
|
||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2FPreMiD%2FPreMiD?ref=badge_large)
|
||||
112
devMode.ts
112
devMode.ts
@@ -1,112 +0,0 @@
|
||||
import * as ts from "typescript";
|
||||
import chalk from "chalk";
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
import { removeSync, writeFileSync, copySync } from "fs-extra";
|
||||
import { extname } from "path";
|
||||
import * as glob from "fast-glob";
|
||||
|
||||
//* Current child process = null
|
||||
var currChild: ChildProcess = null;
|
||||
|
||||
//* Format Host
|
||||
const formatHost: ts.FormatDiagnosticsHost = {
|
||||
getCanonicalFileName: path => path,
|
||||
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
};
|
||||
|
||||
//* Create ts program
|
||||
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
|
||||
|
||||
//* Create Watch compoile host
|
||||
const host = ts.createWatchCompilerHost(
|
||||
"./tsconfig.json",
|
||||
{},
|
||||
ts.sys,
|
||||
createProgram,
|
||||
null,
|
||||
fileChange
|
||||
);
|
||||
|
||||
if (process.argv.length == 3 && process.argv[2] == "compile")
|
||||
prepareDist().then(() => process.exit());
|
||||
//* Create watch program
|
||||
else ts.createWatchProgram(host);
|
||||
|
||||
async function fileChange(diagnostic: ts.Diagnostic) {
|
||||
//* TS compilation != done
|
||||
if (diagnostic.code !== 6194) {
|
||||
//* If error
|
||||
if ([6031, 6032].includes(diagnostic.code))
|
||||
console.log(
|
||||
chalk.blueBright(ts.formatDiagnostic(diagnostic, formatHost))
|
||||
);
|
||||
else
|
||||
console.log(chalk.redBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
return;
|
||||
} else
|
||||
console.log(chalk.greenBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
|
||||
console.log(currChild && currChild.killed);
|
||||
//* Kill old child if exists && alive
|
||||
if (currChild && !currChild.killed) currChild.kill();
|
||||
|
||||
//* Run devMode script
|
||||
prepareDist();
|
||||
|
||||
//* Clear console
|
||||
console.clear();
|
||||
|
||||
//* Run child
|
||||
currChild = spawn("yarn start", {
|
||||
shell: true,
|
||||
stdio: "inherit"
|
||||
});
|
||||
}
|
||||
|
||||
//* Prepare dist folder
|
||||
async function prepareDist() {
|
||||
//* Select files
|
||||
var dist = await glob("dist/app/**/*", { onlyFiles: true }),
|
||||
src = await glob("src/**/*", { onlyFiles: true });
|
||||
|
||||
//* Filter file differences
|
||||
var nDist = dist.map(f => [f.replace("dist/app/", ""), f]);
|
||||
src = src
|
||||
.map(f => f.replace("src/", "").split(".")[0])
|
||||
.filter(sf => nDist.find(d => d[0].split(".")[0] == sf));
|
||||
|
||||
//* Old files, delete
|
||||
Promise.all(
|
||||
dist
|
||||
.filter(f => !src.includes(f.replace("dist/app/", "").split(".")[0]))
|
||||
.map(f => removeSync(f))
|
||||
);
|
||||
|
||||
//* Copy package.json (minified)
|
||||
var packageJSON = require("./package.json"),
|
||||
srcPackageJSON = packageJSON;
|
||||
|
||||
//* Delete scripts, not needed
|
||||
delete srcPackageJSON.scripts;
|
||||
|
||||
//* only electron as devDependency
|
||||
srcPackageJSON.devDependencies = {
|
||||
electron: packageJSON.devDependencies.electron
|
||||
};
|
||||
|
||||
//* Write file
|
||||
await writeFileSync(
|
||||
"./src/package.json",
|
||||
JSON.stringify(srcPackageJSON, null, 2)
|
||||
);
|
||||
|
||||
//* Copy files from src to dist
|
||||
copySync("src", "dist/app", {
|
||||
filter: function(path) {
|
||||
if (path.includes("node_modules")) return false;
|
||||
return extname(path) !== ".ts";
|
||||
console.log(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
416
installer_assets/PreMiD-Upgrade.xml
Normal file
416
installer_assets/PreMiD-Upgrade.xml
Normal file
@@ -0,0 +1,416 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>VERSION</version>
|
||||
<installerFilename>upgrader.${platform_exec_suffix}</installerFilename>
|
||||
<debugLevel>0</debugLevel>
|
||||
<licenseFile>../LICENSE</licenseFile>
|
||||
<leftImage>leftSide.png</leftImage>
|
||||
<logoImage>logo.png</logoImage>
|
||||
<splashImage>logo.png</splashImage>
|
||||
<componentList>
|
||||
<component>
|
||||
<name>default</name>
|
||||
<description>Default Component</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfiles</name>
|
||||
<platforms>all</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux</name>
|
||||
<platforms>linux</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux64</name>
|
||||
<platforms>linux-x64</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows</name>
|
||||
<platforms>windows</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows64</name>
|
||||
<platforms>windows-x64</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfilesosx</name>
|
||||
<platforms>osx</platforms>
|
||||
</folder>
|
||||
</folderList>
|
||||
<startMenuShortcutList>
|
||||
<startMenuShortcut>
|
||||
<comment>Uninstall ${product_fullname}</comment>
|
||||
<name>Uninstall ${product_fullname}</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath>${installdir}/</windowsPath>
|
||||
</startMenuShortcut>
|
||||
<startMenuShortcut>
|
||||
<comment>Rich Presence for web services.</comment>
|
||||
<name>PreMiD</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMiD.${platform_exec_suffix}</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath></windowsPath>
|
||||
</startMenuShortcut>
|
||||
</startMenuShortcutList>
|
||||
</component>
|
||||
</componentList>
|
||||
<initializationActionList>
|
||||
<setInstallerVariable>
|
||||
<name>installdir</name>
|
||||
<persist>1</persist>
|
||||
<value>${windows_folder_appdata}/PreMiD</value>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</setInstallerVariable>
|
||||
<setInstallerVariable>
|
||||
<name>installdir</name>
|
||||
<persist>1</persist>
|
||||
<value>${platform_install_prefix}/PreMiD</value>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</setInstallerVariable>
|
||||
</initializationActionList>
|
||||
<readyToInstallActionList>
|
||||
<actionGroup>
|
||||
<customErrorMessage>Couldn't download release... Try again later.</customErrorMessage>
|
||||
<progressText>Downloading latest release...</progressText>
|
||||
<actionList>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<width>450</width>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-win32-x64.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows-x64</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-win32-ia32.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows-x86</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-darwin-x64.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
<actionGroup>
|
||||
<actionList>
|
||||
<!-- Remove the old ARP Entry
|
||||
Get the old version -->
|
||||
<registryGet>
|
||||
<key>HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}</key>
|
||||
<name>Version</name>
|
||||
<variable>oldVersion</variable>
|
||||
</registryGet>
|
||||
|
||||
<!-- Delete the old ARP registry keys -->
|
||||
<registryDelete>
|
||||
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} ${oldVersion}</key>
|
||||
<name></name>
|
||||
</registryDelete>
|
||||
<registryDelete>
|
||||
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\${project.fullName} ${oldVersion}</key>
|
||||
<name></name>
|
||||
</registryDelete>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest type="windows"/>
|
||||
<isTrue value="${isUpgradeMode}"/>
|
||||
</ruleList>
|
||||
</actionGroup>
|
||||
<actionGroup>
|
||||
<progressText>Killing ${product_fullname}...</progressText>
|
||||
<actionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
</readyToInstallActionList>
|
||||
<postInstallationActionList>
|
||||
<unzip>
|
||||
<addToUninstaller>1</addToUninstaller>
|
||||
<destinationDirectory>${installdir}</destinationDirectory>
|
||||
<progressText>Extracting release...</progressText>
|
||||
<zipFile>${system_temp_directory}/PreMiD-release.zip</zipFile>
|
||||
</unzip>
|
||||
<addDirectoriesToUninstaller>
|
||||
<addContents>1</addContents>
|
||||
<files>${installdir}/</files>
|
||||
</addDirectoriesToUninstaller>
|
||||
</postInstallationActionList>
|
||||
<preUninstallationActionList>
|
||||
<actionGroup>
|
||||
<progressText>Killing ${product_fullname}...</progressText>
|
||||
<actionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
</preUninstallationActionList>
|
||||
<compressionAlgorithm>lzham-ultra</compressionAlgorithm>
|
||||
<createOsxBundleZip>1</createOsxBundleZip>
|
||||
<defaultInstallationMode>unattended</defaultInstallationMode>
|
||||
<deleteOnExit>1</deleteOnExit>
|
||||
<description>Rich Presence for web services.</description>
|
||||
<disableSplashScreen>1</disableSplashScreen>
|
||||
<enableRollback>0</enableRollback>
|
||||
<enableSslSupport>1</enableSslSupport>
|
||||
<enableTimestamp>1</enableTimestamp>
|
||||
<installationScope>user</installationScope>
|
||||
<installationType>upgrade</installationType>
|
||||
<licenseFileEncoding>utf-8</licenseFileEncoding>
|
||||
<osxApplicationBundleIcon>appIcon.icns</osxApplicationBundleIcon>
|
||||
<osxApplicationBundleIdentifier>eu.Timeraa.PreMiD</osxApplicationBundleIdentifier>
|
||||
<osxPlatforms>osx-intel osx-x86_64</osxPlatforms>
|
||||
<osxUninstallerApplicationBundleIcon>appIcon.icns</osxUninstallerApplicationBundleIcon>
|
||||
<outputDirectory>../dist/installer</outputDirectory>
|
||||
<overwritePolicy>onlyIfNewer</overwritePolicy>
|
||||
<productDisplayIcon>C:/Users/metzf/Documents/Development/PreMiD/PreMiD/installer_assets/appIcon.ico</productDisplayIcon>
|
||||
<productUrlHelpLink>https://discord.gg/PreMiD</productUrlHelpLink>
|
||||
<productUrlInfoAbout>https://premid.app</productUrlInfoAbout>
|
||||
<readmeFileEncoding>utf-8</readmeFileEncoding>
|
||||
<removeLogFile>1</removeLogFile>
|
||||
<removeUninstallationLogFile>1</removeUninstallationLogFile>
|
||||
<requestedExecutionLevel>asInvoker</requestedExecutionLevel>
|
||||
<saveRelativePaths>1</saveRelativePaths>
|
||||
<summary>Rich Presence for web services.</summary>
|
||||
<unattendedModeUI>minimalWithDialogs</unattendedModeUI>
|
||||
<vendor>Timeraa</vendor>
|
||||
<width>625</width>
|
||||
<windowsExecutableIcon>appIcon.ico</windowsExecutableIcon>
|
||||
<windowsResourceFileDescription>Rich Presence for web services.</windowsResourceFileDescription>
|
||||
<windowsResourceFileVersion>${product_version}</windowsResourceFileVersion>
|
||||
<windowsUninstallerExecutableIcon>appIcon.ico</windowsUninstallerExecutableIcon>
|
||||
<licenseFileList>
|
||||
<licenseFile>
|
||||
<code>en</code>
|
||||
<encoding>utf-8</encoding>
|
||||
<file>../LICENSE</file>
|
||||
</licenseFile>
|
||||
</licenseFileList>
|
||||
<parameterList>
|
||||
<parameterGroup>
|
||||
<name>post_install_page</name>
|
||||
<title>Installation Finished</title>
|
||||
<explanation></explanation>
|
||||
<value></value>
|
||||
<default></default>
|
||||
<insertAfter>installation</insertAfter>
|
||||
<parameterList>
|
||||
<labelParameter>
|
||||
<name>general</name>
|
||||
<description>General</description>
|
||||
<explanation></explanation>
|
||||
<image></image>
|
||||
</labelParameter>
|
||||
<booleanParameter>
|
||||
<name>addDesktop</name>
|
||||
<description>Create Desktop Icon</description>
|
||||
<explanation></explanation>
|
||||
<value>false</value>
|
||||
<default>false</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
<booleanParameter>
|
||||
<name>launchApp</name>
|
||||
<description>Launch App</description>
|
||||
<explanation></explanation>
|
||||
<value>true</value>
|
||||
<default>true</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
<labelParameter>
|
||||
<name>extra</name>
|
||||
<description>Extra</description>
|
||||
<explanation></explanation>
|
||||
<image></image>
|
||||
</labelParameter>
|
||||
<booleanParameter>
|
||||
<name>openStore</name>
|
||||
<description>Open Presence Store</description>
|
||||
<explanation></explanation>
|
||||
<value>true</value>
|
||||
<default>true</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
</parameterList>
|
||||
<postShowPageActionList>
|
||||
<createShortcuts>
|
||||
<destination>${windows_folder_desktopdirectory}</destination>
|
||||
<ruleList>
|
||||
<isTrue>
|
||||
<value>${addDesktop}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
<shortcutList>
|
||||
<quickLaunchShortcut>
|
||||
<comment>Rich Presence for web services.</comment>
|
||||
<name>PreMiD</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMiD.${platform_exec_suffix}</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath></windowsPath>
|
||||
</quickLaunchShortcut>
|
||||
</shortcutList>
|
||||
</createShortcuts>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>PreMiD.exe</program>
|
||||
<programArguments>&</programArguments>
|
||||
<progressText>Launching PreMiD...</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<workingDirectory>${installdir}</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<isTrue>
|
||||
<value>${launchApp}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>open</program>
|
||||
<programArguments>${installdir}/PreMiD.app</programArguments>
|
||||
<progressText>Launching PreMiD...</progressText>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<isTrue>
|
||||
<value>${launchApp}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<launchBrowser>
|
||||
<url>https://premid.app/store</url>
|
||||
<ruleList>
|
||||
<isTrue>
|
||||
<value>${openStore}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</launchBrowser>
|
||||
<exit/>
|
||||
</postShowPageActionList>
|
||||
</parameterGroup>
|
||||
</parameterList>
|
||||
<platformOptionsList>
|
||||
<platformOptions>
|
||||
<platform>windows</platform>
|
||||
</platformOptions>
|
||||
</platformOptionsList>
|
||||
</project>
|
||||
|
||||
412
installer_assets/PreMiD.xml
Normal file
412
installer_assets/PreMiD.xml
Normal file
@@ -0,0 +1,412 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>latest</version>
|
||||
<installerFilename>${product_shortname}-installer.${platform_exec_suffix}</installerFilename>
|
||||
<debugLevel>0</debugLevel>
|
||||
<licenseFile>../LICENSE</licenseFile>
|
||||
<leftImage>leftSide.png</leftImage>
|
||||
<logoImage>logo.png</logoImage>
|
||||
<splashImage>logo.png</splashImage>
|
||||
<componentList>
|
||||
<component>
|
||||
<name>default</name>
|
||||
<description>Default Component</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfiles</name>
|
||||
<platforms>all</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux</name>
|
||||
<platforms>linux</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux64</name>
|
||||
<platforms>linux-x64</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows</name>
|
||||
<platforms>windows</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows64</name>
|
||||
<platforms>windows-x64</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfilesosx</name>
|
||||
<platforms>osx</platforms>
|
||||
</folder>
|
||||
</folderList>
|
||||
<startMenuShortcutList>
|
||||
<startMenuShortcut>
|
||||
<comment>Uninstall ${product_fullname}</comment>
|
||||
<name>Uninstall ${product_fullname}</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath>${installdir}/</windowsPath>
|
||||
</startMenuShortcut>
|
||||
<startMenuShortcut>
|
||||
<comment>Rich Presence for web services.</comment>
|
||||
<name>PreMiD</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMiD.${platform_exec_suffix}</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath></windowsPath>
|
||||
</startMenuShortcut>
|
||||
</startMenuShortcutList>
|
||||
</component>
|
||||
</componentList>
|
||||
<initializationActionList>
|
||||
<setInstallerVariable>
|
||||
<name>installdir</name>
|
||||
<persist>1</persist>
|
||||
<value>${windows_folder_appdata}/PreMiD</value>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</setInstallerVariable>
|
||||
<setInstallerVariable>
|
||||
<name>installdir</name>
|
||||
<persist>1</persist>
|
||||
<value>${platform_install_prefix}/PreMiD</value>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</setInstallerVariable>
|
||||
</initializationActionList>
|
||||
<readyToInstallActionList>
|
||||
<actionGroup>
|
||||
<customErrorMessage>Couldn't download release... Try again later.</customErrorMessage>
|
||||
<progressText>Downloading latest release...</progressText>
|
||||
<actionList>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<width>450</width>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-win32-x64.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows-x64</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-win32-ia32.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows-x86</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
<showProgressDialog>
|
||||
<title>Downloading latest release...</title>
|
||||
<actionList>
|
||||
<httpGet>
|
||||
<customErrorMessage>${platform_name}</customErrorMessage>
|
||||
<filename>${system_temp_directory}/PreMiD-release.zip</filename>
|
||||
<url>https://github.com/PreMiD/PreMiD/releases/latest/download/PreMiD-darwin-x64.zip</url>
|
||||
</httpGet>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</showProgressDialog>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
<actionGroup>
|
||||
<actionList>
|
||||
<!-- Remove the old ARP Entry
|
||||
Get the old version -->
|
||||
<registryGet>
|
||||
<key>HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}</key>
|
||||
<name>Version</name>
|
||||
<variable>oldVersion</variable>
|
||||
</registryGet>
|
||||
|
||||
<!-- Delete the old ARP registry keys -->
|
||||
<registryDelete>
|
||||
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${project.fullName} ${oldVersion}</key>
|
||||
<name></name>
|
||||
</registryDelete>
|
||||
<registryDelete>
|
||||
<key>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Management\ARPCache\${project.fullName} ${oldVersion}</key>
|
||||
<name></name>
|
||||
</registryDelete>
|
||||
</actionList>
|
||||
<ruleList>
|
||||
<platformTest type="windows"/>
|
||||
<isTrue value="${isUpgradeMode}"/>
|
||||
</ruleList>
|
||||
</actionGroup>
|
||||
<actionGroup>
|
||||
<progressText>Killing ${product_fullname}...</progressText>
|
||||
<actionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
</readyToInstallActionList>
|
||||
<postInstallationActionList>
|
||||
<unzip>
|
||||
<addToUninstaller>1</addToUninstaller>
|
||||
<destinationDirectory>${installdir}</destinationDirectory>
|
||||
<progressText>Extracting release...</progressText>
|
||||
<zipFile>${system_temp_directory}/PreMiD-release.zip</zipFile>
|
||||
</unzip>
|
||||
<addDirectoriesToUninstaller>
|
||||
<addContents>1</addContents>
|
||||
<files>${installdir}/</files>
|
||||
</addDirectoriesToUninstaller>
|
||||
</postInstallationActionList>
|
||||
<preUninstallationActionList>
|
||||
<actionGroup>
|
||||
<progressText>Killing ${product_fullname}...</progressText>
|
||||
<actionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</actionList>
|
||||
</actionGroup>
|
||||
</preUninstallationActionList>
|
||||
<compressionAlgorithm>lzham-ultra</compressionAlgorithm>
|
||||
<createOsxBundleZip>1</createOsxBundleZip>
|
||||
<deleteOnExit>1</deleteOnExit>
|
||||
<description>Rich Presence for web services.</description>
|
||||
<disableSplashScreen>1</disableSplashScreen>
|
||||
<enableRollback>0</enableRollback>
|
||||
<enableSslSupport>1</enableSslSupport>
|
||||
<enableTimestamp>1</enableTimestamp>
|
||||
<installationScope>user</installationScope>
|
||||
<licenseFileEncoding>utf-8</licenseFileEncoding>
|
||||
<osxApplicationBundleIcon>appIcon.icns</osxApplicationBundleIcon>
|
||||
<osxApplicationBundleIdentifier>eu.Timeraa.PreMiD</osxApplicationBundleIdentifier>
|
||||
<osxPlatforms>osx-intel osx-x86_64</osxPlatforms>
|
||||
<osxUninstallerApplicationBundleIcon>appIcon.icns</osxUninstallerApplicationBundleIcon>
|
||||
<outputDirectory>../dist/installer</outputDirectory>
|
||||
<overwritePolicy>onlyIfNewer</overwritePolicy>
|
||||
<productDisplayIcon>C:/Users/metzf/Documents/Development/PreMiD/PreMiD/installer_assets/appIcon.ico</productDisplayIcon>
|
||||
<productUrlHelpLink>https://discord.gg/PreMiD</productUrlHelpLink>
|
||||
<productUrlInfoAbout>https://premid.app</productUrlInfoAbout>
|
||||
<readmeFileEncoding>utf-8</readmeFileEncoding>
|
||||
<removeLogFile>1</removeLogFile>
|
||||
<removeUninstallationLogFile>1</removeUninstallationLogFile>
|
||||
<requestedExecutionLevel>asInvoker</requestedExecutionLevel>
|
||||
<saveRelativePaths>1</saveRelativePaths>
|
||||
<summary>Rich Presence for web services.</summary>
|
||||
<vendor>Timeraa</vendor>
|
||||
<windowsExecutableIcon>appIcon.ico</windowsExecutableIcon>
|
||||
<windowsResourceFileDescription>Rich Presence for web services.</windowsResourceFileDescription>
|
||||
<windowsResourceFileVersion>${product_version}</windowsResourceFileVersion>
|
||||
<windowsUninstallerExecutableIcon>appIcon.ico</windowsUninstallerExecutableIcon>
|
||||
<licenseFileList>
|
||||
<licenseFile>
|
||||
<code>en</code>
|
||||
<encoding>utf-8</encoding>
|
||||
<file>../LICENSE</file>
|
||||
</licenseFile>
|
||||
</licenseFileList>
|
||||
<parameterList>
|
||||
<parameterGroup>
|
||||
<name>post_install_page</name>
|
||||
<title>Installation Finished</title>
|
||||
<explanation></explanation>
|
||||
<value></value>
|
||||
<default></default>
|
||||
<insertAfter>installation</insertAfter>
|
||||
<parameterList>
|
||||
<labelParameter>
|
||||
<name>general</name>
|
||||
<description>General</description>
|
||||
<explanation></explanation>
|
||||
<image></image>
|
||||
</labelParameter>
|
||||
<booleanParameter>
|
||||
<name>addDesktop</name>
|
||||
<description>Create Desktop Icon</description>
|
||||
<explanation></explanation>
|
||||
<value>false</value>
|
||||
<default>false</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
<booleanParameter>
|
||||
<name>launchApp</name>
|
||||
<description>Launch App</description>
|
||||
<explanation></explanation>
|
||||
<value>true</value>
|
||||
<default>true</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
<labelParameter>
|
||||
<name>extra</name>
|
||||
<description>Extra</description>
|
||||
<explanation></explanation>
|
||||
<image></image>
|
||||
</labelParameter>
|
||||
<booleanParameter>
|
||||
<name>openStore</name>
|
||||
<description>Open Presence Store</description>
|
||||
<explanation></explanation>
|
||||
<value>true</value>
|
||||
<default>true</default>
|
||||
<displayStyle>checkbox-left</displayStyle>
|
||||
</booleanParameter>
|
||||
</parameterList>
|
||||
<postShowPageActionList>
|
||||
<createShortcuts>
|
||||
<destination>${windows_folder_desktopdirectory}</destination>
|
||||
<ruleList>
|
||||
<isTrue>
|
||||
<value>${addDesktop}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
<shortcutList>
|
||||
<quickLaunchShortcut>
|
||||
<comment>Rich Presence for web services.</comment>
|
||||
<name>PreMiD</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMiD.${platform_exec_suffix}</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath></windowsPath>
|
||||
</quickLaunchShortcut>
|
||||
</shortcutList>
|
||||
</createShortcuts>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>PreMiD.exe</program>
|
||||
<programArguments>&</programArguments>
|
||||
<progressText>Launching PreMiD...</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<workingDirectory>${installdir}</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<isTrue>
|
||||
<value>${launchApp}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>open</program>
|
||||
<programArguments>${installdir}/PreMiD.app</programArguments>
|
||||
<progressText>Launching PreMiD...</progressText>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<isTrue>
|
||||
<value>${launchApp}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<launchBrowser>
|
||||
<url>https://premid.app/store</url>
|
||||
<ruleList>
|
||||
<isTrue>
|
||||
<value>${openStore}</value>
|
||||
</isTrue>
|
||||
</ruleList>
|
||||
</launchBrowser>
|
||||
<exit/>
|
||||
</postShowPageActionList>
|
||||
</parameterGroup>
|
||||
</parameterList>
|
||||
<platformOptionsList>
|
||||
<platformOptions>
|
||||
<platform>windows</platform>
|
||||
</platformOptions>
|
||||
</platformOptionsList>
|
||||
</project>
|
||||
|
||||
@@ -1,257 +0,0 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>{{VERSION}}</version>
|
||||
<installerFilename>${product_fullname}-${product_version}-installer_64bit.${platform_exec_suffix}</installerFilename>
|
||||
<wrapLicenseFileText>0</wrapLicenseFileText>
|
||||
<logoImage>../installer_assets/appIcon.png</logoImage>
|
||||
<osxApplicationBundleIcon>../installer_assets/appIcon.icns</osxApplicationBundleIcon>
|
||||
<componentList>
|
||||
<component>
|
||||
<name>default</name>
|
||||
<description>Default Component</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfiles</name>
|
||||
<platforms>all</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>update.ini</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileslinux</name>
|
||||
<platforms>linux</platforms>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfileswindows</name>
|
||||
<platforms>windows</platforms>
|
||||
<distributionFileList>
|
||||
<distributionDirectory allowWildcards="1">
|
||||
<origin>../dist/PACKAGEDNAME/*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionFile>
|
||||
<origin>../installer_assets/appIcon.ico</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../installer_assets/updater.exe</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
<description>Program Files</description>
|
||||
<destination>${installdir}</destination>
|
||||
<name>programfilesosx</name>
|
||||
<platforms>osx</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>../installer_assets/updater.app</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../dist/PACKAGEDNAME/PreMiD.app</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
</folderList>
|
||||
<startMenuShortcutList>
|
||||
<startMenuShortcut>
|
||||
<comment></comment>
|
||||
<name>${product_fullname}</name>
|
||||
<runAsAdmin>0</runAsAdmin>
|
||||
<runInTerminal>0</runInTerminal>
|
||||
<windowsExec>${installdir}/PreMiD.exe</windowsExec>
|
||||
<windowsExecArgs></windowsExecArgs>
|
||||
<windowsIcon></windowsIcon>
|
||||
<windowsPath>${installdir}/</windowsPath>
|
||||
</startMenuShortcut>
|
||||
</startMenuShortcutList>
|
||||
</component>
|
||||
</componentList>
|
||||
<preInstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<program>${windows_folder_local_appdata}\premid\Update.exe</program>
|
||||
<programArguments>--uninstall</programArguments>
|
||||
<onErrorActionList>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
</deleteFile>
|
||||
</onErrorActionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<fileExists>
|
||||
<path>${windows_folder_local_appdata}\premid\PreMiD.exe</path>
|
||||
</fileExists>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<runProgram>
|
||||
<program>${windows_folder_common_appdata}\${system_username}\premid\Update.exe</program>
|
||||
<programArguments>--uninstall</programArguments>
|
||||
<onErrorActionList>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_common_appdata}\${system_username}\premid</path>
|
||||
</deleteFile>
|
||||
</onErrorActionList>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
<fileExists>
|
||||
<path>${windows_folder_common_appdata}\${system_username}\premid\PreMiD.exe</path>
|
||||
</fileExists>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
</preInstallationActionList>
|
||||
<postInstallationActionList>
|
||||
<runProgram>
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>PreMiD.exe</program>
|
||||
<programArguments>&</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<show>0</show>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<workingDirectory>${installdir}</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<setInstallerVariableFromRegEx show="0">
|
||||
<name>escaped_installdir</name>
|
||||
<pattern> </pattern>
|
||||
<substitution>\\ </substitution>
|
||||
<text>${installdir}</text>
|
||||
</setInstallerVariableFromRegEx>
|
||||
<runProgram>
|
||||
<program>open</program>
|
||||
<programArguments> ${escaped_installdir}/PreMiD.app</programArguments>
|
||||
<progressText>Launching PreMiD</progressText>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update</path>
|
||||
</deleteFile>
|
||||
<addDirectoriesToUninstaller>
|
||||
<addContents>1</addContents>
|
||||
<files>${installdir}</files>
|
||||
</addDirectoriesToUninstaller>
|
||||
<deleteFile>
|
||||
<path>${windows_folder_local_appdata}\premid</path>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</deleteFile>
|
||||
</postInstallationActionList>
|
||||
<preUninstallationActionList>
|
||||
<kill>
|
||||
<abortOnError>0</abortOnError>
|
||||
<name>${product_fullname}.exe</name>
|
||||
<progressText>Killing ${product_fullname}</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</kill>
|
||||
<runProgram>
|
||||
<program>pkill</program>
|
||||
<programArguments>PreMiD</programArguments>
|
||||
<runAs>${env(USER)}</runAs>
|
||||
<useMSDOSPath>0</useMSDOSPath>
|
||||
<workingDirectory>${installdir}/</workingDirectory>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>osx</type>
|
||||
</platformTest>
|
||||
<processTest>
|
||||
<logic>is_running</logic>
|
||||
<name>PreMiD</name>
|
||||
</processTest>
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<deleteFile>
|
||||
<path>${installdir}/update/</path>
|
||||
</deleteFile>
|
||||
<deleteFile>
|
||||
<matchHiddenFiles>1</matchHiddenFiles>
|
||||
<path>${windows_folder_appdata}/${product_fullname}</path>
|
||||
</deleteFile>
|
||||
</preUninstallationActionList>
|
||||
<defaultInstallationMode>unattended</defaultInstallationMode>
|
||||
<enableRollback>0</enableRollback>
|
||||
<enableTimestamp>1</enableTimestamp>
|
||||
<installationScope>user</installationScope>
|
||||
<overwritePolicy>onlyIfNewer</overwritePolicy>
|
||||
<osxApplicationBundleIdentifier>eu.Timeraa.PreMiD</osxApplicationBundleIdentifier>
|
||||
<outputDirectory>../dist/installer</outputDirectory>
|
||||
<productDisplayIcon>${installdir}/appIcon.ico</productDisplayIcon>
|
||||
<saveRelativePaths>1</saveRelativePaths>
|
||||
<unattendedModeUI>minimal</unattendedModeUI>
|
||||
<vendor>Timeraa</vendor>
|
||||
<windowsExecutableIcon>../installer_assets/appIcon.ico</windowsExecutableIcon>
|
||||
<parameterList>
|
||||
<directoryParameter>
|
||||
<name>installdir</name>
|
||||
<description>Installer.Parameter.installdir.description</description>
|
||||
<explanation>Installer.Parameter.installdir.explanation</explanation>
|
||||
<value></value>
|
||||
<default>${platform_install_prefix}/${product_shortname}</default>
|
||||
<allowEmptyValue>0</allowEmptyValue>
|
||||
<cliOptionName>prefix</cliOptionName>
|
||||
<mustBeWritable>1</mustBeWritable>
|
||||
<mustExist>0</mustExist>
|
||||
<width>40</width>
|
||||
</directoryParameter>
|
||||
</parameterList>
|
||||
</project>
|
||||
BIN
installer_assets/leftSide.png
Normal file
BIN
installer_assets/leftSide.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
BIN
installer_assets/logo.png
Normal file
BIN
installer_assets/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1,6 +0,0 @@
|
||||
[Update]
|
||||
|
||||
url=https://api.premid.app/app/update/64bit/
|
||||
version_id= ?
|
||||
check_for_updates=1
|
||||
update_download_location=${installer_directory}/update
|
||||
@@ -1,11 +0,0 @@
|
||||
<autoUpdateProject>
|
||||
<fullName>PreMiD</fullName>
|
||||
<shortName>PreMiD</shortName>
|
||||
<vendor>Timeraa</vendor>
|
||||
<version>2.0</version>
|
||||
<singleInstanceCheck>1</singleInstanceCheck>
|
||||
<requestedExecutionLevel>asInvoker</requestedExecutionLevel>
|
||||
<enableSslSupport>1</enableSslSupport>
|
||||
<outputDirectory>./</outputDirectory>
|
||||
<installerFilename>updater.${platform_exec_suffix}</installerFilename>
|
||||
</autoUpdateProject>
|
||||
101
package.json
101
package.json
@@ -1,51 +1,54 @@
|
||||
{
|
||||
"name": "premid",
|
||||
"productName": "PreMiD",
|
||||
"description": "Discord Rich Presence for websites.",
|
||||
"version": "2.0.3",
|
||||
"repository": "https://github.com/PreMiD/PreMiD",
|
||||
"scripts": {
|
||||
"init": "tsc && tsc pkg devMode && node devMode.js compile",
|
||||
"start": "electron dist/app/.",
|
||||
"dev": "node devMode.js",
|
||||
"pkg": "rimraf dist && tsc && node devMode compile && cd dist/app/ && yarn && cd ../../ && node pkg",
|
||||
"deploy": "tsc .github/deploy && cd .github && node deploy.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/archiver": "3.0.0",
|
||||
"@types/auto-launch": "5.0.1",
|
||||
"@types/discord-rpc": "3.0.2",
|
||||
"@types/electron-packager": "14.0.0",
|
||||
"@types/fs-extra": "8.0.1",
|
||||
"@types/ini": "1.3.30",
|
||||
"@types/node": "^12.11.7",
|
||||
"@types/prompts": "2.0.2",
|
||||
"@types/request-promise-native": "1.0.17",
|
||||
"@types/rimraf": "2.0.3",
|
||||
"@types/socket.io": "2.1.4",
|
||||
"@types/ssh2-sftp-client": "4.1.0",
|
||||
"archiver": "3.1.1",
|
||||
"chalk": "2.4.2",
|
||||
"electron": "7.0.0",
|
||||
"electron-packager": "14.0.6",
|
||||
"fast-glob": "3.1.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"ini": "1.3.5",
|
||||
"nodemon": "1.19.4",
|
||||
"ora": "4.0.2",
|
||||
"prompts": "2.2.1",
|
||||
"rimraf": "3.0.0",
|
||||
"source-map-support": "0.5.13",
|
||||
"ssh2-sftp-client": "4.2.2",
|
||||
"typescript": "3.6.4",
|
||||
"yarn": "^1.19.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"auto-launch": "5.0.5",
|
||||
"discord-rpc": "github:discordjs/RPC",
|
||||
"electron-store": "5.0.0",
|
||||
"socket.io": "2.3.0",
|
||||
"sudo-prompt": "9.0.0"
|
||||
}
|
||||
"name": "premid",
|
||||
"productName": "PreMiD",
|
||||
"description": "Discord Rich Presence for web services.",
|
||||
"version": "2.1.2",
|
||||
"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",
|
||||
"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",
|
||||
"devDependencies": {
|
||||
"@timeraa/devscript": "Timeraa/DevScript",
|
||||
"@types/archiver": "3.0.0",
|
||||
"@types/auto-launch": "5.0.1",
|
||||
"@types/discord-rpc": "3.0.2",
|
||||
"@types/electron-packager": "14.0.0",
|
||||
"@types/fs-extra": "8.0.1",
|
||||
"@types/ini": "1.3.30",
|
||||
"@types/node": "13.7.1",
|
||||
"@types/prompts": "2.0.3",
|
||||
"@types/request-promise-native": "1.0.17",
|
||||
"@types/rimraf": "2.0.3",
|
||||
"@types/socket.io": "2.1.4",
|
||||
"@types/ssh2-sftp-client": "4.1.3",
|
||||
"@types/unzipper": "^0.10.2",
|
||||
"archiver": "3.1.1",
|
||||
"chalk": "3.0.0",
|
||||
"electron": "8.0.1",
|
||||
"electron-packager": "14.2.1",
|
||||
"fast-glob": "3.2.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"nodemon": "2.0.2",
|
||||
"ora": "4.0.3",
|
||||
"prompts": "2.3.1",
|
||||
"rimraf": "3.0.2",
|
||||
"ssh2-sftp-client": "5.0.2",
|
||||
"typescript": "3.7.5",
|
||||
"unzipper": "0.10.8",
|
||||
"yarn": "1.22.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"auto-launch": "5.0.5",
|
||||
"axios": "0.19.2",
|
||||
"chokidar": "3.3.1",
|
||||
"discord-rpc": "github:discordjs/RPC",
|
||||
"electron-store": "5.1.0",
|
||||
"socket.io": "2.3.0",
|
||||
"source-map-support": "^0.5.16"
|
||||
}
|
||||
}
|
||||
|
||||
330
pkg.ts
330
pkg.ts
@@ -1,233 +1,123 @@
|
||||
import * as electronPackager from "electron-packager";
|
||||
import { platform, arch } from "os";
|
||||
import { existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { exec } from "child_process";
|
||||
import { removeSync, ensureDirSync } from "fs-extra";
|
||||
import { parse, stringify } from "ini";
|
||||
import { platform } from "os";
|
||||
import * as prompts from "prompts";
|
||||
import * as ora from "ora";
|
||||
|
||||
(async () => {
|
||||
let response = {
|
||||
os: "current",
|
||||
arch: "all",
|
||||
installer: false
|
||||
};
|
||||
let response = {
|
||||
os: "current",
|
||||
arch: "all"
|
||||
};
|
||||
|
||||
if (process.env.NODE_ENV !== "DePloY")
|
||||
response = await prompts([
|
||||
{
|
||||
type: "select",
|
||||
name: "arch",
|
||||
message: "What architecture?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "arm64",
|
||||
value: "arm64"
|
||||
},
|
||||
{
|
||||
title: "armv7l",
|
||||
value: "armv7l"
|
||||
},
|
||||
{
|
||||
title: "ia32",
|
||||
value: "ia32"
|
||||
},
|
||||
{
|
||||
title: "mips64el",
|
||||
value: "mips64el"
|
||||
},
|
||||
{
|
||||
title: "x64",
|
||||
value: "x64"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
name: "os",
|
||||
message: "What operating system?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "darwin",
|
||||
value: "darwin"
|
||||
},
|
||||
{
|
||||
title: "linux",
|
||||
value: "linux"
|
||||
},
|
||||
{
|
||||
title: "mas",
|
||||
value: "mas"
|
||||
},
|
||||
{
|
||||
title: "win32",
|
||||
value: "win32"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "confirm",
|
||||
name: "installer",
|
||||
message: "With installer?"
|
||||
}
|
||||
]);
|
||||
if (process.env.NODE_ENV !== "DePloY")
|
||||
response = await prompts([
|
||||
{
|
||||
type: "select",
|
||||
name: "arch",
|
||||
message: "What architecture?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "arm64",
|
||||
value: "arm64"
|
||||
},
|
||||
{
|
||||
title: "armv7l",
|
||||
value: "armv7l"
|
||||
},
|
||||
{
|
||||
title: "ia32",
|
||||
value: "ia32"
|
||||
},
|
||||
{
|
||||
title: "mips64el",
|
||||
value: "mips64el"
|
||||
},
|
||||
{
|
||||
title: "x64",
|
||||
value: "x64"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
name: "os",
|
||||
message: "What operating system?",
|
||||
choices: [
|
||||
{
|
||||
title: "current",
|
||||
value: "current"
|
||||
},
|
||||
{
|
||||
title: "all",
|
||||
value: "all"
|
||||
},
|
||||
{
|
||||
title: "darwin",
|
||||
value: "darwin"
|
||||
},
|
||||
{
|
||||
title: "linux",
|
||||
value: "linux"
|
||||
},
|
||||
{
|
||||
title: "mas",
|
||||
value: "mas"
|
||||
},
|
||||
{
|
||||
title: "win32",
|
||||
value: "win32"
|
||||
}
|
||||
]
|
||||
}
|
||||
]);
|
||||
|
||||
//#region WIP
|
||||
let installerXml = readFileSync(`installer_assets/installer.xml`, "utf-8");
|
||||
if (!response.os) {
|
||||
process.exit();
|
||||
}
|
||||
|
||||
installerXml = installerXml.replace(
|
||||
"{{VERSION}}",
|
||||
require("./package.json").version
|
||||
);
|
||||
installerXml = installerXml.replace(
|
||||
/(PACKAGEDNAME)/g,
|
||||
`PreMiD-${platform()}-${arch()}`
|
||||
);
|
||||
let icon: string;
|
||||
|
||||
ensureDirSync("tmp");
|
||||
writeFileSync("tmp/installer.xml", installerXml);
|
||||
//#endregion
|
||||
if (
|
||||
response.os == "darwin" ||
|
||||
(response.os === "current" && platform() === "darwin")
|
||||
)
|
||||
icon = "./installer_assets/appIcon.icns";
|
||||
if (["ia32", "x64"].includes(response.arch) || platform() === "win32")
|
||||
icon = "./installer_assets/appIcon.ico";
|
||||
|
||||
if (!response.os) {
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
let spinner = ora("Packaging app").start(),
|
||||
packagingOptions: electronPackager.Options = {
|
||||
dir: "./dist/app",
|
||||
out: "./dist",
|
||||
darwinDarkModeSupport: true,
|
||||
icon: icon,
|
||||
overwrite: true,
|
||||
quiet: true,
|
||||
appBundleId: "eu.Timeraa.PreMiD",
|
||||
appCategoryType: "Utilities",
|
||||
appCopyright: `Timeraa 2018-${new Date().getFullYear()}`,
|
||||
prune: true,
|
||||
asar: true,
|
||||
// @ts-ignore
|
||||
arch: response.arch,
|
||||
// @ts-ignore
|
||||
platform: response.os
|
||||
};
|
||||
|
||||
let icon: string;
|
||||
if (response.arch === "current") delete packagingOptions.arch;
|
||||
if (response.os === "current") delete packagingOptions.platform;
|
||||
|
||||
if (
|
||||
response.os == "darwin" ||
|
||||
(response.os === "current" && platform() === "darwin")
|
||||
)
|
||||
icon = "./installer_assets/appIcon.icns";
|
||||
if (["ia32", "x64"].includes(response.arch) || platform() === "win32")
|
||||
icon = "./installer_assets/appIcon.ico";
|
||||
|
||||
if (existsSync("./dist/app/update.ini")) removeSync("./dist/app/update.ini");
|
||||
if (existsSync("./dist/app/updater.app"))
|
||||
removeSync("./dist/app/updater.app");
|
||||
if (existsSync("./dist/app/updater.exe"))
|
||||
removeSync("./dist/app/updater.exe");
|
||||
|
||||
let spinner = ora("Packaging app").start(),
|
||||
packagingOptions: electronPackager.Options = {
|
||||
dir: "./dist/app",
|
||||
out: "./dist",
|
||||
darwinDarkModeSupport: true,
|
||||
icon: icon,
|
||||
overwrite: true,
|
||||
quiet: true,
|
||||
appBundleId: "eu.Timeraa.PreMiD",
|
||||
appCategoryType: "Utilities",
|
||||
appCopyright: `Timeraa 2018-${new Date().getFullYear()}`,
|
||||
prune: true,
|
||||
// @ts-ignore
|
||||
arch: response.arch,
|
||||
// @ts-ignore
|
||||
platform: response.os
|
||||
};
|
||||
|
||||
if (response.arch === "current") delete packagingOptions.arch;
|
||||
if (response.os === "current") delete packagingOptions.platform;
|
||||
|
||||
// @ts-ignore
|
||||
electronPackager(packagingOptions).then(() => {
|
||||
if (!response.installer) {
|
||||
spinner.text = "Done!";
|
||||
spinner.succeed();
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
let versionId = "0" + require("./package.json").version.replace(/[.]/g, ""),
|
||||
updateIni = parse(readFileSync("./installer_assets/update.ini", "utf-8"));
|
||||
|
||||
updateIni.Update.version_id = versionId;
|
||||
|
||||
ensureDirSync("./tmp");
|
||||
writeFileSync("./tmp/update.ini", stringify(updateIni));
|
||||
|
||||
let bitRockBuilder = "",
|
||||
bitRockUpdater = "";
|
||||
|
||||
if (platform() === "win32") {
|
||||
bitRockBuilder = resolve(
|
||||
"C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/bin/builder-cli.exe"
|
||||
);
|
||||
bitRockUpdater = resolve(
|
||||
"C:/Program Files (x86)/BitRock InstallBuilder Enterprise 19.8.0/autoupdate/bin/customize.exe"
|
||||
);
|
||||
}
|
||||
|
||||
if (platform() === "darwin") {
|
||||
bitRockBuilder = resolve(
|
||||
"/Applications/Installbuilder/bin/Builder.app/Contents/MacOS/installbuilder.sh"
|
||||
);
|
||||
bitRockUpdater = resolve(
|
||||
"/Applications/Installbuilder/autoupdate/bin/customize.sh"
|
||||
);
|
||||
}
|
||||
|
||||
if (!existsSync(bitRockBuilder) || !existsSync(bitRockUpdater)) {
|
||||
spinner.fail("Bitrock installation not found.");
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Building updater";
|
||||
|
||||
let updater = exec(
|
||||
`"${bitRockUpdater}" build installer_assets/updater.xml ${
|
||||
platform() === "win32" ? "windows" : "osx"
|
||||
}`
|
||||
);
|
||||
|
||||
updater.once("exit", (code, signal) => {
|
||||
if (![0, 1].includes(code)) {
|
||||
spinner.fail(`Updater failed with code ${code}: ${signal}`);
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Building installer";
|
||||
let builder = exec(
|
||||
`"${bitRockBuilder}" build tmp/installer.xml ${
|
||||
platform() === "win32" ? "windows" : "osx"
|
||||
}`
|
||||
);
|
||||
|
||||
builder.once("exit", code => {
|
||||
removeSync("./tmp");
|
||||
|
||||
if (code !== 0) {
|
||||
spinner.fail(`Error code: ${code}`);
|
||||
process.exit();
|
||||
return;
|
||||
}
|
||||
|
||||
spinner.text = "Done!";
|
||||
spinner.succeed();
|
||||
process.exit();
|
||||
return;
|
||||
});
|
||||
});
|
||||
});
|
||||
electronPackager(packagingOptions).then(() => {
|
||||
spinner.text = "Done!";
|
||||
spinner.succeed();
|
||||
process.exit();
|
||||
});
|
||||
})();
|
||||
|
||||
BIN
src/assets/appIcon.icns
Normal file
BIN
src/assets/appIcon.icns
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 986 B After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 986 B After Width: | Height: | Size: 986 B |
41
src/index.ts
41
src/index.ts
@@ -1,12 +1,13 @@
|
||||
import { app, dialog } from "electron";
|
||||
//* Source .map support if devEnv
|
||||
if (!app.isPackaged) require("source-map-support").install();
|
||||
import "source-map-support/register";
|
||||
|
||||
import { app, dialog } from "electron";
|
||||
import { init as initSocket, socket } from "./managers/socketManager";
|
||||
import { init as initTray } from "./managers/trayManager";
|
||||
import { update as initAutoLaunch } from "./managers/launchManager";
|
||||
import { platform } from "os";
|
||||
import { checkForUpdate } from "./util/updateChecker";
|
||||
import { TrayManager } from "./managers/trayManager";
|
||||
|
||||
export let trayManager: TrayManager;
|
||||
|
||||
//* Define and set it to null
|
||||
//* Set AppUserModelId for task manager etc
|
||||
@@ -14,32 +15,28 @@ import { checkForUpdate } from "./util/updateChecker";
|
||||
export let updateCheckerInterval = null;
|
||||
app.setAppUserModelId("Timeraa.PreMiD");
|
||||
app.whenReady().then(async () => {
|
||||
//* Init auto launch
|
||||
//* Check for updates > Update and relaunch
|
||||
//* Init socket
|
||||
//* init application tray icon
|
||||
//* If app is packaged, run an update check every 15 mins
|
||||
initAutoLaunch();
|
||||
await checkForUpdate(true);
|
||||
await initSocket();
|
||||
await initTray();
|
||||
app.isPackaged
|
||||
? (updateCheckerInterval = setInterval(checkForUpdate, 15 * 1000 * 60))
|
||||
: undefined;
|
||||
if (platform() === "darwin") app.dock.hide();
|
||||
trayManager = new TrayManager();
|
||||
|
||||
await Promise.all([checkForUpdate(true), initAutoLaunch(), initSocket()]);
|
||||
|
||||
app.isPackaged
|
||||
? (updateCheckerInterval = setInterval(checkForUpdate, 15 * 1000 * 60))
|
||||
: undefined;
|
||||
if (platform() === "darwin") app.dock.hide();
|
||||
});
|
||||
|
||||
//* If second instance started, close old one
|
||||
app.on("second-instance", app.quit);
|
||||
app.on("second-instance", () => app.exit(0));
|
||||
|
||||
//* Send errors from app to extension
|
||||
process.on("unhandledRejection", rejection => {
|
||||
console.log(rejection);
|
||||
socket.emit("unhandledRejection", rejection);
|
||||
console.error(rejection);
|
||||
if (socket && socket.connected) socket.emit("unhandledRejection", rejection);
|
||||
});
|
||||
|
||||
// TODO Find better way to log
|
||||
process.on("uncaughtException", err => {
|
||||
dialog.showErrorBox(err.name, err.stack);
|
||||
app.exit(0);
|
||||
console.error(err.stack);
|
||||
dialog.showErrorBox(err.name, err.stack);
|
||||
app.exit(0);
|
||||
});
|
||||
|
||||
@@ -1,35 +1,93 @@
|
||||
import { Client } from "discord-rpc";
|
||||
import { app } from "electron";
|
||||
import { platform } from "os";
|
||||
import { tray } from "./trayManager";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
//* Import custom types
|
||||
import Presence from "../../@types/PreMiD/Presence";
|
||||
import PresenceData from "../../@types/PreMiD/PresenceData";
|
||||
import { trayManager } from "..";
|
||||
|
||||
//* Define Presence array
|
||||
let loggedInPresences: Array<Presence> = [];
|
||||
export let rpcClients: Array<RPCClient> = [];
|
||||
|
||||
class RPCClient {
|
||||
clientId: string;
|
||||
currentPresence: PresenceData;
|
||||
client: Client;
|
||||
clientReady: boolean = false;
|
||||
|
||||
constructor(clientId: string) {
|
||||
rpcClients.push(this);
|
||||
|
||||
this.clientId = clientId;
|
||||
this.client = new Client({
|
||||
transport: "ipc"
|
||||
});
|
||||
|
||||
this.client.once("ready", () => {
|
||||
this.clientReady = true;
|
||||
this.setActivity();
|
||||
});
|
||||
this.client.once(
|
||||
// @ts-ignore
|
||||
"disconnected",
|
||||
() =>
|
||||
(rpcClients = rpcClients.filter(
|
||||
client => client.clientId !== this.clientId
|
||||
))
|
||||
);
|
||||
|
||||
this.client.login({ clientId: this.clientId }).catch(() => this.destroy());
|
||||
|
||||
info(`Create RPC client (${this.clientId})`);
|
||||
}
|
||||
|
||||
setActivity(presenceData?: PresenceData) {
|
||||
presenceData = presenceData ? presenceData : this.currentPresence;
|
||||
|
||||
if (!this.clientReady || !presenceData) return;
|
||||
|
||||
if (presenceData.trayTitle)
|
||||
trayManager.tray.setTitle(presenceData.trayTitle);
|
||||
|
||||
this.client
|
||||
.setActivity(presenceData.presenceData)
|
||||
.catch(() => this.destroy());
|
||||
info("setActivity");
|
||||
}
|
||||
|
||||
clearActivity() {
|
||||
this.currentPresence = null;
|
||||
|
||||
if (!this.clientReady) return;
|
||||
|
||||
this.client.clearActivity().catch(() => this.destroy());
|
||||
trayManager.tray.setTitle("");
|
||||
}
|
||||
|
||||
async destroy() {
|
||||
try {
|
||||
info(`Destroy RPC client (${this.clientId})`);
|
||||
this.client.clearActivity();
|
||||
this.client.destroy();
|
||||
|
||||
trayManager.tray.setTitle("");
|
||||
rpcClients = rpcClients.filter(
|
||||
client => client.clientId !== this.clientId
|
||||
);
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's activity
|
||||
* @param presence PresenceData to set activity
|
||||
*/
|
||||
export function setActivity(presence: PresenceData) {
|
||||
//* If platform is darwin (Mac OS) set trayTitle if theres one
|
||||
//* Check if theres an active RPC connection that we can use
|
||||
//* If we have one, use it
|
||||
//* Else create one and use it
|
||||
//* Show debug
|
||||
if (platform() === "darwin" && presence.trayTitle)
|
||||
tray.setTitle(presence.trayTitle);
|
||||
let rpc = loggedInPresences.find(p => p.clientId === presence.clientId);
|
||||
if (rpc) rpc.rpc.setActivity(presence.presenceData).catch(destroy);
|
||||
else
|
||||
loginPresence(presence.clientId).then(p =>
|
||||
p.rpc.setActivity(presence.presenceData).catch(destroy)
|
||||
);
|
||||
info("setActivity");
|
||||
let client = rpcClients.find(c => c.clientId === presence.clientId);
|
||||
|
||||
if (!client) {
|
||||
client = new RPCClient(presence.clientId);
|
||||
client.currentPresence = presence;
|
||||
} else client.setActivity(presence);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,82 +95,22 @@ export function setActivity(presence: PresenceData) {
|
||||
* @param clientId clientId of presence to clear
|
||||
*/
|
||||
export function clearActivity(clientId: string = undefined) {
|
||||
//* Clear tray title
|
||||
//* If clientId set
|
||||
//* Else map through presences and clear them
|
||||
//* Show Debug
|
||||
if (platform() === "darwin") tray.setTitle("");
|
||||
if (clientId) {
|
||||
//* Check if this presence is logged in
|
||||
//* If it is clear its activity
|
||||
//* Return to prevent further actions
|
||||
let pTC = loggedInPresences.find(p => p.clientId === clientId);
|
||||
if (pTC) pTC.rpc.clearActivity().catch(destroy);
|
||||
return;
|
||||
}
|
||||
loggedInPresences.map(p => p.rpc.clearActivity().catch(destroy));
|
||||
info("clearActivity");
|
||||
info("clearActivity");
|
||||
|
||||
if (clientId) {
|
||||
let client = rpcClients.find(c => c.clientId === clientId);
|
||||
client.clearActivity();
|
||||
} else rpcClients.forEach(c => c.clearActivity());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create RPC connection to discord
|
||||
* @param clientId client ID of presence
|
||||
*/
|
||||
function loginPresence(clientId: string) {
|
||||
//* Return promise that will resolve to either Presence or null
|
||||
return new Promise<Presence>((resolve, reject) => {
|
||||
//* Create presence object
|
||||
//* Add presence to object
|
||||
//* Try login with client id
|
||||
//* Once RPC connection is ready
|
||||
//* Destroy all clients when Discord closed (My issue #42)
|
||||
let presence: Presence = {
|
||||
clientId: clientId,
|
||||
rpc: new Client({ transport: "ipc" }),
|
||||
ready: false
|
||||
};
|
||||
loggedInPresences.push(presence);
|
||||
presence.rpc.login({ clientId: clientId }).catch(() => {
|
||||
//* If couldn't log in remove it from loggedInPresences
|
||||
//* Reject promise
|
||||
loggedInPresences = loggedInPresences.filter(
|
||||
p => p.clientId !== presence.clientId
|
||||
);
|
||||
reject();
|
||||
});
|
||||
presence.rpc.once("ready", () => {
|
||||
//* Update status
|
||||
//* Resolve with presence
|
||||
presence.ready = true;
|
||||
resolve(presence);
|
||||
});
|
||||
// @ts-ignore
|
||||
presence.rpc.once("disconnected", destroy);
|
||||
});
|
||||
export async function getDiscordUser() {
|
||||
const user = await new Client({ transport: "ipc" }).login({
|
||||
clientId: "503557087041683458"
|
||||
});
|
||||
return user.user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys all rpc connections
|
||||
*/
|
||||
export function destroy() {
|
||||
//* Clear tray title
|
||||
//* Map through loggedInPresences and destroy their rpcs
|
||||
//* Set loggedInPresences to new Array
|
||||
//* Return the promise
|
||||
if (platform() === "darwin" && typeof tray !== "undefined") tray.setTitle("");
|
||||
let res = Promise.all(
|
||||
loggedInPresences.map((presence: Presence) =>
|
||||
presence.rpc.destroy().catch(() => {})
|
||||
)
|
||||
);
|
||||
loggedInPresences = [];
|
||||
return res;
|
||||
}
|
||||
|
||||
//* if app will quit
|
||||
app.once("will-quit", () => {
|
||||
//* Show debug
|
||||
//* Destroy all connections
|
||||
info("Closing rpc connections");
|
||||
destroy();
|
||||
});
|
||||
app.once(
|
||||
"will-quit",
|
||||
async () => await Promise.all(rpcClients.map(c => c.destroy()))
|
||||
);
|
||||
|
||||
@@ -5,25 +5,25 @@ import { info } from "../util/debug";
|
||||
|
||||
//* Create autoLaunch object
|
||||
let autoLaunch = new AutoLaunch({
|
||||
name: app.name,
|
||||
isHidden: true
|
||||
name: app.name,
|
||||
isHidden: true
|
||||
});
|
||||
|
||||
/**
|
||||
* Updates autoLaunch
|
||||
*/
|
||||
export async function update() {
|
||||
//* If app not packaged return
|
||||
//* Either enable/disable autolaunch
|
||||
if (!app.isPackaged) {
|
||||
//* Show debug
|
||||
//* Return
|
||||
info("Skipping autoLaunch.");
|
||||
return;
|
||||
}
|
||||
if (settings.get("autoLaunch", true))
|
||||
//* Enable if not enabled
|
||||
autoLaunch.enable();
|
||||
//* Disable if enabled
|
||||
else autoLaunch.disable();
|
||||
//* If app not packaged return
|
||||
//* Either enable/disable autolaunch
|
||||
if (!app.isPackaged) {
|
||||
//* Show debug
|
||||
//* Return
|
||||
info("Skipping autoLaunch.");
|
||||
return;
|
||||
}
|
||||
if (settings.get("autoLaunch", true))
|
||||
//* Enable if not enabled
|
||||
autoLaunch.enable();
|
||||
//* Disable if enabled
|
||||
else autoLaunch.disable();
|
||||
}
|
||||
|
||||
@@ -1,77 +1,82 @@
|
||||
import { readdirSync, readFileSync, unwatchFile, watchFile } from "fs";
|
||||
import { dialog } from "electron";
|
||||
import { readdirSync, readFileSync, unwatchFile } from "fs";
|
||||
import { dialog, app } from "electron";
|
||||
import { socket } from "./socketManager";
|
||||
import { extname } from "path";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
import chokidar from "chokidar";
|
||||
|
||||
let presenceDevWatchedFiles = [],
|
||||
currWatchPath = "";
|
||||
currWatchPath = "",
|
||||
currWatcher: chokidar.FSWatcher = null;
|
||||
|
||||
export async function watchDir(path: string) {
|
||||
//* Read dir
|
||||
//* Set currWatchDir
|
||||
//* Set watched files to files
|
||||
//* Add file watcher to each file
|
||||
let files = await readdirSync(path);
|
||||
currWatchPath = path + "/";
|
||||
presenceDevWatchedFiles = files;
|
||||
presenceDevWatchedFiles.map(f => {
|
||||
//* Watch file
|
||||
//* ReadFiles
|
||||
watchFile(currWatchPath + f, { interval: 250 }, async () => {
|
||||
//* Read dir
|
||||
//* ReadFiles
|
||||
files = await readdirSync(path);
|
||||
readFiles(files, path);
|
||||
});
|
||||
});
|
||||
readFiles(files, path);
|
||||
currWatchPath = path + "/";
|
||||
let files = readdirSync(path);
|
||||
|
||||
if (currWatcher) await currWatcher.close();
|
||||
|
||||
currWatcher = chokidar.watch(currWatchPath, {
|
||||
ignoreInitial: true,
|
||||
ignored: ["*.ts"]
|
||||
});
|
||||
|
||||
currWatcher.on("all", eventName => {
|
||||
files = readdirSync(currWatchPath);
|
||||
|
||||
console.log(eventName, currWatchPath, files);
|
||||
|
||||
readFiles(files, currWatchPath);
|
||||
});
|
||||
|
||||
readFiles(files, path);
|
||||
}
|
||||
|
||||
async function readFiles(files, path) {
|
||||
//* Send files to extension
|
||||
socket.emit("localPresence", {
|
||||
files: await Promise.all(
|
||||
files.map(f => {
|
||||
if (extname(f) === ".json")
|
||||
return {
|
||||
file: f,
|
||||
contents: JSON.parse(readFileSync(`${path}/${f}`).toString())
|
||||
};
|
||||
else if (extname(f) === ".js")
|
||||
return {
|
||||
file: f,
|
||||
contents: readFileSync(`${path}/${f}`).toString()
|
||||
};
|
||||
else return;
|
||||
})
|
||||
)
|
||||
});
|
||||
//* Send files to extension
|
||||
socket.emit("localPresence", {
|
||||
files: await Promise.all(
|
||||
files.map(f => {
|
||||
if (extname(f) === ".json")
|
||||
return {
|
||||
file: f,
|
||||
contents: JSON.parse(readFileSync(`${path}/${f}`).toString())
|
||||
};
|
||||
else if (extname(f) === ".js")
|
||||
return {
|
||||
file: f,
|
||||
contents: readFileSync(`${path}/${f}`).toString()
|
||||
};
|
||||
else return;
|
||||
})
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
export async function openFileDialog() {
|
||||
//* Open file dialog
|
||||
//* If user cancels
|
||||
//* Unwatch all still watched files
|
||||
//* Watch directory
|
||||
let filePaths = await dialog.showOpenDialogSync(null, {
|
||||
title: "Select Presence Folder",
|
||||
message:
|
||||
"Please select the folder that contains the presence you want to load.\n(metadata.json, presence.js, iframe.js)",
|
||||
buttonLabel: "Load Presence",
|
||||
properties: ["openDirectory"]
|
||||
});
|
||||
if (typeof filePaths === "undefined") {
|
||||
//* Show debug
|
||||
//* return
|
||||
info("Presence load canceled.");
|
||||
return;
|
||||
}
|
||||
info(`Watching ${filePaths[0]}`);
|
||||
if (presenceDevWatchedFiles.length > 0)
|
||||
await Promise.all(
|
||||
presenceDevWatchedFiles.map(f => unwatchFile(currWatchPath + f))
|
||||
);
|
||||
//* Open file dialog
|
||||
//* If user cancels
|
||||
//* Unwatch all still watched files
|
||||
//* Watch directory
|
||||
app.focus();
|
||||
let oDialog = await dialog.showOpenDialog(null, {
|
||||
title: "Select Presence Folder",
|
||||
message:
|
||||
"Please select the folder that contains the presence you want to load.\n(metadata.json, presence.js, iframe.js)",
|
||||
buttonLabel: "Load Presence",
|
||||
properties: ["openDirectory"]
|
||||
});
|
||||
if (oDialog.canceled) {
|
||||
//* Show debug
|
||||
//* return
|
||||
info("Presence load canceled.");
|
||||
return;
|
||||
}
|
||||
info(`Watching ${oDialog.filePaths[0]}`);
|
||||
if (presenceDevWatchedFiles.length > 0)
|
||||
await Promise.all(
|
||||
presenceDevWatchedFiles.map(f => unwatchFile(currWatchPath + f))
|
||||
);
|
||||
|
||||
watchDir(filePaths[0]);
|
||||
watchDir(oDialog.filePaths[0]);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import ElectronStore from "electron-store";
|
||||
import { tray } from "./trayManager";
|
||||
import { update as updateAutoLaunch } from "./launchManager";
|
||||
import { platform } from "os";
|
||||
import { info } from "../util/debug";
|
||||
|
||||
//* Import custom types
|
||||
import ExtensionSettings from "../../@types/PreMiD/ExtensionSettings";
|
||||
import { trayManager } from "..";
|
||||
|
||||
//* Export and set default settings
|
||||
export let settings = new ElectronStore({
|
||||
defaults: {
|
||||
autoLaunch: true
|
||||
}
|
||||
defaults: {
|
||||
autoLaunch: true
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -19,15 +19,15 @@ export let settings = new ElectronStore({
|
||||
* @param extensionSettings Settings from extension
|
||||
*/
|
||||
export function update(extensionSettings: ExtensionSettings) {
|
||||
//* Show debug
|
||||
//* remove title if disabled
|
||||
//* Update autolaunch if updated
|
||||
//* Save Settings
|
||||
info("Updated settings");
|
||||
if (!extensionSettings.titleMenubar && platform() === "darwin")
|
||||
tray.setTitle("");
|
||||
if (settings.get("autoLaunch") != extensionSettings.autoLaunch) {
|
||||
settings.set("autoLaunch", extensionSettings.autoLaunch);
|
||||
updateAutoLaunch();
|
||||
}
|
||||
//* Show debug
|
||||
//* remove title if disabled
|
||||
//* Update autolaunch if updated
|
||||
//* Save Settings
|
||||
info("Updated settings");
|
||||
if (!extensionSettings.titleMenubar && platform() === "darwin")
|
||||
trayManager.tray.setTitle("");
|
||||
if (settings.get("autoLaunch") != extensionSettings.autoLaunch) {
|
||||
settings.set("autoLaunch", extensionSettings.autoLaunch);
|
||||
updateAutoLaunch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,74 +4,84 @@ import { app, dialog } from "electron";
|
||||
import { success, error } from "../util/debug";
|
||||
import { update as updateSettings } from "./settingsManager";
|
||||
import { openFileDialog } from "./presenceDevManager";
|
||||
import { setActivity, clearActivity, destroy } from "./discordManager";
|
||||
import {
|
||||
rpcClients,
|
||||
setActivity,
|
||||
clearActivity,
|
||||
getDiscordUser
|
||||
} from "./discordManager";
|
||||
import { trayManager } from "..";
|
||||
|
||||
export let io: socketIo.Server;
|
||||
export let socket: socketIo.Socket;
|
||||
export let server: Server;
|
||||
export let connected: boolean = false;
|
||||
|
||||
export function init() {
|
||||
return new Promise(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 });
|
||||
server.listen(3020, () => {
|
||||
//* Resolve promise
|
||||
//* Debug info
|
||||
resolve();
|
||||
success("Opened socket");
|
||||
});
|
||||
server.on("error", socketError);
|
||||
io.on("connection", socketConnection);
|
||||
});
|
||||
return new Promise(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 });
|
||||
server.listen(3020, () => {
|
||||
//* Resolve promise
|
||||
//* Debug info
|
||||
resolve();
|
||||
success("Opened socket");
|
||||
});
|
||||
server.on("error", socketError);
|
||||
io.on("connection", socketConnection);
|
||||
});
|
||||
}
|
||||
|
||||
function socketConnection(cSocket: socketIo.Socket) {
|
||||
//* Show debug
|
||||
//* Set exported socket letiable to current socket
|
||||
//* Handle setActivity event
|
||||
//* Handle clearActivity event
|
||||
//* Handle settingsUpdate
|
||||
//* Handle presenceDev
|
||||
//* Handle version request
|
||||
//* Once socket user disconnects run cleanup
|
||||
success("Socket connection");
|
||||
socket = cSocket;
|
||||
socket.on("setActivity", setActivity);
|
||||
socket.on("clearActivity", clearActivity);
|
||||
socket.on("settingUpdate", updateSettings);
|
||||
socket.on("selectLocalPresence", openFileDialog);
|
||||
socket.on("getVersion", () =>
|
||||
socket.emit("receiveVersion", app.getVersion().replace(/[\D]/g, ""))
|
||||
);
|
||||
socket.once("disconnect", () => {
|
||||
//* Show debug
|
||||
//* Destroy all open RPC connections
|
||||
error("Socket disconnection.");
|
||||
destroy();
|
||||
});
|
||||
//* Show debug
|
||||
//* Set exported socket letiable to current socket
|
||||
//* Handle setActivity event
|
||||
//* Handle clearActivity event
|
||||
//* Handle settingsUpdate
|
||||
//* Handle presenceDev
|
||||
//* Handle version request
|
||||
//* Once socket user disconnects run cleanup
|
||||
success("Socket connection");
|
||||
socket = cSocket;
|
||||
getDiscordUser().then(user => socket.emit("discordUser", user));
|
||||
socket.on("setActivity", setActivity);
|
||||
socket.on("clearActivity", clearActivity);
|
||||
socket.on("settingUpdate", updateSettings);
|
||||
socket.on("selectLocalPresence", openFileDialog);
|
||||
socket.on("getVersion", () =>
|
||||
socket.emit("receiveVersion", app.getVersion().replace(/[\D]/g, ""))
|
||||
);
|
||||
socket.once("disconnect", () => {
|
||||
connected = false;
|
||||
trayManager.update();
|
||||
//* Show debug
|
||||
//* Destroy all open RPC connections
|
||||
error("Socket disconnection.");
|
||||
rpcClients.forEach(c => c.destroy());
|
||||
});
|
||||
connected = true;
|
||||
trayManager.update();
|
||||
}
|
||||
|
||||
//* Runs on socket errors
|
||||
function socketError(e: any) {
|
||||
//* Show debug
|
||||
//* If port in use
|
||||
error(e.message);
|
||||
if (e.code === "EADDRINUSE") {
|
||||
//* Focus app
|
||||
//* Show error dialog
|
||||
//* Exit app afterwards
|
||||
app.focus();
|
||||
dialog.showErrorBox(
|
||||
"Oh noes! Port error...",
|
||||
`${app.name} could not bind to port ${
|
||||
e.port
|
||||
}.\nIs ${app.name} running already?`
|
||||
);
|
||||
app.quit();
|
||||
}
|
||||
//* Show debug
|
||||
//* If port in use
|
||||
error(e.message);
|
||||
if (e.code === "EADDRINUSE") {
|
||||
//* Focus app
|
||||
//* Show error dialog
|
||||
//* Exit app afterwards
|
||||
app.focus();
|
||||
dialog.showErrorBox(
|
||||
"Oh noes! Port error...",
|
||||
`${app.name} could not bind to port ${e.port}.\nIs ${app.name} running already?`
|
||||
);
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,74 @@
|
||||
import { Menu, Tray } from "electron";
|
||||
import { Menu, Tray, app, shell } from "electron";
|
||||
import { join } from "path";
|
||||
import { trayManager } from "..";
|
||||
import { checkForUpdate, update, updateAvailable } from "../util/updateChecker";
|
||||
import { connected } from "./socketManager";
|
||||
import { platform } from "os";
|
||||
|
||||
//* Export tray
|
||||
//* Export trayContextMenu
|
||||
export let tray: Tray;
|
||||
export let trayContextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
role: "quit"
|
||||
}
|
||||
]);
|
||||
let trayIcon =
|
||||
platform() === "darwin"
|
||||
? join(__dirname, "../assets/tray/IconTemplate.png")
|
||||
: join(__dirname, "../assets/tray/Icon@2x.png");
|
||||
export class TrayManager {
|
||||
tray: Tray;
|
||||
|
||||
/**
|
||||
* Create tray
|
||||
*/
|
||||
export function init() {
|
||||
//* Return promise resolves to Tray
|
||||
return new Promise<Tray>(function(resolve) {
|
||||
//* Create Tray
|
||||
//* Set its context menu
|
||||
//* Resolve promise
|
||||
tray = new Tray(join(__dirname, "../assets/tray/IconTemplate.png"));
|
||||
tray.setContextMenu(trayContextMenu);
|
||||
resolve(tray);
|
||||
});
|
||||
constructor() {
|
||||
this.tray = new Tray(trayIcon);
|
||||
this.tray.setToolTip(app.name);
|
||||
|
||||
this.tray.on("right-click", () => this.update());
|
||||
}
|
||||
|
||||
update() {
|
||||
this.tray.setContextMenu(
|
||||
Menu.buildFromTemplate([
|
||||
{
|
||||
icon:
|
||||
platform() === "darwin"
|
||||
? join(__dirname, "../assets/tray/IconTemplate.png")
|
||||
: join(__dirname, "../assets/tray/Icon.png"),
|
||||
label: `${app.name} v${app.getVersion()}`,
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
id: "connectInfo",
|
||||
label: `Extension - ${connected ? "Connected" : "Not connected"}`,
|
||||
enabled: false
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
},
|
||||
{
|
||||
label: "Presence Store",
|
||||
click: () => shell.openExternal("https://premid.app/store")
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
},
|
||||
{
|
||||
label: `Update ${app.name}`,
|
||||
visible: updateAvailable,
|
||||
click: () => update()
|
||||
},
|
||||
{
|
||||
label: "Check for Updates...",
|
||||
click: () => checkForUpdate(false, true),
|
||||
visible: !updateAvailable
|
||||
},
|
||||
{
|
||||
label: "Acknowledgments",
|
||||
click: () => shell.openExternal("https://premid.app/contributors")
|
||||
},
|
||||
{
|
||||
type: "separator"
|
||||
},
|
||||
{
|
||||
label: `Quit ${app.name}`,
|
||||
role: "quit"
|
||||
}
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
app.once("quit", () => trayManager.tray.destroy());
|
||||
|
||||
@@ -5,28 +5,28 @@ if (!app.isPackaged) var chalk = require("chalk");
|
||||
* Show info message in console
|
||||
* */
|
||||
export function info(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgBlue(chalk.white(" INFO "))} ${message}`);
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgBlue(chalk.white(" INFO "))} ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show success message in console
|
||||
* */
|
||||
export function success(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgGreen(" SUCCESS ")} ${message}`);
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgGreen(" SUCCESS ")} ${message}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show error message in console
|
||||
* */
|
||||
export function error(message: string) {
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgRed(" ERROR ")} ${message}`);
|
||||
//* Return if app packaged
|
||||
//* Show debug
|
||||
if (app.isPackaged) return;
|
||||
console.log(`${chalk.bgRed(" ERROR ")} ${message}`);
|
||||
}
|
||||
|
||||
@@ -1,112 +1,114 @@
|
||||
import { spawn, exec } from "child_process";
|
||||
import { exec } from "child_process";
|
||||
import { resolve } from "path";
|
||||
import { error, info } from "./debug";
|
||||
import { trayContextMenu } from "../managers/trayManager";
|
||||
import { MenuItem, app, dialog } from "electron";
|
||||
import { tray } from "../managers/trayManager";
|
||||
import { app, dialog, shell } from "electron";
|
||||
import { platform } from "os";
|
||||
import { updateCheckerInterval } from "../index";
|
||||
import { existsSync } from "fs";
|
||||
import sudoPrompt from "sudo-prompt";
|
||||
import axios from "axios";
|
||||
import { Notification } from "electron";
|
||||
import { trayManager } from "..";
|
||||
import { createWriteStream, existsSync, unlinkSync } from "fs";
|
||||
|
||||
let updaterPath: string;
|
||||
export let updateAvailable = false;
|
||||
let initialNotification = true;
|
||||
|
||||
export async function checkForUpdate(autoUpdate = false) {
|
||||
//* Skip Update checker if unsupported OS / not packaged
|
||||
if (!app.isPackaged || !["darwin", "win32"].includes(platform())) {
|
||||
//* Show debug
|
||||
//* return
|
||||
info("Skipping UpdateChecker");
|
||||
return;
|
||||
}
|
||||
export async function checkForUpdate(autoUpdate = false, manual = false) {
|
||||
//* Skip Update checker if unsupported OS / not packaged
|
||||
if (!app.isPackaged || !["darwin", "win32"].includes(platform())) {
|
||||
//* Show debug
|
||||
//* return
|
||||
info("Skipping UpdateChecker");
|
||||
return;
|
||||
}
|
||||
|
||||
//* Resolve paths for each OS
|
||||
switch (platform()) {
|
||||
case "darwin":
|
||||
updaterPath = resolve(
|
||||
`${app.getAppPath()}../../../../../updater.app/Contents/MacOS/installbuilder.sh`
|
||||
);
|
||||
break;
|
||||
case "win32":
|
||||
updaterPath = resolve(`${app.getAppPath()}../../../updater.exe`);
|
||||
break;
|
||||
}
|
||||
axios
|
||||
.get("https://api.premid.app/v2/versions")
|
||||
.then(({ data }) => {
|
||||
if (!data?.app) return;
|
||||
|
||||
// TODO remove?
|
||||
//* return if update doesn't exist
|
||||
if (!existsSync(updaterPath)) {
|
||||
error("Updater not found.");
|
||||
clearInterval(updateCheckerInterval);
|
||||
return;
|
||||
}
|
||||
const latestAppVersion = data.app;
|
||||
|
||||
//* Spawn update checker
|
||||
let child = spawn(updaterPath, ["--mode", "unattended"]);
|
||||
if (app.getVersion() >= latestAppVersion) {
|
||||
if (manual)
|
||||
dialog.showMessageBox(null, {
|
||||
message: "There are currently no updates available.",
|
||||
type: "info"
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
child.on("exit", code => {
|
||||
//* If no update or error return
|
||||
if (code === 1) {
|
||||
info("Up to date!");
|
||||
return;
|
||||
}
|
||||
if (code === 2) {
|
||||
error("Error while checking for updates");
|
||||
return;
|
||||
}
|
||||
if (autoUpdate) {
|
||||
updateTray();
|
||||
update();
|
||||
return;
|
||||
}
|
||||
|
||||
//* If autoUpdate == true
|
||||
if (autoUpdate) {
|
||||
update();
|
||||
return;
|
||||
}
|
||||
if (initialNotification) {
|
||||
const updateNotification = new Notification({
|
||||
title: "Update available!",
|
||||
body: "A new version of PreMiD is available! Click here to update."
|
||||
});
|
||||
|
||||
if (trayContextMenu.items.length < 3) {
|
||||
trayContextMenu.insert(
|
||||
0,
|
||||
new MenuItem({
|
||||
label: "Update available!",
|
||||
click() {
|
||||
update();
|
||||
}
|
||||
})
|
||||
);
|
||||
updateNotification.once("click", update);
|
||||
updateNotification.show();
|
||||
updateTray();
|
||||
|
||||
trayContextMenu.insert(
|
||||
1,
|
||||
new MenuItem({
|
||||
type: "separator"
|
||||
})
|
||||
);
|
||||
tray.setContextMenu(trayContextMenu);
|
||||
}
|
||||
});
|
||||
initialNotification = false;
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
error(err.message);
|
||||
});
|
||||
}
|
||||
|
||||
export function update() {
|
||||
if (platform() === "darwin") {
|
||||
exec(
|
||||
`\"${updaterPath}\" --mode unattended --unattendedmodebehavior download`,
|
||||
() => {
|
||||
dialog.showErrorBox(
|
||||
"Error while updating",
|
||||
`${app.name} was unable to update itself. Please try again later.`
|
||||
);
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
export async function update() {
|
||||
if (!["win32", "darwin"].includes(platform())) return;
|
||||
const updaterPath = resolve(
|
||||
app.getPath("temp"),
|
||||
`PreMiD-Updater${
|
||||
platform() === "win32" ? ".exe" : ".app/Contents/MacOS/installbuilder.sh"
|
||||
}`
|
||||
);
|
||||
|
||||
sudoPrompt.exec(
|
||||
`\"${updaterPath}\" --mode unattended --unattendedmodebehavior download`,
|
||||
(error: Error) => {
|
||||
dialog.showErrorBox(
|
||||
"Error while updating",
|
||||
`${app.name} was unable to update itself. Please try again later.`
|
||||
);
|
||||
if (error) {
|
||||
checkForUpdate();
|
||||
return;
|
||||
}
|
||||
}
|
||||
);
|
||||
if (existsSync(updaterPath)) unlinkSync(updaterPath);
|
||||
if (existsSync(resolve(app.getPath("temp"), "PreMiD-release.zip")))
|
||||
unlinkSync(resolve(app.getPath("temp"), "PreMiD-release.zip"));
|
||||
|
||||
const response = await axios({
|
||||
url: `http://dl.premid.app/upgrader${
|
||||
platform() === "win32" ? ".exe" : ".app"
|
||||
}`,
|
||||
method: "GET",
|
||||
responseType: "stream"
|
||||
});
|
||||
|
||||
const writer = createWriteStream(updaterPath);
|
||||
response.data.pipe(writer);
|
||||
|
||||
new Promise((resolve, reject) => {
|
||||
writer.on("finish", resolve);
|
||||
writer.on("error", reject);
|
||||
})
|
||||
.then(() => exec(updaterPath, errorHandler))
|
||||
.catch(errorHandler);
|
||||
}
|
||||
|
||||
function errorHandler(err: Error) {
|
||||
dialog
|
||||
.showMessageBox({
|
||||
title: `Error while updating ${app.name}`,
|
||||
message: `If this error persists reinstall the app.`,
|
||||
detail: err.message,
|
||||
buttons: ["Okay", "Reinstall Application"],
|
||||
type: "error"
|
||||
})
|
||||
.then(value => {
|
||||
if (value.response === 1)
|
||||
shell.openExternal("https://premid.app/downloads");
|
||||
});
|
||||
updateTray();
|
||||
}
|
||||
|
||||
function updateTray() {
|
||||
updateAvailable = true;
|
||||
trayManager.update();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
"inlineSourceMap": true,
|
||||
"outDir": "dist/app",
|
||||
"removeComments": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"devMode.ts",
|
||||
"pkg.ts",
|
||||
"installer_assets/builder.ts",
|
||||
".github/deploy.ts"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
"moduleResolution": "node",
|
||||
"inlineSourceMap": true,
|
||||
"outDir": "dist/app",
|
||||
"removeComments": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"**/node_modules/",
|
||||
"pkg.ts",
|
||||
"util/**/*",
|
||||
"installer_assets/builder.ts",
|
||||
".github/uploadFile.ts"
|
||||
]
|
||||
}
|
||||
|
||||
7
util/prepare.ts
Normal file
7
util/prepare.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
|
||||
let file = readFileSync("installer_assets/PreMiD-Upgrade.xml", "utf-8");
|
||||
|
||||
file = file.replace("VERSION", require("../package.json").version);
|
||||
|
||||
writeFileSync("installer_assets/PreMiD-Upgrade.xml", file);
|
||||
18
util/uploadFile.ts
Normal file
18
util/uploadFile.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as Client from "ssh2-sftp-client";
|
||||
|
||||
let sftp = new Client();
|
||||
|
||||
sftp
|
||||
.connect({
|
||||
host: process.env.SSHHOST,
|
||||
username: process.env.SSHUSERNAME,
|
||||
password: process.env.SSHPASSWORD
|
||||
})
|
||||
.then(async () => {
|
||||
sftp
|
||||
.fastPut(process.argv[2], process.argv[3])
|
||||
.then(() => {
|
||||
sftp.end();
|
||||
})
|
||||
.catch(console.error);
|
||||
});
|
||||
16
util/zip.ts
Normal file
16
util/zip.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as archiver from "archiver";
|
||||
import { Extract } from "unzipper";
|
||||
import { createWriteStream, createReadStream } from "fs";
|
||||
import { basename } from "path";
|
||||
|
||||
if (process.argv.includes("--zip")) {
|
||||
const archive = archiver("zip"),
|
||||
output = createWriteStream(process.argv[3]);
|
||||
|
||||
archive.pipe(output);
|
||||
archive.directory(process.argv[2], basename(process.argv[3], ".zip"));
|
||||
|
||||
archive.finalize();
|
||||
} else {
|
||||
createReadStream(process.argv[2]).pipe(Extract({ path: process.cwd() }));
|
||||
}
|
||||
Reference in New Issue
Block a user