Show build version in app header
All checks were successful
Release App / release-app (push) Successful in 1m12s
All checks were successful
Release App / release-app (push) Successful in 1m12s
This commit is contained in:
@@ -7,6 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_program(CLANG_FORMAT_BIN clang-format)
|
||||
find_package(Git QUIET)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
@@ -16,6 +17,7 @@ set(TELEGRAM_TUI_TDLIB_ROOT ""
|
||||
|
||||
set(CURSES_NEED_WIDE TRUE)
|
||||
find_package(Curses REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
find_package(nlohmann_json QUIET)
|
||||
if(NOT nlohmann_json_FOUND)
|
||||
@@ -37,6 +39,27 @@ endif()
|
||||
|
||||
set(TELEGRAM_TUI_BUILD_API_ID "")
|
||||
set(TELEGRAM_TUI_BUILD_API_HASH "")
|
||||
set(TELEGRAM_TUI_BUILD_VERSION "${PROJECT_VERSION}")
|
||||
set(TELEGRAM_TUI_BUILD_COMMIT "")
|
||||
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE TELEGRAM_TUI_BUILD_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" describe --tags --always --dirty
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE TELEGRAM_TUI_GIT_DESCRIBE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(TELEGRAM_TUI_GIT_DESCRIBE)
|
||||
set(TELEGRAM_TUI_BUILD_VERSION "${PROJECT_VERSION}+${TELEGRAM_TUI_GIT_DESCRIBE}")
|
||||
endif()
|
||||
endif()
|
||||
if(TELEGRAM_TUI_APP_CONFIG_PATH AND EXISTS "${TELEGRAM_TUI_APP_CONFIG_PATH}")
|
||||
file(READ "${TELEGRAM_TUI_APP_CONFIG_PATH}" TELEGRAM_TUI_APP_CONFIG_JSON)
|
||||
|
||||
@@ -130,7 +153,8 @@ if(CLANG_FORMAT_BIN)
|
||||
endif()
|
||||
|
||||
target_include_directories(shinoa PRIVATE ${CURSES_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(shinoa PRIVATE ${CURSES_LIBRARIES} nlohmann_json::nlohmann_json)
|
||||
target_link_libraries(shinoa PRIVATE ${CURSES_LIBRARIES} Threads::Threads
|
||||
nlohmann_json::nlohmann_json)
|
||||
|
||||
if(TELEGRAM_TUI_USE_SYSTEM_TDLIB)
|
||||
target_link_libraries(shinoa PRIVATE Td::TdJson)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <curses.h>
|
||||
|
||||
#include "build_config.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace telegram_tui {
|
||||
@@ -242,7 +243,7 @@ void App::send_tdlib_parameters() {
|
||||
{"system_language_code", "en"},
|
||||
{"device_model", "shinoa"},
|
||||
{"system_version", "Linux"},
|
||||
{"application_version", "0.1.0"},
|
||||
{"application_version", TELEGRAM_TUI_BUILD_VERSION},
|
||||
{"enable_storage_optimizer", true},
|
||||
{"ignore_file_names", false},
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <curses.h>
|
||||
|
||||
#include "app_ui.h"
|
||||
#include "build_config.h"
|
||||
#include "util.h"
|
||||
|
||||
namespace telegram_tui {
|
||||
@@ -88,7 +89,10 @@ void App::draw() {
|
||||
|
||||
attron(A_REVERSE);
|
||||
mvhline(header_y, 0, ' ', width);
|
||||
const std::string header_label = use_test_dc_ ? "shinoa [TEST DC]" : "shinoa";
|
||||
std::string header_label = std::string("shinoa ") + TELEGRAM_TUI_BUILD_VERSION;
|
||||
if (use_test_dc_) {
|
||||
header_label += " [TEST DC]";
|
||||
}
|
||||
mvprintw(header_y, 1, "%s", header_label.c_str());
|
||||
const std::string auth_label = authorized_ ? "ready" : current_auth_label();
|
||||
const int auth_x = std::max(1, width - static_cast<int>(auth_label.size()) - 2);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define TELEGRAM_TUI_BUILD_VERSION "@TELEGRAM_TUI_BUILD_VERSION@"
|
||||
#define TELEGRAM_TUI_BUILD_API_ID "@TELEGRAM_TUI_BUILD_API_ID@"
|
||||
#define TELEGRAM_TUI_BUILD_API_HASH "@TELEGRAM_TUI_BUILD_API_HASH@"
|
||||
|
||||
Reference in New Issue
Block a user