Code Monkey home page Code Monkey logo

hummingbird's Issues

Получения uid других пользователей

Сделать возможность получать uid, случайный, или по критерию, других пользователей. Что бы его использовать, для взаимодействия с игровыми данными другого пользователя.

Content

Server API
Сделать возможность разработчику создавать данные на сервере в виде пары Key:Value, которые пользователь через клиент может только считывать.

Например /uploadcontent/{pid}/{token}, где pid - project id, token - account token

Client API
Сделать возможность загружать данные для игры, такие как например: версия, параметры уровня, и т.д. Через ключ этих данных, или загружать все данные.

  1. Через ключ:
    /getcontent/{pid}/{key}, где key - ключ наших данных.

Возвращает:
{ string value; }

  1. Все данные:
    /getcontent/{pid}

Возвращает все наши пары Key:Value

{
   {
      string key;
      string value;
   },

...

   {
      string key;
      string value
   }
}

Dev token

Добавить токен разработчика, который не будет умирать со временем, а только после повторной авторизации, или при желании разработчика сменить его.
Это нужно для того что бы не хранить логин и пароль от аккаунта, на устройстве пользователя, и что бы не вводить каждый раз логин и пароль, для взаимодействия с сервером от лица разработчика (создание pid, и т. д. ).

Также можно сделать возможность генерировать токены с различным уровнем доступа.

Player Data

Создать возможность загружать данные на сервер, получать и обновлять данные пользователя по url
Данные гранить в виде пары Key:Value

Загрузка данных на сервер:
/uploadplayerdata/{pid}/{token}/, где pid - project id, token - user token;

Получение данных по ключу
/getplayerdata/{pid}/{token}/{key}, где pid - project id, token - user token, key - ид данных;

Возвращает:
{ string value; }

Получения всех данных пользователя
/getplayerdata/{pid}/{token}/

Возвращает:

{
   {
      string key;
      string value;
   },

...

   {
      string key;
      string value
   }
}

Обновление данных пользователя

/updateplayerdata/{pid}/{token}/{key}, где pid - project id, token - user token, key - ид данных;

UserLogin not found 'script_sha1'

При авторизации пользователя получаем ошибку 400, и лог выдает что не найден скрипт "script_sha1"
image

Loginuser Response возвращает, информацию о сервере

На картинке видно, что кроме uid token и code, нам ещё приходит сколько сервер затратил ресурсов на операцию, что с точки зрения безопасности лучше клиенту не знать.

Нужно разделить информацию на урезанную для клиента, и полную для разработчика (или сервера).

image

Не могу создать новый проект.

Начиная с билда где меняли что для возвращения json данных с паблик даты пользователя, не могу создать новый проект выдаёт ошибку.

Error
error [D:\Unity\ForServer\hummingbird\src\hb_json\hb_json.c:65] json: json '' error line [1] column [0] position [0]: '[' or '{' expected near end of file

Log
info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:334] grid: start grid with config: info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:335] grid: ------------------------------------ info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:336] grid: max_thread: 16 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:337] grid: grid_uri: 127.0.0.1 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:338] grid: grid_port: 5555 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:339] grid: name: hb info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:340] grid: cache_uri: 127.0.0.1 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:341] grid: cache_port: 6379 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:342] grid: cache_timeout: 2000 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:343] grid: db_uri: 127.0.0.1 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:344] grid: db_port: 27017 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:345] grid: log_uri: 127.0.0.1 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:346] grid: log_port: 5044 info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:347] grid: ------------------------------------ info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:454] grid: ready.. info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:136] grid: request 'loginaccount' cmds [] [] [] json: {"login":"Lol9696","password":"test"} error [D:\Unity\ForServer\hummingbird\src\hb_json\hb_json.c:65] json: json '' error line [1] column [0] position [0]: '[' or '{' expected near end of file

Callback
> hb_grid.exe!hb_json_create(const void * _data, unsigned int _size, hb_json_handle_t * * _handle) Line 67 C hb_grid.exe!hb_http_get_request_json(evhttp_request * _request, hb_json_handle_t * * _handle) Line 99 C hb_grid.exe!__hb_grid_request(evhttp_request * _request, void * _ud) Line 111 C hb_grid.exe!evhttp_handle_request(evhttp_request * req, void * arg) Line 3501 C hb_grid.exe!evhttp_connection_done(evhttp_connection * evcon) Line 873 C hb_grid.exe!evhttp_get_body(evhttp_connection * evcon, evhttp_request * req) Line 2238 C hb_grid.exe!evhttp_read_header(evhttp_connection * evcon, evhttp_request * req) Line 2327 C hb_grid.exe!evhttp_read_firstline(evhttp_connection * evcon, evhttp_request * req) Line 2292 C hb_grid.exe!evhttp_read_cb(bufferevent * bufev, void * arg) Line 1143 C hb_grid.exe!bufferevent_run_readcb_(bufferevent * bufev, int options) Line 251 C hb_grid.exe!bufferevent_trigger_nolock_(bufferevent * bufev, short iotype, int options) Line 411 C hb_grid.exe!bufferevent_readcb(int fd, short event, void * arg) Line 214 C hb_grid.exe!event_persist_closure(event_base * base, event * ev) Line 1623 C hb_grid.exe!event_process_active_single_queue(event_base * base, evcallback_list * activeq, int max_to_process, const timeval * endtime) Line 1682 C hb_grid.exe!event_process_active(event_base * base) Line 1783 C hb_grid.exe!event_base_loop(event_base * base, int flags) Line 2006 C hb_grid.exe!event_base_dispatch(event_base * event_base) Line 1817 C hb_grid.exe!__hb_ev_thread_base(void * _ud) Line 209 C hb_grid.exe!__hb_thread_proxy(void * _ud) Line 28 C hb_grid.exe!thread_start<unsigned int (__stdcall*)(void *),1>(void * const parameter) Line 97 C++ [External Code] kernel32.dll![Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll] Unknown

Нельзя передать массив на сервер

Set
То что передаю:
{"key":"test3","data":{"testStr":"SomeString","testInt":27,"testFloat":35.5,"testArray":[0,0,0,0,0]}}

Lua script куда передаю:

api.setCurrentUserData = function(data)
	print(data.key)
	print("Data")
	
	--Print data table
	for key, value in pairs(data.data) do
		print(key, value)
	end
	
	local public_data = {}
	public_data[data.key] = data.data
	server.SetCurrentUserPublicData(public_data)
	return public_data
end

Лог сервера:
info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:136] grid: request 'api' cmds [JJDJRRVHQKTMSMJSSDKQJVVLQKTM] [setCurrentUserData] [] json: {"key":"test3","data":{"testStr":"SomeString","testInt":27,"testFloat":35.5,"testArray":[0,0,0,0,0]}} info [D:\Unity\ForServer\hummingbird\src\hb_script\hb_script.c:460] script: call api 'api' method 'setCurrentUserData'

Ничего в ответ не возвращает.

Update

Передаю:
{"key":"test3","data":{"testStr":"newStr","testInt":5,"testFloat":99.5,"testArray":[0,0,0,0,0]}}

Lua script куда передаю:

api.updateCurrentUserData = function(data)
	print(data.key)
	print("Data")
	
	--Print data table
	for key, value in pairs(data.data) do
		print(key, value)
	end
	
	key = data.key
	local update_data = {}
	update_data[key] = data.data
	server.UpdateCurrentUserPublicData(update_data)
	return update_data
end 

Лог сервера:
info [D:\Unity\ForServer\hummingbird\src\hb_grid\hb_grid.c:136] grid: request 'api' cmds [JJDJRRVHQKTMSMJSSDKQJVVLQKTM] [updateCurrentUserData] [] json: {"key":"test3","data":{"testStr":"newStr","testInt":5,"testFloat":99.5,"testArray":[0,0,0,0,0]}} info [D:\Unity\ForServer\hummingbird\src\hb_script\hb_script.c:460] script: call api 'api' method 'updateCurrentUserData'

Возвращает ошибку 400

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.