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

Credentials #4

Closed
camjac251 opened this issue Apr 22, 2020 · 17 comments
Closed

Credentials #4

camjac251 opened this issue Apr 22, 2020 · 17 comments
Labels
help wanted Extra attention is needed

Comments

@camjac251
Copy link

I think I missed something during setup. I made a postgresql db and username but when I view the table for users, nothing shows up. Is there an installer setup that I should run? I get redirected to /api/login but never signed up.

@Jack-Gledhill
Copy link
Owner

You need to configure a superuser in the config.yml file. Then you need to login using the configured username and password, after that click the Lock icon in the top right and create a user from there.

@camjac251
Copy link
Author

Does it work with the defaults in the example?

Should this work with username superuser and pass youshallnotpass?

# ================
# Superuser config
# ================
superuser:
    username: superuser
    password: youshallnotpass

    display_name: Administrator
    api_token: Master youshallnotpass

@Jack-Gledhill
Copy link
Owner

Yes that would work

@camjac251
Copy link
Author

I tried to login using those credentials and it failed. Weird

@Jack-Gledhill
Copy link
Owner

Odd. Are you sure you've got it word for word? Have you made sure that you've restarted the server after changing the config file?

@camjac251
Copy link
Author

Yup. I even tried to change the username and pass to my username and it still failed. I'm closing the process before changing the config.

@Jack-Gledhill
Copy link
Owner

Could you add a line of code to bottom of util/constants.py for me and send me what you see in the console?
print(const.superuser)

@camjac251
Copy link
Author

camjac251 commented Apr 22, 2020

 __  __ ____   ____       ___                             
|  \/  / ___| / ___|___  |_ _|_ __ ___   __ _  __ _  ___  
| |\/| \___ \| |  _/ __|  | || '_ ` _ \ / _` |/ _` |/ _ \ 
| |  | |___) | |_| \__ \  | || | | | | | (_| | (_| | (_) |
|_|  |_|____/ \____|___/ |___|_| |_| |_|\__,_|\__, |\___/ 
                                              |___/       

appears at the top. It looks like it clears the console before which had the output

I did take a screenshot though and OCR'd it

<user api_token:str=Master youshallnotpass class_name:str=user created_at:str=2020-04-22 16:04:53.456780 display_name:str=camjac251 is_admin:bool=True password:str=youshallnotpass user_id:int=0 username: str=superuser>

@Jack-Gledhill
Copy link
Owner

You're certain that the username you're entering at /api/login is superuser and the password is youshallnotpass?

@camjac251
Copy link
Author

100% certain. I will change it again and try a new username and pass just to see

@camjac251
Copy link
Author

I think I found the culprit. I'm sorry for wasting your time.
It worked on Chrome just now. Firefox keeps failing

@Jack-Gledhill
Copy link
Owner

Ah. I see! Don't worry, that's not your fault, I clearly forgot to add browser compatibility somewhere. Have a good day!

@camjac251
Copy link
Author

Thank you.

I'm testing it through ShareX now but it's not going as fast as I'd hope. Is there a throttle happening somewhere? It's locked at 16-16.8MB/s. On the same server with a PHP sharex custom uploader, I get 80MB/s

@Jack-Gledhill
Copy link
Owner

The server isn't throttling anything itself so perhaps it has something to do with your connection as well as what Nginx is doing in the background? Unfortunately the server is made at a pretty high-level so there's little I can do about poor connection speeds.

@camjac251
Copy link
Author

camjac251 commented Apr 22, 2020

I'm using the direct ip and port that the app is running on for testing. I'm pretty sure it's not "my connection speed".
I am running another file host that is on PHP on the same server that this script is running from. When I transfer the same file to each, I get 16MB/s for this app, and 80MB/s for the PHP one.

That's why I'm worried there's a bottleneck somewhere.

@camjac251
Copy link
Author

I haven't been able to figure out what's wrong with uploading from sharex. It fails with every attempt.

This is the log from the server

[2020-04-22 20:07:31,575] ERROR in app: Exception on /api/upload [POST]
Traceback (most recent call last):
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/root/imago/imagoweb/plugins/api.py", line 219, in upload_file
    file.save(f"static/uploads/{discriminator}")
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/werkzeug/datastructures.py", line 3066, in save
    dst = open(dst, "wb")
FileNotFoundError: [Errno 2] No such file or directory: 'static/uploads/aM8OBnt2.png'
[2020-04-22 20:07:32,618] ERROR in app: Exception on /api/upload [POST]
Traceback (most recent call last):
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/root/imago/imagoweb/plugins/api.py", line 219, in upload_file
    file.save(f"static/uploads/{discriminator}")
  File "/root/anaconda3/envs/imago/lib/python3.6/site-packages/werkzeug/datastructures.py", line 3066, in save
    dst = open(dst, "wb")
FileNotFoundError: [Errno 2] No such file or directory: 'static/uploads/Oh6vhksQ.png'

@Jack-Gledhill
Copy link
Owner

This looks like a Wekzeug error to me. Please submit another Issue.

Repository owner locked as resolved and limited conversation to collaborators Apr 23, 2020
@Jack-Gledhill Jack-Gledhill added the help wanted Extra attention is needed label Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants