Closed z2labplus closed 2 days ago
in the neko v3 or neko-rooms v3 ? and the v3 is release?
In neko v3, neko rooms works with both. Its on the v3 branch.
what different about with the v3 and v3-phase1?
when I git clone v3 I run the neko/client/dev/serve neko/server/dev/start
not the chrome?
what different about with the v3 and v3-phase1?
Its all explained in https://github.com/m1k1o/neko/issues/371
not the chrome?
It is meant only for development. But you could replace directory server/dev/runtime/
with .docker/google-chrome/
and then rebuild, to get it working even for development.
Thanks very much! Can we add users through APIs? Delete user? ban user ?
In v3 yes. You can copy the openapi.yaml to some editor like https://swagger.io and it shows you interactively what APIs are available.
I use the https://app.swaggerhub.com/apis/Z858570636/n-eko_rest_api/1.0.0#/members/membersCreate
but it show the error
{
"code": 401,
"message": "Unauthorized"
}
how to add the token
You need to perform login, one of the first api calls. And then there is probably possibly to set the token in swagger. https://stackoverflow.com/questions/32910065/how-to-use-authorization-bearer-token-in-a-swagger-spec
I use the /api/login
and then get the response
and then use the token
{
"id": "admin-tRjjT",
"token": "VBPykToh-HpB7Yuw-gDRMkoutYmatJriI-IC6BE9iqmy3Bs6sM8lhRTbI83CdoRs",
"profile": {
"name": "admin",
"is_admin": false,
"can_login": true,
"can_connect": true,
"can_watch": true,
"can_host": true,
"can_share_media": true,
"can_access_clipboard": true,
"sends_inactive_cursor": true,
"can_see_inactive_cursors": false,
"plugins": null
},
"state": {
"is_connected": false,
"is_watching": false
}
}
and then use the
import requests
url = "http://74.48.86.124:3000/api/members"
token = "VBPykToh-HpB7Yuw-gDRMkoutYmatJriI-IC6BE9iqmy3Bs6sM8lhRTbI83CdoRs"
headers = {
"Authorization": f"Bearer {token}"
}
data = {
"username": "admin",
"password": "neko",
"profile": {
"name": "bill",
"is_admin": False,
"can_login": True,
"can_connect": True,
"can_watch": True,
"can_host": True,
"can_share_media": True,
"can_access_clipboard": True,
"sends_inactive_cursor": True,
"can_see_inactive_cursors": True,
"plugins": {
"additionalProp1": {}
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.text)
but I get the result
403
{"code":403,"message":"session is not admin"}
request failed (401): Unauthorized error="no authentication provided"
I say the admin account not the admin, another account ? how to solve it ?
As you can see in your details, the user is not admin, so he cannot list members.
By default the login is done the same way as in the neko v2, where you have a single password for admin and a single password for user. When you use this password it creates a new profile based on that. It looks like you used password neko
that is probably assigned to user profile. Even though you used username admin
its just a display name that can be anything. Try using the adming password.
I use the
username:admin
password:admin
to get the token
and send the request
import requests
url = "http://74.48.86.124:3000/api/members"
token = "nzw_3LufSXeiUQeOunmpjwo71L3smIp8qql6Q208yMk_OhgMH0z2sGaXGRgTougk"
headers = {
"Authorization": f"Bearer {token}"
}
data = {
"username": "user2",
"password": "password2",
"profile": {
"name": "bill2",
"is_admin": True,
"can_login": True,
"can_connect": True,
"can_watch": True,
"can_host": True,
"can_share_media": True,
"can_access_clipboard": True,
"sends_inactive_cursor": True,
"can_see_inactive_cursors": True,
"plugins": {
"additionalProp1": {}
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.status_code)
print(response.text)
but it still can not to create the new user,it raise the error
ERR request failed (500): Internal Server Error error="new user is created on first login in multiuser mode" how to solve it?
By default, there is multiuser mode meaning that new users are created when logging in. You can switch to other user mode and then you need to create your own users.
Add this to env:
NEKO_SESSION_API_TOKEN="yourApiTokenCanBeAnything"
NEKO_MEMBER_PROVIDER="object"
You will now need to create your own users and you can delete/manage them. By default you will have no users when starting neko, and you can use the specified access token to create these users.
Or you can preserve your logins by using file provider. All users will be saved to specified json file. You must then mount it outside of container to have it available when recreated.
NEKO_MEMBER_PROVIDER="file"
NEKO_MEMBER_FILE_PATH="/path/to/members.json"
add this NEKO_SESSION_API_TOKEN="yourApiTokenCanBeAnything" NEKO_MEMBER_PROVIDER="object" to the .docker/.env.default file ?
If you use dev scripts then you need to directly modify start script. You will see there are other environment variables and you need to add it to them.
I motify the file server/dev/start and run the server/dev/start and I request again,it also show me the error new user is created on first login in noauth mode" how to solve it ? also can not throught the api to create new user
The issue is probably your additional quotes'
. It looks like neko parses the string as 'object'
with the quotes, and it cannot find it so it fallbacks to noauth mode. Remove it as well from token.
So it should look like this:
-e "NEKO_SESSION_API_TOKEN=yourApiTokenCanBeAnything" \
-e "NEKO_MEMBER_PROVIDER=object" \
it works,thanks a lot!
Can I Kick or Ban someone from the room through the API? or Can I make someone in the room lose control through an API?