Skip to content

Commit

Permalink
docs(CHANGELOG.md): update ZaDark version to 24.8.3 and PC version to…
Browse files Browse the repository at this point in the history
… 14.0.1

feat(package.json): update package version to 24.8.3 and add "del" dependency
feat(src/pc/package.json): update package version to 14.0.1
refactor(src/pc/zadark-pc.js): improve file handling logic for better error handling and cleanup
  • Loading branch information
ncdai committed Aug 29, 2024
1 parent de3bd55 commit 7cacb15
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## ZaDark 24.8.3

> PC 14.0.1
- Sửa lỗi cài đặt ZaDark PC: `EEXIST: file already exists, mkdir 'C:\Users\ncdai\zadark-tmp'`
- Hỗ trợ cài lại ZaDark PC mà không cần gỡ ZaDark PC trước khi cài

## ZaDark 24.8.2

> PC 14.0
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zadark",
"description": "Dark Mode tốt nhất cho Zalo",
"version": "24.8.2",
"version": "24.8.3",
"repository": "https://github.com/quaric/zadark.git",
"author": {
"name": "Quaric",
Expand Down Expand Up @@ -35,6 +35,7 @@
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-gzip": "^1.4.2",
Expand All @@ -58,7 +59,6 @@
"@electron/asar": "^3.2.10",
"chalk": "4.1.2",
"cross-spawn": "^7.0.3",
"del": "^6.0.0",
"fs-extra": "^11.2.0",
"glob": "^7.2.0",
"inquirer": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/pc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zadark-pc",
"description": "Dark Mode tốt nhất cho Zalo",
"version": "14.0",
"version": "14.0.1",
"main": "index.js",
"repository": "https://github.com/quaric/zadark.git",
"author": {
Expand Down
27 changes: 16 additions & 11 deletions src/pc/zadark-pc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const fs = require('fs-extra')
const path = require('path')
const del = require('del')
const asar = require('@electron/asar')
const HTMLParser = require('node-html-parser')
const glob = require('glob')
Expand Down Expand Up @@ -471,25 +470,31 @@ const installZaDark = async (zaloDir) => {
const appAsarBakPath = path.join(zaloDir, 'app.asar.bak')
const appDirTmpPath = path.join(ZADARK_TMP_PATH, 'app')

if (!isFile(appAsarPath)) {
throw new Error(zaloDir + ' khong co tap tin "app.asar" (E002).')
if (!isFile(appAsarPath) && !isFile(appAsarBakPath)) {
throw new Error(zaloDir + ' khong co tap tin "app.asar" hoac "app.asar.bak" (E002).')
}

// Delete dir "ZADARK_TMP_PATH"
if (fs.existsSync(ZADARK_TMP_PATH)) {
printDebug('- deleteDir:', ZADARK_TMP_PATH)
fs.rmSync(ZADARK_TMP_PATH, { recursive: true })
}

// Delete dir "resources/app.asar"
if (isDirectory(appAsarPath)) {
printDebug('- deleteDir:', appAsarPath)
await del(appAsarPath, { force: true })
fs.rmSync(appAsarPath, { recursive: true })
}

// Delete dir "ZADARK_TMP_PATH"
if (isDirectory(ZADARK_TMP_PATH)) {
printDebug('- deleteDir:', ZADARK_TMP_PATH)
await del(ZADARK_TMP_PATH, { force: true })
// Rename file "resources/app.asar.bak" to "resources/app.asar"
if (!isFile(appAsarPath) && isFile(appAsarBakPath)) {
printDebug('- renameFile:', appAsarBakPath, '>', appAsarPath)
fs.renameSync(appAsarBakPath, appAsarPath)
}

// Create dir "ZADARK_TMP_PATH"
printDebug('- createDir:', ZADARK_TMP_PATH)
fs.mkdirSync(ZADARK_TMP_PATH)
fs.mkdirSync(ZADARK_TMP_PATH, { recursive: true })

// Extract file "resources/app.asar" to dir "ZADARK_TMP_PATH/app"
printDebug('- extractAsar:', appAsarPath, '>', appDirTmpPath)
Expand Down Expand Up @@ -526,7 +531,7 @@ const installZaDark = async (zaloDir) => {

// Delete dir "ZADARK_TMP_PATH"
printDebug('- deleteDir:', ZADARK_TMP_PATH)
await del(ZADARK_TMP_PATH, { force: true })
fs.rmSync(ZADARK_TMP_PATH, { recursive: true })
}

/**
Expand Down Expand Up @@ -555,7 +560,7 @@ const uninstallZaDark = async (zaloDir) => {
// Delete dir "resources/app.asar"
if (isDirectory(appAsarPath)) {
printDebug('- deleteDir:', appDirPath)
await del(appAsarPath, { force: true })
fs.rmSync(appAsarPath, { recursive: true })
}

// Rename file "resources/app.asar.bak" to "resources/app.asar"
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,9 @@ define-property@^2.0.2:
isobject "^3.0.1"

del@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/del/-/del-6.0.0.tgz#0b40d0332cea743f1614f818be4feb717714c952"
integrity sha512-1shh9DQ23L16oXSZKB2JxpL7iMy2E0S9d517ptA1P8iw0alkPtQcrKH7ru31rYtKwF499HkTu+DRzq3TCKDFRQ==
version "6.1.1"
resolved "https://registry.yarnpkg.com/del/-/del-6.1.1.tgz#3b70314f1ec0aa325c6b14eb36b95786671edb7a"
integrity sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==
dependencies:
globby "^11.0.1"
graceful-fs "^4.2.4"
Expand Down Expand Up @@ -2316,11 +2316,16 @@ got@^9.6.0:
to-readable-stream "^1.0.0"
url-parse-lax "^3.0.0"

graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4:
graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0:
version "4.2.9"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96"
integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==

graceful-fs@^4.2.4:
version "4.2.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==

gulp-cli@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/gulp-cli/-/gulp-cli-2.3.0.tgz#ec0d380e29e52aa45e47977f0d32e18fd161122f"
Expand Down

0 comments on commit 7cacb15

Please sign in to comment.