linsyking / CanvasHelper2

New generation of Canvas Helper.
MIT License
13 stars 5 forks source link

Interfaces authentication and multi-user #25

Closed PACHAKUTlQ closed 4 months ago

PACHAKUTlQ commented 5 months ago

All the interfaces have been protected by JWT based authentication system, with only logged-in users can access the configs and make modifications to announcements and configs of his own. All the authentications are based on user, and the sign-up and log-in interface have been added, which enables multiple users to share the same backend while still supporting a single user running uvicorn locally.

linsyking commented 5 months ago
  • /browser should open the link in frontend instead of backend, since backend can be put on a server instead of running locally

Generally it should open in the frontend but in wallpaper engine it bans user from opening web browser so maybe we can set this as an option in config file.

linsyking commented 5 months ago

Hi, may you change the target branch to feat/multi-user? Thanks!

linsyking commented 5 months ago

You need to add new dependencies like passlib to requirements.txt. Test it in a new environment (clone in another folder, create venv).

I have error when starting:

  File "auth.py", line 51, in gen_key
    with open(secret_file, 'w') as f:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './canvas/.secret'
PACHAKUTlQ commented 5 months ago

There is an easier workaround for path on Windows by simply format Windows path into Unix path: fullPath = fullPath.replace("\\", "/"), so no need for merge conflicts.

PACHAKUTlQ commented 5 months ago

You need to add new dependencies like passlib to requirements.txt. Test it in a new environment (clone in another folder, create venv).

I have error when starting:

  File "auth.py", line 51, in gen_key
    with open(secret_file, 'w') as f:
         ^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './canvas/.secret'

If you encounter this, please add a folder called canvas, where there are two empty folders, one called user_configs and the other called user_caches. The .secret file will be automatically written into the canvas directory. This FileNotFoundError seems to be because the canvas folder is ignored by .gitignore (of course files in it MUST be ignored, but the empty folder should be there.). I will fix it.

linsyking commented 4 months ago

Hi, could you push code to a branch in this repo rather than in this PR?

PACHAKUTlQ commented 4 months ago

ok. I forgot to close this PR. I am closing it now. I will open a new branch as soon as I fix the bugs.