Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
updates.h File Reference

The nightly update check. More...

#include <glib.h>
+ Include dependency graph for updates.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* dt_updates_notify_fn) (const char *version, const char *url)
 

Functions

void dt_updates_init (const gboolean have_gui, dt_updates_notify_fn notify)
 
void dt_updates_shutdown (void)
 
const char * dt_updates_get_download_url (void)
 
const char * dt_updates_get_available_version (void)
 
const char * dt_updates_runtime_format (void)
 

Detailed Description

The nightly update check.

Once a day, a nightly build fetches https://ansel.photos/nightly.json – the one file the nightly CI writes after each build, naming the newest build of every format – and compares the commit recorded for its own format with the commit it was built from. A difference is announced with a toast and made actionable through Help > Update to the latest nightly build, which opens the download for the running format (AppImage, Flatpak, dmg per architecture, exe).

The check exists only in the nightly channel (DT_BUILD_CHANNEL), only with a GUI, and only when updates/enabled is set – a third line in the first-launch privacy dialog, and a toggle in Preferences > Storage > Privacy. It sends nothing but an HTTP GET carrying the application's User-Agent; there is no identity, no telemetry and no dependency on the analytics or crash-reporting modules.

Definition in file updates.h.

Typedef Documentation

◆ dt_updates_notify_fn

typedef void(* dt_updates_notify_fn) (const char *version, const char *url)

Called on the GUI thread when a newer build was found: the version string and the download URL for the running format. Registered by the caller of dt_updates_init(), because telling the user is the upper layers' business – this module sits in common/ and must not reach into control/ or gui/ for a toast.

Definition at line 46 of file updates.h.

Function Documentation

◆ dt_updates_get_available_version()

const char * dt_updates_get_available_version ( void  )

The version string of the newer build found by the last check, or NULL.

Definition at line 68 of file updates.c.

References _available_version.

◆ dt_updates_get_download_url()

const char * dt_updates_get_download_url ( void  )

The download URL of the newer build found by the last check, or NULL when none was found (or the check did not run). The string is owned by the module.

Definition at line 63 of file updates.c.

References _download_url.

Referenced by update_nightly_callback().

◆ dt_updates_init()

void dt_updates_init ( const gboolean  have_gui,
dt_updates_notify_fn  notify 
)

Start the check if it is due. Returns immediately; the fetch runs on its own thread. notify may be NULL, in which case a result is only queryable through the getters.

Definition at line 199 of file updates.c.

References _notify, _shutting_down, _updates_worker(), _worker, DT_BUILD_CHANNEL, dt_conf_get_bool(), dt_conf_get_int64(), dt_conf_set_int64(), DT_DEBUG_CONTROL, dt_print(), DT_UPDATES_ENABLED_KEY, DT_UPDATES_INTERVAL, DT_UPDATES_LAST_CHECK_KEY, and dt_updates_runtime_format().

Referenced by dt_init().

◆ dt_updates_runtime_format()

const char * dt_updates_runtime_format ( void  )

Where the running binary came from, as a key of the manifest's "formats" object ("appimage", "flatpak", "dmg-arm64", "dmg-i386", "exe"), or NULL when it cannot tell. Exposed for the consent dialog and for diagnostics.

Definition at line 44 of file updates.c.

Referenced by _evaluate(), and dt_updates_init().

◆ dt_updates_shutdown()

void dt_updates_shutdown ( void  )

Stop the worker. Bounded by the request timeout.

Definition at line 223 of file updates.c.

References _available_version, _download_url, _shutting_down, and _worker.

Referenced by dt_cleanup().