mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
fix the path of EditThisCookie zip file while run launch-bosszhipin-login-page-with-preload-extension from ui
This commit is contained in:
@@ -14,6 +14,7 @@ import os from 'node:os'
|
|||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import JSON5 from 'json5'
|
import JSON5 from 'json5'
|
||||||
import url from 'url';
|
import url from 'url';
|
||||||
|
import packageJson from './package.json' assert {type: 'json'}
|
||||||
|
|
||||||
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
|
||||||
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
const isRunFromUi = Boolean(process.env.MAIN_BOSSGEEKGO_UI_RUN_MODE)
|
||||||
@@ -32,15 +33,28 @@ if (!fs.existsSync(
|
|||||||
if (!fs.existsSync(extensionDir)) {
|
if (!fs.existsSync(extensionDir)) {
|
||||||
fs.mkdirSync(extensionDir)
|
fs.mkdirSync(extensionDir)
|
||||||
}
|
}
|
||||||
const editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
|
||||||
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
const editThisCookieExtensionPath = path.join(extensionDir, 'EditThisCookie')
|
||||||
|
|
||||||
|
let editThisCookieZipPath
|
||||||
|
async function getEditThisCookieZipPath () {
|
||||||
|
if (editThisCookieZipPath) {
|
||||||
|
return editThisCookieZipPath
|
||||||
|
}
|
||||||
|
if (isRunFromUi) {
|
||||||
|
const { app } = await import('electron')
|
||||||
|
editThisCookieZipPath = path.join(app.getAppPath(), './node_modules', packageJson.name, 'extensions', 'EditThisCookie.zip')
|
||||||
|
} else {
|
||||||
|
editThisCookieZipPath = path.join(__dirname, 'extensions', 'EditThisCookie.zip')
|
||||||
|
}
|
||||||
|
return editThisCookieZipPath
|
||||||
|
}
|
||||||
|
|
||||||
export async function main() {
|
export async function main() {
|
||||||
if (!fs.existsSync(
|
if (!fs.existsSync(
|
||||||
path.join(editThisCookieExtensionPath, 'manifest.json')
|
path.join(editThisCookieExtensionPath, 'manifest.json')
|
||||||
)) {
|
)) {
|
||||||
await extractZip(
|
await extractZip(
|
||||||
editThisCookieZipPath,
|
await getEditThisCookieZipPath(),
|
||||||
{
|
{
|
||||||
dir: extensionDir
|
dir: extensionDir
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ files:
|
|||||||
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
|
||||||
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
|
||||||
asarUnpack:
|
asarUnpack:
|
||||||
- resources/**
|
- 'resources/**'
|
||||||
|
- 'node_modules/@geekgeekrun/launch-bosszhipin-login-page-with-preload-extension/**'
|
||||||
extraResources:
|
extraResources:
|
||||||
- external-node-runtime-dependencies/**
|
- external-node-runtime-dependencies/**
|
||||||
win:
|
win:
|
||||||
|
|||||||
Reference in New Issue
Block a user