Mute audio from playing in ads (#2471)

* Mute audio from playing in ads

* Update tauri version, get rid of custom

* bump wry

* fix more

* Fix lint
This commit is contained in:
Geometrically 2024-09-29 17:51:51 -07:00 committed by GitHub
parent e81a4ade97
commit 624abf0df4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 3254 additions and 5114 deletions

View File

@ -41,9 +41,6 @@ jobs:
with: with:
components: rustfmt, clippy components: rustfmt, clippy
- name: Install Tauri CLI
run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5e2942876c2266594ed1db516c1d9975c873c36a
- name: Setup rust cache - name: Setup rust cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -121,7 +118,6 @@ jobs:
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
V1_COMPATIBLE_BIN_NAME: true
- name: build app - name: build app
run: pnpm --filter=@modrinth/app run tauri build --config "tauri-release.conf.json" run: pnpm --filter=@modrinth/app run tauri build --config "tauri-release.conf.json"
@ -131,7 +127,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
V1_COMPATIBLE_BIN_NAME: true
- name: upload ${{ matrix.platform }} - name: upload ${{ matrix.platform }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4

View File

@ -32,9 +32,6 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Tauri CLI
run: cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5e2942876c2266594ed1db516c1d9975c873c36a
- name: Setup Node.JS environment - name: Setup Node.JS environment
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:

505
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -18,5 +18,4 @@ strip = true # Remove debug symbols
opt-level = 3 opt-level = 3
[patch.crates-io] [patch.crates-io]
wry = { git = "https://github.com/modrinth/wry", rev = "5840108" } wry = { git = "https://github.com/modrinth/wry", rev = "27fb16b" }
tauri = { git = "https://github.com/modrinth/tauri", rev = "5e29428" }

View File

@ -1,7 +1,7 @@
{ {
"name": "@modrinth/app-frontend", "name": "@modrinth/app-frontend",
"private": true, "private": true,
"version": "0.8.7", "version": "0.8.8",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -230,7 +230,7 @@ const createInstance = async () => {
@click="installModal.hide()" @click="installModal.hide()"
> >
<Avatar <Avatar
:src="profile.icon_path ? tauri.convertFileSrc(profile.icon_path) : null" :src="profile.icon_path ? convertFileSrc(profile.icon_path) : null"
class="profile-image" class="profile-image"
/> />
{{ profile.name }} {{ profile.name }}

View File

@ -363,6 +363,25 @@ async function purgeCache() {
<span class="label__title size-card-header">Privacy</span> <span class="label__title size-card-header">Privacy</span>
</h3> </h3>
</div> </div>
<div class="adjacent-input">
<label for="opt-out-analytics">
<span class="label__title">Personalized ads</span>
<span class="label__description">
Modrinth's ad provider, Aditude, shows ads based on your preferences. By disabling this
option, you opt out and ads will no longer be shown based on your interests.
</span>
</label>
<Toggle
id="opt-out-analytics"
:model-value="settings.personalized_ads"
:checked="settings.personalized_ads"
@update:model-value="
(e) => {
settings.personalized_ads = e
}
"
/>
</div>
<div class="adjacent-input"> <div class="adjacent-input">
<label for="opt-out-analytics"> <label for="opt-out-analytics">
<span class="label__title">Telemetry</span> <span class="label__title">Telemetry</span>

View File

@ -1,6 +1,6 @@
[package] [package]
name = "theseus_gui" name = "theseus_gui"
version = "0.8.7" version = "0.8.8"
description = "The Modrinth App is a desktop application for managing your Minecraft mods" description = "The Modrinth App is a desktop application for managing your Minecraft mods"
license = "GPL-3.0-only" license = "GPL-3.0-only"
repository = "https://github.com/modrinth/code/apps/app/" repository = "https://github.com/modrinth/code/apps/app/"
@ -8,7 +8,7 @@ edition = "2021"
build = "build.rs" build = "build.rs"
[build-dependencies] [build-dependencies]
tauri-build = { git = "https://github.com/modrinth/tauri", features = ["codegen"], rev = "5e29428" } tauri-build = { version = "2.0.0-rc", features = ["codegen"] }
[dependencies] [dependencies]
theseus = { path = "../../packages/app-lib", features = ["tauri"] } theseus = { path = "../../packages/app-lib", features = ["tauri"] }
@ -16,7 +16,7 @@ theseus = { path = "../../packages/app-lib", features = ["tauri"] }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { git = "https://github.com/modrinth/tauri", features = ["devtools", "macos-private-api", "protocol-asset", "unstable"], rev = "5e29428" } tauri = { version = "2.0.0-rc", features = ["devtools", "macos-private-api", "protocol-asset", "unstable"] }
tauri-plugin-window-state = "2.0.0-rc" tauri-plugin-window-state = "2.0.0-rc"
tauri-plugin-deep-link = "2.0.0-rc" tauri-plugin-deep-link = "2.0.0-rc"
tauri-plugin-os = "2.0.0-rc" tauri-plugin-os = "2.0.0-rc"

View File

@ -22,7 +22,6 @@ Before you begin, ensure you have the following installed on your machine:
Follow these steps to set up your development environment: Follow these steps to set up your development environment:
```bash ```bash
cargo install tauri-cli --git https://github.com/modrinth/tauri.git --rev 5e2942876c2266594ed1db516c1d9975c873c36a
pnpm install pnpm install
pnpm app:dev pnpm app:dev
``` ```

View File

@ -228,6 +228,7 @@ fn main() {
"show_ads_window", "show_ads_window",
"record_ads_click", "record_ads_click",
"open_link", "open_link",
"get_ads_personalization",
]) ])
.default_permission( .default_permission(
DefaultPermissionRule::AllowAllCommands, DefaultPermissionRule::AllowAllCommands,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,16 @@
{ {
"name": "@modrinth/app", "name": "@modrinth/app",
"scripts": { "scripts": {
"build": "cargo tauri build", "build": "tauri build",
"tauri": "cargo tauri", "tauri": "tauri",
"dev": "cargo tauri dev", "dev": "tauri dev",
"test": "cargo test", "test": "cargo test",
"lint": "cargo fmt --check && cargo clippy -- -D warnings", "lint": "cargo fmt --check && cargo clippy -- -D warnings",
"fix": "cargo fmt && cargo clippy --fix" "fix": "cargo fmt && cargo clippy --fix"
}, },
"devDependencies": {
"@tauri-apps/cli": "2.0.0-rc.16"
},
"dependencies": { "dependencies": {
"@modrinth/app-frontend": "workspace:*", "@modrinth/app-frontend": "workspace:*",
"@modrinth/app-lib": "workspace:*" "@modrinth/app-lib": "workspace:*"

View File

@ -21,3 +21,86 @@ document.addEventListener(
window.open = (url, target, features) => { window.open = (url, target, features) => {
window.top.postMessage({ modrinthOpenUrl: url }, 'https://modrinth.com') window.top.postMessage({ modrinthOpenUrl: url }, 'https://modrinth.com')
} }
function muteAudioContext() {
if (window.AudioContext || window.webkitAudioContext) {
const AudioContext = window.AudioContext || window.webkitAudioContext
const originalCreateMediaElementSource = AudioContext.prototype.createMediaElementSource
const originalCreateMediaStreamSource = AudioContext.prototype.createMediaStreamSource
const originalCreateMediaStreamTrackSource = AudioContext.prototype.createMediaStreamTrackSource
const originalCreateBufferSource = AudioContext.prototype.createBufferSource
const originalCreateOscillator = AudioContext.prototype.createOscillator
AudioContext.prototype.createGain = function () {
const gain = originalCreateGain.call(this)
gain.gain.value = 0
return gain
}
AudioContext.prototype.createMediaElementSource = function (mediaElement) {
const source = originalCreateMediaElementSource.call(this, mediaElement)
source.connect(this.createGain())
return source
}
AudioContext.prototype.createMediaStreamSource = function (mediaStream) {
const source = originalCreateMediaStreamSource.call(this, mediaStream)
source.connect(this.createGain())
return source
}
AudioContext.prototype.createMediaStreamTrackSource = function (mediaStreamTrack) {
const source = originalCreateMediaStreamTrackSource.call(this, mediaStreamTrack)
source.connect(this.createGain())
return source
}
AudioContext.prototype.createBufferSource = function () {
const source = originalCreateBufferSource.call(this)
source.connect(this.createGain())
return source
}
AudioContext.prototype.createOscillator = function () {
const oscillator = originalCreateOscillator.call(this)
oscillator.connect(this.createGain())
return oscillator
}
}
}
function muteVideo(mediaElement) {
let count = Number(mediaElement.getAttribute('data-modrinth-muted-count') ?? 0)
if (!mediaElement.muted || mediaElement.volume !== 0) {
mediaElement.muted = true
mediaElement.volume = 0
mediaElement.setAttribute('data-modrinth-muted-count', count + 1)
}
if (count > 5) {
// Video is detected as malicious, so it is removed from the page
mediaElement.remove()
}
}
function muteVideos() {
document.querySelectorAll('video, audio').forEach(function (mediaElement) {
muteVideo(mediaElement)
if (!mediaElement.hasAttribute('data-modrinth-muted')) {
mediaElement.addEventListener('volumechange', () => muteVideo(mediaElement))
mediaElement.setAttribute('data-modrinth-muted', 'true')
}
})
}
document.addEventListener('DOMContentLoaded', () => {
muteVideos()
muteAudioContext()
const observer = new MutationObserver(muteVideos)
observer.observe(document.body, { childList: true, subtree: true })
})

View File

@ -4,6 +4,7 @@ use std::time::{Duration, Instant};
use tauri::plugin::TauriPlugin; use tauri::plugin::TauriPlugin;
use tauri::{Emitter, LogicalPosition, LogicalSize, Manager, Runtime}; use tauri::{Emitter, LogicalPosition, LogicalSize, Manager, Runtime};
use tauri_plugin_shell::ShellExt; use tauri_plugin_shell::ShellExt;
use theseus::settings;
use tokio::sync::RwLock; use tokio::sync::RwLock;
pub struct AdsState { pub struct AdsState {
@ -14,6 +15,8 @@ pub struct AdsState {
pub malicious_origins: HashSet<String>, pub malicious_origins: HashSet<String>,
} }
const AD_LINK: &str = "https://modrinth.com/wrapper/app-ads-cookie";
pub fn init<R: Runtime>() -> TauriPlugin<R> { pub fn init<R: Runtime>() -> TauriPlugin<R> {
tauri::plugin::Builder::<R>::new("ads") tauri::plugin::Builder::<R>::new("ads")
.setup(|app, _api| { .setup(|app, _api| {
@ -31,11 +34,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
loop { loop {
if let Some(webview) = app.webviews().get_mut("ads-window") if let Some(webview) = app.webviews().get_mut("ads-window")
{ {
let _ = webview.navigate( let _ = webview.navigate(AD_LINK.parse().unwrap());
"https://modrinth.com/wrapper/app-ads-cookie"
.parse()
.unwrap(),
);
} }
tokio::time::sleep(std::time::Duration::from_secs(60 * 5)) tokio::time::sleep(std::time::Duration::from_secs(60 * 5))
@ -52,6 +51,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
show_ads_window, show_ads_window,
record_ads_click, record_ads_click,
open_link, open_link,
get_ads_personalization,
]) ])
.build() .build()
} }
@ -84,11 +84,11 @@ pub async fn init_ads_window<R: Runtime>(
let _ = webview.set_size(LogicalSize::new(width, height)); let _ = webview.set_size(LogicalSize::new(width, height));
} }
} else if let Some(window) = app.get_window("main") { } else if let Some(window) = app.get_window("main") {
let window = window.add_child( let _ = window.add_child(
tauri::webview::WebviewBuilder::new( tauri::webview::WebviewBuilder::new(
"ads-window", "ads-window",
WebviewUrl::External( WebviewUrl::External(
"https://modrinth.com/wrapper/app-ads-cookie".parse().unwrap(), AD_LINK.parse().unwrap(),
), ),
) )
.initialization_script(LINK_SCRIPT) .initialization_script(LINK_SCRIPT)
@ -102,12 +102,6 @@ pub async fn init_ads_window<R: Runtime>(
}, },
LogicalSize::new(width, height), LogicalSize::new(width, height),
); );
if let Ok(window) = window {
window.listen_any("click", |event| {
println!("click: {:?}", event);
});
}
} }
Ok(()) Ok(())
@ -214,3 +208,9 @@ pub async fn open_link<R: Runtime>(
Ok(()) Ok(())
} }
#[tauri::command]
pub async fn get_ads_personalization() -> crate::api::Result<bool> {
let res = settings::get().await?;
Ok(res.personalized_ads)
}

View File

@ -52,7 +52,8 @@
] ]
}, },
"productName": "Modrinth App", "productName": "Modrinth App",
"version": "0.8.7", "version": "0.8.8",
"mainBinaryName": "Modrinth App",
"identifier": "ModrinthApp", "identifier": "ModrinthApp",
"plugins": { "plugins": {
"deep-link": { "deep-link": {

View File

@ -44,11 +44,14 @@
</head> </head>
<body> <body>
<div class="ads-container"> <div class="ads-container">
<a id="plus-link" href="https://modrinth.com/plus" target="_blank"></a> <div id="plus-link"></div>
<div id="modrinth-rail-1" /> <div id="modrinth-rail-1" />
</div> </div>
<script> <script>
window.__TAURI_INTERNALS__.invoke("plugin:ads|get_ads_personalization", {})
.then((personalized) => {
window.tude = window.tude || { cmd: [] }; window.tude = window.tude || { cmd: [] };
tude.cmd.push(function () { tude.cmd.push(function () {
tude.refreshAdsViaDivMappings([ tude.refreshAdsViaDivMappings([
{ {
@ -56,6 +59,11 @@
baseDivId: "pb-slot-square-2", baseDivId: "pb-slot-square-2",
}, },
]); ]);
tude.setPrivacySettings({
personalizedAds: personalized ?? true,
})
});
}); });
window.addEventListener( window.addEventListener(
@ -84,6 +92,15 @@
}); });
document.addEventListener("contextmenu", (event) => event.preventDefault()); document.addEventListener("contextmenu", (event) => event.preventDefault());
const plusLink = document.getElementById("plus-link");
plusLink.addEventListener('click', function() {
window.__TAURI_INTERNALS__.invoke("plugin:ads|record_ads_click", {});
window.__TAURI_INTERNALS__.invoke("plugin:ads|open_link", {
path: 'https://modrinth.com/plus',
origin: 'https://modrinth.com',
});
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -0,0 +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 default_page = $4,\n collapsed_navigation = $5,\n advanced_rendering = $6,\n native_decorations = $7,\n\n discord_rpc = $8,\n developer_mode = $9,\n telemetry = $10,\n personalized_ads = $11,\n\n onboarded = $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 ",
"describe": {
"columns": [],
"parameters": {
"Right": 25
},
"nullable": []
},
"hash": "26e3ed8680f6c492b03b458aabfb3f94fddc753b343ef705263188945d0e578d"
}

View File

@ -1,6 +1,6 @@
{ {
"db_name": "SQLite", "db_name": "SQLite",
"query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, default_page, collapsed_navigation, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry,\n onboarded,\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\n FROM settings\n ", "query": "\n SELECT\n max_concurrent_writes, max_concurrent_downloads,\n theme, default_page, collapsed_navigation, advanced_rendering, native_decorations,\n discord_rpc, developer_mode, telemetry, personalized_ads,\n onboarded,\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\n FROM settings\n ",
"describe": { "describe": {
"columns": [ "columns": [
{ {
@ -54,73 +54,78 @@
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "onboarded", "name": "personalized_ads",
"ordinal": 10, "ordinal": 10,
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "extra_launch_args", "name": "onboarded",
"ordinal": 11, "ordinal": 11,
"type_info": "Text" "type_info": "Integer"
}, },
{ {
"name": "custom_env_vars", "name": "extra_launch_args",
"ordinal": 12, "ordinal": 12,
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "mc_memory_max", "name": "custom_env_vars",
"ordinal": 13, "ordinal": 13,
"type_info": "Integer" "type_info": "Text"
}, },
{ {
"name": "mc_force_fullscreen", "name": "mc_memory_max",
"ordinal": 14, "ordinal": 14,
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "mc_game_resolution_x", "name": "mc_force_fullscreen",
"ordinal": 15, "ordinal": 15,
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "mc_game_resolution_y", "name": "mc_game_resolution_x",
"ordinal": 16, "ordinal": 16,
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "hide_on_process_start", "name": "mc_game_resolution_y",
"ordinal": 17, "ordinal": 17,
"type_info": "Integer" "type_info": "Integer"
}, },
{ {
"name": "hook_pre_launch", "name": "hide_on_process_start",
"ordinal": 18, "ordinal": 18,
"type_info": "Text" "type_info": "Integer"
}, },
{ {
"name": "hook_wrapper", "name": "hook_pre_launch",
"ordinal": 19, "ordinal": 19,
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "hook_post_exit", "name": "hook_wrapper",
"ordinal": 20, "ordinal": 20,
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "custom_dir", "name": "hook_post_exit",
"ordinal": 21, "ordinal": 21,
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "prev_custom_dir", "name": "custom_dir",
"ordinal": 22, "ordinal": 22,
"type_info": "Text" "type_info": "Text"
}, },
{ {
"name": "migrated", "name": "prev_custom_dir",
"ordinal": 23, "ordinal": 23,
"type_info": "Text"
},
{
"name": "migrated",
"ordinal": 24,
"type_info": "Integer" "type_info": "Integer"
} }
], ],
@ -139,6 +144,7 @@
false, false,
false, false,
false, false,
false,
null, null,
null, null,
false, false,
@ -154,5 +160,5 @@
false false
] ]
}, },
"hash": "03d1aeddf7788320530c447a82342aecdb4099ce183dd9106c4bcc47604cb080" "hash": "8e19c9cdb0aaa48509724e82f6e8f212c9cd2112fdba77cfeee206025af47761"
} }

View File

@ -1,12 +0,0 @@
{
"db_name": "SQLite",
"query": "\n UPDATE settings\n SET\n max_concurrent_writes = $1,\n max_concurrent_downloads = $2,\n\n theme = $3,\n default_page = $4,\n collapsed_navigation = $5,\n advanced_rendering = $6,\n native_decorations = $7,\n\n discord_rpc = $8,\n developer_mode = $9,\n telemetry = $10,\n\n onboarded = $11,\n\n extra_launch_args = jsonb($12),\n custom_env_vars = jsonb($13),\n mc_memory_max = $14,\n mc_force_fullscreen = $15,\n mc_game_resolution_x = $16,\n mc_game_resolution_y = $17,\n hide_on_process_start = $18,\n\n hook_pre_launch = $19,\n hook_wrapper = $20,\n hook_post_exit = $21,\n\n custom_dir = $22,\n prev_custom_dir = $23,\n migrated = $24\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 24
},
"nullable": []
},
"hash": "d645daf951ff6fead3c86df685d99bacc81cb0a999c0f8d2ff7755b0089a79d8"
}

View File

@ -1,6 +1,6 @@
[package] [package]
name = "theseus" name = "theseus"
version = "0.8.7" version = "0.8.8"
authors = ["Jai A <jaiagr+gpg@pm.me>"] authors = ["Jai A <jaiagr+gpg@pm.me>"]
edition = "2021" edition = "2021"
@ -36,7 +36,7 @@ tracing-error = "0.2.0"
paste = { version = "1.0" } paste = { version = "1.0" }
tauri = { git = "https://github.com/modrinth/tauri", rev = "5e29428", optional = true } tauri = { version = "2.0.0-rc", optional = true }
indicatif = { version = "0.17.3", optional = true } indicatif = { version = "0.17.3", optional = true }
async-tungstenite = { version = "0.27.0", features = ["tokio-runtime", "tokio-rustls-webpki-roots"] } async-tungstenite = { version = "0.27.0", features = ["tokio-runtime", "tokio-rustls-webpki-roots"] }

View File

@ -0,0 +1 @@
ALTER TABLE settings ADD COLUMN personalized_ads INTEGER NOT NULL DEFAULT TRUE;

View File

@ -17,6 +17,7 @@ pub struct Settings {
pub telemetry: bool, pub telemetry: bool,
pub discord_rpc: bool, pub discord_rpc: bool,
pub developer_mode: bool, pub developer_mode: bool,
pub personalized_ads: bool,
pub onboarded: bool, pub onboarded: bool,
@ -42,7 +43,7 @@ impl Settings {
SELECT SELECT
max_concurrent_writes, max_concurrent_downloads, max_concurrent_writes, max_concurrent_downloads,
theme, default_page, collapsed_navigation, advanced_rendering, native_decorations, theme, default_page, collapsed_navigation, advanced_rendering, native_decorations,
discord_rpc, developer_mode, telemetry, discord_rpc, developer_mode, telemetry, personalized_ads,
onboarded, onboarded,
json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars, json(extra_launch_args) extra_launch_args, json(custom_env_vars) custom_env_vars,
mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start, mc_memory_max, mc_force_fullscreen, mc_game_resolution_x, mc_game_resolution_y, hide_on_process_start,
@ -65,6 +66,7 @@ impl Settings {
telemetry: res.telemetry == 1, telemetry: res.telemetry == 1,
discord_rpc: res.discord_rpc == 1, discord_rpc: res.discord_rpc == 1,
developer_mode: res.developer_mode == 1, developer_mode: res.developer_mode == 1,
personalized_ads: res.personalized_ads == 1,
onboarded: res.onboarded == 1, onboarded: res.onboarded == 1,
extra_launch_args: res extra_launch_args: res
.extra_launch_args .extra_launch_args
@ -123,24 +125,25 @@ impl Settings {
discord_rpc = $8, discord_rpc = $8,
developer_mode = $9, developer_mode = $9,
telemetry = $10, telemetry = $10,
personalized_ads = $11,
onboarded = $11, onboarded = $12,
extra_launch_args = jsonb($12), extra_launch_args = jsonb($13),
custom_env_vars = jsonb($13), custom_env_vars = jsonb($14),
mc_memory_max = $14, mc_memory_max = $15,
mc_force_fullscreen = $15, mc_force_fullscreen = $16,
mc_game_resolution_x = $16, mc_game_resolution_x = $17,
mc_game_resolution_y = $17, mc_game_resolution_y = $18,
hide_on_process_start = $18, hide_on_process_start = $19,
hook_pre_launch = $19, hook_pre_launch = $20,
hook_wrapper = $20, hook_wrapper = $21,
hook_post_exit = $21, hook_post_exit = $22,
custom_dir = $22, custom_dir = $23,
prev_custom_dir = $23, prev_custom_dir = $24,
migrated = $24 migrated = $25
", ",
max_concurrent_writes, max_concurrent_writes,
max_concurrent_downloads, max_concurrent_downloads,
@ -152,6 +155,7 @@ impl Settings {
self.discord_rpc, self.discord_rpc,
self.developer_mode, self.developer_mode,
self.telemetry, self.telemetry,
self.personalized_ads,
self.onboarded, self.onboarded,
extra_launch_args, extra_launch_args,
custom_env_vars, custom_env_vars,

112
pnpm-lock.yaml generated
View File

@ -31,6 +31,10 @@ importers:
'@modrinth/app-lib': '@modrinth/app-lib':
specifier: workspace:* specifier: workspace:*
version: link:../../packages/app-lib version: link:../../packages/app-lib
devDependencies:
'@tauri-apps/cli':
specifier: 2.0.0-rc.16
version: 2.0.0-rc.16
apps/app-frontend: apps/app-frontend:
dependencies: dependencies:
@ -2002,6 +2006,71 @@ packages:
'@tauri-apps/api@2.0.0-rc.4': '@tauri-apps/api@2.0.0-rc.4':
resolution: {integrity: sha512-UNiIhhKG08j4ooss2oEEVexffmWkgkYlC2M3GcX3VPtNsqFgVNL8Mcw/4Y7rO9M9S+ffAMnLOF5ypzyuyb8tyg==} resolution: {integrity: sha512-UNiIhhKG08j4ooss2oEEVexffmWkgkYlC2M3GcX3VPtNsqFgVNL8Mcw/4Y7rO9M9S+ffAMnLOF5ypzyuyb8tyg==}
'@tauri-apps/cli-darwin-arm64@2.0.0-rc.16':
resolution: {integrity: sha512-lISZU4gG0c9PbY7h/j/gW7nJLxZEygNBrYEET6zN8R99Znf5rSO+CfjenaMcJUUj6yTAd8gzdakRpLqNSAWegA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [darwin]
'@tauri-apps/cli-darwin-x64@2.0.0-rc.16':
resolution: {integrity: sha512-D9uxPCxpyYcTSQulJGFX3POAKPOJd8WcWHFH8x6YVM1cIx6EWRXIE1sZnPUOjFr7qCg+bSdYdr8/BFHcZGcApQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [darwin]
'@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.16':
resolution: {integrity: sha512-WsVdKm4D1I1XV8I9yRnmOINZRwwWfh6xcLV3m19+B9g6TohK8RkRxWfxvs3TLQlWOLQ6lo8BzS9rzXB+KtjDpg==}
engines: {node: '>= 10'}
cpu: [arm]
os: [linux]
'@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.16':
resolution: {integrity: sha512-2jpZDagNs6rrqposHJihHBayttgOl5aB2+bYiVEC6ye+haiFtmYmpdaPOaVIw+YVQs6lepf5PVrisCoU9DmYsg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16':
resolution: {integrity: sha512-SNEDcB+sWOls/B0a+UpUHVa/oegvlXXKYWsTxuXtgWIr5VbWG7rXLZ3fZpLLP3SpRVGTGTnABcyqshFbWSqqKQ==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
'@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16':
resolution: {integrity: sha512-Zsq29MM1ooeH1+chQBa7ffDFnzAZebBBFdsvs4e05tS1H8gn4oKE+PSMn9p/okzVXykEk9ri2/n7BG1XFeifMA==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16':
resolution: {integrity: sha512-g+pwSuis2YMxhJJ/pJYwp/Nps5CWvlv/5MV5UfDvClkCkeAyzIqVX+HbBLPcs5S0CePUQNeP0j4d4jBWUqZZQg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
'@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16':
resolution: {integrity: sha512-PpPqdMTwJSDAK4KnNjvh77ShSkY+7pih1f6e50EtXar8bjC17e3XcEqFhDNne5mxEVTLYhibs6p1JLPad0ZjRA==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [win32]
'@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.16':
resolution: {integrity: sha512-io2yIcEcG7YLP+9n13NbilB93SjcB7jIl8GbURC4XZT4/4t9D1PWHpJr5hySVsGRLCz5e8NzwC5RlnenNzmpPQ==}
engines: {node: '>= 10'}
cpu: [ia32]
os: [win32]
'@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.16':
resolution: {integrity: sha512-Rfkmxe3k+cBVA/kVYt8O25QrQqWKJlH9AiH7Q3C6xBzzG9PCSRMBszCp+JhBF8jhVlwNmOBv6UG+lm85kspwGg==}
engines: {node: '>= 10'}
cpu: [x64]
os: [win32]
'@tauri-apps/cli@2.0.0-rc.16':
resolution: {integrity: sha512-wdjZg/M3dcxiqgWG6VRnABpX0dYxRww93t0d1MYoZxFDrnyoUz5kYwFQ0v4J9u0qenEgskjoypvon7V/Nj9qrg==}
engines: {node: '>= 10'}
hasBin: true
'@tauri-apps/plugin-dialog@2.0.0-rc.0': '@tauri-apps/plugin-dialog@2.0.0-rc.0':
resolution: {integrity: sha512-DPOXYe8SQ6Radk/67EOdaomlxL7oF99JO/ZUaPp1IBEs3Wro7lhlz63CfdKIBfKIZTLJLzP1R7/EiPL/GTA3Bg==} resolution: {integrity: sha512-DPOXYe8SQ6Radk/67EOdaomlxL7oF99JO/ZUaPp1IBEs3Wro7lhlz63CfdKIBfKIZTLJLzP1R7/EiPL/GTA3Bg==}
@ -8041,6 +8110,49 @@ snapshots:
'@tauri-apps/api@2.0.0-rc.4': {} '@tauri-apps/api@2.0.0-rc.4': {}
'@tauri-apps/cli-darwin-arm64@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-darwin-x64@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-linux-arm-gnueabihf@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-linux-arm64-gnu@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-linux-arm64-musl@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-linux-x64-gnu@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-linux-x64-musl@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-win32-arm64-msvc@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-win32-ia32-msvc@2.0.0-rc.16':
optional: true
'@tauri-apps/cli-win32-x64-msvc@2.0.0-rc.16':
optional: true
'@tauri-apps/cli@2.0.0-rc.16':
optionalDependencies:
'@tauri-apps/cli-darwin-arm64': 2.0.0-rc.16
'@tauri-apps/cli-darwin-x64': 2.0.0-rc.16
'@tauri-apps/cli-linux-arm-gnueabihf': 2.0.0-rc.16
'@tauri-apps/cli-linux-arm64-gnu': 2.0.0-rc.16
'@tauri-apps/cli-linux-arm64-musl': 2.0.0-rc.16
'@tauri-apps/cli-linux-x64-gnu': 2.0.0-rc.16
'@tauri-apps/cli-linux-x64-musl': 2.0.0-rc.16
'@tauri-apps/cli-win32-arm64-msvc': 2.0.0-rc.16
'@tauri-apps/cli-win32-ia32-msvc': 2.0.0-rc.16
'@tauri-apps/cli-win32-x64-msvc': 2.0.0-rc.16
'@tauri-apps/plugin-dialog@2.0.0-rc.0': '@tauri-apps/plugin-dialog@2.0.0-rc.0':
dependencies: dependencies:
'@tauri-apps/api': 2.0.0-rc.3 '@tauri-apps/api': 2.0.0-rc.3