mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
working on notarization, deal with multiple instances. remove fs-ext
This commit is contained in:
parent
773088d070
commit
2dd9cf16fa
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,4 +5,5 @@ node_modules/
|
||||
*.log
|
||||
out/
|
||||
.DS_Store
|
||||
bin
|
||||
bin
|
||||
*.pw
|
@ -7,9 +7,9 @@ var AllowedFirstParts = {
|
||||
};
|
||||
|
||||
var AllowedNodeModules = {
|
||||
"lzma-native": true,
|
||||
"fs-ext": true,
|
||||
"fsevents": true,
|
||||
// "lzma-native": true,
|
||||
// "fs-ext": true,
|
||||
// "fsevents": true,
|
||||
};
|
||||
|
||||
var modCache = {};
|
||||
@ -27,6 +27,11 @@ function ignoreFn(path) {
|
||||
if (parts.length <= 2) {
|
||||
return false;
|
||||
}
|
||||
if (parts.length > 3) {
|
||||
if (parts[3] == "build") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
let nodeModule = parts[2];
|
||||
if (!modCache[nodeModule]) {
|
||||
modCache[nodeModule] = true;
|
||||
@ -34,6 +39,7 @@ function ignoreFn(path) {
|
||||
if (!AllowedNodeModules[nodeModule]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -50,24 +56,39 @@ module.exports = {
|
||||
"node_modules/fsevents/**",
|
||||
],
|
||||
icon: "static/PromptIcon.icns",
|
||||
osxNotarize: {
|
||||
tool: "notarytool",
|
||||
keychainProfile: "notarytool-creds",
|
||||
},
|
||||
osxSign: {
|
||||
"hardened-runtime": true,
|
||||
binaries: [
|
||||
"Contents/Resources/app/bin/prompt-local-server",
|
||||
"Contents/Resources/app/bin/mshell/mshell-v0.2-linux.amd64",
|
||||
"Contents/Resources/app/bin/mshell/mshell-v0.2-linux.arm64",
|
||||
"Contents/Resources/app/bin/mshell/mshell-v0.2-darwin.amd64",
|
||||
"Contents/Resources/app/bin/mshell/mshell-v0.2-darwin.arm64",
|
||||
],
|
||||
identity: "VYQ48YC2N2",
|
||||
},
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
{
|
||||
name: '@electron-forge/maker-squirrel',
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-zip',
|
||||
platforms: ['darwin'],
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-deb',
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-rpm',
|
||||
config: {},
|
||||
},
|
||||
],
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
{
|
||||
name: '@electron-forge/maker-squirrel',
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-zip',
|
||||
platforms: ['darwin'],
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-deb',
|
||||
config: {},
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-rpm',
|
||||
config: {},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -8,7 +8,6 @@
|
||||
"classnames": "^2.3.1",
|
||||
"dayjs": "^1.11.3",
|
||||
"electron-squirrel-startup": "^1.0.0",
|
||||
"fs-ext": "^2.0.0",
|
||||
"mobx": "^6.6.0",
|
||||
"mobx-react": "^7.5.0",
|
||||
"node-fetch": "^3.2.10",
|
||||
|
11
src/base.ts
11
src/base.ts
@ -1,6 +1,5 @@
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
import {flockSync} from "fs-ext";
|
||||
|
||||
const HomeVarName = "HOME";
|
||||
const PromptHomeVarName = "PROMPT_HOME";
|
||||
@ -26,12 +25,4 @@ function getDBName() : string {
|
||||
return path.join(promptHome, DBFileName);
|
||||
}
|
||||
|
||||
function acquirePromptElectronLock() : File {
|
||||
let promptHome = getPromptHomeDir();
|
||||
let lockFileName = path.join(promptHome, PromptLockFile);
|
||||
let fd = fs.openSync(lockFileName, "w", 0o600);
|
||||
flockSync(fd, "exnb");
|
||||
return fd;
|
||||
}
|
||||
|
||||
export {getPromptHomeDir, getDBName, acquirePromptElectronLock};
|
||||
export {getPromptHomeDir, getDBName};
|
||||
|
25
src/emain.ts
25
src/emain.ts
@ -4,7 +4,6 @@ import * as fs from "fs";
|
||||
import fetch from "node-fetch";
|
||||
import * as child_process from "node:child_process";
|
||||
import {debounce} from "throttle-debounce";
|
||||
import {acquirePromptElectronLock} from "./base";
|
||||
import {handleJsonFetchResponse} from "./util";
|
||||
import * as winston from "winston";
|
||||
import * as util from "util";
|
||||
@ -18,6 +17,7 @@ let scHome = getPromptHomeDir();
|
||||
ensureDir(scHome);
|
||||
let DistDir = (isDev ? "dist-dev" : "dist");
|
||||
let GlobalAuthKey = "";
|
||||
let instanceId = uuidv4();
|
||||
|
||||
// these are either "darwin/amd64" or "darwin/arm64"
|
||||
// normalize darwin/x64 to darwin/amd64 for GOARCH compatibility
|
||||
@ -26,7 +26,6 @@ let unameArch = process.arch;
|
||||
if (unameArch == "x64") {
|
||||
unameArch = "amd64"
|
||||
}
|
||||
|
||||
let logger;
|
||||
let loggerConfig = {
|
||||
level: "info",
|
||||
@ -50,7 +49,8 @@ console.log(sprintf("prompt-app starting, PROMPT_HOME=%s, apppath=%s arch=%s/%s"
|
||||
if (isDev) {
|
||||
console.log("prompt-app PROMPT_DEV set");
|
||||
}
|
||||
|
||||
let app = electron.app;
|
||||
app.setName("Prompt");
|
||||
const DevLocalServerPath = "/Users/mike/prompt/local-server";
|
||||
let localServerProc = null;
|
||||
let localServerShouldRestart = false;
|
||||
@ -113,17 +113,6 @@ function readAuthKey() {
|
||||
return authKeyStr.trim();
|
||||
}
|
||||
|
||||
let app = electron.app;
|
||||
app.setName("Prompt");
|
||||
|
||||
let lock : File;
|
||||
try {
|
||||
lock = acquirePromptElectronLock();
|
||||
}
|
||||
catch (e) {
|
||||
app.exit(0);
|
||||
}
|
||||
|
||||
let menuTemplate = [
|
||||
{
|
||||
role: "appMenu",
|
||||
@ -318,7 +307,7 @@ app.on('window-all-closed', () => {
|
||||
});
|
||||
|
||||
electron.ipcMain.on("get-id", (event) => {
|
||||
event.returnValue = event.processId;
|
||||
event.returnValue = instanceId + ":" + event.processId;
|
||||
return;
|
||||
});
|
||||
|
||||
@ -454,6 +443,12 @@ async function sleep(ms) {
|
||||
// ====== MAIN ====== //
|
||||
|
||||
(async () => {
|
||||
let instanceLock = app.requestSingleInstanceLock();
|
||||
if (!instanceLock) {
|
||||
console.log("prompt-app could not get single-instance-lock, shutting down");
|
||||
app.quit();
|
||||
return;
|
||||
}
|
||||
GlobalAuthKey = readAuthKey();
|
||||
try {
|
||||
await runLocalServer();
|
||||
|
@ -507,7 +507,7 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
|
||||
class Line extends React.Component<{sw : ScreenWindow, line : LineType, width : number, staticRender : boolean, visible : OV<boolean>, onHeightChange : HeightChangeCallbackType}, {}> {
|
||||
render() {
|
||||
let line = this.props.line;
|
||||
if (line.hidden) {
|
||||
if (line.archived) {
|
||||
return null;
|
||||
}
|
||||
if (line.linetype == "text") {
|
||||
|
@ -29,7 +29,7 @@ type LineType = {
|
||||
cmdid? : string,
|
||||
contentheight? : number,
|
||||
star? : number,
|
||||
hidden? : boolean,
|
||||
archived? : boolean,
|
||||
ephemeral? : boolean,
|
||||
remove? : boolean,
|
||||
};
|
||||
|
12
yarn.lock
12
yarn.lock
@ -3529,13 +3529,6 @@ fresh@0.5.2:
|
||||
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
|
||||
integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==
|
||||
|
||||
fs-ext@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-ext/-/fs-ext-2.0.0.tgz#e58168fcc37506a9358e0928f4aae60912af7caa"
|
||||
integrity sha512-aK8NlpSO5LUdSoWeshpnkgtptbua1rGo58Wc+mHQ2+JnoBlubMTsnV56Swl4bA0msrgAhG8TDu1aGS8deJwzBQ==
|
||||
dependencies:
|
||||
nan "^2.14.0"
|
||||
|
||||
fs-extra@^10.0.0, fs-extra@^10.1.0:
|
||||
version "10.1.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf"
|
||||
@ -4868,11 +4861,6 @@ mute-stream@0.0.8:
|
||||
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d"
|
||||
integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==
|
||||
|
||||
nan@^2.14.0:
|
||||
version "2.16.0"
|
||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.16.0.tgz#664f43e45460fb98faf00edca0bb0d7b8dce7916"
|
||||
integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA==
|
||||
|
||||
nanoid@^3.3.4:
|
||||
version "3.3.4"
|
||||
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
|
||||
|
Loading…
Reference in New Issue
Block a user