-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f65ceaa
commit bdbe506
Showing
4 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import AppPatch from "@patches/apppatch"; | ||
import path from "path"; | ||
import {homedir} from "os"; | ||
import fs from "fs"; | ||
|
||
const firefoxPath = path.join(homedir(), "Library", "Application Support", "Firefox", "Profiles") | ||
const patchCode = "user_pref(\"layers.acceleration.disabled\", true);" | ||
export default class FirefoxDev extends AppPatch { | ||
prefPath: string | ||
constructor(appName: string) { | ||
super(appName); | ||
fs.readdirSync(firefoxPath).forEach(dir => { | ||
if(dir.endsWith(".dev-edition-default")){ | ||
this.prefPath = path.join(firefoxPath, dir, "prefs.js"); | ||
} | ||
}); | ||
} | ||
supported(): boolean { | ||
return this.appName === "Firefox Developer Edition"; | ||
} | ||
patched() { | ||
let pref = fs.readFileSync(this.prefPath, "utf8"); | ||
return pref.includes(patchCode) ? 1 : 0; | ||
} | ||
patch() { | ||
if(this.patched() === 1) return console.log(`${this.appName} already patched. Ignoring...`); | ||
let pref = fs.readFileSync(this.prefPath, "utf8"); | ||
pref += "\n" + patchCode; | ||
fs.writeFileSync(this.prefPath, pref); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import AppPatch from "@patches/apppatch"; | ||
import path from "path"; | ||
import {homedir} from "os"; | ||
import fs from "fs"; | ||
|
||
const firefoxPath = path.join(homedir(), "Library", "Application Support", "Firefox", "Profiles") | ||
const patchCode = "user_pref(\"layers.acceleration.disabled\", true);" | ||
export default class Firefox extends AppPatch { | ||
prefPath: string | ||
constructor(appName: string) { | ||
super(appName); | ||
fs.readdirSync(firefoxPath).forEach(dir => { | ||
if(dir.endsWith(".default-release")){ | ||
this.prefPath = path.join(firefoxPath, dir, "prefs.js"); | ||
} | ||
}); | ||
} | ||
supported(): boolean { | ||
return this.appName === "Firefox"; | ||
} | ||
patched() { | ||
let pref = fs.readFileSync(this.prefPath, "utf8"); | ||
return pref.includes("user_pref(\"layers.acceleration.disabled\", true);") ? 1 : 0; | ||
} | ||
patch() { | ||
if(this.patched() === 1) return console.log(`${this.appName} already patched. Ignoring...`); | ||
let pref = fs.readFileSync(this.prefPath, "utf8"); | ||
pref += "\n" + patchCode; | ||
fs.writeFileSync(this.prefPath, pref); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters