|
@@ -35,149 +35,71 @@ def vprint(*data):
|
|
|
|
|
|
|
|
|
def create_folder(package_id):
|
|
|
- try:
|
|
|
- path = os.path.join(app.temp_folder, package_id)
|
|
|
- if not os.path.exists(path):
|
|
|
- os.mkdir(path)
|
|
|
- else:
|
|
|
- shutil.rmtree(path)
|
|
|
- os.mkdir(path)
|
|
|
- vprint(path)
|
|
|
- path_dest = os.path.join(path, app.base_project_name)
|
|
|
- if not os.path.exists(path_dest):
|
|
|
- shutil.copytree(app.base_project, path_dest)
|
|
|
- code_path = "app/src/main/java/"
|
|
|
- orig_code = "com/example/qmeralitesamplecode"
|
|
|
- path_package_id = package_id.replace(".", "/")
|
|
|
- c_code_path = os.path.join(path_dest, code_path, path_package_id)
|
|
|
- orig_code_path = os.path.join(path_dest, code_path, orig_code)
|
|
|
- if not os.path.exists(c_code_path):
|
|
|
- shutil.copytree(orig_code_path, c_code_path)
|
|
|
- shutil.rmtree(orig_code_path)
|
|
|
- return path_dest, c_code_path
|
|
|
- except:
|
|
|
- raise
|
|
|
+ path = os.path.join(app.temp_folder, package_id)
|
|
|
+ if not os.path.exists(path):
|
|
|
+ os.mkdir(path)
|
|
|
+ else:
|
|
|
+ shutil.rmtree(path)
|
|
|
+ os.mkdir(path)
|
|
|
+ vprint(path)
|
|
|
+ path_dest = os.path.join(path, app.base_project_name)
|
|
|
+ if not os.path.exists(path_dest):
|
|
|
+ shutil.copytree(app.base_project, path_dest)
|
|
|
+ code_path = "app/src/main/java/"
|
|
|
+ orig_code = "com/example/qmeralitesamplecode"
|
|
|
+ path_package_id = package_id.replace(".", "/")
|
|
|
+ c_code_path = os.path.join(path_dest, code_path, path_package_id)
|
|
|
+ orig_code_path = os.path.join(path_dest, code_path, orig_code)
|
|
|
+ if not os.path.exists(c_code_path):
|
|
|
+ shutil.copytree(orig_code_path, c_code_path)
|
|
|
+ shutil.rmtree(orig_code_path)
|
|
|
+ return path_dest, c_code_path
|
|
|
|
|
|
|
|
|
def change_acc(c_code_path, acc, enable_sms):
|
|
|
- try:
|
|
|
- main_activity = os.path.join(c_code_path, "MAB.java")
|
|
|
- with open(main_activity, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("***REPLACE***WITH***YOUR***QMERA***ACCOUNT***", acc)
|
|
|
- if enable_sms == 1:
|
|
|
- replaced = replaced.replace("isEnabledSMS = false", "isEnabledSMS = true")
|
|
|
- with open(main_activity, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ main_activity = os.path.join(c_code_path, "MAB.java")
|
|
|
+ with open(main_activity, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("***REPLACE***WITH***YOUR***QMERA***ACCOUNT***", acc)
|
|
|
+ if enable_sms == 1:
|
|
|
+ replaced = replaced.replace("isEnabledSMS = false", "isEnabledSMS = true")
|
|
|
+ with open(main_activity, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def change_url(c_code_path, url):
|
|
|
- try:
|
|
|
- main_activity = os.path.join(c_code_path, "MAB.java")
|
|
|
- with open(main_activity, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("https://www.google.com", url)
|
|
|
- with open(main_activity, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ main_activity = os.path.join(c_code_path, "MAB.java")
|
|
|
+ with open(main_activity, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("https://www.google.com", url)
|
|
|
+ with open(main_activity, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def change_name(path_dest, name, enable_sms):
|
|
|
- try:
|
|
|
- manifest = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
|
|
|
- string_res = os.path.join(path_dest, "app/src/main/res/values/strings.xml")
|
|
|
- with open(manifest, "r") as f:
|
|
|
- lines = f.readlines()
|
|
|
- # file_source = f.read()
|
|
|
- with open(manifest, "w") as f:
|
|
|
- for line in lines:
|
|
|
- if "NexilisLite" in line:
|
|
|
- line = line.replace("NexilisLite", name)
|
|
|
- if enable_sms == 0:
|
|
|
- if "SMS" not in line:
|
|
|
- f.write(line)
|
|
|
- else:
|
|
|
+ manifest = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
|
|
|
+ string_res = os.path.join(path_dest, "app/src/main/res/values/strings.xml")
|
|
|
+ with open(manifest, "r") as f:
|
|
|
+ lines = f.readlines()
|
|
|
+ # file_source = f.read()
|
|
|
+ with open(manifest, "w") as f:
|
|
|
+ for line in lines:
|
|
|
+ if "NexilisLite" in line:
|
|
|
+ line = line.replace("NexilisLite", name)
|
|
|
+ if enable_sms == 0:
|
|
|
+ if "SMS" not in line:
|
|
|
f.write(line)
|
|
|
- with open(string_res, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("Nexilis Sport", name)
|
|
|
- with open(string_res, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ else:
|
|
|
+ f.write(line)
|
|
|
+ with open(string_res, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("Nexilis Sport", name)
|
|
|
+ with open(string_res, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def change_font(path_dest, font, package):
|
|
|
- try:
|
|
|
- if font == 1:
|
|
|
- path_package_id = package.replace(".", "/")
|
|
|
- code_path = "app/src/main/java/"
|
|
|
- code_path = os.path.join(path_dest, code_path, path_package_id)
|
|
|
- res_path = "app/src/main/res/"
|
|
|
- res_path = os.path.join(path_dest, res_path)
|
|
|
- javas = [os.path.join(dp, f) for dp, dn, filenames in os.walk(code_path) for f in filenames]
|
|
|
- res = [os.path.join(dp, f) for dp, dn, filenames in os.walk(res_path) for f in filenames if "xml" in f]
|
|
|
- button_apps_code_path = os.path.join(path_dest, "palio-button-app/src/main/java")
|
|
|
- button_apps_res_path = os.path.join(path_dest, "palio-button-app/src/main/res-pba/")
|
|
|
- lib_javas = [os.path.join(dp, f) for dp, dn, filenames in os.walk(button_apps_code_path) for f in filenames]
|
|
|
- lib_res = [os.path.join(dp, f) for dp, dn, filenames in os.walk(button_apps_res_path) for f in filenames if
|
|
|
- "xml" in f]
|
|
|
- for j in javas:
|
|
|
- print(j)
|
|
|
- if "ForumFragment.java" in j:
|
|
|
- with open(j, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
- with open(j, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- for j in res:
|
|
|
- print(j)
|
|
|
- with open(j, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
- with open(j, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- for j in lib_javas:
|
|
|
- print(j)
|
|
|
- with open(j, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
- with open(j, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- for j in lib_res:
|
|
|
- print(j)
|
|
|
- with open(j, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
- with open(j, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
-
|
|
|
-
|
|
|
-def change_package(path_dest, package):
|
|
|
- try:
|
|
|
- build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
- with open(build_gradle, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
- with open(build_gradle, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- proguard = os.path.join(path_dest, 'app/proguard-rules.pro')
|
|
|
- with open(proguard, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
- with open(proguard, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- manifest = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
|
|
|
- with open(manifest, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
- with open(manifest, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
+ if font == 1:
|
|
|
path_package_id = package.replace(".", "/")
|
|
|
code_path = "app/src/main/java/"
|
|
|
code_path = os.path.join(path_dest, code_path, path_package_id)
|
|
@@ -185,200 +107,252 @@ def change_package(path_dest, package):
|
|
|
res_path = os.path.join(path_dest, res_path)
|
|
|
javas = [os.path.join(dp, f) for dp, dn, filenames in os.walk(code_path) for f in filenames]
|
|
|
res = [os.path.join(dp, f) for dp, dn, filenames in os.walk(res_path) for f in filenames if "xml" in f]
|
|
|
+ button_apps_code_path = os.path.join(path_dest, "palio-button-app/src/main/java")
|
|
|
+ button_apps_res_path = os.path.join(path_dest, "palio-button-app/src/main/res-pba/")
|
|
|
+ lib_javas = [os.path.join(dp, f) for dp, dn, filenames in os.walk(button_apps_code_path) for f in filenames]
|
|
|
+ lib_res = [os.path.join(dp, f) for dp, dn, filenames in os.walk(button_apps_res_path) for f in filenames if
|
|
|
+ "xml" in f]
|
|
|
for j in javas:
|
|
|
+ print(j)
|
|
|
+ if "ForumFragment.java" in j:
|
|
|
+ with open(j, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
+ with open(j, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ for j in res:
|
|
|
print(j)
|
|
|
with open(j, "r") as f:
|
|
|
file_source = f.read()
|
|
|
- replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
with open(j, "w") as f:
|
|
|
f.write(replaced)
|
|
|
- for j in res:
|
|
|
+ for j in lib_javas:
|
|
|
print(j)
|
|
|
with open(j, "r") as f:
|
|
|
file_source = f.read()
|
|
|
- replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
with open(j, "w") as f:
|
|
|
f.write(replaced)
|
|
|
+ for j in lib_res:
|
|
|
+ print(j)
|
|
|
+ with open(j, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("pb_poppins", "roboto")
|
|
|
+ with open(j, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+
|
|
|
+
|
|
|
+def change_package(path_dest, package):
|
|
|
+ build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
+ with open(build_gradle, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ with open(build_gradle, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ proguard = os.path.join(path_dest, 'app/proguard-rules.pro')
|
|
|
+ with open(proguard, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ with open(proguard, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ manifest = os.path.join(path_dest, "app/src/main/AndroidManifest.xml")
|
|
|
+ with open(manifest, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ with open(manifest, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ path_package_id = package.replace(".", "/")
|
|
|
+ code_path = "app/src/main/java/"
|
|
|
+ code_path = os.path.join(path_dest, code_path, path_package_id)
|
|
|
+ res_path = "app/src/main/res/"
|
|
|
+ res_path = os.path.join(path_dest, res_path)
|
|
|
+ javas = [os.path.join(dp, f) for dp, dn, filenames in os.walk(code_path) for f in filenames]
|
|
|
+ res = [os.path.join(dp, f) for dp, dn, filenames in os.walk(res_path) for f in filenames if "xml" in f]
|
|
|
+ for j in javas:
|
|
|
+ print(j)
|
|
|
+ with open(j, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ with open(j, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ for j in res:
|
|
|
+ print(j)
|
|
|
+ with open(j, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("com.example.qmeralitesamplecode", package)
|
|
|
+ with open(j, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
- gradle = os.path.join(path_dest, "app/build.gradle")
|
|
|
- with open(gradle, "r") as f:
|
|
|
- lines = f.readlines()
|
|
|
- # file_source = f.read()
|
|
|
- if package == "io.nexilis.digipos" or package == "io.nexilis.digisales":
|
|
|
- with open(gradle, "w") as f:
|
|
|
- counter = 0
|
|
|
- for line in lines:
|
|
|
- if counter == 0:
|
|
|
- if "forallapps" in line:
|
|
|
- counter = 3
|
|
|
- continue
|
|
|
- if "nexilis-libs" in line:
|
|
|
- continue
|
|
|
- if "temp-nexilis-client" in line:
|
|
|
- continue
|
|
|
- if "AP6ZuWCxBVTzLGiUjfacryBiwPQ" in line:
|
|
|
- continue
|
|
|
- else:
|
|
|
- f.write(line)
|
|
|
+ gradle = os.path.join(path_dest, "app/build.gradle")
|
|
|
+ with open(gradle, "r") as f:
|
|
|
+ lines = f.readlines()
|
|
|
+ # file_source = f.read()
|
|
|
+ if package == "io.nexilis.digipos" or package == "io.nexilis.digisales":
|
|
|
+ with open(gradle, "w") as f:
|
|
|
+ counter = 0
|
|
|
+ for line in lines:
|
|
|
+ if counter == 0:
|
|
|
+ if "forallapps" in line:
|
|
|
+ counter = 3
|
|
|
+ continue
|
|
|
+ if "nexilis-libs" in line:
|
|
|
+ continue
|
|
|
+ if "temp-nexilis-client" in line:
|
|
|
+ continue
|
|
|
+ if "AP6ZuWCxBVTzLGiUjfacryBiwPQ" in line:
|
|
|
+ continue
|
|
|
else:
|
|
|
- counter = counter - 1
|
|
|
- else:
|
|
|
- with open(gradle, "w") as f:
|
|
|
- counter = 0
|
|
|
- for line in lines:
|
|
|
- if counter == 0:
|
|
|
- if "fordigisales" in line:
|
|
|
- counter = 3
|
|
|
- continue
|
|
|
- if "cx-button-libs" in line:
|
|
|
- continue
|
|
|
- if "cx-tsel-client" in line:
|
|
|
- continue
|
|
|
- if "AP5NjpoELAt7gHYMtnsrm9hxdGk" in line:
|
|
|
- continue
|
|
|
- else:
|
|
|
- f.write(line)
|
|
|
+ f.write(line)
|
|
|
+ else:
|
|
|
+ counter = counter - 1
|
|
|
+ else:
|
|
|
+ with open(gradle, "w") as f:
|
|
|
+ counter = 0
|
|
|
+ for line in lines:
|
|
|
+ if counter == 0:
|
|
|
+ if "fordigisales" in line:
|
|
|
+ counter = 3
|
|
|
+ continue
|
|
|
+ if "cx-button-libs" in line:
|
|
|
+ continue
|
|
|
+ if "cx-tsel-client" in line:
|
|
|
+ continue
|
|
|
+ if "AP5NjpoELAt7gHYMtnsrm9hxdGk" in line:
|
|
|
+ continue
|
|
|
else:
|
|
|
- counter = counter - 1
|
|
|
+ f.write(line)
|
|
|
+ else:
|
|
|
+ counter = counter - 1
|
|
|
|
|
|
- if package == "com.nexilis.persija" or package == "io.newuniverse.GoToMalls" or package == "io.qmera.mylab":
|
|
|
- string_res = os.path.join(path_dest, "app/src/main/res/values/strings.xml")
|
|
|
- string_en_res = os.path.join(path_dest, "app/src/main/res/values-en/strings.xml")
|
|
|
- string_id_res = os.path.join(path_dest, "app/src/main/res/values-in/strings.xml")
|
|
|
- with open(string_res, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
- with open(string_res, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- with open(string_en_res, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
- with open(string_en_res, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- with open(string_id_res, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
- with open(string_id_res, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
+ if package == "com.nexilis.persija" or package == "io.newuniverse.GoToMalls" or package == "io.qmera.mylab":
|
|
|
+ string_res = os.path.join(path_dest, "app/src/main/res/values/strings.xml")
|
|
|
+ string_en_res = os.path.join(path_dest, "app/src/main/res/values-en/strings.xml")
|
|
|
+ string_id_res = os.path.join(path_dest, "app/src/main/res/values-in/strings.xml")
|
|
|
+ with open(string_res, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
+ with open(string_res, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ with open(string_en_res, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
+ with open(string_en_res, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ with open(string_id_res, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("Nexilis", "Qmera")
|
|
|
+ with open(string_id_res, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
- old_img_powered = "app/src/main/res/drawable/pb_powered_button.png"
|
|
|
- old_img_powered = os.path.join(path_dest, old_img_powered)
|
|
|
- old_new_img_powered = "app/src/main/res/drawable/pb_powered_button_temp.png"
|
|
|
- old_new_img_powered = os.path.join(path_dest, old_new_img_powered)
|
|
|
- shutil.move(old_img_powered, old_new_img_powered)
|
|
|
+ old_img_powered = "app/src/main/res/drawable/pb_powered_button.png"
|
|
|
+ old_img_powered = os.path.join(path_dest, old_img_powered)
|
|
|
+ old_new_img_powered = "app/src/main/res/drawable/pb_powered_button_temp.png"
|
|
|
+ old_new_img_powered = os.path.join(path_dest, old_new_img_powered)
|
|
|
+ shutil.move(old_img_powered, old_new_img_powered)
|
|
|
|
|
|
- img_powered = "app/src/main/res/drawable/pb_powered_button1.png"
|
|
|
- img_powered = os.path.join(path_dest, img_powered)
|
|
|
- new_img_powered = "app/src/main/res/drawable/pb_powered_button.png"
|
|
|
- new_img_powered = os.path.join(path_dest, new_img_powered)
|
|
|
- shutil.move(img_powered, new_img_powered)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ img_powered = "app/src/main/res/drawable/pb_powered_button1.png"
|
|
|
+ img_powered = os.path.join(path_dest, img_powered)
|
|
|
+ new_img_powered = "app/src/main/res/drawable/pb_powered_button.png"
|
|
|
+ new_img_powered = os.path.join(path_dest, new_img_powered)
|
|
|
+ shutil.move(img_powered, new_img_powered)
|
|
|
|
|
|
|
|
|
def change_logo(path_dest, logo, logo_float=None):
|
|
|
- try:
|
|
|
- img_path = "app/src/main/res/drawable/ic_launcher.png"
|
|
|
- img_path = os.path.join(path_dest, img_path)
|
|
|
- img_notif = "app/src/main/res/drawable/pb_ball.png"
|
|
|
- img_notif = os.path.join(path_dest, img_notif)
|
|
|
- img_path_float = "app/src/main/res/drawable/pb_button.png"
|
|
|
- img_path_float = os.path.join(path_dest, img_path_float)
|
|
|
- if isinstance(logo, str):
|
|
|
- logo = requests.get('https://newuniverse.io/dashboardv2/uploads/logo/{}'.format(logo))
|
|
|
- with open(img_path, "wb") as f:
|
|
|
- f.write(logo.content)
|
|
|
- with open(img_path, "rb") as f:
|
|
|
- logo = Image.open(f)
|
|
|
- logo = logo.resize((512, 512))
|
|
|
- if logo_float:
|
|
|
- logo_float = requests.get('https://newuniverse.io/dashboardv2/uploads/logofloat/{}'.format(logo_float))
|
|
|
- with open(img_path_float, "wb") as f:
|
|
|
- f.write(logo_float.content)
|
|
|
- with open(img_path_float, "rb") as f:
|
|
|
- logo_float = Image.open(f)
|
|
|
- logo_float = logo_float.resize((150, 150))
|
|
|
- else:
|
|
|
- logo = Image.open(logo)
|
|
|
+ img_path = "app/src/main/res/drawable/ic_launcher.png"
|
|
|
+ img_path = os.path.join(path_dest, img_path)
|
|
|
+ img_notif = "app/src/main/res/drawable/pb_ball.png"
|
|
|
+ img_notif = os.path.join(path_dest, img_notif)
|
|
|
+ img_path_float = "app/src/main/res/drawable/pb_button.png"
|
|
|
+ img_path_float = os.path.join(path_dest, img_path_float)
|
|
|
+ if isinstance(logo, str):
|
|
|
+ logo = requests.get('https://newuniverse.io/dashboardv2/uploads/logo/{}'.format(logo))
|
|
|
+ with open(img_path, "wb") as f:
|
|
|
+ f.write(logo.content)
|
|
|
+ with open(img_path, "rb") as f:
|
|
|
+ logo = Image.open(f)
|
|
|
logo = logo.resize((512, 512))
|
|
|
- if logo_float:
|
|
|
- logo_float = Image.open(logo_float)
|
|
|
+ if logo_float:
|
|
|
+ logo_float = requests.get('https://newuniverse.io/dashboardv2/uploads/logofloat/{}'.format(logo_float))
|
|
|
+ with open(img_path_float, "wb") as f:
|
|
|
+ f.write(logo_float.content)
|
|
|
+ with open(img_path_float, "rb") as f:
|
|
|
+ logo_float = Image.open(f)
|
|
|
logo_float = logo_float.resize((150, 150))
|
|
|
- logo.save(img_path, "PNG")
|
|
|
+ else:
|
|
|
+ logo = Image.open(logo)
|
|
|
+ logo = logo.resize((512, 512))
|
|
|
if logo_float:
|
|
|
- logo_float.save(img_path_float, "PNG")
|
|
|
- logo_float.save(img_notif, "PNG")
|
|
|
- except:
|
|
|
- raise
|
|
|
+ logo_float = Image.open(logo_float)
|
|
|
+ logo_float = logo_float.resize((150, 150))
|
|
|
+ logo.save(img_path, "PNG")
|
|
|
+ if logo_float:
|
|
|
+ logo_float.save(img_path_float, "PNG")
|
|
|
+ logo_float.save(img_notif, "PNG")
|
|
|
|
|
|
|
|
|
def change_tab(path_dest, tabs, tab_icon, package, tab3_mode, tab_amount):
|
|
|
- try:
|
|
|
- default_tab_icon = ["tab{}.png".format(x) for x in tabs]
|
|
|
- for i, icon in enumerate(default_tab_icon):
|
|
|
- if not tab_icon[i]:
|
|
|
- continue
|
|
|
- img_path = "app/src/main/res/drawable"
|
|
|
- img_path = os.path.join(path_dest, img_path, icon)
|
|
|
- if isinstance(tab_icon[i], str):
|
|
|
- logo = requests.get('https://newuniverse.io/dashboardv2/uploads/tab_icon/{}'.format(tab_icon[i]))
|
|
|
- with open(img_path, "wb") as f:
|
|
|
- f.write(logo.content)
|
|
|
- with open(img_path, "rb") as f:
|
|
|
- logo = Image.open(f)
|
|
|
- logo = logo.resize((150, 150))
|
|
|
- logo.save(img_path, "PNG")
|
|
|
- else:
|
|
|
- logo = Image.open(tab_icon[i])
|
|
|
+ default_tab_icon = ["tab{}.png".format(x) for x in tabs]
|
|
|
+ for i, icon in enumerate(default_tab_icon):
|
|
|
+ if not tab_icon[i]:
|
|
|
+ continue
|
|
|
+ img_path = "app/src/main/res/drawable"
|
|
|
+ img_path = os.path.join(path_dest, img_path, icon)
|
|
|
+ if isinstance(tab_icon[i], str):
|
|
|
+ logo = requests.get('https://newuniverse.io/dashboardv2/uploads/tab_icon/{}'.format(tab_icon[i]))
|
|
|
+ with open(img_path, "wb") as f:
|
|
|
+ f.write(logo.content)
|
|
|
+ with open(img_path, "rb") as f:
|
|
|
+ logo = Image.open(f)
|
|
|
logo = logo.resize((150, 150))
|
|
|
logo.save(img_path, "PNG")
|
|
|
- path_package_id = package.replace(".", "/")
|
|
|
- code_path = "app/src/main/java/"
|
|
|
- sobj_code_path = os.path.join(path_dest, code_path, path_package_id, "SObj.java")
|
|
|
- print(sobj_code_path)
|
|
|
- with open(sobj_code_path, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("1,2,3,4", ",".join(tabs))
|
|
|
- with open(sobj_code_path, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- main_code_path = os.path.join(path_dest, code_path, path_package_id, "MAB.java")
|
|
|
- with open(main_code_path, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace('tab3 = "0"', 'tab3 = "{}"'.format(tab3_mode))
|
|
|
- with open(main_code_path, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- prefs_code_path = os.path.join(path_dest, code_path, path_package_id, "util/PrefsUtil.java")
|
|
|
- with open(prefs_code_path, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace('DEFAULT_TAB_AMOUNT = "4"', 'DEFAULT_TAB_AMOUNT = "{}"'.format(tab_amount))
|
|
|
- with open(prefs_code_path, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ else:
|
|
|
+ logo = Image.open(tab_icon[i])
|
|
|
+ logo = logo.resize((150, 150))
|
|
|
+ logo.save(img_path, "PNG")
|
|
|
+ path_package_id = package.replace(".", "/")
|
|
|
+ code_path = "app/src/main/java/"
|
|
|
+ sobj_code_path = os.path.join(path_dest, code_path, path_package_id, "SObj.java")
|
|
|
+ print(sobj_code_path)
|
|
|
+ with open(sobj_code_path, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("1,2,3,4", ",".join(tabs))
|
|
|
+ with open(sobj_code_path, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ main_code_path = os.path.join(path_dest, code_path, path_package_id, "MAB.java")
|
|
|
+ with open(main_code_path, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace('tab3 = "0"', 'tab3 = "{}"'.format(tab3_mode))
|
|
|
+ with open(main_code_path, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
+ prefs_code_path = os.path.join(path_dest, code_path, path_package_id, "util/PrefsUtil.java")
|
|
|
+ with open(prefs_code_path, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace('DEFAULT_TAB_AMOUNT = "4"', 'DEFAULT_TAB_AMOUNT = "{}"'.format(tab_amount))
|
|
|
+ with open(prefs_code_path, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def change_fb(path_dest, fb_icon):
|
|
|
- try:
|
|
|
- default_fb_icon = ["pb_button_chat.png", "pb_button_call.png", "pb_button_cc.png", "pb_button_stream.png",
|
|
|
- "nexilis_fb_04.png"]
|
|
|
- for i in range(5):
|
|
|
- if not fb_icon[i]:
|
|
|
- continue
|
|
|
- img_path = "app/src/main/res/drawable-nodpi"
|
|
|
- img_path = os.path.join(path_dest, img_path, default_fb_icon[i])
|
|
|
- if isinstance(fb_icon[i], str):
|
|
|
- logo = requests.get('https://newuniverse.io/dashboardv2/uploads/fb_icon/{}'.format(fb_icon[i]))
|
|
|
- with open(img_path, "wb") as f:
|
|
|
- f.write(logo.content)
|
|
|
- with open(img_path, "rb") as f:
|
|
|
- logo = Image.open(f)
|
|
|
- logo = logo.resize((150, 150))
|
|
|
- logo.save(img_path, "PNG")
|
|
|
- else:
|
|
|
- logo = Image.open(fb_icon[i])
|
|
|
+ default_fb_icon = ["pb_button_chat.png", "pb_button_call.png", "pb_button_cc.png", "pb_button_stream.png",
|
|
|
+ "nexilis_fb_04.png"]
|
|
|
+ for i in range(5):
|
|
|
+ if not fb_icon[i]:
|
|
|
+ continue
|
|
|
+ img_path = "app/src/main/res/drawable-nodpi"
|
|
|
+ img_path = os.path.join(path_dest, img_path, default_fb_icon[i])
|
|
|
+ if isinstance(fb_icon[i], str):
|
|
|
+ logo = requests.get('https://newuniverse.io/dashboardv2/uploads/fb_icon/{}'.format(fb_icon[i]))
|
|
|
+ with open(img_path, "wb") as f:
|
|
|
+ f.write(logo.content)
|
|
|
+ with open(img_path, "rb") as f:
|
|
|
+ logo = Image.open(f)
|
|
|
logo = logo.resize((150, 150))
|
|
|
logo.save(img_path, "PNG")
|
|
|
- except: raise
|
|
|
+ else:
|
|
|
+ logo = Image.open(fb_icon[i])
|
|
|
+ logo = logo.resize((150, 150))
|
|
|
+ logo.save(img_path, "PNG")
|
|
|
|
|
|
|
|
|
def change_background(path_dest, background):
|
|
@@ -404,51 +378,45 @@ def change_background(path_dest, background):
|
|
|
|
|
|
|
|
|
def change_access(path_dest, access_model, package):
|
|
|
- try:
|
|
|
- access = ["CPAAS_MODE_FLOATING", "CPAAS_MODE_DOCKED", "CPAAS_MODE_BURGER"]
|
|
|
- path_package_id = package.replace(".", "/")
|
|
|
- code_path = "app/src/main/java/"
|
|
|
- code_path = os.path.join(path_dest, code_path, path_package_id, "util", "PrefsUtil.java")
|
|
|
- print(code_path)
|
|
|
- with open(code_path, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("= CPAAS_MODE_DOCKED", "= {}".format(access[access_model]))
|
|
|
- with open(code_path, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ access = ["CPAAS_MODE_FLOATING", "CPAAS_MODE_DOCKED", "CPAAS_MODE_BURGER"]
|
|
|
+ path_package_id = package.replace(".", "/")
|
|
|
+ code_path = "app/src/main/java/"
|
|
|
+ code_path = os.path.join(path_dest, code_path, path_package_id, "util", "PrefsUtil.java")
|
|
|
+ print(code_path)
|
|
|
+ with open(code_path, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("= CPAAS_MODE_DOCKED", "= {}".format(access[access_model]))
|
|
|
+ with open(code_path, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def change_certificate(path_dest, key, keyfile, keytool):
|
|
|
- try:
|
|
|
- keyfile_name = "{}.keystore".format(key["alias"])
|
|
|
- keyfile_path = os.path.join(path_dest, keyfile_name)
|
|
|
- if keyfile:
|
|
|
- keyfile.save(keyfile_path)
|
|
|
- else:
|
|
|
- vprint("keytool run")
|
|
|
- os.chdir(path_dest)
|
|
|
- vprint("current working directory: ", os.getcwd())
|
|
|
- dname = "CN={}, OU={}, O={}, L={}, S={}, C={}".format(key["common_name"], key["organization_unit"],
|
|
|
- key["organization_name"], key["locality_name"],
|
|
|
- key["state_name"], key["country"])
|
|
|
- cmd = [keytool, "-genkey", "-v", "-keystore", keyfile_path, "-alias", key["alias"], "-keyalg", "RSA",
|
|
|
- "-keysize", "2048",
|
|
|
- "-validity", "10000", "-dname", dname, "-storepass", key["store_password"], "-keypass",
|
|
|
- key["key_password"]]
|
|
|
- vprint(cmd)
|
|
|
- subprocess.run(cmd)
|
|
|
- vprint("keytool end")
|
|
|
- build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
- with open(build_gradle, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("allyourbase", key["store_password"])
|
|
|
- replaced = replaced.replace("arebelongto", key["key_password"])
|
|
|
- replaced = replaced.replace("key-qmeralite", key["alias"])
|
|
|
- with open(build_gradle, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ keyfile_name = "{}.keystore".format(key["alias"])
|
|
|
+ keyfile_path = os.path.join(path_dest, keyfile_name)
|
|
|
+ if keyfile:
|
|
|
+ keyfile.save(keyfile_path)
|
|
|
+ else:
|
|
|
+ vprint("keytool run")
|
|
|
+ os.chdir(path_dest)
|
|
|
+ vprint("current working directory: ", os.getcwd())
|
|
|
+ dname = "CN={}, OU={}, O={}, L={}, S={}, C={}".format(key["common_name"], key["organization_unit"],
|
|
|
+ key["organization_name"], key["locality_name"],
|
|
|
+ key["state_name"], key["country"])
|
|
|
+ cmd = [keytool, "-genkey", "-v", "-keystore", keyfile_path, "-alias", key["alias"], "-keyalg", "RSA",
|
|
|
+ "-keysize", "2048",
|
|
|
+ "-validity", "10000", "-dname", dname, "-storepass", key["store_password"], "-keypass",
|
|
|
+ key["key_password"]]
|
|
|
+ vprint(cmd)
|
|
|
+ subprocess.run(cmd)
|
|
|
+ vprint("keytool end")
|
|
|
+ build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
+ with open(build_gradle, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("allyourbase", key["store_password"])
|
|
|
+ replaced = replaced.replace("arebelongto", key["key_password"])
|
|
|
+ replaced = replaced.replace("key-qmeralite", key["alias"])
|
|
|
+ with open(build_gradle, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
def run_build(path_dest):
|
|
@@ -476,8 +444,8 @@ def deliver_apk(path_dest, package_id, key, key_exists):
|
|
|
new_aab_dir = os.path.join(app.apk_folder, aab_name)
|
|
|
new_dir = os.path.join(app.apk_folder, zip_name)
|
|
|
vprint(apk_dir)
|
|
|
+ shutil.move(apk_dir, new_apk_dir)
|
|
|
try:
|
|
|
- shutil.move(apk_dir, new_apk_dir)
|
|
|
shutil.move(aab_dir, new_aab_dir)
|
|
|
with ZipFile(new_dir, 'w') as zip_file:
|
|
|
zip_file.write(new_apk_dir, os.path.basename(new_apk_dir))
|
|
@@ -494,16 +462,13 @@ def deliver_apk(path_dest, package_id, key, key_exists):
|
|
|
|
|
|
|
|
|
def change_version(path_dest, version_code, version_name):
|
|
|
- try:
|
|
|
- build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
- with open(build_gradle, "r") as f:
|
|
|
- file_source = f.read()
|
|
|
- replaced = file_source.replace("versionCode 3", "versionCode {}".format(version_code))
|
|
|
- replaced = replaced.replace('versionName "3.0"', 'versionName "{}"'.format(version_name))
|
|
|
- with open(build_gradle, "w") as f:
|
|
|
- f.write(replaced)
|
|
|
- except:
|
|
|
- raise
|
|
|
+ build_gradle = os.path.join(path_dest, 'app/build.gradle')
|
|
|
+ with open(build_gradle, "r") as f:
|
|
|
+ file_source = f.read()
|
|
|
+ replaced = file_source.replace("versionCode 3", "versionCode {}".format(version_code))
|
|
|
+ replaced = replaced.replace('versionName "3.0"', 'versionName "{}"'.format(version_name))
|
|
|
+ with open(build_gradle, "w") as f:
|
|
|
+ f.write(replaced)
|
|
|
|
|
|
|
|
|
@app.route('/', methods=["GET", "POST"])
|
|
@@ -697,7 +662,7 @@ def build_apk():
|
|
|
return {"status": "2", "message": "Process failure\n{}\n".format(str(e))}
|
|
|
os.chdir(path_dest)
|
|
|
return_code, error = run_build(path_dest)
|
|
|
- if (return_code == 0):
|
|
|
+ if return_code == 0:
|
|
|
return deliver_apk(path_dest, package_id, key, key_exists)
|
|
|
return {"status": "3", "message": "Build failed\n{}".format(str(error))}
|
|
|
else:
|