v0.0.26 - Remove theme toggle link from pages, default restore_session=off, clear history and session on shutdown for privacy
This commit is contained in:
+11
-2
@@ -384,8 +384,17 @@ static void on_window_destroy(GtkWidget *widget, gpointer data) {
|
||||
(void)widget;
|
||||
(void)data;
|
||||
|
||||
/* Save the session before cleanup. */
|
||||
session_save();
|
||||
const browser_settings_t *s = settings_get();
|
||||
|
||||
if (s->restore_session) {
|
||||
/* Save the session for next launch. */
|
||||
session_save();
|
||||
} else {
|
||||
/* Privacy mode: clear session and history on shutdown. */
|
||||
db_session_clear();
|
||||
history_clear();
|
||||
g_print("[shutdown] Cleared session and history (restore_session=off)\n");
|
||||
}
|
||||
|
||||
/* Stop the agent server. */
|
||||
agent_server_stop();
|
||||
|
||||
+1
-17
@@ -507,23 +507,7 @@ static char *sovereign_page_head(const char *title) {
|
||||
/* Build the theme-toggle button + closing </body></html>.
|
||||
* Returns a newly-allocated string (g_free). */
|
||||
static char *sovereign_page_foot(void) {
|
||||
/* The theme toggle immediately flips the CSS class on <html> for an
|
||||
* instant visual response, then fires an async XHR to save the setting
|
||||
* in the background. No page reload, no UI blocking. */
|
||||
return g_strdup_printf(
|
||||
"<a class='theme-toggle' href='#' onclick='"
|
||||
"var h=document.documentElement;"
|
||||
"var isDark=h.classList.contains(\"dark\");"
|
||||
"if(isDark){h.classList.remove(\"dark\");}"
|
||||
"else{h.classList.add(\"dark\");}"
|
||||
"this.textContent=isDark?\"Night Mode\":\"Day Mode\";"
|
||||
"var x=new XMLHttpRequest();"
|
||||
"x.open(\"GET\",\"sovereign://settings/set?feature=theme_dark\",true);"
|
||||
"x.send();"
|
||||
"return false;"
|
||||
"'>%s</a>\n"
|
||||
"</body></html>\n",
|
||||
settings_get()->theme_dark ? "Day Mode" : "Night Mode");
|
||||
return g_strdup("</body></html>\n");
|
||||
}
|
||||
|
||||
/* ── Settings page ─────────────────────────────────────────────── */
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ static browser_settings_t g_settings;
|
||||
/* ── Defaults ─────────────────────────────────────────────────────── */
|
||||
|
||||
static void settings_set_defaults(browser_settings_t *s) {
|
||||
s->restore_session = TRUE;
|
||||
s->restore_session = FALSE;
|
||||
snprintf(s->new_tab_url, sizeof(s->new_tab_url), "%s",
|
||||
SETTINGS_NEW_TAB_URL_DEFAULT);
|
||||
s->tab_bar_position = GTK_POS_TOP;
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@
|
||||
#ifndef SOVEREIGN_BROWSER_VERSION_H
|
||||
#define SOVEREIGN_BROWSER_VERSION_H
|
||||
|
||||
#define SB_VERSION "v0.0.25"
|
||||
#define SB_VERSION "v0.0.26"
|
||||
#define SB_VERSION_MAJOR 0
|
||||
#define SB_VERSION_MINOR 0
|
||||
#define SB_VERSION_PATCH 25
|
||||
#define SB_VERSION_PATCH 26
|
||||
|
||||
#endif /* SOVEREIGN_BROWSER_VERSION_H */
|
||||
|
||||
Reference in New Issue
Block a user