Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
chore: minor changes (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlysoftBeta authored Jul 13, 2023
1 parent 32c2308 commit 66df1fd
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 29 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"scripts": {
"dev": "NODE_ENV=development tsc & TS_NODE_FILES=1 TS_NODE_TRANSPILE_ONLY=1 NODE_ENV=development ts-node ./build.ts && chmod +x ./scripts/dev.sh && ./scripts/dev.sh",
"build": "NODE_ENV=production tsc && TS_NODE_FILES=1 TS_NODE_TRANSPILE_ONLY=1 NODE_ENV=production ts-node ./build.ts",
"start": "chmod +x ./scripts/start.sh && ./scripts/start.sh",
"start:win": "powershell -ExecutionPolicy Unrestricted -File ./scripts/start.ps1",
"start:linux": "chmod +x ./scripts/start.sh && ./scripts/start.sh",
"lint": "rome check .",
"lint:apply": "rome check . --apply",
"format": "rome format . --write"
Expand Down
11 changes: 7 additions & 4 deletions publish/_/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
}

foreach ($RegistryPath in @("HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*")) {
foreach ($Item in (Get-ItemProperty $RegistryPath)) {
if ($Item.PSChildName -eq "QQ") {
$QQInstallDir = (Split-Path -Parent $Item.UninstallString)
break
try {
foreach ($Item in (Get-ItemProperty $RegistryPath)) {
if ($Item.PSChildName -eq "QQ") {
$QQInstallDir = (Split-Path -Parent $Item.UninstallString)
break
}
}
}
catch {}
}

if (($null -eq $QQInstallDir) -or ((Test-Path $QQInstallDir) -eq $false)) {
Expand Down
11 changes: 7 additions & 4 deletions publish/_/uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdenti
}

foreach ($RegistryPath in @("HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*")) {
foreach ($Item in (Get-ItemProperty $RegistryPath)) {
if ($Item.PSChildName -eq "QQ") {
$QQInstallDir = (Split-Path -Parent $Item.UninstallString)
break
try {
foreach ($Item in (Get-ItemProperty $RegistryPath)) {
if ($Item.PSChildName -eq "QQ") {
$QQInstallDir = (Split-Path -Parent $Item.UninstallString)
break
}
}
}
catch {}
}

if (($null -eq $QQInstallDir) -or ((Test-Path $QQInstallDir) -eq $false)) {
Expand Down
2 changes: 1 addition & 1 deletion rome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"enabled": true
},
"files": {
"ignore": [".pnp.cjs", ".pnp.loader.mjs", ".yarn/*", "dist/*", "src/electron.d.ts"]
"ignore": [".pnp.cjs", ".pnp.loader.mjs", ".yarn/*", "dist/*", "src/typings/src/electron.d.ts"]
},
"formatter": {
"indentSize": 4,
Expand Down
16 changes: 0 additions & 16 deletions scripts/dev.sh

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/start.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$ErrorActionPreference = "Stop"

Set-Location (Split-Path -Parent $MyInvocation.MyCommand.Definition)

foreach ($RegistryPath in @("HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*")) {
try {
foreach ($Item in (Get-ItemProperty $RegistryPath)) {
if ($Item.PSChildName -eq "QQ") {
$QQInstallDir = (Split-Path -Parent $Item.UninstallString)
break
}
}
}
catch {}
}

if (($null -eq $QQInstallDir) -or ((Test-Path $QQInstallDir) -eq $false)) {
throw "未找到 QQNT 安装目录。"
}
$QQAppDir = "$QQInstallDir\resources\app"
$QQAppLauncherDir = "$QQAppDir\app_launcher"
$PackageJSONFile = "$QQAppDir\package.json"

Copy-Item ".\qqntim.js", ".\qqntim-renderer.js" $QQAppLauncherDir -Force
Copy-Item ".\node_modules", ".\builtins" $QQAppLauncherDir -Recurse -Force
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($PackageJSONFile, ((Get-Content $PackageJSONFile -Raw -Encoding UTF8 -Force) -replace "./app_launcher/index.js", "./app_launcher/qqntim.js"), $Utf8NoBomEncoding)

Start-Process "$QQInstallDir\QQ.exe" -Wait
12 changes: 12 additions & 0 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,16 @@

cd "$( dirname "${BASH_SOURCE[0]}" )/.."

qq_installation_dir=$( dirname $( readlink $( which qq || which linuxqq ) ) )
if [ ! -d "$qq_installation_dir" ]; then
echo "未找到 QQNT 安装目录。"
fi
qq_app_dir="$qq_installation_dir/resources/app"
qq_applauncher_dir="$qq_app_dir/app_launcher"
package_json_file="$qq_app_dir/package.json"

sudo cp -f ./dist/_/qqntim.js ./dist/_/qqntim-renderer.js "$qq_applauncher_dir"
sudo cp -rf ./dist/_/node_modules ./dist/_/builtins "$qq_applauncher_dir"
sudo sed -i "s#\.\/app_launcher\/index\.js#\.\/app_launcher\/qqntim\.js#g" "$package_json_file"

qq 2>&1 | sed -e '/NODE_TLS_REJECT_UNAUTHORIZED/d' -e '/Gtk-Message/d' -e '/to show where the warning was created/d' -e '/gbm_wrapper\.cc/d' -e '/node_bindings\.cc/d' -e '/UnhandledPromiseRejectionWarning/d' -e '/\[BuglyManager\.cpp\]/d' -e '/\[NativeCrashHandler\.cpp\]/d' -e '/\[BuglyService\.cpp\]/d' -e '/\[HotUpdater\]/d' -e '/ERROR:CONSOLE/d'
8 changes: 5 additions & 3 deletions src/typings/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "@flysoftbeta/qqntim-typings",
"private": false,
"version": "2.0.0",
"version": "2.0.1",
"license": "LGPL-3.0-or-later",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"dependencies": {
"@types/fs-extra": "^11.0.1",
"@types/node": "^20.4.1",
"typed-emitter": "^2.1.0",
"typed-emitter": "^2.1.0"
},
"devDependencies": {
"typescript": "^5.1.6"
}
}

0 comments on commit 66df1fd

Please sign in to comment.