Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

[Feature Request] Allow Custom Location of Demos Folder #144

Closed
TandelK opened this issue Oct 14, 2019 · 10 comments
Closed

[Feature Request] Allow Custom Location of Demos Folder #144

TandelK opened this issue Oct 14, 2019 · 10 comments
Labels
feature suggestion Something to think about.

Comments

@TandelK
Copy link

TandelK commented Oct 14, 2019

Is your feature request related to a problem? Please describe.
Currently the Website gets demo from the server using the FTP upload function to demos folder but there are limitations on the host of Data Transfer specially VPS or dedicated host where Data Transfer , Uploads and Downloads are all calculated , so people like to use Cusom location of Demos to be used. For eg. , we have Unlimited Web Hosting Plans where we have access to FTP and even Website Protocol where we can have Unlimited Data as well as Data Transfer. Can we use this area for linking with Demos to be uploaded on this servers instead of Get5-Web host server.

Describe the solution you'd like
We can use Custom Config where we can use Demos folder Web Location like Website path to Demos folder which already comes to Web Hosting. For eg.
matches.get5web.com has the Panel
demos.get5web.com defined as the Demos folder with Web Hosting plan. so in config we can use Use Demos Custom Location : "" If left empty can use default Web Host of Get5Web i.e. matches.get5web.com/static/demos folder and in case if we change Demos Custom Locaiton to "demos.get5web.com" the path gets change of demos to be i.e. demos.get5web.com/demoname.dem or demoname.zip

After the match has ended the Panel can check with filename.dem or .zip exist or not and show button if exist of download demo

SOLUTION
Add .htaccess file in home directory of get5-web
Add the following lines to it for it.

Options +FollowSymLinks
RewriteEngine On

RedirectMatch ^/static/demos/(.*)$ https://csgodemo.websitename.com/$1

Make sure your Apache2 configuration location for Directory /var/www has override set to all instead of none.

@TandelK TandelK added the feature suggestion Something to think about. label Oct 14, 2019
@mrc4tt
Copy link

mrc4tt commented Oct 14, 2019

I agree.

@PhlexPlexico
Copy link
Owner

So, this is a twofold problem as I would not like to make it a bandaid fix. PRs are welcome, but essentially what you will need to do is the following:
Modify the parameter sent by the api_stats plugin, and add in another config option to the plugin itself. This requires creating a new variable, and making some adjustments through the program flow of demo uploads. Someone could also remove compression from the plugin for now, or comment it out, either or. If you fix the plugin, you don't need to make modifications to the webapp whatsoever, due to how the URL is sent over in the first place (api_stats sends the g_APIURLCvar essentially, which is set when a match is created).

An absolute band-aid fix which I do not recommend, would be to create a config option in the webapp, then proceed to get the URL via request in the api.py and use strings to replace the URL with the config option. Would not recommend.

Lastly, and probably the easiest as it is the least work of development, would be to setup HTTP redirects on your webserver to go to your other subdomain you have setup. I believe this may work, after a short amount of googling, as per your example:
RedirectMatch ^/static/demos/(.*)$ https://demos.get5web.com/$1

This should redirect and remap everything that's located in /demos/ on the site to your subdomain. This is Apache only, but if you are running Nginx, you can find more info online: https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections

I think the redirect would be the best way to go, personally, as I do not wish to attempt to fix the api_stats as its held together by duct-tape and dreams. However, if you wish to make changes and test it well enough where everything works as it should, feel free to make a PR :)

@PhlexPlexico
Copy link
Owner

Any updates? I would really recommend just doing the redirect on a web server level.

@PhlexPlexico PhlexPlexico added the on hold Something that is awaiting response. label Oct 24, 2019
@PhlexPlexico
Copy link
Owner

Mind if I close this? I probably won't be touching the plugin to add a custom location for uploads like mentioned, but HTTP(s) redirection should work as stated above, it's more user config. on the web server, if anything.

@TandelK
Copy link
Author

TandelK commented Nov 9, 2019

I tested with the above line of .htaccess code for Rewrite and i can confirm it is 100% working.

RedirectMatch ^/static/demos/(.*)$ https://demos.get5web.com/$1 This command is working 100% for Demo download function.

@TandelK
Copy link
Author

TandelK commented Nov 9, 2019

Problem i faced is my FTP requires TLS Explicit Connection and without that it wont allow CSGO Server to upload to that FTP. So i think need to check how to enable no encryption based FTP for my host.

@PhlexPlexico
Copy link
Owner

Sounds good. Hopefully you can figure that out, but I'm glad the rewrite rule worked :) mind if we close this for now?

Thanks!

@PhlexPlexico PhlexPlexico removed the on hold Something that is awaiting response. label Nov 9, 2019
@TandelK
Copy link
Author

TandelK commented Nov 21, 2019

Closing . Fixed . Is there any way we can add this small section in Wiki Pages ? @PhlexPlexico

@PhlexPlexico
Copy link
Owner

Sure thing. I'll give a small info section about demo upload redirection when I have the time here :) will close this issue once it's complete!

@PhlexPlexico
Copy link
Owner

Now within the wiki with reference back to this issues solution. It can be found here: https://github.com/PhlexPlexico/get5-web/wiki/Demo-Locations

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature suggestion Something to think about.
Projects
None yet
Development

No branches or pull requests

3 participants