ascii-chat
Binary v0.15.83-53-gb711d8720
Library lib/v0.3.2-701-gb711d8720
Video chat in your terminal
Loading...
Searching...
No Matches
update_checker.h
Go to the documentation of this file.
1#pragma once
2
21
22/* Storage capacities in elements; text buffers include the terminating NUL. */
23#define NETWORK_UPDATE_CHECKER_LATEST_VERSION_BUFFER_SIZE 64
24#define NETWORK_UPDATE_CHECKER_LATEST_SHA_BUFFER_SIZE 41
25#define NETWORK_UPDATE_CHECKER_CURRENT_VERSION_BUFFER_SIZE 64
26#define NETWORK_UPDATE_CHECKER_CURRENT_SHA_BUFFER_SIZE 41
27#define NETWORK_UPDATE_CHECKER_RELEASE_URL_BUFFER_SIZE 512
28
29#include <stdbool.h>
30#include <stdint.h>
31#include <time.h>
32#include "../common.h"
33
49
61
76
91
101
104
107
115
118
127
138void update_check_get_upgrade_suggestion(install_method_t method, const char *latest_version, char *buffer,
139 size_t buffer_size);
140
142const char *update_check_get_aur_helper(void);
143
154void update_check_format_notification(const update_check_result_t *result, char *buffer, size_t buffer_size);
155
170
⚙️ Common definitions, error codes, macros, and types shared throughout the application
int buffer_size
Size of circular buffer.
Definition grep.c:68
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:44
asciichat_error_t update_check_startup(update_check_result_t *result)
Perform startup update check with caching.
install_method_t
Installation method for suggesting upgrade command.
#define NETWORK_UPDATE_CHECKER_CURRENT_SHA_BUFFER_SIZE
void update_check_dismiss_for_a_week(update_check_result_t *result)
#define NETWORK_UPDATE_CHECKER_RELEASE_URL_BUFFER_SIZE
void update_check_get_upgrade_suggestion(install_method_t method, const char *latest_version, char *buffer, size_t buffer_size)
Get upgrade suggestion string.
bool update_check_is_cache_fresh(const update_check_result_t *result)
Check if cache is fresh (< 7 days old).
const char * update_check_get_aur_helper(void)
asciichat_error_t update_check_perform(update_check_result_t *result)
Check for updates from GitHub releases API.
asciichat_error_t update_check_save_cache(const update_check_result_t *result)
Save update check result to cache.
bool update_check_try_fresh_cache(update_check_result_t *result)
#define NETWORK_UPDATE_CHECKER_CURRENT_VERSION_BUFFER_SIZE
bool update_check_is_dismissed(const update_check_result_t *result)
#define NETWORK_UPDATE_CHECKER_LATEST_VERSION_BUFFER_SIZE
asciichat_error_t update_check_load_cache(update_check_result_t *result)
Load cached update check result.
#define NETWORK_UPDATE_CHECKER_LATEST_SHA_BUFFER_SIZE
install_method_t update_check_detect_install_method(void)
Detect installation method.
void update_check_format_notification(const update_check_result_t *result, char *buffer, size_t buffer_size)
Format update notification message.
@ INSTALL_METHOD_ARCH_AUR
Installed via Arch AUR (paru/yay).
@ INSTALL_METHOD_UNKNOWN
Unknown installation method.
@ INSTALL_METHOD_GITHUB
Manual install from GitHub releases.
@ INSTALL_METHOD_INSTALLER
Installed by ascii-chat.com installer.
@ INSTALL_METHOD_SCOOP
Installed via Scoop.
@ INSTALL_METHOD_HOMEBREW
Installed via Homebrew.
update check result keeps the values that move through the subsystem: update_available,...
char latest_version[64]
Latest version tag (e.g., "v0.9.0").
char current_sha[41]
Current commit SHA.
time_t dismissed_until
Suppress this available release until this time.
char current_version[64]
Current version string.
time_t last_check_time
Timestamp of last check.
bool update_available
True if newer version exists.
bool check_succeeded
True if check completed (even if no update).
char release_url[512]
GitHub release page URL.
char latest_sha[41]
Latest release commit SHA (full 40 chars + null).
⏱️ High-precision timing utilities using sokol_time.h and uthash