mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-06 07:57:06 +08:00
don't open start editthiscookie start page
This commit is contained in:
BIN
Binary file not shown.
@@ -32,25 +32,20 @@ async function getEditThisCookieZipPath () {
|
|||||||
return editThisCookieZipPath
|
return editThisCookieZipPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const APP_GEEKGEEKRUN_EDIT_VERSION = 1
|
||||||
export async function ensureEditThisCookie () {
|
export async function ensureEditThisCookie () {
|
||||||
let isNeedExtractEditThisCookie = false
|
let isNeedExtractEditThisCookie = false
|
||||||
const manifestFilePath = path.join(editThisCookieExtensionPath, 'manifest.json')
|
const GEEKGEEKRUN_EDIT_VERSION_FILE_PATH = path.join(editThisCookieExtensionPath, 'GEEKGEEKRUN_EDIT_VERSION')
|
||||||
if (!fs.existsSync(
|
let geekgeekrunEditVersion
|
||||||
manifestFilePath
|
try {
|
||||||
)) {
|
const fileContent = fs.readFileSync(GEEKGEEKRUN_EDIT_VERSION_FILE_PATH, { encoding: 'utf-8' })
|
||||||
|
geekgeekrunEditVersion = Number(fileContent) || 0
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
geekgeekrunEditVersion = 0
|
||||||
|
}
|
||||||
|
if (geekgeekrunEditVersion < APP_GEEKGEEKRUN_EDIT_VERSION) {
|
||||||
isNeedExtractEditThisCookie = true
|
isNeedExtractEditThisCookie = true
|
||||||
} else {
|
|
||||||
let manifest
|
|
||||||
try {
|
|
||||||
manifest = JSON.parse(fs.readFileSync(manifestFilePath, { encoding: 'utf-8' }))
|
|
||||||
if (!manifest.manifest_version || manifest.manifest_version <= 2) {
|
|
||||||
isNeedExtractEditThisCookie = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
console.log(`未能获取到文件内容`)
|
|
||||||
isNeedExtractEditThisCookie = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNeedExtractEditThisCookie) {
|
if (isNeedExtractEditThisCookie) {
|
||||||
|
|||||||
Reference in New Issue
Block a user