mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
* [Server/Client/Protocol] Add developer staff role Introduce a Developer staff level (proto flag 32, DB admin bit 8) that sits between admin and moderator: no kick/ban/warn/report/admin powers, but gets server log access via a new developer command container family (GET_SERVER_STATS, VIEWLOG_HISTORY) and an idle-timeout exemption. - Protocol: IsDeveloper flag, developer_commands.proto envelope, Command_GetServerStats/Command_GetLogHistory, Response_GetServerStats, Command_AdjustMod.should_be_developer - Servatrice: fail-closed developer dispatcher, uptime snapshot handler, shared log history handler reuse, bit-8 DB mapping - Client: burgundy pawn/badge/labels/sort order, prepareDeveloperCommand, minimal Developer stats tab, log tab access, promote/demote actions Took 24 minutes Took 18 seconds * [Server/Client/Protocol] Address developer role review feedback Address ZeizaZach's review of the developer staff role: - Nudge the developer log query to exclude private chat and sender IPs (the ModeratorCommand path still sees everything). - Deduplicate Command_GetLogHistory into Command_ViewLogHistory, which now extends both ModeratorCommand (ext) and DeveloperCommand (dev_ext); the client picks the DeveloperCommand-scoped extension by extendee, and the server reads it via the extension number. - Pull the uptime snapshot SQL into Servatrice_DatabaseInterface as getLatestUptimeSnapshot() and widen the reported counters to 64-bit. - Document the admin bitfield (1 admin, 2 moderator, 4 judge, 8 developer) and add a server-side test for the developer command path. * Add missing trailing newline to user_context_menu.cpp * Remove stale includes of deleted command_get_log_history proto The Command_GetLogHistory message was folded into Command_ViewLogHistory, which deleted command_get_log_history.proto, but serversocketinterface still #included its generated header. Fresh CI builds fail on the missing file; local builds masked it by reusing a previously generated header. * [Server] Exclude chat rows when private-chat filter is bypassable A developer who omits log_location entirely — or sends only "chat" — leaves chatType, gameType, roomType all false, so getMessageLogHistory skips the target_type clause and returns every row, private messages included. When !allowPrivateChat the server now forces game+room when no surviving location was requested, guaranteeing the query always carries a target_type restriction. [Client] Demote mod+dev to moderator path in log-tab dispatch The developer command family is strictly weaker than the moderator one (no private chat, no sender_ip, ip filter ignored), so granting the developer bit to an existing moderator must not silently strip their capabilities. useDeveloperCommands is now true only when the user holds the developer bit and not the moderator bit. [Client] Hide the IP-address filter for developer log tab users The developer path ignores the ip_address query field server-side. Showing the field lets a developer type an IP and get results that are silently unfiltered by it rather than an empty result set — reads as a broken filter. Hide labelFindIPAddress/findIPAddress alongside the privateChat checkbox. * Developer pawn is silver. * [Client] Fix indentation of merged Card Art Rules / Developer tabs --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
129 lines
6 KiB
CMake
129 lines
6 KiB
CMake
# NOTE: Qt modules for tests are defined centrally in cmake/FindQtRuntime.cmake (the _TEST_NEEDED variable).
|
|
# If a new test needs additional Qt modules, add them there — not in individual test CMakeLists.txt files.
|
|
enable_testing()
|
|
|
|
add_test(NAME dummy_test COMMAND dummy_test)
|
|
add_test(NAME expression_test COMMAND expression_test)
|
|
add_test(NAME clamped_arithmetic_test COMMAND clamped_arithmetic_test)
|
|
add_test(NAME test_age_formatting COMMAND test_age_formatting)
|
|
add_test(NAME password_hash_test COMMAND password_hash_test)
|
|
add_test(NAME playmat_resolver_test COMMAND playmat_resolver_test)
|
|
add_test(NAME server_card_counter_test COMMAND server_card_counter_test)
|
|
add_test(NAME server_counter_test COMMAND server_counter_test)
|
|
add_test(NAME server_rate_limiter_test COMMAND server_rate_limiter_test)
|
|
add_test(NAME server_developer_role_test COMMAND server_developer_role_test)
|
|
add_test(NAME warning_categories_test COMMAND warning_categories_test)
|
|
add_test(NAME lag_monitor_test COMMAND lag_monitor_test)
|
|
add_test(NAME latency_tracker_test COMMAND latency_tracker_test)
|
|
|
|
add_test(NAME deck_hash_performance_test COMMAND deck_hash_performance_test)
|
|
set_tests_properties(deck_hash_performance_test PROPERTIES TIMEOUT 15)
|
|
|
|
# Find GTest
|
|
|
|
add_executable(dummy_test dummy_test.cpp)
|
|
add_executable(expression_test expression_test.cpp)
|
|
add_executable(clamped_arithmetic_test clamped_arithmetic_test.cpp)
|
|
add_executable(test_age_formatting test_age_formatting.cpp)
|
|
add_executable(password_hash_test password_hash_test.cpp)
|
|
add_executable(playmat_resolver_test playmat_resolver_test.cpp)
|
|
add_executable(deck_hash_performance_test deck_hash_performance_test.cpp)
|
|
add_executable(server_card_counter_test server_card_counter_test.cpp)
|
|
add_executable(server_counter_test server_counter_test.cpp)
|
|
add_executable(server_rate_limiter_test server_rate_limiter_test.cpp)
|
|
add_executable(server_developer_role_test server_developer_role_test.cpp)
|
|
add_executable(warning_categories_test warning_categories_test.cpp)
|
|
add_executable(lag_monitor_test ${CMAKE_SOURCE_DIR}/cockatrice/src/client/lag_monitor.cpp lag_monitor_test.cpp)
|
|
target_include_directories(lag_monitor_test PRIVATE ${CMAKE_SOURCE_DIR}/cockatrice/src)
|
|
add_executable(latency_tracker_test latency_tracker_test.cpp)
|
|
|
|
find_package(GTest)
|
|
|
|
if(NOT GTEST_FOUND)
|
|
if(NOT EXISTS "${CMAKE_BINARY_DIR}/gtest-build")
|
|
message(STATUS "Downloading googletest")
|
|
configure_file(
|
|
"${CMAKE_SOURCE_DIR}/cmake/gtest-CMakeLists.txt.in" "${CMAKE_BINARY_DIR}/gtest-download/CMakeLists.txt"
|
|
)
|
|
execute_process(
|
|
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/gtest-download
|
|
)
|
|
execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/gtest-download)
|
|
else()
|
|
message(STATUS "GoogleTest directory exists")
|
|
endif()
|
|
|
|
# Add gtest directly to our build
|
|
add_subdirectory(${CMAKE_BINARY_DIR}/gtest-src ${CMAKE_BINARY_DIR}/gtest-build EXCLUDE_FROM_ALL)
|
|
|
|
# Add the gtest include directory, since gtest
|
|
# doesn't add that dependency to its gtest target
|
|
target_include_directories(gtest INTERFACE "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/gtest-src/include>")
|
|
|
|
set(GTEST_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/gtest-src/include")
|
|
set(GTEST_BOTH_LIBRARIES gtest)
|
|
add_dependencies(dummy_test gtest)
|
|
add_dependencies(expression_test gtest)
|
|
add_dependencies(clamped_arithmetic_test gtest)
|
|
add_dependencies(test_age_formatting gtest)
|
|
add_dependencies(password_hash_test gtest)
|
|
add_dependencies(playmat_resolver_test gtest)
|
|
add_dependencies(deck_hash_performance_test gtest)
|
|
add_dependencies(server_card_counter_test gtest)
|
|
add_dependencies(server_counter_test gtest)
|
|
add_dependencies(server_rate_limiter_test gtest)
|
|
add_dependencies(server_developer_role_test gtest)
|
|
add_dependencies(warning_categories_test gtest)
|
|
add_dependencies(lag_monitor_test gtest)
|
|
add_dependencies(latency_tracker_test gtest)
|
|
endif()
|
|
|
|
include_directories(${GTEST_INCLUDE_DIRS})
|
|
target_link_libraries(dummy_test Threads::Threads ${GTEST_BOTH_LIBRARIES})
|
|
target_link_libraries(expression_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES})
|
|
target_link_libraries(
|
|
clamped_arithmetic_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
test_age_formatting libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
password_hash_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
playmat_resolver_test libcockatrice_deck_list libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES}
|
|
${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
deck_hash_performance_test libcockatrice_deck_list libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES}
|
|
${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
server_card_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
server_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
server_rate_limiter_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
server_developer_role_test libcockatrice_network libcockatrice_rng Threads::Threads ${GTEST_BOTH_LIBRARIES}
|
|
${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(
|
|
warning_categories_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
target_link_libraries(lag_monitor_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES})
|
|
target_link_libraries(
|
|
latency_tracker_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}
|
|
)
|
|
|
|
add_subdirectory(card_zone_algorithms)
|
|
add_subdirectory(carddatabase)
|
|
add_subdirectory(deck_list_model)
|
|
add_subdirectory(deck_list_zones)
|
|
add_subdirectory(loading_from_clipboard)
|
|
add_subdirectory(movecard_tests)
|
|
add_subdirectory(oracle)
|
|
add_subdirectory(settings)
|