PhlexPlexico / get5-web

[END OF LIFE] Webpanel for servers using the get5 CS:GO server plugin
GNU General Public License v3.0
21 stars 10 forks source link

[HELP] Upload logo (Edit Team as option) #161

Closed mrc4tt closed 4 years ago

mrc4tt commented 4 years ago

Is your feature request related to a problem? Please describe. Could be nice, if we could get made, so it's too possible to "Upload Logo" as admin via Edit Team, without to delete team&create new team again, for each (with upload logo)

Describe the solution you'd like As noted upper. Logo Upload under "Edit Team" without doing delete team/create again.

Describe alternatives you've considered N/A

Additional context Here is an example, where I did view (source code on browser and copied, for view, what I mean!) Example: team/X number/edit for Upload Logo. (Without to create a new team or delete!) screen

PhlexPlexico commented 4 years ago

I'm not exactly sure what you mean by this. The team edit page already has an upload logo area on the form? At least for my instance direct from master, it does. I can edit any team and upload logos from there.

mrc4tt commented 4 years ago

The problem is; I can't (as super_admin) go to the "Team" and Edit because there is no "logo" to choose/or can't upload the logo.

Same with; If I adding a "logo" to the team (it will view) but if I click "F5" it will be gone from the team. ;/

PhlexPlexico commented 4 years ago

What happens if you upload a logo? Are any errors produced in the log?

mrc4tt commented 4 years ago
/var/www/get5-web/venv/lib/python2.7/site-packages/flask_cache/jinja2ext.py:33: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache instead.
  from flask.ext.cache import make_template_fragment_key
/var/www/get5-web/get5/team.py:130: FlaskWTFDeprecationWarning: The "FileField" subclass is no longer necessary and will be removed in 1.0. Use "wtforms.FileField" directly in$
  upload_logo = FileField(validators=[valid_file])
[Wed Oct 23 15:20:12.872850 2019] [wsgi:error] [pid 7246] INFO:flask.app:Added new logo id linux-svgrepo-com_1
[Wed Oct 23 15:20:12.964763 2019] [wsgi:error] [pid 7246] INFO:flask.app:User 1 created team 14

Dunno, about I, should ignore this. as I see "svgrepo" do upload. (or added)

As example added. ;)

@PhlexPlexico

PhlexPlexico commented 4 years ago

Can you please attach the SVG you're trying to upload? Also try using a 2-3 character name, like TMP.svg.

PhlexPlexico commented 4 years ago

https://github.com/PhlexPlexico/get5-web/blob/master/get5/team.py#L66

mrc4tt commented 4 years ago

should "SVG" not uploading automatic to?: get5/static/resource/csgo/materials/panorama/images/tournaments/teams

//Update: Ok, I found out 2 logos (as short with 3 character name) they don't show ingame. So the question is just, how I can fix them.. I have photoshop, but no idea, how I should get them to work.

I have both logos (SVG) on the original with 2000x2000.

PhlexPlexico commented 4 years ago

Well 2000x2000 is way too large to begin with, try down-sizing to 64x64. Next, make sure those logos exist on your machine as well, if they don't they won't show in game. Same folder structure, but on your local copy of CS:GO. Make sure they also load on the server, check those folders as well.

mrc4tt commented 4 years ago

Well 2000x2000 is way too large to begin with, try down-sizing to 64x64. Next, make sure those logos exist on your machine as well, if they don't they won't show in game. Same folder structure, but on your local copy of CS:GO. Make sure they also load on the server, check those folders as well.

I found out, what happens. Logo (SVG) was 850% zoomed from dropbox, so I couldn't see the logo anyway. :D

PhlexPlexico commented 4 years ago

Sooooo that being said, is this okay now? Are you able to see the edit logo? I haven't been able to reproduce now.

mrc4tt commented 4 years ago

@PhlexPlexico, Nah. If I edit the team. I can't see the "Upload logo" (but only, if I create new) OR if I uploading manually to "img/logos" eg. (Where I can find the file under "Logo")

PhlexPlexico commented 4 years ago

Give the development branch a try. I missed a super admin check :)

mrc4tt commented 4 years ago

I will do a check! ;)

mrc4tt commented 4 years ago

Update: Should "Upload Logo" not uploading SVG file to get5-web/get5/static/img/logos or do I need to upload manually?

I did upload a file called: lol.svg but it's not uploaded to the get5-web server. 🤔🤔 @PhlexPlexico

/var/www/get5-web/venv/lib/python2.7/site-packages/flask_cache/jinja2ext.py:33: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache inste$
  from flask.ext.cache import make_template_fragment_key
/var/www/get5-web/get5/team.py:130: FlaskWTFDeprecationWarning: The "FileField" subclass is no longer necessary and will be removed in 1.0. Use "wtforms.FileField" d$
  upload_logo = FileField(validators=[valid_file])
/var/www/get5-web/venv/lib/python2.7/site-packages/flask_cache/jinja2ext.py:33: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache inste$
  from flask.ext.cache import make_template_fragment_key
/var/www/get5-web/get5/team.py:130: FlaskWTFDeprecationWarning: The "FileField" subclass is no longer necessary and will be removed in 1.0. Use "wtforms.FileField" d$
  upload_logo = FileField(validators=[valid_file])

I get this on error.log (apache2) when I upload.

Can be it because of permission? for it running as root:root and not www-data:www-data

PhlexPlexico commented 4 years ago

Since those are deprecation warnings, they can be ignored as it is not using FlaskWTF, but a different library for FileField.

As for permissions. I disable my root accounts as soon as I can on my servers. So currently, everything in my get5-web is owned by me (except for logs folder) and the resource folder belongs to the www-data group. For you it should be chown -R root:www-data get5-web/get5/static/; chmod -R 776 get5-web/get5/static. Work permissions back from there.

mrc4tt commented 4 years ago

Hmmm. I did update it.. but

do we agree that "Logo upload" should transfer the file over to the path, correct?

path: get5-web/get5/static/img/logos/ <<<<

PhlexPlexico commented 4 years ago

No, it shouldn't. You can check the source code for it, and see that it goes into:

if (width in {'64', '64px'}) and (height in {'64', '64px'}):
            tree.write(app.config['PANO_LOGO_FOLDER'] +
            "/" + secure_filename(filename))

Source

So please check where your panorama folder is defined, and see if the file is uploaded there.

mrc4tt commented 4 years ago

Hmmm.

I don't find the file as lol.svg I did check on:

get5-web/get5/static/resource/csgo/materials/panorama/images/tournaments/teams
get5-web/get5/static/img/logos

Big Strange!

I did check on prod_config.py There is nothing with LOGO_DIR for panorama. :/ // So, in fact, I have to upload all the .svg files manually?

PhlexPlexico commented 4 years ago

Logo directory, much like the original, was stored in __init__.py, so it can be found here: https://github.com/PhlexPlexico/get5-web/blob/development/get5/__init__.py#L49

PhlexPlexico commented 4 years ago

Please upload the SVG file here, I would like to try and upload it within my instance.

mrc4tt commented 4 years ago

lol.zip

Couldn't upload SVG, so I did pack it down to .zip ;) @PhlexPlexico

It should be 64x64 ;)

PhlexPlexico commented 4 years ago

image

https://github.com/PhlexPlexico/get5-web/blob/development/get5/team.py#L100

It's not formatted to be 64x64.

Please adjust your <svg> tag to include: <svg id="Capa_1" data-name="Capa 1" height="64px" width="64px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 59 59">

mrc4tt commented 4 years ago

Weird, I don't get the same "error" on get5-web ;/ on my page.

Update: It don't there on the "folders" as I did name on an earlier post. ;/ did check my own logo.

I think, there are some weird settings on my VPS. ;n

TandelK commented 4 years ago

@PhlexPlexico where does by default logos get stored? If we try to upload .svg and we can see the Logo name while Editing Team or selecting from the Menu but if i go to those directories i cannot see any logos got uploaded to their respective folders. I looked in all the three locations but there were none of the logos uploaded.

mrc4tt commented 4 years ago

where does by default logos get stored? If we try to upload .svg and we can see the Logo name while Editing Team or selecting from the Menu but if i go to those directories i cannot see any logos got uploaded to their respective folders. I looked in all the three locations but there were none of the logos uploaded.

Same problem I have as, @TandelK notes! ;)

So it actually means I have to "personally" as an owner/sponsor who has 15 csgoservers, I have to manually ask people for their logo (SVG) and then I have to upload manually...I thought it was all uploaded automatically ... which there is also hinted at the script .. "Upload logo"

TandelK commented 4 years ago

@MikkelDK the Upload Logo function is only available for Admins to upload to their respective Teams and there is no public upload function available as it may create controversy at any given time due to Logos uploaded by people.

Currently there is a bug that logos are not getting uploaded, once they get uploaded it is all automatically done including FastDL as the path where Logos are stored are exact path of FastDL .

mrc4tt commented 4 years ago

@MikkelDK the Upload Logo function is only available for Admins to upload to their respective Teams and there is no public upload function available as it may create controversy at any given time due to Logos uploaded by people.

Currently there is a bug that logos are not getting uploaded, once they get uploaded it is all automatically done including FastDL as the path where Logos are stored are exact path of FastDL .

Yeah......I know? but there is NO logo! not EVEN them I'm uploading from Logo Upload function. only, if I "doing" manual (UPLOAD) via SFTP ;)

PhlexPlexico commented 4 years ago

Like I mentioned before the logos for SVGs are stored in /static/resource/csgo/materials/panorama/images/tournaments/teams/ so that you could even set your get5 panel as a FastDL (https://get5.instance/static/resource/csgo) so that it can download from where you uploaded it.I tried your SVG with my instance, had to adjust the image and height in the main <svg> tag as it didn't exist, and then uploaded it. It was successful in uploading, appended to the image list, and was there in that directory. I'm not exactly sure what to tell you if it's not working on your instance, as your log isn't providing any errors. It even showed it on my instance itself.

Here's from editing a team: image image image image

TandelK commented 4 years ago

@PhlexPlexico can you share what are the permissions of these folders ? Do we require any specific users access to those directories.

PhlexPlexico commented 4 years ago

I probably need to tighten permissions on mine, but my folders are in my www-data group, with rwxrwxr-x for my images, so that www-data can upload them to that directory.

PhlexPlexico commented 4 years ago

Closing as no response in over two weeks.