mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3bcb3de4cf | ||
![]() |
9a70733421 | ||
![]() |
449232e2ca | ||
![]() |
1c74d8501c | ||
![]() |
9289872831 | ||
![]() |
0c3bace49e | ||
![]() |
2e459cafe2 | ||
![]() |
1ff34a7372 | ||
![]() |
367ee5be42 | ||
![]() |
abf07e8301 | ||
![]() |
c551c6bd66 | ||
![]() |
572a7de68a | ||
![]() |
2b00942749 |
@@ -5,7 +5,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.python.org/"> <img src="https://forthebadge.com/images/badges/made-with-python.svg" alt="madewithpython" border="0"></a>
|
<a href="https://www.python.org/"> <img src="https://img.shields.io/badge/made%20with-python%20%F0%9F%90%8D-brightgreen" alt="madewithpython" border="0"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -13,15 +13,13 @@
|
|||||||
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/v/release/Neocky/pluGET?include_prereleases" alt"latestrelease"></a>
|
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/v/release/Neocky/pluGET?include_prereleases" alt"latestrelease"></a>
|
||||||
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/downloads/Neocky/pluGET/total" alt="downloads" border="0"></a>
|
<a href="https://github.com/Neocky/pluGET/releases"> <img src="https://img.shields.io/github/downloads/Neocky/pluGET/total" alt="downloads" border="0"></a>
|
||||||
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FNeocky%2FpluGET&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
|
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2FNeocky%2FpluGET&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"/></a>
|
||||||
|
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
# pluGET
|
# pluGET
|
||||||
#### A powerful package manager which updates [Plugins](https://www.spigotmc.org/resources/) and Server Software for minecraft servers.
|
#### A powerful package manager which updates [Plugins](https://www.spigotmc.org/resources/) and Server Software for minecraft servers.
|
||||||
|
|
||||||
<img src="https://www.bildhost.com/images/2021/03/23/pluGET.gif" alt="pluGET.gif" border="0" />
|
<img src="https://www.bildhost.com/images/2021/06/27/ezgif-1-28e102202188.gif" alt="pluGET.gif" border="0" />
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Screenshots</summary>
|
<summary>Screenshots</summary>
|
||||||
@@ -51,7 +49,7 @@ The program works with a locally installed server or with a remote host through
|
|||||||
It uses the [Spiget](https://spiget.org/) API to download and compare plugin versions and can download the latest version of plugins from the [Spigot](https://www.spigotmc.org/) site.
|
It uses the [Spiget](https://spiget.org/) API to download and compare plugin versions and can download the latest version of plugins from the [Spigot](https://www.spigotmc.org/) site.
|
||||||
It can also compare and download the latest update of specific server software (e.g. [PaperMC](https://papermc.io/)).
|
It can also compare and download the latest update of specific server software (e.g. [PaperMC](https://papermc.io/)).
|
||||||
|
|
||||||
Plugin management was the hard part of managing a minecraft server. The time it took to check the [Spigot ressource](https://www.spigotmc.org/resources/) page for updates for the installed plugins and updating all plugins manually which have available updates was too long and daunting.
|
Plugin management was the hard part of managing a minecraft server. The time it took to check the [Spigot resource](https://www.spigotmc.org/resources/) page for updates for the installed plugins and updating all plugins manually which have available updates was too long and daunting.
|
||||||
So I built pluGET to automate and ease the plugin handling of a minecraft server and to turn the most time consuming part of managing a minecraft server to an easy one.
|
So I built pluGET to automate and ease the plugin handling of a minecraft server and to turn the most time consuming part of managing a minecraft server to an easy one.
|
||||||
|
|
||||||
This program is suited for minecraft server owners who want to save time and stay on top of their plugin versions.
|
This program is suited for minecraft server owners who want to save time and stay on top of their plugin versions.
|
||||||
|
@@ -20,12 +20,14 @@ class configurationValues:
|
|||||||
self.sftp_user = config['SFTP - Remote Server']['Username']
|
self.sftp_user = config['SFTP - Remote Server']['Username']
|
||||||
self.sftp_password = config['SFTP - Remote Server']['Password']
|
self.sftp_password = config['SFTP - Remote Server']['Password']
|
||||||
sftp_port = config['SFTP - Remote Server']['SFTPPort']
|
sftp_port = config['SFTP - Remote Server']['SFTPPort']
|
||||||
|
ftp_port = config['SFTP - Remote Server']['FTPPort']
|
||||||
self.sftp_folderPath = config['SFTP - Remote Server']['PluginFolderOnServer']
|
self.sftp_folderPath = config['SFTP - Remote Server']['PluginFolderOnServer']
|
||||||
sftp_useSftp = config['SFTP - Remote Server']['USE_SFTP']
|
sftp_useSftp = config['SFTP - Remote Server']['USE_SFTP']
|
||||||
sftp_seperateDownloadPath = config['SFTP - Remote Server']['SeperateDownloadPath']
|
sftp_seperateDownloadPath = config['SFTP - Remote Server']['SeperateDownloadPath']
|
||||||
self.sftp_pathToSeperateDownloadPath = config['SFTP - Remote Server']['PathToSeperateDownloadPath']
|
self.sftp_pathToSeperateDownloadPath = config['SFTP - Remote Server']['PathToSeperateDownloadPath']
|
||||||
|
|
||||||
self.sftp_port = int(sftp_port)
|
self.sftp_port = int(sftp_port)
|
||||||
|
self.ftp_port = int(ftp_port)
|
||||||
if localPluginFolder == 'True':
|
if localPluginFolder == 'True':
|
||||||
self.localPluginFolder = True
|
self.localPluginFolder = True
|
||||||
else:
|
else:
|
||||||
@@ -72,13 +74,15 @@ def createConfig():
|
|||||||
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
config['SFTP - Remote Server']['Server'] = '0.0.0.0'
|
||||||
config['SFTP - Remote Server']['Username'] = 'user'
|
config['SFTP - Remote Server']['Username'] = 'user'
|
||||||
config['SFTP - Remote Server']['Password'] = 'password'
|
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']['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']['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']['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']['SeperateDownloadPath'] = 'False'
|
||||||
config['SFTP - Remote Server']['PathToSeperateDownloadPath'] = '/plugins'
|
config['SFTP - Remote Server']['PathToSeperateDownloadPath'] = '/plugins'
|
||||||
|
|
||||||
|
@@ -10,9 +10,10 @@ from handlers.handle_config import configurationValues
|
|||||||
|
|
||||||
def createFTPConnection():
|
def createFTPConnection():
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
ftp = ftplib.FTP(configValues.sftp_server, user=configValues.sftp_user, \
|
|
||||||
passwd=configValues.sftp_password)
|
|
||||||
try:
|
try:
|
||||||
|
ftp = ftplib.FTP()
|
||||||
|
ftp.connect(configValues.sftp_server, configValues.ftp_port)
|
||||||
|
ftp.login(configValues.sftp_user, configValues.sftp_password)
|
||||||
return ftp
|
return ftp
|
||||||
except UnboundLocalError:
|
except UnboundLocalError:
|
||||||
print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite)
|
print(oColors.brightRed + "[FTP]: Check your config.ini!" + oColors.standardWhite)
|
||||||
@@ -100,11 +101,17 @@ def ftp_downloadFile(ftp, downloadPath, fileToDownload):
|
|||||||
ftp.quit()
|
ftp.quit()
|
||||||
|
|
||||||
|
|
||||||
def ftp_validateFileAttributes(ftp, pluginPath):
|
def ftp_is_file(ftp, pluginPath):
|
||||||
pluginFTPAttribute = ftp.lstat(pluginPath)
|
if ftp.nlst(pluginPath) == [pluginPath]:
|
||||||
if stat.S_ISDIR(pluginFTPAttribute.st_mode):
|
return True
|
||||||
return False
|
else:
|
||||||
elif re.search(r'.jar$', pluginPath):
|
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
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@@ -21,8 +21,11 @@ def handleRegexPackageName(packageNameFull):
|
|||||||
packageNameFull2 = packageNameFull.replace(unwantedpackageNameString, '')
|
packageNameFull2 = packageNameFull.replace(unwantedpackageNameString, '')
|
||||||
# gets the real packagename "word1 & word2" is not supported only gets word 1
|
# 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)
|
packageName = re.search(r'([a-zA-Z]\d*)+(\s?\-*\_*[a-zA-Z]\d*\+*\-*\'*)+', packageNameFull2)
|
||||||
packageNameFullString = packageName.group()
|
try:
|
||||||
packageNameOnly = packageNameFullString.replace(' ', '')
|
packageNameFullString = packageName.group()
|
||||||
|
packageNameOnly = packageNameFullString.replace(' ', '')
|
||||||
|
except AttributeError:
|
||||||
|
packageNameOnly = unwantedpackageNameString
|
||||||
return packageNameOnly
|
return packageNameOnly
|
||||||
|
|
||||||
|
|
||||||
@@ -51,20 +54,20 @@ def getVersionName(packageId, versionId):
|
|||||||
return versionName
|
return versionName
|
||||||
|
|
||||||
|
|
||||||
def searchPackage(ressourceName):
|
def searchPackage(resourceName):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
url = f"https://api.spiget.org/v2/search/resources/{ressourceName}?field=name&sort=-downloads"
|
url = f"https://api.spiget.org/v2/search/resources/{resourceName}?field=name&sort=-downloads"
|
||||||
packageName = doAPIRequest(url)
|
packageName = doAPIRequest(url)
|
||||||
i = 1
|
i = 1
|
||||||
print(oColors.brightBlack + f"Searching: {ressourceName}" + oColors.standardWhite)
|
print(oColors.brightBlack + f"Searching: {resourceName}" + oColors.standardWhite)
|
||||||
print("┌─────┬─────────────────────────────┬───────────┬──────────────────────────────────────────────────────────────────────┐")
|
print("┌─────┬─────────────────────────────┬───────────┬──────────────────────────────────────────────────────────────────────┐")
|
||||||
print("│ No. │ Name │ Downloads │ Description │")
|
print("│ No. │ Name │ Downloads │ Description │")
|
||||||
print("└─────┴─────────────────────────────┴───────────┴──────────────────────────────────────────────────────────────────────┘")
|
print("└─────┴─────────────────────────────┴───────────┴──────────────────────────────────────────────────────────────────────┘")
|
||||||
for ressource in packageName:
|
for resource in packageName:
|
||||||
pName = ressource["name"]
|
pName = resource["name"]
|
||||||
newName = handleRegexPackageName(pName)
|
newName = handleRegexPackageName(pName)
|
||||||
pTag = ressource["tag"]
|
pTag = resource["tag"]
|
||||||
pDownloads = ressource["downloads"]
|
pDownloads = resource["downloads"]
|
||||||
print(f" [{i}]".rjust(6), end='')
|
print(f" [{i}]".rjust(6), end='')
|
||||||
print(" ", end='')
|
print(" ", end='')
|
||||||
print(f"{newName}".ljust(30), end='')
|
print(f"{newName}".ljust(30), end='')
|
||||||
@@ -73,10 +76,10 @@ def searchPackage(ressourceName):
|
|||||||
print(f"{pTag}".ljust(120))
|
print(f"{pTag}".ljust(120))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
ressourceSelected = int(input("Select your wanted Ressource (No.)(0 to exit): "))
|
resourceSelected = int(input("Select your wanted resource (No.)(0 to exit): "))
|
||||||
if ressourceSelected != 0:
|
if resourceSelected != 0:
|
||||||
ressourceSelected = ressourceSelected - 1
|
resourceSelected = resourceSelected - 1
|
||||||
ressourceId = packageName[ressourceSelected]["id"]
|
resourceId = packageName[resourceSelected]["id"]
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
if configValues.sftp_seperateDownloadPath is True:
|
if configValues.sftp_seperateDownloadPath is True:
|
||||||
pluginDownloadPath = configValues.sftp_pathToSeperateDownloadPath
|
pluginDownloadPath = configValues.sftp_pathToSeperateDownloadPath
|
||||||
@@ -88,20 +91,20 @@ def searchPackage(ressourceName):
|
|||||||
else:
|
else:
|
||||||
pluginDownloadPath = configValues.pathToPluginFolder
|
pluginDownloadPath = configValues.pathToPluginFolder
|
||||||
try:
|
try:
|
||||||
getSpecificPackage(ressourceId, pluginDownloadPath)
|
getSpecificPackage(resourceId, pluginDownloadPath)
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
|
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
|
||||||
|
|
||||||
|
|
||||||
def downloadSpecificVersion(ressourceId, downloadPath, versionID='latest'):
|
def downloadSpecificVersion(resourceId, downloadPath, versionID='latest'):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
if versionID != 'latest':
|
if versionID != 'latest':
|
||||||
#url = f"https://spigotmc.org/resources/{ressourceId}/download?version={versionID}"
|
#url = f"https://spigotmc.org/resources/{resourceId}/download?version={versionID}"
|
||||||
print(oColors.brightRed + "Sorry but specific version downloads aren't supported because of cloudflare protection. :(" + oColors.standardWhite)
|
print(oColors.brightRed + "Sorry but specific version downloads aren't supported because of cloudflare protection. :(" + oColors.standardWhite)
|
||||||
print(oColors.brightRed + "Reverting to latest version." + oColors.standardWhite)
|
print(oColors.brightRed + "Reverting to latest version." + oColors.standardWhite)
|
||||||
|
|
||||||
url = f"https://api.spiget.org/v2/resources/{ressourceId}/download"
|
url = f"https://api.spiget.org/v2/resources/{resourceId}/download"
|
||||||
#url = f"https://api.spiget.org/v2/resources/{ressourceId}/versions/latest/download" #throws 403 forbidden error...cloudflare :(
|
#url = f"https://api.spiget.org/v2/resources/{resourceId}/versions/latest/download" #throws 403 forbidden error...cloudflare :(
|
||||||
|
|
||||||
urrlib_opener = urllib.request.build_opener()
|
urrlib_opener = urllib.request.build_opener()
|
||||||
urrlib_opener.addheaders = [('User-agent', 'pluGET/1.0')]
|
urrlib_opener.addheaders = [('User-agent', 'pluGET/1.0')]
|
||||||
@@ -127,22 +130,26 @@ def downloadSpecificVersion(ressourceId, downloadPath, versionID='latest'):
|
|||||||
ftp_upload_file(ftpSession, downloadPath)
|
ftp_upload_file(ftpSession, downloadPath)
|
||||||
|
|
||||||
|
|
||||||
def getSpecificPackage(ressourceId, downloadPath, inputPackageVersion='latest'):
|
def getSpecificPackage(resourceId, downloadPath, inputPackageVersion='latest'):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
if configValues.localPluginFolder == False:
|
if configValues.localPluginFolder == False:
|
||||||
downloadPath = createTempPluginFolder()
|
downloadPath = createTempPluginFolder()
|
||||||
url = f"https://api.spiget.org/v2/resources/{ressourceId}"
|
url = f"https://api.spiget.org/v2/resources/{resourceId}"
|
||||||
packageDetails = doAPIRequest(url)
|
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)
|
packageNameNew = handleRegexPackageName(packageName)
|
||||||
versionId = getVersionID(ressourceId, inputPackageVersion)
|
versionId = getVersionID(resourceId, inputPackageVersion)
|
||||||
packageVersion = getVersionName(ressourceId, versionId)
|
packageVersion = getVersionName(resourceId, versionId)
|
||||||
packageDownloadName = f"{packageNameNew}-{packageVersion}.jar"
|
packageDownloadName = f"{packageNameNew}-{packageVersion}.jar"
|
||||||
downloadPackagePath = Path(f"{downloadPath}/{packageDownloadName}")
|
downloadPackagePath = Path(f"{downloadPath}/{packageDownloadName}")
|
||||||
if inputPackageVersion is None or inputPackageVersion == 'latest':
|
if inputPackageVersion is None or inputPackageVersion == 'latest':
|
||||||
downloadSpecificVersion(ressourceId=ressourceId, downloadPath=downloadPackagePath)
|
downloadSpecificVersion(resourceId=resourceId, downloadPath=downloadPackagePath)
|
||||||
else:
|
else:
|
||||||
downloadSpecificVersion(ressourceId, downloadPackagePath, versionId)
|
downloadSpecificVersion(resourceId, downloadPackagePath, versionId)
|
||||||
|
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
deleteTempPluginFolder(downloadPath)
|
deleteTempPluginFolder(downloadPath)
|
||||||
|
@@ -75,12 +75,24 @@ def getUpdateDescription(pluginId):
|
|||||||
return stringnonEmptyLines
|
return stringnonEmptyLines
|
||||||
|
|
||||||
|
|
||||||
|
def versionTuple(versionString):
|
||||||
|
return tuple(map(int, (versionString.split("."))))
|
||||||
|
|
||||||
|
|
||||||
|
def getVersionWithoutLetters(versionString):
|
||||||
|
return re.sub(r'([A-Za-z]*)', '', versionString)
|
||||||
|
|
||||||
|
|
||||||
def compareVersions(plugin_latest_version, pluginVersion):
|
def compareVersions(plugin_latest_version, pluginVersion):
|
||||||
if pluginVersion < plugin_latest_version:
|
try:
|
||||||
plugin_is_outdated = True
|
pluginVersionTuple = versionTuple(getVersionWithoutLetters(pluginVersion))
|
||||||
|
plugin_latest_versionTuple = versionTuple(getVersionWithoutLetters(plugin_latest_version))
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
if pluginVersionTuple < plugin_latest_versionTuple:
|
||||||
|
return True
|
||||||
else:
|
else:
|
||||||
plugin_is_outdated = False
|
return False
|
||||||
return plugin_is_outdated
|
|
||||||
|
|
||||||
|
|
||||||
def eggCrackingJar(localJarFileName, searchMode):
|
def eggCrackingJar(localJarFileName, searchMode):
|
||||||
@@ -121,6 +133,9 @@ def eggCrackingJar(localJarFileName, searchMode):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pluginVersion = ''
|
pluginVersion = ''
|
||||||
pluginName = ''
|
pluginName = ''
|
||||||
|
except KeyError:
|
||||||
|
pluginVersion = ''
|
||||||
|
pluginName = ''
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
deleteTempPluginFolder(tempPluginFolderPath)
|
deleteTempPluginFolder(tempPluginFolderPath)
|
||||||
if searchMode == 'version':
|
if searchMode == 'version':
|
||||||
@@ -218,9 +233,9 @@ def checkInstalledPackage(inputSelectedObject="all", inputOptionalParam=None):
|
|||||||
print(f" [{i+1}]".rjust(6), end='')
|
print(f" [{i+1}]".rjust(6), end='')
|
||||||
print(" ", end='')
|
print(" ", end='')
|
||||||
if pluginIsOutdated == True:
|
if pluginIsOutdated == True:
|
||||||
print(oColors.brightGreen + f"{fileName}".ljust(33) + oColors.standardWhite, end='')
|
|
||||||
elif pluginIsOutdated == False:
|
|
||||||
print(oColors.brightRed + f"{fileName}".ljust(33) + oColors.standardWhite, end='')
|
print(oColors.brightRed + f"{fileName}".ljust(33) + oColors.standardWhite, end='')
|
||||||
|
elif pluginIsOutdated == False:
|
||||||
|
print(oColors.brightGreen + f"{fileName}".ljust(33) + oColors.standardWhite, end='')
|
||||||
else:
|
else:
|
||||||
print(f"{fileName}".ljust(33), end='')
|
print(f"{fileName}".ljust(33), end='')
|
||||||
|
|
||||||
@@ -263,7 +278,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
|
|
||||||
print()
|
print()
|
||||||
updateConfirmation = input("Update these plugins [y/n] ? ")
|
updateConfirmation = input("Update these plugins [y/n] ? ")
|
||||||
if updateConfirmation != "y":
|
if str.lower(updateConfirmation) != "y":
|
||||||
print(oColors.brightRed + "Aborting the update process."+ oColors.standardWhite)
|
print(oColors.brightRed + "Aborting the update process."+ oColors.standardWhite)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -322,70 +337,86 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if inputSelectedObject == 'all' or inputSelectedObject == pluginIdStr or re.search(inputSelectedObject, fileName, re.IGNORECASE):
|
if inputSelectedObject != 'all' and inputSelectedObject != pluginIdStr and not re.search(inputSelectedObject, fileName, re.IGNORECASE):
|
||||||
if INSTALLEDPLUGINLIST[i][4] == True:
|
|
||||||
print(f" [{indexNumberUpdated+1}]".rjust(6), end='')
|
|
||||||
print(" ", end='')
|
|
||||||
print(f"{fileName}".ljust(33), end='')
|
|
||||||
print(f"{fileVersion}".ljust(13), end='')
|
|
||||||
print(f"{latestVersion}".ljust(13))
|
|
||||||
if not configValues.localPluginFolder:
|
|
||||||
if configValues.sftp_seperateDownloadPath is True:
|
|
||||||
pluginPath = configValues.sftp_pathToSeperateDownloadPath
|
|
||||||
else:
|
|
||||||
pluginPath = configValues.sftp_folderPath
|
|
||||||
pluginPath = f"{pluginPath}/{plugin}"
|
|
||||||
indexNumberUpdated += 1
|
|
||||||
pluginsUpdated += 1
|
|
||||||
if configValues.sftp_useSftp:
|
|
||||||
sftp = createSFTPConnection()
|
|
||||||
try:
|
|
||||||
getSpecificPackage(pluginId, pluginPath)
|
|
||||||
if configValues.sftp_seperateDownloadPath is False:
|
|
||||||
sftp.remove(pluginPath)
|
|
||||||
except HTTPError as err:
|
|
||||||
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
|
||||||
pluginsUpdated -= 1
|
|
||||||
except FileNotFoundError:
|
|
||||||
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
|
||||||
|
|
||||||
else:
|
|
||||||
ftp = createFTPConnection()
|
|
||||||
try:
|
|
||||||
getSpecificPackage(pluginId, pluginPath)
|
|
||||||
if configValues.sftp_seperateDownloadPath is False:
|
|
||||||
ftp.delete(pluginPath)
|
|
||||||
except HTTPError as err:
|
|
||||||
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
|
||||||
pluginsUpdated -= 1
|
|
||||||
except FileNotFoundError:
|
|
||||||
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
|
||||||
|
|
||||||
else:
|
|
||||||
if configValues.seperateDownloadPath is True:
|
|
||||||
pluginPath = configValues.pathToSeperateDownloadPath
|
|
||||||
else:
|
|
||||||
pluginPath = configValues.pathToPluginFolder
|
|
||||||
indexNumberUpdated += 1
|
|
||||||
pluginsUpdated += 1
|
|
||||||
try:
|
|
||||||
getSpecificPackage(pluginId, pluginPath)
|
|
||||||
if configValues.seperateDownloadPath is False:
|
|
||||||
os.remove(pluginPath)
|
|
||||||
except HTTPError as err:
|
|
||||||
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
|
||||||
pluginsUpdated -= 1
|
|
||||||
except FileNotFoundError:
|
|
||||||
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
|
||||||
if inputSelectedObject != 'all':
|
|
||||||
break
|
|
||||||
elif inputSelectedObject != 'all':
|
|
||||||
print(oColors.brightGreen + f"{fileName} is already on {latestVersion}" + oColors.standardWhite)
|
|
||||||
print(oColors.brightRed + "Aborting the update process."+ oColors.standardWhite)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
if INSTALLEDPLUGINLIST[i][4] != True:
|
||||||
|
i += 1
|
||||||
|
continue
|
||||||
|
if INSTALLEDPLUGINLIST[i][4] == False and inputSelectedObject != 'all':
|
||||||
|
print(oColors.brightGreen + f"{fileName} is already on {latestVersion}" + oColors.standardWhite)
|
||||||
|
print(oColors.brightRed + "Aborting the update process."+ oColors.standardWhite)
|
||||||
|
break
|
||||||
|
|
||||||
|
print(f" [{indexNumberUpdated+1}]".rjust(6), end='')
|
||||||
|
print(" ", end='')
|
||||||
|
print(f"{fileName}".ljust(33), end='')
|
||||||
|
print(f"{fileVersion}".ljust(13), end='')
|
||||||
|
print(f"{latestVersion}".ljust(13))
|
||||||
|
if not configValues.localPluginFolder:
|
||||||
|
if configValues.sftp_seperateDownloadPath is True:
|
||||||
|
pluginPath = configValues.sftp_pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginPath = configValues.sftp_folderPath
|
||||||
|
pluginPath = f"{pluginPath}/{plugin}"
|
||||||
|
indexNumberUpdated += 1
|
||||||
|
pluginsUpdated += 1
|
||||||
|
if configValues.sftp_useSftp:
|
||||||
|
sftp = createSFTPConnection()
|
||||||
|
try:
|
||||||
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
|
if configValues.sftp_seperateDownloadPath is False:
|
||||||
|
sftp.remove(pluginPath)
|
||||||
|
except HTTPError as err:
|
||||||
|
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except TypeError:
|
||||||
|
print(oColors.brightRed + f"TypeError: Couldn't download new version. Is the file available on spigotmc?" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
|
||||||
|
else:
|
||||||
|
ftp = createFTPConnection()
|
||||||
|
try:
|
||||||
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
|
if configValues.sftp_seperateDownloadPath is False:
|
||||||
|
ftp.delete(pluginPath)
|
||||||
|
except HTTPError as err:
|
||||||
|
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except TypeError:
|
||||||
|
print(oColors.brightRed + f"TypeError: Couldn't download new version. Is the file available on spigotmc?" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
|
||||||
|
else:
|
||||||
|
if configValues.seperateDownloadPath is True:
|
||||||
|
pluginPath = configValues.pathToSeperateDownloadPath
|
||||||
|
else:
|
||||||
|
pluginPath = configValues.pathToPluginFolder
|
||||||
|
indexNumberUpdated += 1
|
||||||
|
pluginsUpdated += 1
|
||||||
|
try:
|
||||||
|
getSpecificPackage(pluginId, pluginPath)
|
||||||
|
if configValues.seperateDownloadPath is False:
|
||||||
|
pluginPath = f"{pluginPath}/{plugin}"
|
||||||
|
os.remove(pluginPath)
|
||||||
|
except HTTPError as err:
|
||||||
|
print(oColors.brightRed + f"HTTPError: {err.code} - {err.reason}" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except TypeError:
|
||||||
|
print(oColors.brightRed + f"TypeError: Couldn't download new version. Is the file available on spigotmc?" + oColors.standardWhite)
|
||||||
|
pluginsUpdated -= 1
|
||||||
|
except FileNotFoundError:
|
||||||
|
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
if inputSelectedObject != 'all':
|
||||||
|
break
|
||||||
|
elif inputSelectedObject != 'all':
|
||||||
|
print(oColors.brightGreen + f"{fileName} is already on {latestVersion}" + oColors.standardWhite)
|
||||||
|
print(oColors.brightRed + "Aborting the update process."+ oColors.standardWhite)
|
||||||
|
break
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@@ -423,10 +454,10 @@ def getInstalledPlugin(localFileName, localFileVersion, localPluginFullName):
|
|||||||
|
|
||||||
localFileVersion = localFileVersionNew
|
localFileVersion = localFileVersionNew
|
||||||
|
|
||||||
for ressource in packageName:
|
for resource in packageName:
|
||||||
if plugin_match_found == True:
|
if plugin_match_found == True:
|
||||||
continue
|
continue
|
||||||
pID = ressource["id"]
|
pID = resource["id"]
|
||||||
url2 = f"https://api.spiget.org/v2/resources/{pID}/versions?size=100&sort=-name"
|
url2 = f"https://api.spiget.org/v2/resources/{pID}/versions?size=100&sort=-name"
|
||||||
try:
|
try:
|
||||||
packageVersions = doAPIRequest(url2)
|
packageVersions = doAPIRequest(url2)
|
||||||
@@ -445,10 +476,7 @@ def getInstalledPlugin(localFileName, localFileVersion, localPluginFullName):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if plugin_match_found != True:
|
if plugin_match_found != True:
|
||||||
pID = None
|
pID = updateId = plugin_latest_version = plugin_is_outdated = None
|
||||||
updateId = None
|
|
||||||
plugin_latest_version = None
|
|
||||||
plugin_is_outdated = None
|
|
||||||
addToPluginList(localPluginFullName, pID, updateId, plugin_latest_version , plugin_is_outdated)
|
addToPluginList(localPluginFullName, pID, updateId, plugin_latest_version , plugin_is_outdated)
|
||||||
|
|
||||||
return pluginID
|
return pluginID
|
||||||
|
@@ -98,24 +98,16 @@ def updateServerjar(serverJarBuild='latest'):
|
|||||||
|
|
||||||
if 'paper' in installedServerjarFullName:
|
if 'paper' in installedServerjarFullName:
|
||||||
print(oColors.brightBlack + f"Updating Paper to build: {serverJarBuild}" + oColors.standardWhite)
|
print(oColors.brightBlack + f"Updating Paper to build: {serverJarBuild}" + oColors.standardWhite)
|
||||||
if not configValues.localPluginFolder:
|
try:
|
||||||
try:
|
papermc_downloader(serverJarBuild, None, installedServerjarFullName)
|
||||||
papermc_downloader(serverJarBuild, installedServerjarFullName)
|
if not configValues.localPluginFolder:
|
||||||
sftp.remove(serverJarPath)
|
sftp.remove(serverJarPath)
|
||||||
except HTTPError as err:
|
else:
|
||||||
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
|
|
||||||
except FileNotFoundError:
|
|
||||||
print(oColors.brightRed + "Error: Old serverjar file coulnd't be deleted" + oColors.standardWhite)
|
|
||||||
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
papermc_downloader(serverJarBuild, installedServerjarFullName)
|
|
||||||
os.remove(serverJarPath)
|
os.remove(serverJarPath)
|
||||||
except HTTPError as err:
|
except HTTPError as err:
|
||||||
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
|
print(oColors.brightRed + f"Error: {err.code} - {err.reason}" + oColors.standardWhite)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(oColors.brightRed + "Error: Old serverjar file coulnd't be deleted" + oColors.standardWhite)
|
print(oColors.brightRed + "Error: Old serverjar file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(oColors.brightRed + f"{installedServerjarFullName} isn't supported.")
|
print(oColors.brightRed + f"{installedServerjarFullName} isn't supported.")
|
||||||
print(oColors.brightRed + "Aborting the process." + oColors.standardWhite)
|
print(oColors.brightRed + "Aborting the process." + oColors.standardWhite)
|
||||||
|
@@ -111,28 +111,28 @@ def paperCheckForUpdate(installedServerjarFullName):
|
|||||||
|
|
||||||
# Report an error if getInstalledPaperMinecraftVersion encountered an issue.
|
# Report an error if getInstalledPaperMinecraftVersion encountered an issue.
|
||||||
if not mcVersion:
|
if not mcVersion:
|
||||||
print(oColors.brightRed + f"ERR: An error was encountered while detecting the server's Minecraft version." +
|
print(oColors.brightRed + "ERR: An error was encountered while detecting the server's Minecraft version." +
|
||||||
oColors.standardWhite)
|
oColors.standardWhite)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
paperInstalledBuild = getInstalledPaperVersion(installedServerjarFullName)
|
paperInstalledBuild = getInstalledPaperVersion(installedServerjarFullName)
|
||||||
# Report an error if getInstalledPaperVersion encountered an issue.
|
# Report an error if getInstalledPaperVersion encountered an issue.
|
||||||
if not paperInstalledBuild:
|
if not paperInstalledBuild:
|
||||||
print(oColors.brightRed + f"ERR: An error was encountered while detecting the server's Paper version." +
|
print(oColors.brightRed + "ERR: An error was encountered while detecting the server's Paper version." +
|
||||||
oColors.standardWhite)
|
oColors.standardWhite)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
versionGroup = findVersionGroup(mcVersion)
|
versionGroup = findVersionGroup(mcVersion)
|
||||||
# Report an error if findVersionGroup encountered an issue.
|
# Report an error if findVersionGroup encountered an issue.
|
||||||
if not versionGroup:
|
if not versionGroup:
|
||||||
print(oColors.brightRed + f"ERR: An error was encountered while fetching the server's version group." +
|
print(oColors.brightRed + "ERR: An error was encountered while fetching the server's version group." +
|
||||||
oColors.standardWhite)
|
oColors.standardWhite)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
paperLatestBuild = findLatestBuild(versionGroup)
|
paperLatestBuild = findLatestBuild(versionGroup)
|
||||||
# Report an error if findLatestBuild encountered an issue.
|
# Report an error if findLatestBuild encountered an issue.
|
||||||
if not paperLatestBuild:
|
if not paperLatestBuild:
|
||||||
print(oColors.brightRed + f"ERR: An error was encountered while fetching the latest version of PaperMC." +
|
print(oColors.brightRed + "ERR: An error was encountered while fetching the latest version of PaperMC." +
|
||||||
oColors.standardWhite)
|
oColors.standardWhite)
|
||||||
return False # Not currently handled, but can be at a later date. Currently just stops the following from
|
return False # Not currently handled, but can be at a later date. Currently just stops the following from
|
||||||
# being printed.
|
# being printed.
|
||||||
@@ -140,27 +140,29 @@ def paperCheckForUpdate(installedServerjarFullName):
|
|||||||
paperVersionBehind = versionBehind(paperInstalledBuild, paperLatestBuild)
|
paperVersionBehind = versionBehind(paperInstalledBuild, paperLatestBuild)
|
||||||
# Report an error if getInstalledPaperVersion encountered an issue.
|
# Report an error if getInstalledPaperVersion encountered an issue.
|
||||||
if not paperVersionBehind:
|
if not paperVersionBehind:
|
||||||
print(oColors.brightRed + f"ERR: An error was encountered while detecting how many versions behind you are. "
|
print(oColors.brightRed + "ERR: An error was encountered while detecting how many versions behind you are. "
|
||||||
f"Will display as 'N/A'." + oColors.standardWhite)
|
f"Will display as 'N/A'." + oColors.standardWhite)
|
||||||
paperVersionBehind = "N/A" # Sets paperVersionBehind to N/A while still letting the versionBehind check return
|
paperVersionBehind = "N/A" # Sets paperVersionBehind to N/A while still letting the versionBehind check return
|
||||||
# False for error-handing reasons.
|
# False for error-handing reasons.
|
||||||
|
|
||||||
# Does not return false as versions behind doesn't break things. It is just helpful information.
|
# Does not return false as versions behind doesn't break things. It is just helpful information.
|
||||||
# paperVersionBehind will just display as "N/A"
|
# paperVersionBehind will just display as "N/A"
|
||||||
print("┌─────┬────────────────────────────────┬──────────────┬──────────────┬───────────────────┐")
|
print("┌─────┬────────────────────────────────┬──────────────┬──────────────┐")
|
||||||
print("│ No. │ Name │ Installed V. │ Latest V. │ Versions behind │")
|
print("│ No. │ Name │ Installed V. │ Latest V. │")
|
||||||
print("└─────┴────────────────────────────────┴──────────────┴──────────────┴───────────────────┘")
|
print("└─────┴────────────────────────────────┴──────────────┴──────────────┘")
|
||||||
print(" [1]".rjust(6), end='')
|
print(" [1]".rjust(6), end='')
|
||||||
print(" ", end='')
|
print(" ", end='')
|
||||||
print("paper".ljust(33), end='')
|
if paperVersionBehind != 0:
|
||||||
|
print(oColors.brightRed + "paper".ljust(33) + oColors.standardWhite, end='')
|
||||||
|
else:
|
||||||
|
print(oColors.brightGreen + "paper".ljust(33) + oColors.standardWhite, end='')
|
||||||
print(f"{paperInstalledBuild}".ljust(15), end='')
|
print(f"{paperInstalledBuild}".ljust(15), end='')
|
||||||
print(f"{paperLatestBuild}".ljust(15), end='')
|
print(f"{paperLatestBuild}".ljust(15))
|
||||||
print(f"{paperVersionBehind}".ljust(8))
|
|
||||||
print(oColors.brightYellow + f"Versions behind: [{paperVersionBehind}]" + oColors.standardWhite)
|
print(oColors.brightYellow + f"Versions behind: [{paperVersionBehind}]" + oColors.standardWhite)
|
||||||
|
|
||||||
|
|
||||||
# https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config#/
|
# https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config#/
|
||||||
def papermc_downloader(paperBuild='latest', installedServerjarName=None, mcVersion=None):
|
def papermc_downloader(paperBuild='latest', mcVersion=None, installedServerjarName=None):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
if configValues.localPluginFolder == False:
|
if configValues.localPluginFolder == False:
|
||||||
downloadPath = createTempPluginFolder()
|
downloadPath = createTempPluginFolder()
|
||||||
@@ -172,7 +174,7 @@ def papermc_downloader(paperBuild='latest', installedServerjarName=None, mcVersi
|
|||||||
|
|
||||||
if mcVersion == None:
|
if mcVersion == None:
|
||||||
if paperBuild == 'latest':
|
if paperBuild == 'latest':
|
||||||
mcVersion = '1.17'
|
mcVersion = '1.17.1'
|
||||||
else:
|
else:
|
||||||
mcVersion = findBuildVersion(paperBuild)
|
mcVersion = findBuildVersion(paperBuild)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user