NikGapps 3.31__py3-none-any.whl → 3.33__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/helper/Assets.py +4 -20
- NikGapps/helper/assets/appsets.json +6 -0
- NikGapps/helper/assets/packages.json +8 -0
- NikGapps/helper/overlay/Library.py +28 -0
- {NikGapps-3.31.dist-info → NikGapps-3.33.dist-info}/METADATA +14 -15
- {NikGapps-3.31.dist-info → NikGapps-3.33.dist-info}/RECORD +11 -14
- NikGapps/helper/upload/CmdUpload.py +0 -169
- NikGapps/helper/upload/GoFileUpload.py +0 -56
- NikGapps/helper/upload/__init__.py +0 -0
- {NikGapps-3.31.dist-info → NikGapps-3.33.dist-info}/LICENSE +0 -0
- {NikGapps-3.31.dist-info → NikGapps-3.33.dist-info}/WHEEL +0 -0
- {NikGapps-3.31.dist-info → NikGapps-3.33.dist-info}/entry_points.txt +0 -0
- {NikGapps-3.31.dist-info → NikGapps-3.33.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/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"
|
|
@@ -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
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: NikGapps
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.33
|
|
4
4
|
Summary: A short description of your project
|
|
5
5
|
Home-page: https://github.com/nikgapps/project
|
|
6
6
|
Author: Nikhil Menghani
|
|
@@ -10,21 +10,20 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Requires-Python: >=3.12
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
License-File: LICENSE
|
|
13
|
-
Requires-Dist: colorama
|
|
14
|
-
Requires-Dist: pytz
|
|
15
|
-
Requires-Dist: pysftp
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
18
|
-
Requires-Dist:
|
|
19
|
-
Requires-Dist:
|
|
20
|
-
Requires-Dist:
|
|
21
|
-
Requires-Dist:
|
|
22
|
-
Requires-Dist: PyGithub
|
|
23
|
-
Requires-Dist: python-gitlab
|
|
24
|
-
Requires-Dist: cryptography
|
|
13
|
+
Requires-Dist: colorama ~=0.4.6
|
|
14
|
+
Requires-Dist: pytz ~=2024.2
|
|
15
|
+
Requires-Dist: pysftp ~=0.2.9
|
|
16
|
+
Requires-Dist: requests ~=2.32.3
|
|
17
|
+
Requires-Dist: PyYAML ~=6.0.2
|
|
18
|
+
Requires-Dist: psutil ~=6.0.0
|
|
19
|
+
Requires-Dist: setuptools ~=75.1.0
|
|
20
|
+
Requires-Dist: pexpect ~=4.9.0
|
|
21
|
+
Requires-Dist: GitPython ~=3.1.43
|
|
22
|
+
Requires-Dist: PyGithub ~=2.4.0
|
|
23
|
+
Requires-Dist: python-gitlab ~=4.12.2
|
|
24
|
+
Requires-Dist: cryptography ~=43.0.1
|
|
25
25
|
Requires-Dist: python-dotenv ~=1.0.1
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist: niklibrary >=0.17
|
|
26
|
+
Requires-Dist: niklibrary ~=0.21
|
|
28
27
|
|
|
29
28
|

|
|
30
29
|
|
|
@@ -7,7 +7,7 @@ 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
13
|
NikGapps/build/Release.py,sha256=ww2ol4v6ZbL31EG8T3X0HzWtqWcZZKz3JYr93kVRZ5M,4834
|
|
@@ -16,13 +16,13 @@ NikGapps/config/NikGappsConfig.py,sha256=7qqeKyWm-2GO39Z8vSOI9TqEd22u0QHLetu2urQ
|
|
|
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
|
|
19
|
+
NikGapps/helper/Assets.py,sha256=cIM38x_rLaxpAx_bOh6a-tqZy2ZoX25I2tdpL56srGE,2292
|
|
20
20
|
NikGapps/helper/Config.py,sha256=iCTMt5Zd3g3Rq0Y14u4i5e2-hCv9SKcSl4xMJ1KhYJE,2606
|
|
21
21
|
NikGapps/helper/ConfigObj.py,sha256=ep9--o1SPgGXkElrjkf7hjF96KGSrmcQ9oGCpicN7D4,462
|
|
22
22
|
NikGapps/helper/Package.py,sha256=P8BU3r_5t_6-Qs0WoTAt0rB64oVzqAE-NERItwYW1X4,9182
|
|
23
23
|
NikGapps/helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
24
|
NikGapps/helper/assets/addon.sh,sha256=qXwZ7GQVnOrkSNRcJTKycKRKkUa8kRA_iDwsKVDMHwY,9424
|
|
25
|
-
NikGapps/helper/assets/appsets.json,sha256=
|
|
25
|
+
NikGapps/helper/assets/appsets.json,sha256=oIxqDUAZda7eOT9bloFRVpX2nHQ1klfF1YEPDOUFJh0,7070
|
|
26
26
|
NikGapps/helper/assets/changelogs.yaml,sha256=J6TKXUre04OTOLdX3ks7AUkDUPz8wBcpQEweGGIX8HM,47787
|
|
27
27
|
NikGapps/helper/assets/config_versions.json,sha256=T7fJFW5uYUbiZphw7VP89T4F1WKK6EzG7q_33M8zrJA,102
|
|
28
28
|
NikGapps/helper/assets/customize.sh,sha256=bfYUgf1vd7GGUix4CPIhzn2eFN-DJh67IVIY6eMIrGo,10242
|
|
@@ -37,7 +37,7 @@ NikGapps/helper/assets/mount.sh,sha256=G_rAktQyrUQJpQlCpihbCwWrDCJ71zNEZJ3ZCARA7
|
|
|
37
37
|
NikGapps/helper/assets/mtg_mount.sh,sha256=M6oYs7aLmMRBJbIq8ANmHxGrTIf7Jxe0GLsPq3SdmJ0,2697
|
|
38
38
|
NikGapps/helper/assets/nikgapps.config,sha256=807lgmt0MhX2hx18ZgM7idj5ZwCgyHkKJ4VtSKOD3ew,1575
|
|
39
39
|
NikGapps/helper/assets/nikgapps_functions.sh,sha256=SXzJEPTwYdhqPqgSAUx9Fa4UNPWSbNHVuUI31TGFAh8,57645
|
|
40
|
-
NikGapps/helper/assets/packages.json,sha256=
|
|
40
|
+
NikGapps/helper/assets/packages.json,sha256=HBvfNR8mXJyJ4hDI8EKbV5-eGyUlpO9LeWlujuPRjTs,17269
|
|
41
41
|
NikGapps/helper/assets/uninstaller.sh,sha256=Lob89FNVfpHFkdzUJFDwVQwlnc7WB_U-U28Y4fZgycE,870
|
|
42
42
|
NikGapps/helper/assets/unmount.sh,sha256=L8Lq7ZVfwazXaZp5Jkuce2pCGJCLZh57uj_BzFSDb-c,1107
|
|
43
43
|
NikGapps/helper/compression/CompOps.py,sha256=RjYxtNh98xCds58oWxX8UGbe9g-WUYCriTRupWZqMZc,1823
|
|
@@ -47,19 +47,16 @@ NikGapps/helper/git/TestGit.py,sha256=-RHGYO4cY9tQhBCraU6m2gOUUVAPtbfzQwkJ4oQ9ht
|
|
|
47
47
|
NikGapps/helper/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
NikGapps/helper/overlay/ApkMetaInfo.py,sha256=l8Au74MPXWqllzooNGF8AIn-JTWiwxIuYAnu1nwq-e0,1567
|
|
49
49
|
NikGapps/helper/overlay/Bool.py,sha256=1VfI30ytFvT5eTWHwRCePE2hVRb_X-lFYPhAxS6xVCM,372
|
|
50
|
-
NikGapps/helper/overlay/Library.py,sha256=
|
|
50
|
+
NikGapps/helper/overlay/Library.py,sha256=KTVoNKuklcClouz1yDtLSBaLt9dGfT7-ys3e8aCgPHY,43671
|
|
51
51
|
NikGapps/helper/overlay/Manifest.py,sha256=johNJ7iejBTBubTPUdsJLqr4NlxC6USaHn1NZzDzaHw,2450
|
|
52
52
|
NikGapps/helper/overlay/Overlay.py,sha256=CHPsviezeE8sRuPBtWwdTvrotGw1159mBYnOPM3K53s,910
|
|
53
53
|
NikGapps/helper/overlay/Resources.py,sha256=bKWJEF2avl3j2ud390HQq9fRMMA8GKh9-KABdvim-Wg,1458
|
|
54
54
|
NikGapps/helper/overlay/String.py,sha256=nyCAD_dNfwHlOgj4zuKGGz71n20CLEKyZCgrVAmiX2I,469
|
|
55
55
|
NikGapps/helper/overlay/StringArray.py,sha256=DYPEAIdpicaJ3C08IYW6Q2tnTH6gUFXmu3KhQlHGY5g,563
|
|
56
56
|
NikGapps/helper/overlay/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
-
NikGapps/
|
|
58
|
-
NikGapps/
|
|
59
|
-
NikGapps/
|
|
60
|
-
NikGapps-3.
|
|
61
|
-
NikGapps-3.
|
|
62
|
-
NikGapps-3.
|
|
63
|
-
NikGapps-3.31.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
|
|
64
|
-
NikGapps-3.31.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
|
|
65
|
-
NikGapps-3.31.dist-info/RECORD,,
|
|
57
|
+
NikGapps-3.33.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
58
|
+
NikGapps-3.33.dist-info/METADATA,sha256=TFnZflTOTko0KQwpEHN-VFCWW4gAC68vafvFy6nJtg4,4148
|
|
59
|
+
NikGapps-3.33.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
60
|
+
NikGapps-3.33.dist-info/entry_points.txt,sha256=iKbeOiuELwTDu5kmQHrU9XBVASWRR6_TuRIRva2UnAY,286
|
|
61
|
+
NikGapps-3.33.dist-info/top_level.txt,sha256=CD7RpCb7bzjyvpQLt8hh2gU6X1wj3Z0NIErVkg-nJI4,9
|
|
62
|
+
NikGapps-3.33.dist-info/RECORD,,
|
|
@@ -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
|