Raised This Month: $81 Target: $400
 20% 

[AMX] Auto Updater


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-28-2023 , 17:02   [AMX] Auto Updater
Reply With Quote #1

Basically, it is a system that downloads new versions of your plugins automatically without having to install them manually. It also has a 'license' type of system that checks the IP of the server before downloading updates for the registered plugins. This option can be disabled since some hosts make the use of get_user_ip(0, useless.


It uses json to parse the data and curl to download the json-formated file to the server. Right after it downloads the file from the website, it checks and parses the data to check some informations, they are:

1. Name of the plugin you want to "download"
2. filename.amxx
3. Version
4. Directory
5. License option (in case you want make the plugin licensed only)

The last parameter makes the system also download other files than just .amxx files, such as .ini, .cfgs, .txts etc.

This is how the json-formated file looks like:

PHP Code:
{
    
"1":{
        
"pluginname""Your Plugin Name",
        
"filename""yourpluginname.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.0",
        
"licensecheck"false
    
}


If licensecheck is true, the plugin will check the IP of the server into the database before downloading the file, otherwise, just will download it.

It will check the version of the json-formated file and the version written in the plugin (AKA register_plugin()) before downloading it as well. So to trigger the download function, make the version value of the json-formated file different from the version registered with register_plugin() and thats it.

For files without this version trigger, it'll always download no matter the sizes or versions.
It seemed to be stable for most servers I tried. I also have another one that uses EasyHTTP module.

OBS: Make sure to register your database informations if USE_LICENSE is defined.

PHP Code:
#define DATABASE_HOST         "localhost"
#define DATABASE_USER        "root"
#define DATABASE_PASS        ""
#define DATABASE_NAME        "servers" 
(The EasyHTTP version doesn't use IP checker, it will download all the listed files since licensecheck key is not listed on the json-formated file).

Also, register your server links as well

CURL version:
PHP Code:
// this will be where the json-formated file will be located on your website. The plugin will download it first.
new const g_szWebsitePluginsListFile[] =     "https://www.yourwebsite.com/pluginsList.res"

// this will be where the downloaded file will be stored on the server.
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"

// this is where your auto-download plugins will be located and downloaded afterwards.
new const g_szWebsitePluginsLink[] =     "https://www.yourwebsite.com/plugins" 
EasyHTTP:

PHP Code:
// this will be where the json-formated file will be located on your website. The plugin will download it first.
new const g_szWebsitePluginsListFile[] =     "http://www.yourwebsite.com/pluginsList.res"

// this will be where the downloaded file will be stored on the server.
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"

// this is where your auto-download plugins will be located and downloaded afterwards.
new const g_szWebsitePluginsLink[] =         "https://www.yourwebsite.com/plugins" 
Thats all.
Attached Files
File Type: zip AutoUpdater CURL.zip (4.4 KB, 42 views)
File Type: zip AutoUpdater EasyHTTP.zip (2.11 MB, 32 views)
File Type: zip Modules Required.zip (1.88 MB, 20 views)
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 12-02-2023 at 14:10.
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-28-2023 , 17:07   Re: [AMX] Auto Updater
Reply With Quote #2

Reserved
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-29-2023 , 00:41   Re: [AMX] Auto Updater
Reply With Quote #3

The concept of a license makes absolutely no sense in a plugin so I'm not sure why you would think it makes any sense here. I have a feeling that what you're doing here has nothing to do with "licensing" and probably needs renamed to something more accurate.

Also, for the cURL version (the only one I looked at), you provide no information about cURL which you should provide since it's not part of AMX Mod X. Even if it's a link, it would be better than nothing.

However, overall, I don't really understand the purpose of this plugin. It looks like it only makes sense for a single server and you have to do all the work to put the plugin and its files onto a website with the proper organization so why not just put them on the server directly?

Speaking of file organization on your website for being downloaded, what exactly is the required setup there? You mention being able to download plugin resources but I don't see how, do you have an example of this configuration?
__________________
fysiks is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-29-2023 , 05:02   Re: [AMX] Auto Updater
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
The concept of a license makes absolutely no sense in a plugin so I'm not sure why you would think it makes any sense here. I have a feeling that what you're doing here has nothing to do with "licensing" and probably needs renamed to something more accurate.
Well maybe you are right. Licensing was the first thing that came up on my mind for me to name something that means that the plugin needs make sure whether the server is allowed to download the updated version of the plugin for some reason. This feature was on the cURL version since the beginning when I started building this and I stopped using it on the EasyHTTP afterwards.

Quote:
Originally Posted by fysiks View Post
Also, for the cURL version (the only one I looked at), you provide no information about cURL which you should provide since it's not part of AMX Mod X. Even if it's a link, it would be better than nothing.
On the link constants, there are descriptions on how you set ip up to be able to connect. I thought it was enough for people to understand.

Quote:
Originally Posted by fysiks View Post
However, overall, I don't really understand the purpose of this plugin. It looks like it only makes sense for a single server and you have to do all the work to put the plugin and its files onto a website with the proper organization so why not just put them on the server directly?
Think a little: the system downloads plugins automatically without you having to touch the server. Imagine you have 20 servers using 7 plugins you created. With this, you just upload all 7 plugins on your website and the system will download all updated plugins for all servers at once without you having to install them manually on all 20 servers. It helped me a while ago with a lot of plugins I built for users. Sometimes I lost the FTP data or had too much auto connections registered on File Zilla. With this all I had to do was update the plugin from my website and all servers got the plugin updated, saving me a lot of time.

Quote:
Originally Posted by fysiks View Post
Speaking of file organization on your website for being downloaded, what exactly is the required setup there? You mention being able to download plugin resources but I don't see how, do you have an example of this configuration?
Lets say your site is named www.forums.alliedmods.net
On the cURL, it will be:

PHP Code:
new const g_szWebsitePluginsListFile[] =     "https://www.forums.alliedmods.net/pluginsList.res"
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"
new const g_szWebsitePluginsLink[] =     "https://www.forums.alliedmods.net/plugins" 
All the plugins you want to auto update will be inside the plugins folder on your website.
The json-formated file will be also hosted on your website (pluginsList.res), it will be the first download the plugin will do to check the informations before starting to download the new versions avaliable.

So lets say I want to update a plugin called Kill Display, with filename killdisplay.amxx

On the json-formated file, it'll be

PHP Code:
{
    
"1":{
        
"pluginname""Kill Display",
        
"filename""killdisplay.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.1"// To trigger the download, I changed the previous version to the same version registered in register_plugin("Kill Display", "1.1", "EFFEX"), before it was 1.0
        
"licensecheck"false // this will ignore the IP check, everybody can update this plugin
    
}

With EasyHTTP:

PHP Code:
new const g_szWebsitePluginsListFile[] =     "http://www.forums.alliedmods.net/pluginsList.res"
new const g_szJsonFileDirectory[] =         "resource/pluginsList.res"
new const g_szWebsitePluginsLink[] =     "https://www.forums.alliedmods.net/plugins" 
Json-formated file:

PHP Code:
{
    
"1":{
        
"pluginname""Kill Display",
        
"filename""killdisplay.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.1" // To trigger the download, I changed the previous version to the same version registered in register_plugin("Kill Display", "1.1", "EFFEX"), before it was 1.0
    
}

To register any other file:

PHP Code:
{
    
"1":{
        
"pluginname""Plugins Languages",
        
"filename""translations.txt",
        
"directory""addons/amxmodx/data/lang"
    
}

In this case, it will be always downloaded on every map start since there is no version or file size checking avaliable for me to use before the download feature to trigger.
So in the end:

cURL:

PHP Code:
{
    
"1":{
        
"pluginname""Kill Display",
        
"filename""killdisplay.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.1"// To trigger the download, I changed the previous version to the same version registered in register_plugin("Kill Display", "1.1", "EFFEX"), before it was 1.0
        
"licensecheck"false // this will ignore the IP check, everybody can update this plugin
    
},
    
"2":{
        
"pluginname""Plugins Languages",
        
"filename""translations.txt",
        
"directory""addons/amxmodx/data/lang",
        
"licensecheck"false // this will ignore the IP check, everybody can update this .txt file
    
}

EasyHTTP:

PHP Code:
{
    
"1":{
        
"pluginname""Kill Display",
        
"filename""killdisplay.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.1" // To trigger the download, I changed the previous version to the same version registered in register_plugin("Kill Display", "1.1", "EFFEX"), before it was 1.0
    
},
    
"2":{
        
"pluginname""Plugins Languages",
        
"filename""translations.txt",
        
"directory""addons/amxmodx/data/lang"
    
}

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 11-29-2023 at 12:32.
EFFx is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-01-2023 , 01:40   Re: [AMX] Auto Updater
Reply With Quote #5

Quote:
Originally Posted by EFFx View Post
On the link constants, there are descriptions on how you set ip up to be able to connect. I thought it was enough for people to understand.
I'm not talking about URLs, I'm talking about the cURL module and its corresponding include file. It would be nice to know which version you've tested with and a quick way to download it.

Quote:
Originally Posted by EFFx View Post
Think a little: the system downloads plugins automatically without you having to touch the server. Imagine you have 20 servers using 7 plugins you created. With this, you just upload all 7 plugins on your website and the system will download all updated plugins for all servers at once without you having to install them manually on all 20 servers. It helped me a while ago with a lot of plugins I built for users. Sometimes I lost the FTP data or had too much auto connections registered on File Zilla. With this all I had to do was update the plugin from my website and all servers got the plugin updated, saving me a lot of time.
I'm not sure I'd want 20 identical servers though . . . Not sure who would need that many identical servers. If, instead, you set up a system that would allow the server to identify itself and then grab a list of plugins specifically configured for that server, maybe it makes more sense. Something like a JSON file per server; I guess you could just change the JSON file URL (and maybe the others) into a cvar and that would actually implement that feature.


Quote:
Originally Posted by EFFx View Post
To register any other file:

PHP Code:
{
    
"1":{
        
"pluginname""Plugins Languages",
        
"filename""translations.txt",
        
"directory""addons/amxmodx/data/lang"
    
}

In this case, it will be always downloaded on every map start since there is no version or file size checking avaliable for me to use before the download feature to trigger.
So in the end:

cURL:

PHP Code:
{
    
"1":{
        
"pluginname""Kill Display",
        
"filename""killdisplay.amxx",
        
"directory""addons/amxmodx/plugins",
        
"version""1.1"// To trigger the download, I changed the previous version to the same version registered in register_plugin("Kill Display", "1.1", "EFFEX"), before it was 1.0
        
"licensecheck"false // this will ignore the IP check, everybody can update this plugin
    
},
    
"2":{
        
"pluginname""Plugins Languages",
        
"filename""translations.txt",
        
"directory""addons/amxmodx/data/lang",
        
"licensecheck"false // this will ignore the IP check, everybody can update this .txt file
    
}

By file organization, I was referring to having to organize the files on your web server since not all plugins are downloaded as fully completed packages ready for copying directly into a server. For example, I was thinking of a file tree like this on the web server:

Code:
.
├── plugin1
│   ├── addons
│   │   └── amxmodx
│   │       ├── data
│   │       │   └── lang
│   │       │       └── plugin1.txt
│   │       └── plugins
│   │           └── plugin1.amxx
│   └── models
│       └── plugin1_specific_model.mdl
├── plugin2
│   ├── addons
│   │   └── amxmodx
│   │       └── plugins
│   │           └── plugin1.amxx
│   └── sound
│       └── plugin2_specific_sound.wav
Then, you would only need to configure for that plugin (and not all the files individually) and it would grab all files for that plugin. I didn't expect that you would need to list each individual file.


Overall, FYI, I was just trying to understand how this was supposed to be used (and for the sake of others), I'm not criticizing it.
__________________
fysiks is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-01-2023 , 05:38   Re: [AMX] Auto Updater
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
I'm not talking about URLs, I'm talking about the cURL module and its corresponding include file. It would be nice to know which version you've tested with and a quick way to download it.
Got it. Added.

Quote:
Originally Posted by fysiks View Post
I'm not sure I'd want 20 identical servers though . . . Not sure who would need that many identical servers. If, instead, you set up a system that would allow the server to identify itself and then grab a list of plugins specifically configured for that server, maybe it makes more sense. Something like a JSON file per server; I guess you could just change the JSON file URL (and maybe the others) into a cvar and that would actually implement that feature.
No... when I said 'lets say you have 20 servers', I wanted to say lets say you have 20 servers using your Kill Display plugin and you keep updating it. By giving them this Auto Updater, you can make all 20 download the plugin when you update then on your website instead of having to install the edited plugin in 20 different FTP connections, see now? The 20 servers does not need to be mine, thats why the 'License-like' thing in case I want to block the download for some servers.



Quote:
Originally Posted by fysiks View Post
By file organization, I was referring to having to organize the files on your web server since not all plugins are downloaded as fully completed packages ready for copying directly into a server. For example, I was thinking of a file tree like this on the web server:

Code:
.
├── plugin1
│   ├── addons
│   │   └── amxmodx
│   │       ├── data
│   │       │   └── lang
│   │       │       └── plugin1.txt
│   │       └── plugins
│   │           └── plugin1.amxx
│   └── models
│       └── plugin1_specific_model.mdl
├── plugin2
│   ├── addons
│   │   └── amxmodx
│   │       └── plugins
│   │           └── plugin1.amxx
│   └── sound
│       └── plugin2_specific_sound.wav
Then, you would only need to configure for that plugin (and not all the files individually) and it would grab all files for that plugin. I didn't expect that you would need to list each individual file.
I thought about it, but as big as the file is, it takes more time to download (obviously). And as I mentioned, there is no version or file size check that can be done BEFORE the download starts.

But you gave a valid point... maybe a file to each and individual servers, I could create something like
PHP Code:
"shouldDownload"true 
status on the json file so it can be downloaded once and not keep repeating... I may implement that.


Quote:
Originally Posted by fysiks View Post
Overall, FYI, I was just trying to understand how this was supposed to be used (and for the sake of others), I'm not criticizing it.
I understand that for most people, even creating a menu makes them struggle still. But the way this plugin works, it is not recommended to newbies because I see no other people using it but guys that have multiple servers using their plugins, which is old members and has more experience I assume. But yeah... you are right.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 12-03-2023 , 11:36   Re: [AMX] Auto Updater
Reply With Quote #7

regarding "licensecheck" for obvious reasons get_user_ip can be easily circumvented, failing which you can choose to use socket for its respective verification
__________________
mlibre is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 12-03-2023 , 11:44   Re: [AMX] Auto Updater
Reply With Quote #8

As mentioned, it was on the first version since the start and I did not touch it for months, hence the ezhttp version without any IP check.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode