Compare commits

..

10 Commits

Author SHA1 Message Date
Neocky
cf710088a9 Merge pull request #45 from ProfessorSniff/#!/bin/sh
add shebang to launcher.sh
2021-12-05 16:53:44 +01:00
ProfessorSniff
b1b5eeb992 add shebang to launcher.sh 2021-12-03 04:02:24 +00:00
Neocky
3bcb3de4cf Fixed error when searching for plugins
Changes:
- fixed bug when searching for plugins where the name couldn't be sanitized
- fixed bug when searching for plugins with numbers in name
2021-08-26 19:24:17 +02:00
Neocky
9a70733421 Changed description for FTP Port support 2021-08-07 18:58:23 +02:00
Neocky
449232e2ca Merge pull request #38 from TheDudeFromCI/patch-1
Added custom port support for FTP access.
2021-08-07 18:50:18 +02:00
TheDudeFromCI
1c74d8501c Apply suggestions from code review
Co-authored-by: Neocky <Neocky@users.noreply.github.com>
2021-08-04 19:52:10 -07:00
TheDudeFromCI
9289872831 Removed warning in default config 2021-08-03 03:01:51 -07:00
TheDudeFromCI
0c3bace49e Added custom port support for ftp access 2021-08-03 03:00:23 -07:00
Neocky
2e459cafe2 Fixed spelling
Changes:
- fixed uppercase variable name
2021-08-01 15:10:36 +02:00
Neocky
1ff34a7372 Fixed ftp file or folder check
Changes:
- fixed issue where it couldn't detect if it would be a file or folder with ftp
2021-08-01 15:06:55 +02:00
4 changed files with 34 additions and 15 deletions

View File

@@ -1,2 +1,3 @@
#!/bin/sh
cd src/
python3 "__main__.py"
python3 "__main__.py"

View File

@@ -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'

View File

@@ -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

View File

@@ -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)