CrimsonSorcerer commited on
Commit
2bf0405
·
verified ·
1 Parent(s): fe433ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -7
app.py CHANGED
@@ -1,5 +1,5 @@
1
  from flask import Flask, request, send_file, jsonify
2
- import subprocess, os, shutil, uuid
3
 
4
  app = Flask(__name__)
5
 
@@ -35,21 +35,31 @@ def build():
35
  os.makedirs(work_dir, exist_ok=True)
36
 
37
  try:
 
38
  with open(f"{work_dir}/index.html", "w", encoding="utf-8") as f:
39
  f.write(html)
40
 
41
- # Özel manifest varsa kaydet
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  if manifest.strip():
43
  with open(f"{work_dir}/custom_manifest.xml", "w", encoding="utf-8") as f:
44
  f.write(manifest)
45
 
46
- # logo base64 prefix temizle
47
- if logo_b64 and ',' in logo_b64:
48
- logo_b64 = logo_b64.split(',')[1]
49
-
50
  result = subprocess.run(
51
  ["bash", "/app/build_apk.sh", work_dir, name, pkg,
52
- "/opt/debug.keystore", min_sdk, logo_b64],
53
  capture_output=True, text=True, timeout=120
54
  )
55
 
 
1
  from flask import Flask, request, send_file, jsonify
2
+ import subprocess, os, shutil, uuid, base64
3
 
4
  app = Flask(__name__)
5
 
 
35
  os.makedirs(work_dir, exist_ok=True)
36
 
37
  try:
38
+ # HTML
39
  with open(f"{work_dir}/index.html", "w", encoding="utf-8") as f:
40
  f.write(html)
41
 
42
+ # Logo dosyaya yaz, argüman olarak geçirme
43
+ has_logo = "0"
44
+ if logo_b64 and logo_b64.strip():
45
+ try:
46
+ if ',' in logo_b64:
47
+ logo_b64 = logo_b64.split(',')[1]
48
+ os.makedirs(f"{work_dir}/res/mipmap-hdpi", exist_ok=True)
49
+ with open(f"{work_dir}/res/mipmap-hdpi/ic_launcher.png", "wb") as f:
50
+ f.write(base64.b64decode(logo_b64))
51
+ has_logo = "1"
52
+ except:
53
+ has_logo = "0"
54
+
55
+ # Özel manifest
56
  if manifest.strip():
57
  with open(f"{work_dir}/custom_manifest.xml", "w", encoding="utf-8") as f:
58
  f.write(manifest)
59
 
 
 
 
 
60
  result = subprocess.run(
61
  ["bash", "/app/build_apk.sh", work_dir, name, pkg,
62
+ "/opt/debug.keystore", min_sdk, has_logo],
63
  capture_output=True, text=True, timeout=120
64
  )
65