This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Импорт изменений для версии 0.0.2 (#102)
* Перенос изменений из master в master-develop (#88) * Realease version 0.0.1 (#56) * Update Pipfile.lock * added dependencies sqlobject * update database/main - SQLite database module has been updated * Update main.py * added ORM from SQLObject * Update api.py * Update .gitignore * Update app.py - Added information how to switch between ORM and working directly with SQLite database * Update controller.py - change type str to int * Delete database.db * Create LICENSE - MIT Licence * Update README.md - added information about manage.py * Update libhash.py - delete import PasswordValidate * The internal workflow of manage.py has been changed - Added automatic creation and deletion of database tables after loading models.py. * Update models.py - Added documentation for all classes. Changed the name of columns. Added relations between tables. * added logging module * Repair controller.py to match new models.py (request username by ID) Added to app.py and controller.py stub to implement new protocol api in future Minor edit api.py (don't direct run print when import module) * New protocol "register_user" implemented * Controller rewriten - now return errors to client. * Imports single-in-line * fix long comments * logging config modified - looging INFO disconnected client IP * Update controller.py - Added plugs instead of functions all_flow, all_messages, authentication, get_update, send_message, user_info, delete_user, delete_message, edited_message, ping-pong. * add methods all_flow and add_flow * Implemented register_user and send_message * Implemented register_user and send_message * Implemented register_user and send_message * Update api.py - delete unused function "response" * update controller and api - add new function 'user_info' to controller.py: the function returns information about the user's personal settings or error 404 if such user is not in the database. delete unused import ValidationError in apy.py commented on the "dict_json" object. * Update controller.py - added key 'jsonapi' and 'meta' in response object * Update api.py - change 'id' in class User to 'UUID' * Update api.py - delete unused imports * added LibHash config section added two constant PASSWORD_HASH_SIZE and AUTH_ID_HASH_SIZE * convertet to class Hash and added new function "auth_id" * added method 'authentication' also minor changes in 'user_info' methods for query in DB * Update comment and TODO * change UUID to login in dbquery * added method ping-pong * chenging UUID to uuid * minor changes in api.py and controller.py * Update README.md minor changes and added link to Slack * fix minor bug and add method all_messages() * minor fix bug * added method delete_user * update method delete_user added docstring added Search the database by three fields: login, password, username. * minor changes * added two new methods: delete_message and edited_message also: change check user in user_info function change status code from 404 to 401 in user_info function change try:...except to if:...esle in delete_user change status code from 404 to 401 in delete_user function miror changes * changes requested by stepanskryabin * Update controller.py corrected according to the comment: #22 (review) * fix * fix 2 * install loguru module * added files in gitignore from the PyCharm appendix. * delete old file config * added new logging system * added logging description to README.md * changes requested by stepanskryabin * Refactoring code * refactoring app.py and config.py Settings of uvicorn are in config.py * delete full JSON-object from api.py * refactoring api.py * Update controller.py - The auxiliary function 'user_info_for_server' has been moved to the beginning of the file. - The 'register_user' function is moved to the part where all the other methods are implemented. - to exclude time differences in different places of one function, the time call is executed once and assigned to the 'get_time' variable. - small corrections in the documentation lines. - variable names are given in a single form - the unnecessary variables have been removed. - In the 'all_flow' and 'add_flow' functions, the documentation strings have been added. - creation of the 'response' object is brought to a single view. - the string value of the 'version' key of the 'jsonapi' object has been replaced with the dynamic loading from the constant located in the config.py file. * Update models.py delete two blank lines * Update logging.py - Russian-language lines of documentation have been replaced by English-language lines. - long line breaks. - other small corrections. * Update manage.py - line break - commenting * line break in controller.py * Update main.py line break * Реализован метод get_update() (#29) * Refactoring code and add docstring for metod get_update() * add metod get_update and add file func.py(function for controler.py) * Refactoring code * Update controller.py * Update controller.py * Create test.py init commit * added 3 tests - TestPingPong - TestAllMessages - TestServeRequest * Реализован метод errors, а также добавлена функция errors_catching для отлова ошибок (#30) * Create errors.py initial commit * Update Pipfile.lock * add new dependencies - "attr" * added function 'error_catching' Added error-catching feature * added backtrace and diagnose to log level "ERROR" * Update errors.py - TemplateErrors class optimization - doctrings added, extra comments removed. - function check - different log level options have been added * Update controller.py shortened two lines * File changes in errors.py and libhash.py -rename the file libhash.py to lib.py -transfer the "error_catching" function to lib.py * added methods errors added methods errors and minor changes * added docstring for method errors and change level for logger * minor changes * changes are made on request @rus-ai - code_list is removed - key type changed to int - keywords - minor alterations * changes are made on request @NekrodNIK changed the attr package to attrs * bug fix in Hash.check_password() and minor changes class Hash - fixed and simplified algorithm of password and its hash-password verification - changes in docstring and delete unnecessary comments - minor changes in variable names * added unit test to Hash and error_catching() * the method of converting UUID from 'int' to 'byte-like' object was updated * update test for Hash * update test for error_catching() and minor changes - rename test - added docstring - added comments * added logger remove in error_catching test * transfer 'test_lib.py' file to 'tests' directory and delete test_controller.py and __init__.py * Добавление модульных тестов. Тесты для api.py - тестирование валидации JSON-файла (#32) * Create test_api.py initial release * added api_full.json * added api test and minor chages in test api - rename full_api.json to api.json - transfer 'test_api.py' file to 'tests' directory * minor chages request @rus-ai - full pathfinding features have been fixed - delete unused import * Добавление модульных тестов. Тесты для controller.py - тестирование работы методов (#34) * Create test_controller.py init commit * Update test_controller.py * added test for all methods Added tests to check data type that returns functions * Create not_valid_api.json * fixed serve_request() function - ValidationError import is corrected - fixed generation of response when ValidationError exception appears * fixed TestServeRequest, added TestRegisterUser TestGetUpdate * fixed args in docstring * the function check_uuid_and_auth_id was changed now the function produces True or False instead of error codes * replace error to error_catching() in get_update * operation of the user_info function has been optimized - function checks that the user has been authenticated * Fixes some bugs and improvements. - all text errors are replaced by error_catching() function - in all methods added check uuid and auth_id - construct "if bool(dbquery.count()):" replaced with "if dbquery.count():". - unnecessary time() calls are removed - deleted unused filter_dbquery_by_time_from_and_to() - database queries have been corrected - redesigned (simplified) authorization algorithm - mechanism of adding messages to the list in the all_message method has been updated - minor changes * Update test_controller.py update all test methods in test_controller.py * Delete not_valid_api.json * fix type for id in class Flow * Bug fixes and code improvements - message filtering in get_update method was optimized, time-based filtering was temporarily removed. - optimized generation of message list in get_update method - database query optimization in send_message method - add_flow method is rewritten - all_flow method is rewritten - Added UUID and auth_id check function to all methods (except registration and authorization), and where I forgot to add there then add. - query to the database of delete_message method was fixed - query to the database of all_message method was fixed - method operation was optimized, part of its work was moved to serve_request() function. - any other minor code optimization, lazy to describe everything :) * all tests have been rewritten or optimized * minor changes * code improvements and minor changes in naming function * fix bug in run server description * Упаковал все методы протокола в один класс и переделал генерацию ответа (#37) * packed all protocol methods into one class and much more * added alternate realese class ProtocolMethods * fix * api.py is brought into compliance with protocol revision 1.15 - added classes to validate lists with attached dictionaries. - clarifications in class description. - minor revisions of "types". * fix method in class ProtocolMethod * fix name metods and more * fix some bugs * fix type annotation * transform function to class fo error_catching * Update controller.py * fix class ErrorCatching * fix some functions in ProtocolMethod * fix: brought into line with the protocol * fix: minor bugs have been fixed * fix: unnecessary objects have been deleted - removed from_flow, from_user, file, edited_message - ProtocolMethods class has completed the internal functions _user_info, _all_flow, _send_message, _get_update * fix * Delete test.py * FIx all * Fixed bugs auth and register(+testing) * fix check password * fix ForeignKey bug & test send_message and fix * fix all class and testing * Исправления для класса ProtocolMethods и для тестов (#52) * FIX: tests are updated to check the class ProtocolMethods * FEAT: added to _register_user and _authentification added new test in _register_user: - test_user_created_in_database * Revert "FEAT: added to _register_user and _authentification" This reverts commit a287d01. * FEAT: new test in _register_user and _authentification * FEAT: add two tests in TestSendMessage class test_write_text_in_database and test_write_time_in_database delete unusen key and value in SEND_MESSAGE * FIX: errors in lib() function tests are fixed * FIX: delete unused module attrs * FEAT: "ErrorCatching" class has been moved from lib.py to controller.py in "ProtocolMethods" class * FIX: import sorted out * FIX: emoji column has changed its type to BLOB, small corrections * FIX: class methods are given in accordance with the protocol version 1.0 revision 1.15 - in _authentication() it is fixed response generation - fixed name of variables in cycles for - response generation added to _add_flow() - the _get_update() is completely rewritten - TEMPORARY CHANGES uuid and flowId GENERATIONS - database query have been corrected and simplified - the logic of the __check_auth_token() method is changed to reverse - _user_info() and _ping_pong() methods now require user authentication - documentations have been fixed or added - sorted out import - other minor corrections * FIX: fixed all tests * FIX: misprint in __check_auth_token() Co-authored-by: Stepan Skriabin <stepan.skrjabin@gmail.com> * Исправлена работа с вебсокетами, удалён легаси-код (#54) * FEAT: simplification websocket_endpoint and delete legacy code (get_all_message, send_message, reg_user) * FIX: delete import config.py * Update Pipfile.lock * BREAKING CHANGE: delete folder "old" * FIX: added message count * FEAT: add command "superuser" to creating default user * FIX: added @websockets@ in dependencies * FIX: off logger and add config in uvicorn * FIX: change mode to "binary" in websocket.send_json() * FEAT: add logging and close websocket if lost connection * FIX: logger.info in websocket_endpoint() * FIX: change logger.info message * FIX: minor changes * FIX: minoir changes * FIX: minor changes * FEAT: add processing RuntimeError in websocket_endpoint() * FIX: added break into except * FIX: package versions are fixed packages "pyjwt" and "PyYYAML" are removed * FIX: rename app.py to server.py delete uvicorn.run() * FEAT: description of server start and testing section added directory and file description corrected * FEAT: added debug mode added debug_server.py added documentation section on launching the debagger * FIX: import server.py and minor changes * FIX: delete unused settings in config.py * FIX: config ddebug level in add_logging() * Update debug_server.py * Update debug_server.py * Update debug_server.py * fix colors debug Co-authored-by: NekrodNIK <NP17210@yandex.ru> Co-authored-by: Alexey Matvienko <50598487+ma1ex@users.noreply.github.com> Co-authored-by: NekrodNIK <NP17210@yandex.ru> Co-authored-by: Aleksan <Dev.aleksan@gmail.com> Co-authored-by: rus-ai <russian-ai@yandex.ru> Co-authored-by: rus-ai <67479455+rus-ai@users.noreply.github.com> Co-authored-by: NekrodNIK <60639354+NekrodNIK@users.noreply.github.com> * Fixbug#60 auth error (#66) change importing config.py in lib.py change type salt and key when manage.py created superuser, and added hash_password change uvucorn run settings in debug_server.py return salt and key bytes-like fix table name in manage.py return importing config convert error message to string fixed test Hash class * added new exception JSONDecodeError (#72) * Fixbug #73 delete indent and disaable ensure_ascii * Fixbug #62 and #73 create postgresql database (#75) * fixed table name User to UserConfig * rename table User to UserConfig * added comment tag "#noqa" to disable flake8 * long line break * Fixed minor: register_user methods, add fields (#77) * Fixed minor: register_user methods, add fields * Fixed: add_flow check flow type * Fixed: add_flow - check two uuid presence for "chat" * Fixed: add_flow - removed excess error reporting * Fixed: SQL model fixed, right database join type * Added: 3 Unit-tests for add_flow method * Update: Unit-tests for "add_flow" improved * Fix: Unit-tests for "add_flow" order independent * Fix: Unit-tests for "add_flow" * Bump jinja2 from 2.11.2 to 2.11.3 (#84) Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.2 to 2.11.3. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst) - [Commits](pallets/jinja@2.11.2...2.11.3) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alexey Matvienko <50598487+ma1ex@users.noreply.github.com> Co-authored-by: NekrodNIK <NP17210@yandex.ru> Co-authored-by: Aleksan <Dev.aleksan@gmail.com> Co-authored-by: rus-ai <russian-ai@yandex.ru> Co-authored-by: rus-ai <67479455+rus-ai@users.noreply.github.com> Co-authored-by: NekrodNIK <60639354+NekrodNIK@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * upgrade: package fastapi, websockets, pydantic * fix: pipfile.lock * fix: change branch name master-develop to develop * refactor: minor corrections of function and class descriptions Also added to the code additional explanations and corrected typos. The length of the lines shortened. * fix: Fixed an error in the Message table column name * upgrade: to Python 3.9 * fix: missing fields were added to the get_update() method response * update: updated versions of packages in dependencies * feat: added new key in api added additional fields (beginning and end of sequence number of message in flow) to validation scheme * feat: error description code 520 and new parameter in config.py LIMIT_MESSAGE = indicating maximum number of messages server can return in response to a request * feat: pagination added to "all_message" method output of messages is performed taking into account limit specified in server settings * feat: added new description for error code 206 and added type indication for other variables * fix: Fixed "all_messages" method added a checking size of requested messages and generated a response with 403 error, corrected code of database request, added error catching when requesting a missing "FlowID" * fix: corrected tests for the "all_messages" method * fix: Fixed check for number of users when creating a chat * feat: Added new parameter LIMIT_USERS * fix: Fixed "user_info" method when number of requests exceeds server generates an error with code 403 * feat: improved and new tests for "user_info" method * refactor: corrected length of lines * fix: Fixed "delete_user" method user information is replaced by a template instead of complete deletion * feat: Fixed "delete_message" method user information is replaced by a template instead of complete deletion * fix: Fixed tests of "delete_message" method added an additional test to check replacement of message text after delete operation * feat: Server response on successful "send_message" request has been expanded In server response added information about "user uuid", "flow id", "message id" * fix: Fixed an error in name of variable containing "uuid" * feat: Added a test that checks message "id" in "send_message" methods * refactor: corrected the dictionary for "errors" method tests * fix: corrected repository description and typos in text * feat: added a description of repository in English * feat: Added a test to check validation of an invalid request (with one "type" key) * fix: Fixed declaration of object types that accept "__check_auth_token" and "__catching_error" methods * refactor: corrected line lengths * fix: the FlowId type was changed to str * feat: generation of unique user ID and flow ID is transferred to UUID module * fix: replacing FlowID from int type to str type * fix: corrected query to database in "all_flow" method * feat: generation of unique identification numbers using built-in module "uuid" - support of "users" and "owner" keys for "flow" field is implemented - "id" with int type was replaced by "uuid" with str type. uuid is firstly generated with int type, then converted to str type - added checking of type of object uuid transferred to "__check_auth_token". - added uuid conversion from str to int in Hash() - database model was changed, uuid field was added to all tables, relations between tables were corrected * fix: change dict to list * fix: protocolMethods class is fixed and tests are fixed * fix: unused uuid type test was removed * fix: corrected data type * feat: client_id added to the validation scheme * feat: client_id was added to send_message method * feat: added a test to check client_id * feat: option to create a group was added, creation of tables and database are separated into different options - DB connection moved to main() function * feat: all settings are moved to a special file config.ini - example server settings file example_config.ini added to repository - fixed an error in manage.py when creating a flow * feat: a constant was added to api.py with MTP protocol API version * refactor: move logging.py to "mod" directory * fix: delete unused module uuid * refactor: error codes moved to a separate module error.py * feat: Added a mini client to check the server functionality and updated documentation. - ngrok.exe added to gitignore - websocket-client package added to dependencies - in readme.md and readme_eng.md updated section on preconfiguration and launching the server, as well as on work with the mini client * feat: added logging to "ProtocolMethod" - corrected logging level in "client.py" - logging level in "debug_server.py" was set to DEBUG - log format setting from logging.py moved to config.ini - corrected log level in "server.py" * refactor: part of repetitive values in test queries are put in separate variables * refactor: changed the variable name URI to LOCALHOST * fix: Corrected errors and inaccuracies in the "readme" * fix: fixed name of protocol * fix: update pipfile.lock Co-authored-by: Alexey Matvienko <50598487+ma1ex@users.noreply.github.com> Co-authored-by: NekrodNIK <NP17210@yandex.ru> Co-authored-by: Aleksan <Dev.aleksan@gmail.com> Co-authored-by: rus-ai <russian-ai@yandex.ru> Co-authored-by: rus-ai <67479455+rus-ai@users.noreply.github.com> Co-authored-by: NekrodNIK <60639354+NekrodNIK@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information