mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cf710088a9 | ||
![]() |
b1b5eeb992 | ||
![]() |
3bcb3de4cf | ||
![]() |
9a70733421 | ||
![]() |
449232e2ca | ||
![]() |
1c74d8501c | ||
![]() |
9289872831 | ||
![]() |
0c3bace49e | ||
![]() |
2e459cafe2 | ||
![]() |
1ff34a7372 |
@@ -1,2 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd src/
|
||||
python3 "__main__.py"
|
||||
python3 "__main__.py"
|
||||
|
@@ -20,12 +20,14 @@ class configurationValues:
|
||||
self.sftp_user = config['SFTP - Remote Server']['Username']
|
||||
self.sftp_password = config['SFTP - Remote Server']['Password']
|
||||
sftp_port = config['SFTP - Remote Server']['SFTPPort']
|
||||
ftp_port = config['SFTP - Remote Server']['FTPPort']
|
||||
self.sftp_folderPath = config['SFTP - Remote Server']['PluginFolderOnServer']
|
||||
sftp_useSftp = config['SFTP - Remote Server']['USE_SFTP']
|
||||
sftp_seperateDownloadPath = config['SFTP - Remote Server']['SeperateDownloadPath']
|
||||
self.sftp_pathToSeperateDownloadPath = config['SFTP - Remote Server']['PathToSeperateDownloadPath']
|
||||
|
||||
self.sftp_port = int(sftp_port)
|
||||
self.ftp_port = int(ftp_port)
|
||||
if localPluginFolder == 'True':
|
||||
self.localPluginFolder = True
|
||||
else:
|
||||
@@ -72,13 +74,15 @@ def createConfig():
|
||||
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
||||
config['SFTP - Remote Server']['Username'] = 'user'
|
||||
config['SFTP - Remote Server']['Password'] = 'password'
|
||||
config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used (Works only for SFTP)'
|
||||
config['SFTP - Remote Server'][';'] = 'If a different Port for SFTP needs to be used (Default: 22)'
|
||||
config['SFTP - Remote Server']['SFTPPort'] = '22'
|
||||
config['SFTP - Remote Server'][';_'] = 'Change the path below if the plugin folder path is different on the SFTP/FTP server (Change only if you know what you are doing)'
|
||||
config['SFTP - Remote Server'][';_'] = 'If a different Port for FTP needs to be used (Default: 21)'
|
||||
config['SFTP - Remote Server']['FTPPort'] = '21'
|
||||
config['SFTP - Remote Server'][';__'] = 'Change the path below if the plugin folder path is different on the SFTP/FTP server (Change only if you know what you are doing)'
|
||||
config['SFTP - Remote Server']['PluginFolderOnServer'] = '/plugins'
|
||||
config['SFTP - Remote Server'][';__'] = 'If you want to use FTP instead of SFTP change to (False) else use (True)'
|
||||
config['SFTP - Remote Server'][';___'] = 'If you want to use FTP instead of SFTP change to (False) else use (True)'
|
||||
config['SFTP - Remote Server']['USE_SFTP'] = 'True'
|
||||
config['SFTP - Remote Server'][';___'] = 'For a different folder to store the updated plugins (Only with the update command!) change to (True/False) and the path below'
|
||||
config['SFTP - Remote Server'][';____'] = 'For a different folder to store the updated plugins (Only with the update command!) change to (True/False) and the path below'
|
||||
config['SFTP - Remote Server']['SeperateDownloadPath'] = 'False'
|
||||
config['SFTP - Remote Server']['PathToSeperateDownloadPath'] = '/plugins'
|
||||
|
||||
|
@@ -10,9 +10,10 @@ from handlers.handle_config import configurationValues
|
||||
|
||||
def createFTPConnection():
|
||||
configValues = configurationValues()
|
||||
ftp = ftplib.FTP(configValues.sftp_server, user=configValues.sftp_user, \
|
||||
passwd=configValues.sftp_password)
|
||||
try:
|
||||
ftp = ftplib.FTP()
|
||||
ftp.connect(configValues.sftp_server, configValues.ftp_port)
|
||||
ftp.login(configValues.sftp_user, configValues.sftp_password)
|
||||
return ftp
|
||||
except UnboundLocalError:
|
||||
print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite)
|
||||
@@ -100,11 +101,17 @@ def ftp_downloadFile(ftp, downloadPath, fileToDownload):
|
||||
ftp.quit()
|
||||
|
||||
|
||||
def ftp_validateFileAttributes(ftp, pluginPath):
|
||||
pluginFTPAttribute = ftp.lstat(pluginPath)
|
||||
if stat.S_ISDIR(pluginFTPAttribute.st_mode):
|
||||
return False
|
||||
elif re.search(r'.jar$', pluginPath):
|
||||
def ftp_is_file(ftp, pluginPath):
|
||||
if ftp.nlst(pluginPath) == [pluginPath]:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def ftp_validateFileAttributes(ftp, pluginPath):
|
||||
if ftp_is_file(ftp, pluginPath) is False:
|
||||
return False
|
||||
if re.search(r'.jar$', pluginPath):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
@@ -21,8 +21,11 @@ def handleRegexPackageName(packageNameFull):
|
||||
packageNameFull2 = packageNameFull.replace(unwantedpackageNameString, '')
|
||||
# gets the real packagename "word1 & word2" is not supported only gets word 1
|
||||
packageName = re.search(r'([a-zA-Z]\d*)+(\s?\-*\_*[a-zA-Z]\d*\+*\-*\'*)+', packageNameFull2)
|
||||
packageNameFullString = packageName.group()
|
||||
packageNameOnly = packageNameFullString.replace(' ', '')
|
||||
try:
|
||||
packageNameFullString = packageName.group()
|
||||
packageNameOnly = packageNameFullString.replace(' ', '')
|
||||
except AttributeError:
|
||||
packageNameOnly = unwantedpackageNameString
|
||||
return packageNameOnly
|
||||
|
||||
|
||||
@@ -133,7 +136,11 @@ def getSpecificPackage(resourceId, downloadPath, inputPackageVersion='latest'):
|
||||
downloadPath = createTempPluginFolder()
|
||||
url = f"https://api.spiget.org/v2/resources/{resourceId}"
|
||||
packageDetails = doAPIRequest(url)
|
||||
packageName = packageDetails["name"]
|
||||
try:
|
||||
packageName = packageDetails["name"]
|
||||
except KeyError:
|
||||
print(oColors.brightRed + "Error: Plugin ID couldn't be found" + oColors.standardWhite)
|
||||
return None
|
||||
packageNameNew = handleRegexPackageName(packageName)
|
||||
versionId = getVersionID(resourceId, inputPackageVersion)
|
||||
packageVersion = getVersionName(resourceId, versionId)
|
||||
|
Reference in New Issue
Block a user