mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cd4a66002c | ||
![]() |
0d709cfb6f | ||
![]() |
edc300a33d | ||
![]() |
6e980a1580 | ||
![]() |
cb0282e676 | ||
![]() |
1dad1c62cd | ||
![]() |
91a5e84028 |
24
README.md
24
README.md
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# pluGET
|
# pluGET
|
||||||
#### A powerfull 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/03/23/pluGET.gif" alt="pluGET.gif" border="0" />
|
||||||
|
|
||||||
@@ -47,11 +47,11 @@
|
|||||||
## About
|
## About
|
||||||
This is a package manager for minecraft [Spigot](https://www.spigotmc.org/) servers and its forks (e.g. [PaperMC](https://papermc.io/)).
|
This is a package manager for minecraft [Spigot](https://www.spigotmc.org/) servers and its forks (e.g. [PaperMC](https://papermc.io/)).
|
||||||
This is a standalone program written in python.
|
This is a standalone program written in python.
|
||||||
The program works with a locally installed server or with a remote host through SFTP, when configured in the config.
|
The program works with a locally installed server or with a remote host through SFTP/FTP, when configured in the config.
|
||||||
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 specifif 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 mangaging 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 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.
|
||||||
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.
|
||||||
@@ -63,15 +63,15 @@ If you still have questions [here](https://github.com/Neocky/pluGET#need-help) i
|
|||||||
|
|
||||||
So what can it do exactly?
|
So what can it do exactly?
|
||||||
pluGET can:
|
pluGET can:
|
||||||
- work locally or through sftp
|
- work locally or through SFTP/FTP
|
||||||
- manage plugins:
|
- manage plugins:
|
||||||
- download the latest version of a plugin
|
- download the latest version of a plugin
|
||||||
- update every installed/one specific plugin
|
- update every installed/one specific plugin
|
||||||
- check for an update of every installed/one specific plugin
|
- check for an update of every installed/one specific plugin
|
||||||
- remove a plugin from the plugin folder
|
- remove a plugin from the plugin folder
|
||||||
- manager server software:
|
- manage server software:
|
||||||
- download a specific server software version
|
- download a specific server software version
|
||||||
- check instlalled server software for update
|
- check installed server software for update
|
||||||
- update installed server software to a specific version
|
- update installed server software to a specific version
|
||||||
- supported server software: [PaperMc](https://papermc.io/)
|
- supported server software: [PaperMc](https://papermc.io/)
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ If you feel like showing your love and/or appreciation for this project then how
|
|||||||
|
|
||||||
|
|
||||||
## Need help?
|
## Need help?
|
||||||
[<img src="https://i.imgur.com/D5vyVzC.png" alt="Discord" width="272"/>](https://discord.gg/475Uf4NBPF)
|
[<img src="https://i.ibb.co/CMKbT0L/rsz-1rsz-discord.png" alt="Discord" width="272"/>](https://discord.gg/475Uf4NBPF)
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -97,14 +97,14 @@ Python needs to be installed on your machine.
|
|||||||
Get it [here](https://www.python.org/downloads/).
|
Get it [here](https://www.python.org/downloads/).
|
||||||
### Dependencies
|
### Dependencies
|
||||||
Install the needed packages for this project.
|
Install the needed packages for this project.
|
||||||
Execute this command in the ```\plugGET``` folder:
|
Execute this command in the `\plugGET` folder:
|
||||||
```python
|
```python
|
||||||
py -m pip install -r requirements.txt
|
py -m pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### Edit the Config
|
### Edit the Config
|
||||||
When run the first time, the `config.ini` file will be created in the root package folder and the program will close.
|
When run the first time, the `config.ini` file will be created in the `\src` folder and the program will close.
|
||||||
Edit the config to your needs and relaunch pluGET.
|
Edit the config to your needs and relaunch pluGET.
|
||||||
**Now you are good to go!**
|
**Now you are good to go!**
|
||||||
|
|
||||||
@@ -112,6 +112,10 @@ Edit the config to your needs and relaunch pluGET.
|
|||||||
### Windows:
|
### Windows:
|
||||||
Execute the `launcher.bat` in the `\pluGET` folder.
|
Execute the `launcher.bat` in the `\pluGET` folder.
|
||||||
This will launch pluGET correctly.
|
This will launch pluGET correctly.
|
||||||
|
Sometimes the security warning `Windows protected your PC` comes when launching the `launcher.bat` file.
|
||||||
|
This is a normal behaviour from the windows defender because this is a unknown `.bat` file.
|
||||||
|
To run the `launcher.bat` anyway, click `More Info` and then `Run anyway` when the message pops up.
|
||||||
|
|
||||||
### Linux:
|
### Linux:
|
||||||
Use `cd` to change into the `/pluGET` directory and change the permission of the `launcher.sh` to make it executeable:
|
Use `cd` to change into the `/pluGET` directory and change the permission of the `launcher.sh` to make it executeable:
|
||||||
```
|
```
|
||||||
|
@@ -46,7 +46,7 @@ def getFileVersion(pluginName):
|
|||||||
if pluginVersionString.endswith('.'):
|
if pluginVersionString.endswith('.'):
|
||||||
pluginVersionString = ''
|
pluginVersionString = ''
|
||||||
if pluginVersionString == '':
|
if pluginVersionString == '':
|
||||||
pluginVersionString = eggCrackingJar(pluginNameFull)
|
pluginVersionString = eggCrackingJar(pluginNameFull, 'version')
|
||||||
return pluginVersionString
|
return pluginVersionString
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ def compareVersions(plugin_latest_version, pluginVersion):
|
|||||||
return plugin_is_outdated
|
return plugin_is_outdated
|
||||||
|
|
||||||
|
|
||||||
def eggCrackingJar(localJarFileName):
|
def eggCrackingJar(localJarFileName, searchMode):
|
||||||
configValues = configurationValues()
|
configValues = configurationValues()
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
if configValues.sftp_useSftp:
|
if configValues.sftp_useSftp:
|
||||||
@@ -82,21 +82,34 @@ def eggCrackingJar(localJarFileName):
|
|||||||
pluginPath = configValues.pathToPluginFolder
|
pluginPath = configValues.pathToPluginFolder
|
||||||
pathToPluginJar = Path(f"{pluginPath}/{localJarFileName}")
|
pathToPluginJar = Path(f"{pluginPath}/{localJarFileName}")
|
||||||
pluginVersion = ''
|
pluginVersion = ''
|
||||||
|
pluginName = ''
|
||||||
with ZipFile(pathToPluginJar, 'r') as pluginJar:
|
with ZipFile(pathToPluginJar, 'r') as pluginJar:
|
||||||
try:
|
try:
|
||||||
with io.TextIOWrapper(pluginJar.open('plugin.yml', 'r'), encoding="utf-8") as pluginYml:
|
with io.TextIOWrapper(pluginJar.open('plugin.yml', 'r'), encoding="utf-8") as pluginYml:
|
||||||
pluginYmlContentLine = pluginYml.readlines()
|
pluginYmlContentLine = pluginYml.readlines()
|
||||||
for line in pluginYmlContentLine:
|
for line in pluginYmlContentLine:
|
||||||
if "version: " in line:
|
if searchMode == 'version':
|
||||||
|
if re.match(r'^version: ', line):
|
||||||
pluginVersion = line.replace('version: ', '')
|
pluginVersion = line.replace('version: ', '')
|
||||||
pluginVersion = pluginVersion.replace('\n', '')
|
pluginVersion = pluginVersion.replace('\n', '')
|
||||||
break
|
pluginVersion = pluginVersion.replace("'", '')
|
||||||
|
pluginVersion = pluginVersion.replace('"', '')
|
||||||
|
elif searchMode == 'name':
|
||||||
|
if re.match(r'^name: ', line):
|
||||||
|
pluginName = line.replace('name: ', '')
|
||||||
|
pluginName = pluginName.replace('\n', '')
|
||||||
|
pluginName = pluginName.replace("'", '')
|
||||||
|
pluginName = pluginName.replace('"', '')
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pluginVersion = ''
|
pluginVersion = ''
|
||||||
|
pluginName = ''
|
||||||
if not configValues.localPluginFolder:
|
if not configValues.localPluginFolder:
|
||||||
deleteTempPluginFolder(tempPluginFolderPath)
|
deleteTempPluginFolder(tempPluginFolderPath)
|
||||||
|
if searchMode == 'version':
|
||||||
return pluginVersion
|
return pluginVersion
|
||||||
|
if searchMode == 'name':
|
||||||
|
return pluginName
|
||||||
|
|
||||||
|
|
||||||
def checkInstalledPackage(inputSelectedObject="all"):
|
def checkInstalledPackage(inputSelectedObject="all"):
|
||||||
@@ -122,9 +135,8 @@ def checkInstalledPackage(inputSelectedObject="all"):
|
|||||||
try:
|
try:
|
||||||
fileName = getFileName(plugin)
|
fileName = getFileName(plugin)
|
||||||
fileVersion = getFileVersion(plugin)
|
fileVersion = getFileVersion(plugin)
|
||||||
pluginId = getInstalledPlugin(fileName, fileVersion)
|
pluginId = getInstalledPlugin(fileName, fileVersion, plugin)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
i += 1
|
|
||||||
continue
|
continue
|
||||||
pluginIdStr = str(pluginId)
|
pluginIdStr = str(pluginId)
|
||||||
if fileVersion == '':
|
if fileVersion == '':
|
||||||
@@ -201,13 +213,11 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
try:
|
try:
|
||||||
fileName = getFileName(plugin)
|
fileName = getFileName(plugin)
|
||||||
fileVersion = getFileVersion(plugin)
|
fileVersion = getFileVersion(plugin)
|
||||||
pluginId = getInstalledPlugin(fileName, fileVersion)
|
pluginId = getInstalledPlugin(fileName, fileVersion, plugin)
|
||||||
latestVersion = getLatestPluginVersion(pluginId)
|
latestVersion = getLatestPluginVersion(pluginId)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
i += 1
|
|
||||||
continue
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
i += 1
|
|
||||||
continue
|
continue
|
||||||
pluginIdStr = str(pluginId)
|
pluginIdStr = str(pluginId)
|
||||||
if pluginId == None or pluginId == '':
|
if pluginId == None or pluginId == '':
|
||||||
@@ -326,7 +336,7 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
print(oColors.brightRed + f"FileNotFoundError: Old plugin file coulnd't be deleted" + oColors.standardWhite)
|
||||||
|
|
||||||
i = i + 1
|
i += 1
|
||||||
except TypeError:
|
except TypeError:
|
||||||
print(oColors.brightRed + "Error occured: Aborted updating for plugins." + oColors.standardWhite)
|
print(oColors.brightRed + "Error occured: Aborted updating for plugins." + oColors.standardWhite)
|
||||||
print(oColors.brightYellow + f"Plugins updated: [{pluginsUpdated}/{i}]" + oColors.standardWhite)
|
print(oColors.brightYellow + f"Plugins updated: [{pluginsUpdated}/{i}]" + oColors.standardWhite)
|
||||||
@@ -334,11 +344,24 @@ def updateInstalledPackage(inputSelectedObject='all'):
|
|||||||
print(oColors.brightGreen + "All found plugins are on the latest version!" + oColors.standardWhite)
|
print(oColors.brightGreen + "All found plugins are on the latest version!" + oColors.standardWhite)
|
||||||
|
|
||||||
|
|
||||||
def getInstalledPlugin(localFileName, localFileVersion):
|
def getInstalledPlugin(localFileName, localFileVersion, localPluginFullName):
|
||||||
url = "https://api.spiget.org/v2/search/resources/" + localFileName + "?field=name&sort=-downloads"
|
url = "https://api.spiget.org/v2/search/resources/" + localFileName + "?field=name&sort=-downloads"
|
||||||
packageName = doAPIRequest(url)
|
packageName = doAPIRequest(url)
|
||||||
plugin_match_found = False
|
plugin_match_found = False
|
||||||
pluginID = None
|
pluginID = None
|
||||||
|
localFileVersionNew = localFileVersion
|
||||||
|
i = 0
|
||||||
|
for i in range(0, 3):
|
||||||
|
if plugin_match_found == True:
|
||||||
|
break
|
||||||
|
if i == 1:
|
||||||
|
localFileVersionNew = re.sub(r'(\-\w*)', '', localFileVersion)
|
||||||
|
if i == 2:
|
||||||
|
pluginNameinYML = eggCrackingJar(localPluginFullName, 'name')
|
||||||
|
url = "https://api.spiget.org/v2/search/resources/" + pluginNameinYML + "?field=name&sort=-downloads"
|
||||||
|
packageName = doAPIRequest(url)
|
||||||
|
localFileVersion = localFileVersionNew
|
||||||
|
|
||||||
for ressource in packageName:
|
for ressource in packageName:
|
||||||
if plugin_match_found == True:
|
if plugin_match_found == True:
|
||||||
break
|
break
|
||||||
@@ -347,7 +370,7 @@ def getInstalledPlugin(localFileName, localFileVersion):
|
|||||||
packageVersions = doAPIRequest(url2)
|
packageVersions = doAPIRequest(url2)
|
||||||
for updates in packageVersions:
|
for updates in packageVersions:
|
||||||
updateVersion = updates["name"]
|
updateVersion = updates["name"]
|
||||||
if localFileVersion in updateVersion:
|
if localFileVersionNew in updateVersion:
|
||||||
plugin_match_found = True
|
plugin_match_found = True
|
||||||
pluginID = pID
|
pluginID = pID
|
||||||
updateId = updates["id"]
|
updateId = updates["id"]
|
||||||
|
Reference in New Issue
Block a user