Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Windows executable

# يبني FasterPC.exe على ويندوز ويرفعه كمخرج يمكن تنزيله وتشغيله مباشرة.
# يعمل يدويًا من تبويب Actions، أو تلقائيًا عند إنشاء إصدار (tag يبدأ بـ v).
# يبني FasterPC.exe على ويندوز ويرفعه كمخرج قابل للتنزيل والتشغيل مباشرة.
# يعمل يدويًا من تبويب Actions (Run workflow)، أو تلقائيًا عند إنشاء إصدار (tag يبدأ بـ v).

on:
workflow_dispatch:
Expand Down Expand Up @@ -40,20 +40,25 @@ jobs:
run: |
copy packaging\install.bat dist\install.bat
copy packaging\install.ps1 dist\install.ps1
copy packaging\install.vbs dist\install.vbs
copy packaging\uninstall.bat dist\uninstall.bat
copy packaging\uninstall.ps1 dist\uninstall.ps1
copy packaging\uninstall.vbs dist\uninstall.vbs
copy LICENSE dist\LICENSE

- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: FasterPC-windows
if-no-files-found: error
path: |
dist/FasterPC.exe
dist/install.bat
dist/install.ps1
dist/install.vbs
dist/uninstall.bat
dist/uninstall.ps1
dist/uninstall.vbs
dist/LICENSE

- name: Attach build to release
Expand All @@ -64,5 +69,7 @@ jobs:
dist/FasterPC.exe
dist/install.bat
dist/install.ps1
dist/install.vbs
dist/uninstall.bat
dist/uninstall.ps1
dist/uninstall.vbs
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
يعمل بالخلفية عند إغلاق النافذة (اختياري).
- **تثبيت من داخل البرنامج**: اختصار سطح المكتب وقائمة ابدأ بالصورة الرسمية، تسجيل
التشغيل مع ويندوز، واستثناءات Defender (اختيارية).
- **تثبيت صامت تمامًا**: `install.vbs` يثبّت البرنامج دون ظهور أي نافذة إطلاقًا
(`install.bat` يبقى متاحًا لمن يريد متابعة رسائل التقدم).
- **وضع محمول (Portable)** عبر ملف `portable.flag`.
- **تشغيل نسخة واحدة فقط** مع تنشيط النافذة الموجودة.
- **سجلات احترافية**: `faster_pc.log` دوّار، `errors.log` للأخطاء، و`crash.log` لأي
Expand Down
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,15 @@ python main.py
### بناء نسخة تنفيذية

**الطريقة الأسهل (ويندوز):** دبل-كلك على `build_exe.bat` → ينتج `dist\FasterPC.exe`
و `dist\install.bat`.
مع ملفات التثبيت.

للتثبيت بعد البناء:
- `dist\install.vbs` — **تثبيت صامت تمامًا بدون أي نافذة** (الأفضل).
- `dist\install.bat` — تثبيت مع رسائل تقدم واضحة في نافذة الأوامر.

وكلاهما ينسخ البرنامج إلى `%LOCALAPPDATA%\Programs\Faster PC`، وينشئ اختصار سطح
المكتب وقائمة ابدأ بالأيقونة الرسمية، ويشغّل البرنامج لإكمال الإعداد الأولي.
بديل ثالث: شغّل `FasterPC.exe` مباشرة، فمعالج الإعداد ينشئ الاختصارات بنفسه.

**يدويًا:**

Expand All @@ -116,8 +124,7 @@ pip install -r requirements-dev.txt
pyinstaller --noconfirm --clean faster_pc.spec
```

ثم للتثبيت على الجهاز: شغّل `dist\install.bat` (أو `packaging\install.bat`) فينسخ البرنامج
إلى `%LOCALAPPDATA%\Programs\Faster PC` وينشئ الاختصارات بالصورة الرسمية.
ثم للتثبيت على الجهاز: شغّل `dist\install.vbs` (صامت) أو `dist\install.bat`.

ملاحظات:
- بعض برامج الحماية تعطي إنذارًا كاذبًا ضد أي ملف PyInstaller غير موقّع. البرنامج يتضمن
Expand Down Expand Up @@ -293,8 +300,10 @@ pip install -r requirements-dev.txt
pyinstaller --noconfirm --clean faster_pc.spec
```

On Windows you can simply double-click `build_exe.bat`, then run `dist\install.bat` to
install with desktop/Start Menu shortcuts.
On Windows you can simply double-click `build_exe.bat`, then run `dist\install.vbs` for a
completely silent install (or `dist\install.bat` to see progress). Both copy the app to
`%LOCALAPPDATA%\Programs\Faster PC` and create desktop/Start Menu shortcuts with the
official icon.

### Notes

Expand Down
5 changes: 5 additions & 0 deletions build_exe.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ echo [3/4] بناء البرنامج (بدون نوافذ إضافية)...

echo [4/4] تجهيز ملفات التثبيت...
copy /y "packaging\install.bat" "dist\install.bat" >nul 2>nul
copy /y "packaging\install.ps1" "dist\install.ps1" >nul 2>nul
copy /y "packaging\uninstall.bat" "dist\uninstall.bat" >nul 2>nul
copy /y "packaging\uninstall.ps1" "dist\uninstall.ps1" >nul 2>nul
copy /y "packaging\install.vbs" "dist\install.vbs" >nul 2>nul
copy /y "packaging\uninstall.vbs" "dist\uninstall.vbs" >nul 2>nul
if exist "LICENSE" copy /y "LICENSE" "dist\LICENSE" >nul 2>nul

echo.
echo ============================================================
echo تم البناء بنجاح:
echo dist\FasterPC.exe (البرنامج — يعمل صامتًا وبدون cmd)
echo dist\install.bat (يثبّت البرنامج + اختصار سطح المكتب)
echo dist\install.vbs (تثبيت صامت تمامًا بدون أي نافذة)
echo ============================================================
echo.
pause
Expand Down
5 changes: 3 additions & 2 deletions docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ <h3 data-ar="الاختبارات والجودة" data-en="Tests & quality"></h3

<h3 data-ar="البناء والنشر" data-en="Build & release"></h3>
<pre>pyinstaller --noconfirm --clean faster_pc.spec # -> dist/FasterPC.exe
packaging/install.bat # install + shortcuts
packaging/uninstall.bat # uninstall</pre>
packaging/install.vbs # تثبيت صامت تمامًا (بدون نوافذ)
packaging/install.bat # تثبيت مع رسائل تقدم
packaging/uninstall.vbs # إلغاء تثبيت صامت</pre>
<p data-ar="مواصفات البناء: console=False (بدون نافذة)، uac_admin=True (طلب صلاحيات المدير)، أيقونة رسمية، معلومات إصدار في خصائص الملف، واستثناء وحدات Qt غير المستخدمة لتصغير الحجم."
data-en="Spec highlights: console=False (no window), uac_admin=True, official icon, file version info, and unused Qt modules excluded to shrink size."></p>

Expand Down
21 changes: 16 additions & 5 deletions faster_pc.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@
pyinstaller --noconfirm --clean faster_pc.spec
"""

import sys
from pathlib import Path

from PyInstaller.utils.hooks import collect_data_files

ROOT = Path(SPECPATH)
# ضمان أن حزمة src قابلة للاستيراد وقت البناء (لجمع ملفات البيانات)
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))

try:
from PyInstaller.utils.hooks import collect_data_files
except Exception: # pragma: no cover
collect_data_files = None

datas = [
(str(ROOT / "assets" / "app_icon.ico"), "assets"),
Expand All @@ -25,8 +32,12 @@ datas = [
(str(ROOT / "docs" / "docs.html"), "docs"),
(str(ROOT / "LICENSE"), "."),
]
# أي ملفات بيانات إضافية داخل الحزم (احتياط مستقبلي)
datas += collect_data_files("src", includes=["**/*.qss", "**/*.html"])
# أي ملفات .qss إضافية داخل الحزمة (احتياط مستقبلي) — لا نُفشل البناء لو فشل الجمع
if collect_data_files is not None:
try:
datas += collect_data_files("src", includes=["**/*.qss"])
except Exception as exc: # pragma: no cover
print(f"[spec] collect_data_files skipped: {exc}")

hiddenimports = [
"PySide6.QtNetwork",
Expand All @@ -45,7 +56,7 @@ excludes = [
"PySide6.QtWebSockets", "PySide6.QtWebChannel", "PySide6.QtRemoteObjects",
"PySide6.QtScxml", "PySide6.QtSensors", "PySide6.QtSpatialAudio",
"PySide6.QtTextToSpeech", "PySide6.QtUiTools", "PySide6.QtVirtualKeyboard",
"matplotlib", "numpy", "pandas", "tkinter", "unittest",
"matplotlib", "numpy", "pandas", "tkinter",
]

icon_path = str(ROOT / "assets" / "app_icon.ico")
Expand Down
10 changes: 8 additions & 2 deletions packaging/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ function New-AppShortcut {
if ($dir -and -not (Test-Path $dir)) { New-Item -ItemType Directory -Force -Path $dir | Out-Null }
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut($ShortcutPath)
$workDirFinal = Split-Path -Parent $Target
if ($WorkDir) { $workDirFinal = $WorkDir }
$shortcut.TargetPath = $Target
$shortcut.Arguments = $Arguments
$shortcut.WorkingDirectory = if ($WorkDir) { $WorkDir } else { Split-Path -Parent $Target }
$shortcut.WorkingDirectory = $workDirFinal
$shortcut.IconLocation = "$iconPath,0"
$shortcut.Description = 'Faster PC — صيانة وتسريع ويندوز'
$shortcut.Save()
Expand All @@ -72,7 +74,11 @@ if ($RunAtStartup) {
if (-not $Quiet) { Write-Host "✔ التشغيل التلقائي مع ويندوز" }
}

# اختصار إلغاء التثبيت
# اختصار إلغاء التثبيت (ننسخ السكربت المرفق، أو نكتب بديلًا بسيطًا)
$uninstallPs1Source = Join-Path $SourceDir 'uninstall.ps1'
if (Test-Path $uninstallPs1Source) {
Copy-Item $uninstallPs1Source -Destination (Join-Path $installDir 'uninstall.ps1') -Force
}
$uninstaller = Join-Path $installDir 'uninstall.bat'
if (-not (Test-Path $uninstaller)) {
@"
Expand Down
12 changes: 12 additions & 0 deletions packaging/install.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
' ============================================================
' Faster PC — تثبيت صامت تمامًا (بدون أي نافذة على الإطلاق)
' دبل-كلك على هذا الملف فقط. ينفّذ install.ps1 في الخلفية.
' ============================================================
Option Explicit
Dim shell, fso, baseDir, cmd
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
baseDir = fso.GetParentFolderName(WScript.ScriptFullName)
cmd = "powershell -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & baseDir & "\install.ps1"" -SourceDir """ & baseDir & """"
' 0 = نافذة مخفية، False = لا ننتظر انتهاءها (التثبيت يكمل في الخلفية)
shell.Run cmd, 0, False
10 changes: 10 additions & 0 deletions packaging/uninstall.vbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
' ============================================================
' Faster PC — إلغاء تثبيت صامت تمامًا (بدون أي نافذة)
' ============================================================
Option Explicit
Dim shell, fso, baseDir, cmd
Set shell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
baseDir = fso.GetParentFolderName(WScript.ScriptFullName)
cmd = "powershell -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File """ & baseDir & "\uninstall.ps1"" -Quiet"
shell.Run cmd, 0, False
6 changes: 2 additions & 4 deletions src/core/repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from datetime import datetime

from src.core.results import ActionResult
from src.utils.winapi import IS_WINDOWS, is_admin, run_silent
from src.utils.winapi import IS_WINDOWS, is_admin, run_powershell, run_silent

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -66,9 +66,7 @@ def create_restore_point(self, description: str | None = None) -> ActionResult:
"Checkpoint-Computer -Description '" + _ps_escape(text) + "' "
"-RestorePointType 'MODIFY_SETTINGS'"
)
result = run_silent(
["powershell", "-NoProfile", "-NonInteractive", "-Command", script], timeout=600
)
result = run_powershell(script, timeout=600)
if result.ok:
return ActionResult(True, f"تم إنشاء نقطة استعادة: {text}")
details = result.output
Expand Down
Loading