NikGapps 3.30__py3-none-any.whl → 3.32__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- NikGapps/build/NikGappsManager.py +23 -0
- NikGapps/build/Release.py +1 -1
- NikGapps/build_config.py +3 -3
- NikGapps/cache.py +2 -2
- NikGapps/copy_repos.py +1 -1
- NikGapps/helper/Assets.py +4 -20
- NikGapps/helper/Package.py +1 -1
- NikGapps/helper/assets/appsets.json +6 -0
- NikGapps/helper/assets/packages.json +8 -0
- NikGapps/helper/compression/CompOps.py +3 -3
- NikGapps/helper/compression/Export.py +2 -2
- NikGapps/helper/overlay/Library.py +28 -0
- NikGapps/main.py +2 -2
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/METADATA +1 -1
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/RECORD +19 -29
- NikGapps/helper/B64.py +0 -34
- NikGapps/helper/SystemStat.py +0 -103
- NikGapps/helper/XmlOp.py +0 -40
- NikGapps/helper/compression/Modes.py +0 -4
- NikGapps/helper/compression/Tar.py +0 -25
- NikGapps/helper/compression/Zip.py +0 -98
- NikGapps/helper/compression/Zsh.py +0 -17
- NikGapps/helper/upload/CmdUpload.py +0 -169
- NikGapps/helper/upload/GoFileUpload.py +0 -56
- NikGapps/helper/upload/__init__.py +0 -0
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/LICENSE +0 -0
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/WHEEL +0 -0
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/entry_points.txt +0 -0
- {NikGapps-3.30.dist-info → NikGapps-3.32.dist-info}/top_level.txt +0 -0
|
@@ -303,6 +303,27 @@ class NikGappsManager:
|
|
|
303
303
|
"resources": Library.get_device_health_services_resources()
|
|
304
304
|
}
|
|
305
305
|
],
|
|
306
|
+
"com.google.android.apps.nbu.files": [
|
|
307
|
+
{
|
|
308
|
+
"package_title": "GoogleFiles",
|
|
309
|
+
"package_name": "com.nikgapps.overlay.files",
|
|
310
|
+
"resources": Library.get_google_files_resources()
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"com.google.android.apps.wallpaper": [
|
|
314
|
+
{
|
|
315
|
+
"package_title": "GoogleWallpaper",
|
|
316
|
+
"package_name": "com.nikgapps.overlay.wallpaper",
|
|
317
|
+
"resources": Library.get_google_wallpaper_resources()
|
|
318
|
+
}
|
|
319
|
+
],
|
|
320
|
+
"com.google.android.apps.work.oobconfig": [
|
|
321
|
+
{
|
|
322
|
+
"package_title": "DeviceSetup",
|
|
323
|
+
"package_name": "com.nikgapps.overlay.partnersetup",
|
|
324
|
+
"resources": Library.get_google_partner_setup_resources()
|
|
325
|
+
}
|
|
326
|
+
],
|
|
306
327
|
}
|
|
307
328
|
return [Overlay(overlay["package_title"], overlay["package_name"], self.android_version, overlay["resources"])
|
|
308
329
|
for overlay
|
|
@@ -402,6 +423,8 @@ class NikGappsManager:
|
|
|
402
423
|
# pixel_launcher_packages.append("CinematicEffect")
|
|
403
424
|
pixel_launcher_packages.append("EmojiWallpaper")
|
|
404
425
|
pixel_launcher_packages.append("PixelWeather")
|
|
426
|
+
if float(self.android_version) >= 15:
|
|
427
|
+
pixel_launcher_packages.append("AICore")
|
|
405
428
|
pixel_specifics = self.create_appset_list_from_packages(pixel_launcher_packages)
|
|
406
429
|
stock_packages = [
|
|
407
430
|
"PlayGames",
|
NikGapps/build/Release.py
CHANGED
|
@@ -5,7 +5,7 @@ from NikGapps.helper import Config
|
|
|
5
5
|
from niklibrary.helper.P import P
|
|
6
6
|
from niklibrary.helper.Statics import Statics
|
|
7
7
|
from niklibrary.helper.T import T
|
|
8
|
-
from
|
|
8
|
+
from niklibrary.compression.Modes import Modes
|
|
9
9
|
from NikGapps.helper.compression.Export import Export
|
|
10
10
|
from niklibrary.web.Upload import Upload
|
|
11
11
|
from niklibrary.web.TelegramApi import TelegramApi
|
NikGapps/build_config.py
CHANGED
|
@@ -5,13 +5,13 @@ from NikGapps.build.Build import Build
|
|
|
5
5
|
from NikGapps.config.NikGappsConfig import NikGappsConfig
|
|
6
6
|
from NikGapps.helper.Args import Args
|
|
7
7
|
from NikGapps.helper import Config
|
|
8
|
-
from
|
|
8
|
+
from niklibrary.helper.B64 import B64
|
|
9
9
|
from niklibrary.helper.F import F
|
|
10
10
|
from niklibrary.helper.Statics import Statics
|
|
11
|
-
from
|
|
11
|
+
from niklibrary.helper.SystemStat import SystemStat
|
|
12
12
|
from niklibrary.helper.T import T
|
|
13
13
|
from NikGapps.helper.compression.Export import Export
|
|
14
|
-
from
|
|
14
|
+
from niklibrary.compression.Modes import Modes
|
|
15
15
|
from niklibrary.git.GitOp import GitOp
|
|
16
16
|
|
|
17
17
|
|
NikGapps/cache.py
CHANGED
|
@@ -4,13 +4,13 @@ from NikGapps.build.Build import Build
|
|
|
4
4
|
from NikGapps.config.NikGappsConfig import NikGappsConfig
|
|
5
5
|
from niklibrary.helper.F import F
|
|
6
6
|
from NikGapps.helper.Package import Package
|
|
7
|
-
from
|
|
7
|
+
from niklibrary.compression.Modes import Modes
|
|
8
8
|
from NikGapps.helper.compression.CompOps import CompOps
|
|
9
9
|
from NikGapps.helper.AppSet import AppSet
|
|
10
10
|
from NikGapps.helper import Config
|
|
11
11
|
from niklibrary.helper.P import P
|
|
12
12
|
from niklibrary.helper.T import T
|
|
13
|
-
from
|
|
13
|
+
from niklibrary.helper.SystemStat import SystemStat
|
|
14
14
|
from NikGapps.helper.Args import Args
|
|
15
15
|
from niklibrary.git.GitOp import GitOp
|
|
16
16
|
from niklibrary.git.GitlabManager import GitLabManager
|
NikGapps/copy_repos.py
CHANGED
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
from dotenv import load_dotenv
|
|
3
3
|
from NikGapps.helper.Args import Args
|
|
4
4
|
from NikGapps.helper import Config
|
|
5
|
-
from
|
|
5
|
+
from niklibrary.helper.SystemStat import SystemStat
|
|
6
6
|
from niklibrary.git.GitlabManager import GitLabManager
|
|
7
7
|
|
|
8
8
|
|
NikGapps/helper/Assets.py
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
from pathlib import Path
|
|
2
2
|
from importlib import resources
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from niklibrary.helper.Assets import Assets as A
|
|
5
5
|
from niklibrary.helper.F import F
|
|
6
|
-
|
|
7
|
-
from niklibrary.helper.Statics import Statics
|
|
8
6
|
import os.path
|
|
9
|
-
import platform
|
|
10
7
|
|
|
11
8
|
from niklibrary.json.Json import Json
|
|
12
9
|
|
|
@@ -24,30 +21,17 @@ class Assets:
|
|
|
24
21
|
assets_folder = str(folders)
|
|
25
22
|
break
|
|
26
23
|
cwd = assets_folder + os.path.sep
|
|
27
|
-
system_name =
|
|
24
|
+
system_name = A.system_name
|
|
28
25
|
apksigner_path = A.get("apksigner.jar")
|
|
29
26
|
apktool_path = A.get("apktool_2.10.0.jar")
|
|
30
27
|
key_path = A.get("cert.pk8")
|
|
31
28
|
cert_path = A.get("cert.x509.pem")
|
|
32
29
|
private_key_pem = A.get("private_key.pem")
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
adb_path = os.path.join(A.assets_folder, 'bin', system_name, 'adb.exe')
|
|
36
|
-
elif system_name == "Linux":
|
|
37
|
-
aapt_path = os.path.join(A.assets_folder, 'bin', system_name, 'aapt2')
|
|
38
|
-
adb_path = "adb"
|
|
39
|
-
elif system_name == "Darwin":
|
|
40
|
-
aapt_path = os.path.join(A.assets_folder, 'bin', system_name, 'aapt2')
|
|
41
|
-
if not F.file_exists(aapt_path):
|
|
42
|
-
aapt_path = Statics.find_latest_aapt()
|
|
43
|
-
adb_path = "adb"
|
|
44
|
-
else:
|
|
45
|
-
aapt_path = "adb"
|
|
46
|
-
adb_path = "aapt2"
|
|
30
|
+
aapt_path = A.aapt_path
|
|
31
|
+
adb_path = A.adb_path
|
|
47
32
|
addon_path = cwd + "addon.sh"
|
|
48
33
|
header_path = cwd + "header.sh"
|
|
49
34
|
functions_path = cwd + "functions.sh"
|
|
50
|
-
gofile_path = cwd + "gofile.sh"
|
|
51
35
|
busybox = A.get("busybox")
|
|
52
36
|
file_sizes_path = cwd + "file_size.txt"
|
|
53
37
|
mount_path = cwd + "mount.sh"
|
NikGapps/helper/Package.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from niklibrary.helper.F import F
|
|
2
2
|
from niklibrary.helper.Statics import Statics
|
|
3
3
|
from NikGapps.helper.Package import Package
|
|
4
|
-
from .Modes import Modes
|
|
4
|
+
from niklibrary.compression.Modes import Modes
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
class CompOps:
|
|
@@ -10,10 +10,10 @@ class CompOps:
|
|
|
10
10
|
def get_compression_obj(file_name, compression_mode=Modes.ZIP):
|
|
11
11
|
match compression_mode:
|
|
12
12
|
case Modes.TAR_XZ:
|
|
13
|
-
from .Tar import Tar
|
|
13
|
+
from niklibrary.compression.Tar import Tar
|
|
14
14
|
return Tar(file_name)
|
|
15
15
|
case _:
|
|
16
|
-
from .Zip import Zip
|
|
16
|
+
from niklibrary.compression.Zip import Zip
|
|
17
17
|
return Zip(file_name)
|
|
18
18
|
|
|
19
19
|
@staticmethod
|
|
@@ -6,8 +6,8 @@ from multiprocessing import cpu_count
|
|
|
6
6
|
from threading import Lock
|
|
7
7
|
|
|
8
8
|
from .CompOps import CompOps
|
|
9
|
-
from .Modes import Modes
|
|
10
|
-
from .Zip import Zip
|
|
9
|
+
from niklibrary.compression.Modes import Modes
|
|
10
|
+
from niklibrary.compression.Zip import Zip
|
|
11
11
|
from .. import Config
|
|
12
12
|
from ..Assets import Assets
|
|
13
13
|
from niklibrary.helper.Cmd import Cmd
|
|
@@ -48,6 +48,8 @@ class Library:
|
|
|
48
48
|
r.add(String('config_defaultDndAccessPackages', 'com.google.android.gms:com.google.android.apps.wellbeing',
|
|
49
49
|
comment='Colon separated list of package names that should be granted DND access.'))
|
|
50
50
|
r.add(StringArray('config_packagesExemptFromSuspension', ['com.google.android.apps.wellbeing']))
|
|
51
|
+
r.add(StringArray('config_quickSettingsAutoAdd', ['wind_down_first_time_setup:custom(com.google.android.apps.wellbeing/.screen.ui.GrayscaleTileService)',
|
|
52
|
+
'focus_mode_first_time_setup:custom(com.google.android.apps.wellbeing/.focusmode.quicksettings.FocusModeTileService)']))
|
|
51
53
|
return r
|
|
52
54
|
|
|
53
55
|
@staticmethod
|
|
@@ -82,6 +84,10 @@ class Library:
|
|
|
82
84
|
r.add(String('platform_number_verification_package', 'com.google.android.gms'))
|
|
83
85
|
r.add(String('config_defaultQrCodeComponent',
|
|
84
86
|
'com.google.android.gms/.mlkit.barcode.ui.PlatformBarcodeScanningActivityProxy'))
|
|
87
|
+
r.add(String('config_defaultCredentialManagerHybridService', 'com.google.android.gms/.auth.api.credentials.credman.service.RemoteService'))
|
|
88
|
+
r.add(String('config_remoteCopyPackage', 'com.google.android.gms/.nearby.sharing.RemoteCopyShareSheetActivity'))
|
|
89
|
+
r.add(String('config_systemCallStreaming', 'com.google.android.gms'))
|
|
90
|
+
r.add(String('config_oemCredentialManagerDialogComponent', 'com.google.android.gms/.identitycredentials.ui.CredentialChooserActivity'))
|
|
85
91
|
r.add(Bool('config_enableAutoPowerModes', True))
|
|
86
92
|
r.add(Bool('config_enableNetworkLocationOverlay', True))
|
|
87
93
|
r.add(Bool('config_enableFusedLocationOverlay', True))
|
|
@@ -460,3 +466,25 @@ class Library:
|
|
|
460
466
|
r.add(String('config_defaultWallpaperEffectsGenerationService',
|
|
461
467
|
'com.google.android.as/com.google.android.apps.miphone.aiai.app.wallpapereffects.AiAiWallpaperEffectsGenerationService'))
|
|
462
468
|
return r
|
|
469
|
+
|
|
470
|
+
@staticmethod
|
|
471
|
+
def get_google_files_resources():
|
|
472
|
+
r = Resources()
|
|
473
|
+
r.add(String('config_systemFilePicker', 'com.google.android.apps.nbu.files'))
|
|
474
|
+
r.add(String('config_sceenshotWorkProfileFilesApp', 'com.google.android.apps.nbu.files/com.google.android.apps.nbu.files.home.HomeActivity'))
|
|
475
|
+
return r
|
|
476
|
+
|
|
477
|
+
@staticmethod
|
|
478
|
+
def get_google_wallpaper_resources():
|
|
479
|
+
r = Resources()
|
|
480
|
+
r.add(String('config_wallpaper_picker_package', 'com.google.android.apps.wallpaper'))
|
|
481
|
+
r.add(String('config_wallpaperCropperPackage', 'com.google.android.apps.wallpaper'))
|
|
482
|
+
r.add(String('config_wallpaper_picker_class', 'com.google.android.apps.wallpaper.picker.CategoryPickerActivity'))
|
|
483
|
+
r.add(String('config_styles_and_wallpaper_picker_class', 'com.android.customization.picker.CustomizationPickerActivity'))
|
|
484
|
+
return r
|
|
485
|
+
|
|
486
|
+
@staticmethod
|
|
487
|
+
def get_google_partner_setup_resources():
|
|
488
|
+
r = Resources()
|
|
489
|
+
r.add(String('config_deviceProvisioningPackage', 'com.google.android.apps.work.oobconfig'))
|
|
490
|
+
return r
|
NikGapps/main.py
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
from NikGapps.build.Release import Release
|
|
3
3
|
from NikGapps.helper.Args import Args
|
|
4
4
|
from NikGapps.helper import Config
|
|
5
|
-
from
|
|
5
|
+
from niklibrary.helper.SystemStat import SystemStat
|
|
6
6
|
from niklibrary.helper.T import T
|
|
7
|
-
from
|
|
7
|
+
from niklibrary.compression.Modes import Modes
|
|
8
8
|
from niklibrary.git.GitOp import GitOp
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
NikGapps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
NikGapps/build_config.py,sha256=
|
|
3
|
-
NikGapps/cache.py,sha256=
|
|
2
|
+
NikGapps/build_config.py,sha256=QVWmRLUIv1US8OWeBwwiAHLTBu6heMF1aFezsud8Fxw,3193
|
|
3
|
+
NikGapps/cache.py,sha256=lQTX3-JZOCWhgsiaklKRLSy46FKX9WwQ49dyrLnSQTk,4057
|
|
4
4
|
NikGapps/config_upload.py,sha256=0HE7txm73XXxat_cR0JDXWtQUmg1IYK_SktwJS6N34s,652
|
|
5
|
-
NikGapps/copy_repos.py,sha256=
|
|
6
|
-
NikGapps/main.py,sha256=
|
|
5
|
+
NikGapps/copy_repos.py,sha256=GLaMg2VwkI2hpfzo-O4BNBK4WJIJrLY8cb6UWJaRUxY,1376
|
|
6
|
+
NikGapps/main.py,sha256=Uv0HXy59-cuKM3Y33YGIA7URYIlP32SJ9Mq-P7uorNw,2590
|
|
7
7
|
NikGapps/overlay_control.py,sha256=3BVA8v5JeaFPqKbnjbrDE9qyxY12YTYAoH15r1thE-w,3097
|
|
8
8
|
NikGapps/test.py,sha256=M6fpDBtOpwHgR9bjAEhhjgGtAN9UuLEKZSU0HFX-xdE,84
|
|
9
9
|
NikGapps/build/Build.py,sha256=_-gEQD2vkci-dQOmiE-SCULiAGQ-LkyKWXhvCP61884,7621
|
|
10
|
-
NikGapps/build/NikGappsManager.py,sha256=
|
|
10
|
+
NikGapps/build/NikGappsManager.py,sha256=jjaVwmWAw8prDCh3f3EVwjTqOVfY0AvP3gy0pvWeIiE,21047
|
|
11
11
|
NikGapps/build/NikGappsOverlays.py,sha256=bbAIuIeE7HICdXRNeZJrvuW58_tUuDH9Du_1k6QPkxg,569
|
|
12
12
|
NikGapps/build/PackageConstants.py,sha256=-vmkiAWXoD5Ba1lmqd71ueEkivY7ne0zXSU3dzCfYLc,15847
|
|
13
|
-
NikGapps/build/Release.py,sha256=
|
|
13
|
+
NikGapps/build/Release.py,sha256=ww2ol4v6ZbL31EG8T3X0HzWtqWcZZKz3JYr93kVRZ5M,4834
|
|
14
14
|
NikGapps/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
NikGapps/config/NikGappsConfig.py,sha256=7qqeKyWm-2GO39Z8vSOI9TqEd22u0QHLetu2urQxpMw,20318
|
|
16
16
|
NikGapps/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
NikGapps/helper/AppSet.py,sha256=vEIwk7NX1LQt71UJ3naEdsekmB_Ea0v8j0CQJkrSTEU,352
|
|
18
18
|
NikGapps/helper/Args.py,sha256=r1KIKs1x9DbIPwqBPmfIb3BBD5PvclvUDIv3D-fvy2A,4338
|
|
19
|
-
NikGapps/helper/Assets.py,sha256
|
|
20
|
-
NikGapps/helper/B64.py,sha256=WFtnOa1lNWvCQH_tjslRONZY8uAR6CwDm2-JZVn3vkM,939
|
|
19
|
+
NikGapps/helper/Assets.py,sha256=cIM38x_rLaxpAx_bOh6a-tqZy2ZoX25I2tdpL56srGE,2292
|
|
21
20
|
NikGapps/helper/Config.py,sha256=iCTMt5Zd3g3Rq0Y14u4i5e2-hCv9SKcSl4xMJ1KhYJE,2606
|
|
22
21
|
NikGapps/helper/ConfigObj.py,sha256=ep9--o1SPgGXkElrjkf7hjF96KGSrmcQ9oGCpicN7D4,462
|
|
23
|
-
NikGapps/helper/Package.py,sha256=
|
|
24
|
-
NikGapps/helper/SystemStat.py,sha256=zu75Z_pPskE7VOtnhk0_YLugGysmY0vE1_AaL66J8KY,4108
|
|
25
|
-
NikGapps/helper/XmlOp.py,sha256=ZcaO6JSriNDiOvom6gs6XwucnFInjIXaigUiehgVpQY,1632
|
|
22
|
+
NikGapps/helper/Package.py,sha256=P8BU3r_5t_6-Qs0WoTAt0rB64oVzqAE-NERItwYW1X4,9182
|
|
26
23
|
NikGapps/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
24
|
NikGapps/helper/assets/addon.sh,sha256=qXwZ7GQVnOrkSNRcJTKycKRKkUa8kRA_iDwsKVDMHwY,9424
|
|
28
|
-
NikGapps/helper/assets/appsets.json,sha256=
|
|
25
|
+
NikGapps/helper/assets/appsets.json,sha256=oIxqDUAZda7eOT9bloFRVpX2nHQ1klfF1YEPDOUFJh0,7070
|
|
29
26
|
NikGapps/helper/assets/changelogs.yaml,sha256=J6TKXUre04OTOLdX3ks7AUkDUPz8wBcpQEweGGIX8HM,47787
|
|
30
27
|
NikGapps/helper/assets/config_versions.json,sha256=T7fJFW5uYUbiZphw7VP89T4F1WKK6EzG7q_33M8zrJA,102
|
|
31
28
|
NikGapps/helper/assets/customize.sh,sha256=bfYUgf1vd7GGUix4CPIhzn2eFN-DJh67IVIY6eMIrGo,10242
|
|
@@ -40,33 +37,26 @@ NikGapps/helper/assets/mount.sh,sha256=G_rAktQyrUQJpQlCpihbCwWrDCJ71zNEZJ3ZCARA7
|
|
|
40
37
|
NikGapps/helper/assets/mtg_mount.sh,sha256=M6oYs7aLmMRBJbIq8ANmHxGrTIf7Jxe0GLsPq3SdmJ0,2697
|
|
41
38
|
NikGapps/helper/assets/nikgapps.config,sha256=807lgmt0MhX2hx18ZgM7idj5ZwCgyHkKJ4VtSKOD3ew,1575
|
|
42
39
|
NikGapps/helper/assets/nikgapps_functions.sh,sha256=SXzJEPTwYdhqPqgSAUx9Fa4UNPWSbNHVuUI31TGFAh8,57645
|
|
43
|
-
NikGapps/helper/assets/packages.json,sha256=
|
|
40
|
+
NikGapps/helper/assets/packages.json,sha256=HBvfNR8mXJyJ4hDI8EKbV5-eGyUlpO9LeWlujuPRjTs,17269
|
|
44
41
|
NikGapps/helper/assets/uninstaller.sh,sha256=Lob89FNVfpHFkdzUJFDwVQwlnc7WB_U-U28Y4fZgycE,870
|
|
45
42
|
NikGapps/helper/assets/unmount.sh,sha256=L8Lq7ZVfwazXaZp5Jkuce2pCGJCLZh57uj_BzFSDb-c,1107
|
|
46
|
-
NikGapps/helper/compression/CompOps.py,sha256=
|
|
47
|
-
NikGapps/helper/compression/Export.py,sha256=
|
|
48
|
-
NikGapps/helper/compression/Modes.py,sha256=ifHezKw2uiBgmY33_7es_ox-WBHENYxdRB11jwVLOvU,71
|
|
49
|
-
NikGapps/helper/compression/Tar.py,sha256=E16mCRHU74a6-OxlTRGjWEO1-YdexALThGSs3kOaaPw,795
|
|
50
|
-
NikGapps/helper/compression/Zip.py,sha256=thsUeJ2it3h05EYtNN_g8ukKeBveY9pB2VlkRsmdAWQ,3777
|
|
51
|
-
NikGapps/helper/compression/Zsh.py,sha256=-bzuWvNZ7Ei2Mu2Rc49u2lIrfGubm-mF2BtnxXzukmE,497
|
|
43
|
+
NikGapps/helper/compression/CompOps.py,sha256=RjYxtNh98xCds58oWxX8UGbe9g-WUYCriTRupWZqMZc,1823
|
|
44
|
+
NikGapps/helper/compression/Export.py,sha256=lzpWsiLa9LoyYa9HVX2BnP_A1-yOzKjkVPT5as4njmw,9350
|
|
52
45
|
NikGapps/helper/compression/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
46
|
NikGapps/helper/git/TestGit.py,sha256=-RHGYO4cY9tQhBCraU6m2gOUUVAPtbfzQwkJ4oQ9htg,2121
|
|
54
47
|
NikGapps/helper/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
48
|
NikGapps/helper/overlay/ApkMetaInfo.py,sha256=l8Au74MPXWqllzooNGF8AIn-JTWiwxIuYAnu1nwq-e0,1567
|
|
56
49
|
NikGapps/helper/overlay/Bool.py,sha256=1VfI30ytFvT5eTWHwRCePE2hVRb_X-lFYPhAxS6xVCM,372
|
|
57
|
-
NikGapps/helper/overlay/Library.py,sha256=
|
|
50
|
+
NikGapps/helper/overlay/Library.py,sha256=KTVoNKuklcClouz1yDtLSBaLt9dGfT7-ys3e8aCgPHY,43671
|
|
58
51
|
NikGapps/helper/overlay/Manifest.py,sha256=johNJ7iejBTBubTPUdsJLqr4NlxC6USaHn1NZzDzaHw,2450
|
|
59
52
|
NikGapps/helper/overlay/Overlay.py,sha256=CHPsviezeE8sRuPBtWwdTvrotGw1159mBYnOPM3K53s,910
|
|
60
53
|
NikGapps/helper/overlay/Resources.py,sha256=bKWJEF2avl3j2ud390HQq9fRMMA8GKh9-KABdvim-Wg,1458
|
|
61
54
|
NikGapps/helper/overlay/String.py,sha256=nyCAD_dNfwHlOgj4zuKGGz71n20CLEKyZCgrVAmiX2I,469
|
|
62
55
|
NikGapps/helper/overlay/StringArray.py,sha256=DYPEAIdpicaJ3C08IYW6Q2tnTH6gUFXmu3KhQlHGY5g,563
|
|
63
56
|
NikGapps/helper/overlay/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
64
|
-
NikGapps/
|
|
65
|
-
NikGapps/
|
|
66
|
-
NikGapps/
|
|
67
|
-
NikGapps-3.
|
|
68
|
-
NikGapps-3.
|
|
69
|
-
NikGapps-3.
|
|
70
|
-
NikGapps-3.30.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
|
|
71
|
-
NikGapps-3.30.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
|
|
72
|
-
NikGapps-3.30.dist-info/RECORD,,
|
|
57
|
+
NikGapps-3.32.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
58
|
+
NikGapps-3.32.dist-info/METADATA,sha256=VS983Uc66TIieWjuyVAd-DgE8mqGPhmMlnPUeO6HMkY,4178
|
|
59
|
+
NikGapps-3.32.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
60
|
+
NikGapps-3.32.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
|
|
61
|
+
NikGapps-3.32.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
|
|
62
|
+
NikGapps-3.32.dist-info/RECORD,,
|
NikGapps/helper/B64.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import base64
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class B64:
|
|
5
|
-
|
|
6
|
-
@staticmethod
|
|
7
|
-
def b64e(s):
|
|
8
|
-
print("Encoding: " + s)
|
|
9
|
-
return base64.b64encode(s.encode()).decode()
|
|
10
|
-
|
|
11
|
-
@staticmethod
|
|
12
|
-
def b64d(s):
|
|
13
|
-
try:
|
|
14
|
-
print("Decoding: " + s)
|
|
15
|
-
val = base64.b64decode(s).decode()
|
|
16
|
-
except Exception as e:
|
|
17
|
-
print(str(e))
|
|
18
|
-
return s
|
|
19
|
-
return val
|
|
20
|
-
|
|
21
|
-
@staticmethod
|
|
22
|
-
def is_base64(sb):
|
|
23
|
-
try:
|
|
24
|
-
if isinstance(sb, str):
|
|
25
|
-
# If there's any unicode here, an exception will be thrown and the function will return false
|
|
26
|
-
sb_bytes = bytes(sb, 'ascii')
|
|
27
|
-
elif isinstance(sb, bytes):
|
|
28
|
-
sb_bytes = sb
|
|
29
|
-
else:
|
|
30
|
-
raise ValueError("Argument must be string or bytes")
|
|
31
|
-
return base64.b64encode(base64.b64decode(sb_bytes)) == sb_bytes
|
|
32
|
-
except Exception as e:
|
|
33
|
-
print(str(e))
|
|
34
|
-
return False
|
NikGapps/helper/SystemStat.py
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import platform
|
|
3
|
-
import shutil
|
|
4
|
-
import subprocess
|
|
5
|
-
from multiprocessing import cpu_count
|
|
6
|
-
|
|
7
|
-
import psutil
|
|
8
|
-
|
|
9
|
-
from . import Config
|
|
10
|
-
from .Assets import Assets
|
|
11
|
-
from niklibrary.helper.P import P
|
|
12
|
-
from niklibrary.helper.T import T
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class SystemStat:
|
|
16
|
-
|
|
17
|
-
@staticmethod
|
|
18
|
-
def run_command(command):
|
|
19
|
-
result = None
|
|
20
|
-
try:
|
|
21
|
-
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
22
|
-
# Check both stdout and stderr for output, as some commands might output version info to stderr
|
|
23
|
-
output = result.stdout.strip() if result.stdout.strip() else result.stderr.strip()
|
|
24
|
-
return output
|
|
25
|
-
except subprocess.CalledProcessError as e:
|
|
26
|
-
# If the command fails (e.g., command not found), return the error message from stderr or a custom message
|
|
27
|
-
error_message = result.stderr.strip() if result.stderr.strip() else "Command failed without error output"
|
|
28
|
-
return f"Failed to execute {command}: {e} - {error_message}"
|
|
29
|
-
except Exception as e:
|
|
30
|
-
return f"Failed to execute {command}: {e}"
|
|
31
|
-
|
|
32
|
-
@staticmethod
|
|
33
|
-
def display_time(location, time_str):
|
|
34
|
-
if "AM" in time_str:
|
|
35
|
-
P.yellow(f"{location}: {time_str}")
|
|
36
|
-
else:
|
|
37
|
-
P.green(f"{location}: {time_str}")
|
|
38
|
-
|
|
39
|
-
@staticmethod
|
|
40
|
-
def get_disk_usage(path="/"):
|
|
41
|
-
total, used, free = shutil.disk_usage(path)
|
|
42
|
-
return total, used, free
|
|
43
|
-
|
|
44
|
-
@staticmethod
|
|
45
|
-
def print_disk_usage():
|
|
46
|
-
os_type = platform.system()
|
|
47
|
-
|
|
48
|
-
if os_type == "Windows":
|
|
49
|
-
# On Windows, you can specify a drive letter, e.g., "C:\\"
|
|
50
|
-
path = "C:\\"
|
|
51
|
-
total, used, free = SystemStat.get_disk_usage(path)
|
|
52
|
-
elif os_type == "Linux" or os_type == "Darwin":
|
|
53
|
-
# On Linux and macOS, use the root path
|
|
54
|
-
path = "/"
|
|
55
|
-
total, used, free = SystemStat.get_disk_usage(path)
|
|
56
|
-
else:
|
|
57
|
-
print(f"Unsupported OS: {os_type}")
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
# Convert bytes to gigabytes
|
|
61
|
-
total_gb = total / (2 ** 30)
|
|
62
|
-
used_gb = used / (2 ** 30)
|
|
63
|
-
free_gb = free / (2 ** 30)
|
|
64
|
-
|
|
65
|
-
print(f"Operating System: {os_type}")
|
|
66
|
-
print(f"Disk Usage for {path}")
|
|
67
|
-
print(f"Total: {total_gb:.2f} GiB")
|
|
68
|
-
print(f"Used: {used_gb:.2f} GiB")
|
|
69
|
-
print(f"Free: {free_gb:.2f} GiB")
|
|
70
|
-
|
|
71
|
-
@staticmethod
|
|
72
|
-
def show_stats():
|
|
73
|
-
# Memory and CPU info
|
|
74
|
-
mem = psutil.virtual_memory()
|
|
75
|
-
total_ram_in_bytes = mem.total
|
|
76
|
-
total_ram_in_gb = round(mem.total / 1073741824, 2)
|
|
77
|
-
P.green("---------------------------------------")
|
|
78
|
-
P.green(f"Ram: {total_ram_in_bytes} bytes, {total_ram_in_gb} Gb")
|
|
79
|
-
P.green(f"# of CPUs: {os.cpu_count()}({cpu_count()})")
|
|
80
|
-
P.green("---------------------------------------")
|
|
81
|
-
SystemStat.print_disk_usage()
|
|
82
|
-
# Versions of Java, ADB, and AAPT
|
|
83
|
-
# java_version = SystemStat.run_command(["java", "-version"])
|
|
84
|
-
# P.green(f"Java version: {java_version}")
|
|
85
|
-
# P.green("---------------------------------------")
|
|
86
|
-
if (not Config.ENVIRONMENT_TYPE == "production") and Config.ENVIRONMENT_TYPE == "dev":
|
|
87
|
-
adb_version = SystemStat.run_command([f"{Assets.adb_path}", "version"])
|
|
88
|
-
P.green("---------------------------------------")
|
|
89
|
-
P.green(f"ADB version: {adb_version}")
|
|
90
|
-
P.green("---------------------------------------")
|
|
91
|
-
aapt_version = SystemStat.run_command([f"{Assets.aapt_path}", "version"])
|
|
92
|
-
P.green(f"AAPT version: {aapt_version}")
|
|
93
|
-
P.green("---------------------------------------")
|
|
94
|
-
t = T()
|
|
95
|
-
local_time = t.get_local_date_time("%a, %m/%d/%Y, %I:%M:%S %p")
|
|
96
|
-
ny_time = t.get_new_york_date_time("%a, %m/%d/%Y, %I:%M:%S %p")
|
|
97
|
-
london_time = t.get_london_date_time().strftime("%a, %m/%d/%Y, %I:%M:%S %p")
|
|
98
|
-
|
|
99
|
-
SystemStat.display_time("Local", local_time)
|
|
100
|
-
SystemStat.display_time("NY", ny_time)
|
|
101
|
-
SystemStat.display_time("London", london_time)
|
|
102
|
-
P.green("---------------------------------------")
|
|
103
|
-
print(" ")
|
NikGapps/helper/XmlOp.py
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from xml.etree.ElementTree import Element, SubElement, ElementTree, tostring
|
|
2
|
-
import xml.dom.minidom
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class XmlOp:
|
|
6
|
-
def __init__(self, package_name, permissions_list, import_path=None):
|
|
7
|
-
self.root = Element("permissions")
|
|
8
|
-
self.doc = SubElement(self.root, "privapp-permissions", package=package_name)
|
|
9
|
-
for permission in permissions_list:
|
|
10
|
-
SubElement(self.doc, "permission", name=permission)
|
|
11
|
-
XmlOp.indent(self.root)
|
|
12
|
-
if import_path is not None:
|
|
13
|
-
with open(import_path, 'wb') as f:
|
|
14
|
-
self.tree = ElementTree(self.root)
|
|
15
|
-
self.tree.write(f)
|
|
16
|
-
|
|
17
|
-
@staticmethod
|
|
18
|
-
def indent(elem, level=0):
|
|
19
|
-
i = "\n" + level * " "
|
|
20
|
-
if len(elem):
|
|
21
|
-
if not elem.text or not elem.text.strip():
|
|
22
|
-
elem.text = i + " "
|
|
23
|
-
if not elem.tail or not elem.tail.strip():
|
|
24
|
-
elem.tail = i
|
|
25
|
-
for elem in elem:
|
|
26
|
-
XmlOp.indent(elem, level + 1)
|
|
27
|
-
if not elem.tail or not elem.tail.strip():
|
|
28
|
-
elem.tail = i
|
|
29
|
-
else:
|
|
30
|
-
if level and (not elem.tail or not elem.tail.strip()):
|
|
31
|
-
elem.tail = i
|
|
32
|
-
|
|
33
|
-
def to_string(self):
|
|
34
|
-
xml_str = tostring(self.root, 'utf-8')
|
|
35
|
-
parsed_str = xml.dom.minidom.parseString(xml_str)
|
|
36
|
-
pretty_str = parsed_str.toprettyxml(encoding="utf-8").decode("utf-8")
|
|
37
|
-
pretty_str = "\n".join(
|
|
38
|
-
line for line in pretty_str.splitlines() if line.strip() and not line.__contains__("utf-8"))
|
|
39
|
-
pretty_str = pretty_str.replace("\r\n", "\n") # Ensure LF line endings
|
|
40
|
-
return pretty_str
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import tarfile
|
|
2
|
-
from io import BytesIO
|
|
3
|
-
from niklibrary.helper.F import F
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class Tar:
|
|
7
|
-
|
|
8
|
-
def __init__(self, file_name, folder_to_compress=None):
|
|
9
|
-
if folder_to_compress is None:
|
|
10
|
-
self.folder = folder_to_compress
|
|
11
|
-
self.tarfile = str(file_name) if str(file_name).endswith("tar.xz") else str(file_name) + ".tar.xz"
|
|
12
|
-
F.create_file_dir(self.tarfile)
|
|
13
|
-
self.tar = tarfile.open(self.tarfile, "w:xz")
|
|
14
|
-
|
|
15
|
-
def add_file(self, file_to_add, zippath):
|
|
16
|
-
self.tar.add(file_to_add, arcname=zippath)
|
|
17
|
-
|
|
18
|
-
def add_string(self, text, file_name):
|
|
19
|
-
data = text.encode('utf-8')
|
|
20
|
-
info = tarfile.TarInfo(name=file_name)
|
|
21
|
-
info.size = len(data)
|
|
22
|
-
self.tar.addfile(tarinfo=info, fileobj=BytesIO(data))
|
|
23
|
-
|
|
24
|
-
def close(self):
|
|
25
|
-
self.tar.close()
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import zipfile
|
|
3
|
-
from cryptography.hazmat.primitives import hashes
|
|
4
|
-
from cryptography.hazmat.primitives.asymmetric import padding
|
|
5
|
-
from cryptography.hazmat.primitives.serialization import load_pem_private_key
|
|
6
|
-
from cryptography.hazmat.backends import default_backend
|
|
7
|
-
from base64 import b64encode
|
|
8
|
-
import hashlib
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Zip:
|
|
12
|
-
RSAFileName = "META-INF/Nik.RSA"
|
|
13
|
-
SFFileName = "META-INF/Nik.SF"
|
|
14
|
-
ManifestFileName = "META-INF/MANIFEST.MF"
|
|
15
|
-
DigitalMessage = "Author:- Nikhil Menghani (Nikhil @ Xda-developers.com)"
|
|
16
|
-
SignatureVersion = "1.0"
|
|
17
|
-
ManifestVersion = "1.0"
|
|
18
|
-
CreatedBy = "Nikhil @ XDA"
|
|
19
|
-
|
|
20
|
-
def __init__(self, name, sign=False, private_key_path=None, comment=DigitalMessage):
|
|
21
|
-
directory = os.path.dirname(name)
|
|
22
|
-
if not os.path.exists(directory):
|
|
23
|
-
os.makedirs(directory, exist_ok=True)
|
|
24
|
-
|
|
25
|
-
self.zipObj = zipfile.ZipFile(name, 'w', compression=zipfile.ZIP_DEFLATED)
|
|
26
|
-
self.comment = comment.encode()
|
|
27
|
-
self.sign = sign
|
|
28
|
-
if self.sign:
|
|
29
|
-
if private_key_path is None:
|
|
30
|
-
raise ValueError("Private key path must be provided for signing.")
|
|
31
|
-
self.private_key = Zip.load_private_key(private_key_path)
|
|
32
|
-
self.signatures = {}
|
|
33
|
-
self.manifest_digests = {}
|
|
34
|
-
|
|
35
|
-
@staticmethod
|
|
36
|
-
def load_private_key(file_path):
|
|
37
|
-
with open(file_path, 'rb') as key_file:
|
|
38
|
-
return load_pem_private_key(
|
|
39
|
-
key_file.read(),
|
|
40
|
-
password=None,
|
|
41
|
-
backend=default_backend()
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
def add_file(self, filename, zippath=None):
|
|
45
|
-
if zippath is None:
|
|
46
|
-
zippath = filename
|
|
47
|
-
self.zipObj.write(filename, zippath)
|
|
48
|
-
if self.sign:
|
|
49
|
-
self.sign_content(filename, zippath)
|
|
50
|
-
|
|
51
|
-
def add_string(self, text, zippath):
|
|
52
|
-
text = text.replace('\r\n', '\n')
|
|
53
|
-
self.zipObj.writestr(zippath, text)
|
|
54
|
-
if self.sign:
|
|
55
|
-
self.sign_content_string(text, zippath)
|
|
56
|
-
|
|
57
|
-
def sign_content(self, filename, zippath):
|
|
58
|
-
with open(filename, 'rb') as f:
|
|
59
|
-
content = f.read()
|
|
60
|
-
self.process_signature(content, zippath)
|
|
61
|
-
|
|
62
|
-
def sign_content_string(self, text, zippath):
|
|
63
|
-
content = text.encode()
|
|
64
|
-
self.process_signature(content, zippath)
|
|
65
|
-
|
|
66
|
-
def process_signature(self, content, zippath):
|
|
67
|
-
digest = hashlib.sha256(content).digest()
|
|
68
|
-
self.manifest_digests[zippath] = b64encode(digest).decode('utf-8')
|
|
69
|
-
signature = self.private_key.sign(
|
|
70
|
-
digest,
|
|
71
|
-
padding.PSS(
|
|
72
|
-
mgf=padding.MGF1(hashes.SHA256()),
|
|
73
|
-
salt_length=padding.PSS.MAX_LENGTH
|
|
74
|
-
),
|
|
75
|
-
hashes.SHA256()
|
|
76
|
-
)
|
|
77
|
-
self.signatures[zippath] = b64encode(signature).decode('utf-8')
|
|
78
|
-
# self.zipObj.writestr(zippath + '.sig', signature)
|
|
79
|
-
|
|
80
|
-
def generate_manifest_and_signature_files(self):
|
|
81
|
-
manifest_content = f"Manifest-Version: {self.ManifestVersion}\nCreated-By: {self.CreatedBy}\n"
|
|
82
|
-
for filename, digest in self.manifest_digests.items():
|
|
83
|
-
manifest_content += f"Name: {filename}\nSHA-256-Digest: {digest}\n"
|
|
84
|
-
self.zipObj.writestr(self.ManifestFileName, manifest_content)
|
|
85
|
-
|
|
86
|
-
sf_content = f"Signature-Version: {self.SignatureVersion}\nCreated-By: {self.CreatedBy}\n"
|
|
87
|
-
self.zipObj.writestr(self.SFFileName, sf_content)
|
|
88
|
-
|
|
89
|
-
rsa_content = f"Digital-Message: {self.DigitalMessage}\nSignatures:\n"
|
|
90
|
-
for filename, signature in self.signatures.items():
|
|
91
|
-
rsa_content += f"{filename}: {signature}\n"
|
|
92
|
-
self.zipObj.writestr(self.RSAFileName, rsa_content)
|
|
93
|
-
|
|
94
|
-
def close(self):
|
|
95
|
-
if self.sign:
|
|
96
|
-
self.generate_manifest_and_signature_files()
|
|
97
|
-
self.zipObj.comment = self.comment
|
|
98
|
-
self.zipObj.close()
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
from subprocess import call
|
|
3
|
-
|
|
4
|
-
from niklibrary.helper.T import T
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class Zsh:
|
|
8
|
-
|
|
9
|
-
def __init__(self, folder_to_compress, file_name):
|
|
10
|
-
self.folder = folder_to_compress
|
|
11
|
-
self.tarfile = str(file_name) + ".tar.xz"
|
|
12
|
-
|
|
13
|
-
def compress(self):
|
|
14
|
-
time_obj = T()
|
|
15
|
-
call(["tar", "cJfP", self.tarfile, self.folder])
|
|
16
|
-
print(f"zsh tar filesize: {round(Path(self.tarfile).stat().st_size / (1024 * 1024), 2)} MB")
|
|
17
|
-
time_obj.taken("zsh tar filesize")
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import platform
|
|
3
|
-
import time
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
import pexpect
|
|
6
|
-
from niklibrary.helper.F import F
|
|
7
|
-
from niklibrary.helper.P import P
|
|
8
|
-
from niklibrary.helper.Statics import Statics
|
|
9
|
-
from niklibrary.helper.T import T
|
|
10
|
-
from niklibrary.web.TelegramApi import TelegramApi
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class CmdUpload:
|
|
14
|
-
|
|
15
|
-
def __init__(self, android_version, release_type, upload_files, password=None):
|
|
16
|
-
self.android_version_code = Statics.get_android_code(android_version)
|
|
17
|
-
self.upload_files = upload_files
|
|
18
|
-
self.host = "frs.sourceforge.net"
|
|
19
|
-
self.username = "nikhilmenghani"
|
|
20
|
-
self.password = os.environ.get('SF_PWD') if password is None else password
|
|
21
|
-
self.release_dir = Statics.get_sourceforge_release_directory(release_type)
|
|
22
|
-
self.release_date = T.get_london_date_time("%d-%b-%Y")
|
|
23
|
-
self.child = None
|
|
24
|
-
self.successful_connection = False
|
|
25
|
-
if self.password is None or self.password.__eq__(""):
|
|
26
|
-
self.password = ""
|
|
27
|
-
self.sftp = None
|
|
28
|
-
P.red("Password is not set, please set the password in environment variable SF_PWD")
|
|
29
|
-
return
|
|
30
|
-
self.connect_using_pexpect()
|
|
31
|
-
|
|
32
|
-
def expect_password(self):
|
|
33
|
-
self.child.sendline(str(self.password))
|
|
34
|
-
print(f"Expecting Connected to {self.host} or sftp> or Password")
|
|
35
|
-
return self.check_successful_connection()
|
|
36
|
-
|
|
37
|
-
def check_successful_connection(self):
|
|
38
|
-
status = self.child.expect([f"Connected to {self.host}", "sftp> ", "Password"])
|
|
39
|
-
if status == 0 or status == 1:
|
|
40
|
-
print("Connection was successful")
|
|
41
|
-
return True
|
|
42
|
-
return False
|
|
43
|
-
|
|
44
|
-
def connect_using_pexpect(self):
|
|
45
|
-
self.child = pexpect.spawn(f'sftp {self.username}@{self.host}')
|
|
46
|
-
tried_twice = False
|
|
47
|
-
print("Expecting Password")
|
|
48
|
-
while True:
|
|
49
|
-
i = self.child.expect(["Password", "yes/no", pexpect.TIMEOUT, pexpect.EOF], timeout=120)
|
|
50
|
-
if i == 0: # Password
|
|
51
|
-
print("Sending Password")
|
|
52
|
-
self.successful_connection = self.expect_password()
|
|
53
|
-
elif i == 1: # yes/no
|
|
54
|
-
print("sending yes")
|
|
55
|
-
self.child.sendline("yes")
|
|
56
|
-
print("Expecting Password")
|
|
57
|
-
self.child.expect("Password")
|
|
58
|
-
self.successful_connection = self.expect_password()
|
|
59
|
-
elif i == 2 or i == 3: # TIMEOUT or EOF
|
|
60
|
-
if not tried_twice:
|
|
61
|
-
print("Timeout has occurred, let's try one more time")
|
|
62
|
-
# self.child.sendcontrol('c')
|
|
63
|
-
self.close_connection()
|
|
64
|
-
self.child = pexpect.spawn('sftp nikhilmenghani@frs.sourceforge.net')
|
|
65
|
-
tried_twice = True
|
|
66
|
-
else:
|
|
67
|
-
print("Connection failed")
|
|
68
|
-
break
|
|
69
|
-
else: # other cases
|
|
70
|
-
print("Connection failed")
|
|
71
|
-
self.close_connection()
|
|
72
|
-
try:
|
|
73
|
-
self.child.interact()
|
|
74
|
-
except BaseException as e:
|
|
75
|
-
print("Exception while interacting: " + str(e))
|
|
76
|
-
if self.successful_connection or i not in [0, 1, 2, 3]:
|
|
77
|
-
break
|
|
78
|
-
|
|
79
|
-
def navigate_to_directory(self, directory):
|
|
80
|
-
self.child.expect('sftp>')
|
|
81
|
-
self.child.sendline(f'cd {directory}')
|
|
82
|
-
|
|
83
|
-
def create_directory_structure(self, remote_directory):
|
|
84
|
-
# Split the directory path into components
|
|
85
|
-
remote_directory = remote_directory.replace(f"{self.release_dir}/", '')
|
|
86
|
-
directories = remote_directory.split('/')
|
|
87
|
-
# cd to the root directory
|
|
88
|
-
self.navigate_to_directory(self.release_dir)
|
|
89
|
-
# Create each directory in the path separately
|
|
90
|
-
for i in range(len(directories)):
|
|
91
|
-
path = '/'.join(directories[:i + 1])
|
|
92
|
-
print(f"Creating directory {self.release_dir}/{path}")
|
|
93
|
-
self.child.expect('sftp>')
|
|
94
|
-
self.child.sendline(f'mkdir {path}')
|
|
95
|
-
|
|
96
|
-
def get_cd(self, file_type):
|
|
97
|
-
folder_name = "Test"
|
|
98
|
-
match file_type:
|
|
99
|
-
case "gapps":
|
|
100
|
-
folder_name = "NikGapps-" + self.android_version_code
|
|
101
|
-
case "config":
|
|
102
|
-
folder_name = "NikGapps-" + self.android_version_code
|
|
103
|
-
return self.release_dir + "/" + folder_name
|
|
104
|
-
case "addons":
|
|
105
|
-
folder_name = "Addons-" + self.android_version_code
|
|
106
|
-
case "debloater":
|
|
107
|
-
folder_name = "Debloater"
|
|
108
|
-
case _:
|
|
109
|
-
print(file_type)
|
|
110
|
-
print("Upload Dir: " + self.release_dir + "/" + folder_name)
|
|
111
|
-
return self.release_dir + "/" + folder_name + "/" + self.release_date
|
|
112
|
-
|
|
113
|
-
def upload_file(self, file_path, remote_path):
|
|
114
|
-
self.child.sendline("put " + file_path + " " + remote_path)
|
|
115
|
-
self.child.expect("Uploading")
|
|
116
|
-
self.child.expect("100%", timeout=3600)
|
|
117
|
-
self.child.expect("sftp>")
|
|
118
|
-
time.sleep(1)
|
|
119
|
-
|
|
120
|
-
def upload(self, file_name, telegram: TelegramApi = None, remote_directory=None):
|
|
121
|
-
execution_status = False
|
|
122
|
-
download_link = None
|
|
123
|
-
file_size_mb = None
|
|
124
|
-
if self.successful_connection:
|
|
125
|
-
system_name = platform.system()
|
|
126
|
-
file_size_kb = round(F.get_file_size(file_name, "KB"), 2)
|
|
127
|
-
file_size_mb = round(F.get_file_size(file_name), 2)
|
|
128
|
-
if telegram is not None:
|
|
129
|
-
telegram.message(f"- The zip {file_size_mb} MB is uploading...")
|
|
130
|
-
if system_name != "Windows" and self.upload_files:
|
|
131
|
-
t = T()
|
|
132
|
-
file_type = "gapps"
|
|
133
|
-
if os.path.basename(file_name).__contains__("-Addon-"):
|
|
134
|
-
file_type = "addons"
|
|
135
|
-
elif os.path.basename(file_name).__contains__("Debloater"):
|
|
136
|
-
file_type = "debloater"
|
|
137
|
-
|
|
138
|
-
if remote_directory is None:
|
|
139
|
-
remote_directory = self.get_cd(file_type)
|
|
140
|
-
|
|
141
|
-
remote_filename = Path(file_name).name
|
|
142
|
-
self.create_directory_structure(remote_directory)
|
|
143
|
-
self.navigate_to_directory(remote_directory)
|
|
144
|
-
self.upload_file(file_name, remote_filename)
|
|
145
|
-
P.green(f'File uploaded successfully to {remote_directory}/{remote_filename}')
|
|
146
|
-
download_link = Statics.get_download_link(file_name, remote_directory)
|
|
147
|
-
P.magenta("Download Link: " + download_link)
|
|
148
|
-
print("uploading file finished...")
|
|
149
|
-
execution_status = True
|
|
150
|
-
time_taken = t.taken(f"Total time taken to upload file with size {file_size_mb} MB ("
|
|
151
|
-
f"{file_size_kb} Kb)")
|
|
152
|
-
if execution_status:
|
|
153
|
-
if telegram is not None:
|
|
154
|
-
telegram.message(
|
|
155
|
-
f"- The zip {file_size_mb} MB uploaded in {T.format_time(round(time_taken))}\n",
|
|
156
|
-
replace_last_message=True)
|
|
157
|
-
if download_link is not None:
|
|
158
|
-
telegram.message(f"*Note:* Download link should start working in 10 minutes", escape_text=False,
|
|
159
|
-
ur_link={f"Download": f"{download_link}"})
|
|
160
|
-
else:
|
|
161
|
-
P.red("System incompatible or upload disabled or connection failed!")
|
|
162
|
-
else:
|
|
163
|
-
P.red("Connection failed!")
|
|
164
|
-
return execution_status, download_link, file_size_mb
|
|
165
|
-
|
|
166
|
-
def close_connection(self):
|
|
167
|
-
if not str(self.password).__eq__(""):
|
|
168
|
-
self.child.sendline("bye")
|
|
169
|
-
self.child.close()
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import platform
|
|
2
|
-
|
|
3
|
-
from NikGapps.helper.Assets import Assets
|
|
4
|
-
from niklibrary.helper.Cmd import Cmd
|
|
5
|
-
from niklibrary.helper.F import F
|
|
6
|
-
from niklibrary.helper.P import P
|
|
7
|
-
from niklibrary.helper.T import T
|
|
8
|
-
from niklibrary.web.TelegramApi import TelegramApi
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class GoFileUpload:
|
|
12
|
-
|
|
13
|
-
@staticmethod
|
|
14
|
-
def upload_file(file):
|
|
15
|
-
cmd = Cmd()
|
|
16
|
-
command = [f"{Assets.gofile_path}"] + [file]
|
|
17
|
-
output = cmd.execute_cmd(command)
|
|
18
|
-
print("Upload Log: " + str(output))
|
|
19
|
-
for line in output:
|
|
20
|
-
if line.startswith("https://gofile.io/"):
|
|
21
|
-
return line
|
|
22
|
-
return None
|
|
23
|
-
|
|
24
|
-
@staticmethod
|
|
25
|
-
def upload(file_name, telegram: TelegramApi = None):
|
|
26
|
-
system_name = platform.system()
|
|
27
|
-
execution_status = False
|
|
28
|
-
download_link = None
|
|
29
|
-
file_size_mb = None
|
|
30
|
-
if telegram is not None:
|
|
31
|
-
telegram.message("- The zip is uploading...")
|
|
32
|
-
if system_name != "Windows":
|
|
33
|
-
t = T()
|
|
34
|
-
download_link = GoFileUpload.upload_file(file_name)
|
|
35
|
-
P.magenta("Download Link: " + download_link)
|
|
36
|
-
if download_link is None:
|
|
37
|
-
P.red("Upload failed!")
|
|
38
|
-
telegram.message("- Upload failed!")
|
|
39
|
-
return execution_status
|
|
40
|
-
print("uploading file finished...")
|
|
41
|
-
execution_status = True
|
|
42
|
-
file_size_kb = round(F.get_file_size(file_name, "KB"), 2)
|
|
43
|
-
file_size_mb = round(F.get_file_size(file_name), 2)
|
|
44
|
-
time_taken = t.taken(f"Total time taken to upload file with size {file_size_mb} MB ("
|
|
45
|
-
f"{file_size_kb} Kb)")
|
|
46
|
-
if execution_status:
|
|
47
|
-
if telegram is not None:
|
|
48
|
-
telegram.message(
|
|
49
|
-
f"- The zip {file_size_mb} MB uploaded in {str(round(time_taken))} seconds\n",
|
|
50
|
-
replace_last_message=True)
|
|
51
|
-
if download_link is not None:
|
|
52
|
-
telegram.message(f"*Note:* Download link should start working in 10 minutes", escape_text=False,
|
|
53
|
-
ur_link={f"Download": f"{download_link}"})
|
|
54
|
-
else:
|
|
55
|
-
P.red("System incompatible or upload disabled or connection failed!")
|
|
56
|
-
return execution_status, download_link, file_size_mb
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|