Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements admin/avatar/maps/profile/session/shards/registration apis and small fixes #106

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

dragonhunt02
Copy link
Contributor

@dragonhunt02 dragonhunt02 commented Feb 25, 2025

#103

Additions

  • Add temporary Mailer config (in-memory email storage) for production. This must be replaced with an email service adapter in final server.
  • Serve user content at /uploads with Waffle and Caddyfile
  • Require authenticated_user to access certain endpoints. Since game client and website share some endpoints, a ChooseAuth plug was added to fallback to Cookie authentication if Authorization header is missing.
  • Add avatar/maps /dashboard endpoints
  • Add /admin api endpoint and control panel page stub
  • Add /profile /session /registration game client endpoints
  • Add /session/renew dummy endpoint to refresh access tokens for game client compatibility
  • Completed /shards endpoints implementation
  • Add SIGNUP_API_KEY key to authenticate game client signup requests
  • Add script priv/repo/test_user_content.exs to populate database with test user content

Fixes

  • Disable cache_static_manifest (no file is served from priv/static)
  • Fix missing alias in lib/uro/controllers/identity_proof_controller.ex
  • Add missing function is_session_admin?/1
  • Fix Uro.Plug.Authentication authentication. Client Authorization token was not recognized because it was sent without Bearer prefix
  • Fix priv/repo/test_seeds.exs not confirming email of generated users

Endpoints were tested with curl, further testing is needed

Missing features:

  • Define openapi avatar/maps query specs

@dragonhunt02
Copy link
Contributor Author

Updated with new endpoints

@dragonhunt02 dragonhunt02 changed the title Implements admin/avatar/maps api and small fixes Implements admin/avatar/maps/profile/session/registration apis and small fixes Feb 26, 2025
@github-actions github-actions bot force-pushed the api-fix branch 2 times, most recently from 9752ba1 to fe7072f Compare March 6, 2025 03:59
@dragonhunt02 dragonhunt02 changed the title Implements admin/avatar/maps/profile/session/registration apis and small fixes Implements admin/avatar/maps/profile/session/shards/registration apis and small fixes Mar 6, 2025
@dragonhunt02
Copy link
Contributor Author

Updated with /shards fixes.

Server can receive uploads and host shards now

@fire
Copy link
Member

fire commented Mar 7, 2025

image

Weird

@dragonhunt02
Copy link
Contributor Author

Weird

All test files are empty dummy files generated with touch. I'm not sure what we want to use in final server, however they were good enough as placeholders.

We can replace them after we decide what test scenes to use.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge in a few days.

@fire
Copy link
Member

fire commented Mar 7, 2025

My argument for making the test files real is we should not allow fake files in theory. Yes thats hard but we should at least block mime types that don’t match and zero files

@dragonhunt02
Copy link
Contributor Author

My argument for making the test files real is we should not allow fake files in theory. Yes thats hard but we should at least block mime types that don’t match and zero files

I agree, an extension whitelist is not enough

@versions [:original]
@extension_whitelist ~w(.scn)
# Whitelist file extensions:
def validate({file, _}) do

I think we should handle this in a new issue though.

By the way, if we make test files real we will have a binary .scn in repository, is it ok? @lyuma

@lyuma
Copy link
Member

lyuma commented Mar 7, 2025

@dragonhunt02 If the binary .scn is for a test scene with a plane and default cube, it should be a few kilobytes which is fine. Same thing for .glb and .vrm

File type Checks could make it harder to add more formats or encrypted formats, so I am worried it will make that more difficult in the future, but for now glb header (.glb and .vrm) and RSRC header (.scn) is all I upload

@dragonhunt02
Copy link
Contributor Author

@dragonhunt02 If the binary .scn is for a test scene with a plane and default cube, it should be a few kilobytes which is fine. Same thing for .glb and .vrm

.glb and .vrm are blocked right now. Indeed the test scene needs to be a minimal working scene. 👍

File type Checks could make it harder to add more formats or encrypted formats, so I am worried it will make that more difficult in the future, but for now glb header (.glb and .vrm) and RSRC header (.scn) is all I upload

I don't think it will be a problem, we can filter allowed extensions like what we are doing now and then run optional tests to ensure extension matches binaries.

@lyuma
Copy link
Member

lyuma commented Mar 7, 2025

My code in xr_avatar supports glb. This sort of debate is why I'd prefer not to enforce a whitelist for now, but if we do go for a whitelist, I want at least one standardized 3d format such as glb.

@dragonhunt02
Copy link
Contributor Author

dragonhunt02 commented Mar 7, 2025

My code in xr_avatar supports glb. This sort of debate is why I'd prefer not to enforce a whitelist for now, but if we do go for a whitelist, I want at least one standardized 3d format such as glb.

Well, whitelist on uploads was already enforced before my PR. So, I will add .glb to allowed extensions (next PR?)

@fire Could you handle generating the test avatars/scenes/images?

@fire
Copy link
Member

fire commented Mar 7, 2025

Sure.

I'll grab the vrm1, a standard glb and a binary godot engine scene.

@lyuma
Copy link
Member

lyuma commented Mar 7, 2025

I am not okay with anything above a few kilobytes at this stage.
They should be simple, export a cube with no texture for glb. For VRM, we don't technically need a vrm sample since the file format is still glb.

if we really want to write a validator on the server, that should be a separate PR and we need to consider security implications. For now I assume that all this should be doing is checking the magic bytes in the file header

@fire
Copy link
Member

fire commented Mar 7, 2025

@fire
Copy link
Member

fire commented Mar 8, 2025

@dragonhunt02
Copy link
Contributor Author

@fire Lyuma suggested opening another PR for test_content/ scenes, I agree.
So I removed test_content from this PR.

@fire fire merged commit 3a9839b into V-Sekai:master Mar 11, 2025
@fire
Copy link
Member

fire commented Mar 11, 2025

Thanks! I am a bit busy this week so I'd like a small tutorial how to run uro.

@dragonhunt02
Copy link
Contributor Author

dragonhunt02 commented Mar 11, 2025

Instructions are in README.md Quick Setup
After booting server with docker compose up, you have to export/run V-Sekai game with https://vsekai.local set as address in Project Settings/Uro

I don't have a script ready to quickly install Caddy SSL certificates though. Game will fail TLS handshake if they're not correctly installed.

@fire
Copy link
Member

fire commented Mar 11, 2025

I can proxy uro through tailscale that has a proper CA certificate and is globally accessible.

@dragonhunt02
Copy link
Contributor Author

dragonhunt02 commented Mar 11, 2025

Well, you can replace Caddyfile with Caddyfile.development from my other PR. It runs Caddy server on port 80 so you won't have to deal with certificates.

You can send me a message if you find issues setting it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants