Skip to content

Commit a77cdd0

Browse files
committed
Remove ads muting
1 parent 42ade0f commit a77cdd0

File tree

5 files changed

+4
-87
lines changed

5 files changed

+4
-87
lines changed

apps/app-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@modrinth/app-frontend",
33
"private": true,
4-
"version": "0.8.8",
4+
"version": "0.8.9",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

apps/app/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "theseus_gui"
3-
version = "0.8.8"
3+
version = "0.8.9"
44
description = "The Modrinth App is a desktop application for managing your Minecraft mods"
55
license = "GPL-3.0-only"
66
repository = "https://github.com/modrinth/code/apps/app/"

apps/app/src/api/ads-init.js

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -21,86 +21,3 @@ document.addEventListener(
2121
window.open = (url, target, features) => {
2222
window.top.postMessage({ modrinthOpenUrl: url }, 'https://modrinth.com')
2323
}
24-
25-
function muteAudioContext() {
26-
if (window.AudioContext || window.webkitAudioContext) {
27-
const AudioContext = window.AudioContext || window.webkitAudioContext
28-
const originalCreateMediaElementSource = AudioContext.prototype.createMediaElementSource
29-
const originalCreateMediaStreamSource = AudioContext.prototype.createMediaStreamSource
30-
const originalCreateMediaStreamTrackSource = AudioContext.prototype.createMediaStreamTrackSource
31-
const originalCreateBufferSource = AudioContext.prototype.createBufferSource
32-
const originalCreateOscillator = AudioContext.prototype.createOscillator
33-
34-
AudioContext.prototype.createGain = function () {
35-
const gain = originalCreateGain.call(this)
36-
gain.gain.value = 0
37-
return gain
38-
}
39-
40-
AudioContext.prototype.createMediaElementSource = function (mediaElement) {
41-
const source = originalCreateMediaElementSource.call(this, mediaElement)
42-
source.connect(this.createGain())
43-
return source
44-
}
45-
46-
AudioContext.prototype.createMediaStreamSource = function (mediaStream) {
47-
const source = originalCreateMediaStreamSource.call(this, mediaStream)
48-
source.connect(this.createGain())
49-
return source
50-
}
51-
52-
AudioContext.prototype.createMediaStreamTrackSource = function (mediaStreamTrack) {
53-
const source = originalCreateMediaStreamTrackSource.call(this, mediaStreamTrack)
54-
source.connect(this.createGain())
55-
return source
56-
}
57-
58-
AudioContext.prototype.createBufferSource = function () {
59-
const source = originalCreateBufferSource.call(this)
60-
source.connect(this.createGain())
61-
return source
62-
}
63-
64-
AudioContext.prototype.createOscillator = function () {
65-
const oscillator = originalCreateOscillator.call(this)
66-
oscillator.connect(this.createGain())
67-
return oscillator
68-
}
69-
}
70-
}
71-
72-
function muteVideo(mediaElement) {
73-
let count = Number(mediaElement.getAttribute('data-modrinth-muted-count') ?? 0)
74-
75-
if (!mediaElement.muted || mediaElement.volume !== 0) {
76-
mediaElement.muted = true
77-
mediaElement.volume = 0
78-
79-
mediaElement.setAttribute('data-modrinth-muted-count', count + 1)
80-
}
81-
82-
if (count > 5) {
83-
// Video is detected as malicious, so it is removed from the page
84-
mediaElement.remove()
85-
}
86-
}
87-
88-
function muteVideos() {
89-
document.querySelectorAll('video, audio').forEach(function (mediaElement) {
90-
muteVideo(mediaElement)
91-
92-
if (!mediaElement.hasAttribute('data-modrinth-muted')) {
93-
mediaElement.addEventListener('volumechange', () => muteVideo(mediaElement))
94-
95-
mediaElement.setAttribute('data-modrinth-muted', 'true')
96-
}
97-
})
98-
}
99-
100-
document.addEventListener('DOMContentLoaded', () => {
101-
muteVideos()
102-
muteAudioContext()
103-
104-
const observer = new MutationObserver(muteVideos)
105-
observer.observe(document.body, { childList: true, subtree: true })
106-
})

apps/app/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
]
5050
},
5151
"productName": "Modrinth App",
52-
"version": "0.8.8",
52+
"version": "0.8.9",
5353
"mainBinaryName": "Modrinth App",
5454
"identifier": "ModrinthApp",
5555
"plugins": {

packages/app-lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "theseus"
3-
version = "0.8.8"
3+
version = "0.8.9"
44
authors = ["Jai A <jaiagr+gpg@pm.me>"]
55
edition = "2021"
66

0 commit comments

Comments
 (0)