feat: preferences syncing frontend (#7192)

* feat: prefs frontend

* fix: DI issue

* fix: lint

* feat: appearance settings cleanup + fix settings, remove pinia

* fix: sync btn when logged out

* fix: prepr

* fix: sidebar issue

* feat: language coverage + cleanup

* feat: cleanup lang settings

* fix: fmt

* fix: CI

* fix: ci

* fix: storybook

* feat: bring back loader/game version sort

---------

Co-authored-by: tdgao <mr.trumgao@gmail.com>
This commit is contained in:
Calum H.
2026-08-20 07:23:01 +00:00
committed by GitHub
co-authored by tdgao
parent 79fcf41316
commit 3e07267e10
191 changed files with 3356 additions and 4372 deletions
@@ -1,6 +1,6 @@
{
"db_name": "SQLite",
"query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, locale, default_page, collapsed_navigation, hide_nametag_skins_page, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry, personalized_ads,\n json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,\n mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,\n hook_pre_launch, hook_wrapper, hook_post_exit,\n custom_dir, prev_custom_dir, migrated, json(feature_flags) feature_flags, toggle_sidebar,\n skipped_update, pending_update_toast_for_version, auto_download_updates,\n version\n FROM settings\n ",
"query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, locale, default_page, collapsed_navigation, hide_nametag_skins_page, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry, personalized_ads,\n json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,\n mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,\n hook_pre_launch, hook_wrapper, hook_post_exit,\n custom_dir, prev_custom_dir, migrated, json(feature_flags) feature_flags, toggle_sidebar,\n skipped_update, pending_update_toast_for_version, auto_download_updates,\n sync_theme_across_devices, sync_behavior_across_devices,\n version\n FROM settings\n ",
"describe": {
"columns": [
{
@@ -159,9 +159,19 @@
"type_info": "Integer"
},
{
"name": "version",
"name": "sync_theme_across_devices",
"ordinal": 31,
"type_info": "Integer"
},
{
"name": "sync_behavior_across_devices",
"ordinal": 32,
"type_info": "Integer"
},
{
"name": "version",
"ordinal": 33,
"type_info": "Integer"
}
],
"parameters": {
@@ -199,8 +209,10 @@
true,
true,
true,
false,
false,
false
]
},
"hash": "6f8b76b839db48539a70664af549c12be71df20b8cf520019413f6ea751cd594"
"hash": "29df6a29d9221b9bbea45e024fb26f5b6a3155788880369af940fcd268d3cb94"
}
@@ -1,12 +1,12 @@
{
"db_name": "SQLite",
"query": "\n UPDATE settings\n SET\n max_concurrent_writes = $1,\n max_concurrent_downloads = $2,\n\n theme = $3,\n locale = $4,\n default_page = $5,\n collapsed_navigation = $6,\n advanced_rendering = $7,\n native_decorations = $8,\n\n discord_rpc = $9,\n developer_mode = $10,\n telemetry = $11,\n personalized_ads = $12,\n\n extra_launch_args = jsonb($13),\n custom_env_vars = jsonb($14),\n mc_memory_max = $15,\n mc_force_fullscreen = $16,\n mc_game_resolution_x = $17,\n mc_game_resolution_y = $18,\n hide_on_process_start = $19,\n\n hook_pre_launch = $20,\n hook_wrapper = $21,\n hook_post_exit = $22,\n\n custom_dir = $23,\n prev_custom_dir = $24,\n migrated = $25,\n\n toggle_sidebar = $26,\n feature_flags = $27,\n hide_nametag_skins_page = $28,\n\n skipped_update = $29,\n pending_update_toast_for_version = $30,\n auto_download_updates = $31,\n\n version = $32\n ",
"query": "\n UPDATE settings\n SET\n max_concurrent_writes = $1,\n max_concurrent_downloads = $2,\n\n theme = $3,\n locale = $4,\n default_page = $5,\n collapsed_navigation = $6,\n advanced_rendering = $7,\n native_decorations = $8,\n\n discord_rpc = $9,\n developer_mode = $10,\n telemetry = $11,\n personalized_ads = $12,\n\n extra_launch_args = jsonb($13),\n custom_env_vars = jsonb($14),\n mc_memory_max = $15,\n mc_force_fullscreen = $16,\n mc_game_resolution_x = $17,\n mc_game_resolution_y = $18,\n hide_on_process_start = $19,\n\n hook_pre_launch = $20,\n hook_wrapper = $21,\n hook_post_exit = $22,\n\n custom_dir = $23,\n prev_custom_dir = $24,\n migrated = $25,\n\n toggle_sidebar = $26,\n feature_flags = $27,\n hide_nametag_skins_page = $28,\n\n skipped_update = $29,\n pending_update_toast_for_version = $30,\n auto_download_updates = $31,\n\n sync_theme_across_devices = $32,\n sync_behavior_across_devices = $33,\n\n version = $34\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 32
"Right": 34
},
"nullable": []
},
"hash": "dfdc99cb5ec60bb08c566920628deec7e741eca9490811ebad6594abe8a6126d"
"hash": "88c6a22aa112f10dce9d42779f06c723b356263ffc83aabb645c9fb5b6d5aa7c"
}
@@ -0,0 +1,5 @@
ALTER TABLE settings
ADD COLUMN sync_theme_across_devices INTEGER NOT NULL DEFAULT TRUE;
ALTER TABLE settings
ADD COLUMN sync_behavior_across_devices INTEGER NOT NULL DEFAULT TRUE;
+45
View File
@@ -109,6 +109,51 @@ pub async fn get_user_collections(user_id: &str) -> crate::Result<Value> {
.await
}
#[tracing::instrument]
pub async fn get_user_preferences(user_id: &str) -> crate::Result<Value> {
let state = State::get().await?;
let user_id = urlencoding::encode(user_id);
fetch_json(
Method::GET,
&format!(
"{}user/{}/preferences",
env!("MODRINTH_API_URL_V3"),
user_id
),
None,
None,
Some("/v3/user/:id/preferences"),
&state.api_semaphore,
&state.pool,
)
.await
}
#[tracing::instrument(skip(preferences))]
pub async fn patch_user_preferences(
user_id: &str,
preferences: Value,
) -> crate::Result<Value> {
let state = State::get().await?;
let user_id = urlencoding::encode(user_id);
fetch_json(
Method::PATCH,
&format!(
"{}user/{}/preferences",
env!("MODRINTH_API_URL_V3"),
user_id
),
None,
Some(preferences),
Some("/v3/user/:id/preferences"),
&state.api_semaphore,
&state.pool,
)
.await
}
#[tracing::instrument(skip(patch))]
pub async fn patch_user(user_id: &str, patch: Value) -> crate::Result<()> {
let state = State::get().await?;
+11 -1
View File
@@ -19,6 +19,8 @@ pub struct Settings {
pub advanced_rendering: bool,
pub native_decorations: bool,
pub toggle_sidebar: bool,
pub sync_theme_across_devices: bool,
pub sync_behavior_across_devices: bool,
pub telemetry: bool,
pub discord_rpc: bool,
@@ -88,6 +90,7 @@ impl Settings {
hook_pre_launch, hook_wrapper, hook_post_exit,
custom_dir, prev_custom_dir, migrated, json(feature_flags) feature_flags, toggle_sidebar,
skipped_update, pending_update_toast_for_version, auto_download_updates,
sync_theme_across_devices, sync_behavior_across_devices,
version
FROM settings
"
@@ -146,6 +149,8 @@ impl Settings {
pending_update_toast_for_version: res
.pending_update_toast_for_version,
auto_download_updates: res.auto_download_updates.map(|x| x == 1),
sync_theme_across_devices: res.sync_theme_across_devices == 1,
sync_behavior_across_devices: res.sync_behavior_across_devices == 1,
version: res.version as usize,
})
}
@@ -206,7 +211,10 @@ impl Settings {
pending_update_toast_for_version = $30,
auto_download_updates = $31,
version = $32
sync_theme_across_devices = $32,
sync_behavior_across_devices = $33,
version = $34
",
max_concurrent_writes,
max_concurrent_downloads,
@@ -239,6 +247,8 @@ impl Settings {
self.skipped_update,
self.pending_update_toast_for_version,
self.auto_download_updates,
self.sync_theme_across_devices,
self.sync_behavior_across_devices,
version,
)
.execute(exec)