From 591f05647807190e8a7785402f22486c767e397d Mon Sep 17 00:00:00 2001 From: oneflux Date: Mon, 21 Apr 2025 18:34:57 -0700 Subject: [PATCH] remove deprecated legacy launcher --- legacy/README.md | 6 - legacy/launcher/build.sh | 34 ----- legacy/launcher/constants.go | 47 ------- legacy/launcher/exec.go | 166 ---------------------- legacy/launcher/go.mod | 7 - legacy/launcher/go.sum | 4 - legacy/launcher/load-addons.go | 157 --------------------- legacy/launcher/main.go | 219 ----------------------------- legacy/launcher/procgroup-unix.go | 17 --- legacy/launcher/procgroup-win.go | 16 --- legacy/launcher/validate.go | 75 ---------- legacy/launcher/xpi-dl.go | 146 ------------------- legacy/scripts/generate-locales.sh | 49 ------- settings/camoufox.cfg | 12 +- 14 files changed, 6 insertions(+), 949 deletions(-) delete mode 100644 legacy/README.md delete mode 100644 legacy/launcher/build.sh delete mode 100644 legacy/launcher/constants.go delete mode 100644 legacy/launcher/exec.go delete mode 100644 legacy/launcher/go.mod delete mode 100644 legacy/launcher/go.sum delete mode 100644 legacy/launcher/load-addons.go delete mode 100644 legacy/launcher/main.go delete mode 100644 legacy/launcher/procgroup-unix.go delete mode 100644 legacy/launcher/procgroup-win.go delete mode 100644 legacy/launcher/validate.go delete mode 100644 legacy/launcher/xpi-dl.go delete mode 100644 legacy/scripts/generate-locales.sh diff --git a/legacy/README.md b/legacy/README.md deleted file mode 100644 index 96e1e2e..0000000 --- a/legacy/README.md +++ /dev/null @@ -1,6 +0,0 @@ -## Deprecated Assets - -##### 2024-11-21 - -- Old launcher has been deprecated due to it not supporting non-Linux platforms, and for using FF's debugging protocol to load addons [#90](https://github.com/daijro/camoufox/issues/90). -- `generate-locales.sh` (based on [LibreWolf's locale build system](https://gitlab.com/librewolf-community/browser/source/-/blob/3dc56de7b0665724bf3842198cebe961c42a81e0/scripts/generate-locales.sh)) was deprecated due to "Camoufox" leaking to the page [#90](https://github.com/daijro/camoufox/issues/90). \ No newline at end of file diff --git a/legacy/launcher/build.sh b/legacy/launcher/build.sh deleted file mode 100644 index 5cbacc6..0000000 --- a/legacy/launcher/build.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -if [ $# -ne 2 ]; then - echo "Usage: $0 " - echo "arch: x86_64, i686, arm64" - echo "os: linux, windows, macos" - exit 1 -fi - -ARCH=$1 -OS=$2 - -case $ARCH in - x86_64) GOARCH=amd64 ;; - i686) GOARCH=386 ;; - arm64) GOARCH=arm64 ;; - *) echo "Invalid architecture"; exit 1 ;; -esac - -case $OS in - linux) GOOS=linux ;; - windows) GOOS=windows ;; - macos) GOOS=darwin ;; - *) echo "Invalid OS"; exit 1 ;; -esac - -[ "$OS" = "windows" ] && OUTPUT="launch.exe" || OUTPUT="launch" - -rm -rf ./dist launch launch.exe - -echo Building launcher... -GOOS=$GOOS GOARCH=$GOARCH go build -o dist/$OUTPUT || exit 1 - -echo "Complete: launcher/dist/$OUTPUT" \ No newline at end of file diff --git a/legacy/launcher/constants.go b/legacy/launcher/constants.go deleted file mode 100644 index 58ac57e..0000000 --- a/legacy/launcher/constants.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "regexp" - "strings" -) - -// Default addons to extract to /addons -var DefaultAddons = map[string]string{ - "uBO": "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi", - "BPC": "https://gitflic.ru/project/magnolia1234/bpc_uploads/blob/raw?file=bypass_paywalls_clean-latest.xpi", -} - -// Exclude lines from output -var ExclusionRules = []string{ - // Ignore search related warnings - "^console\\.error:\\ Search", - "SearchService", - "SearchEngineSelector", - // Ignore glxtest errors - "\\[GFX1\\-\\]:", - // Ignore meaningless lines - "^console\\.error:\\ \\(\\{\\}\\)$", - "^console\\.error:\\ \"Could\\ not\\ record\\ event:\\ \"\\ \\(\\{\\}\\)$", - "^\\s*?$", - "Rejected by Camoufox\\.$", - // Ignore missing urlbar provider errors - "^JavaScript\\ error:\\ resource:///modules/UrlbarProvider", -} - -// Convert ExclusionRules into a regex command -var ExclusionRegex = regexp.MustCompile(".*(" + strings.Join(ExclusionRules, "|") + ").*") - -// List of fonts for each OS -var FontsByOS = map[string][]string{ - "windows": { - "Arial", "Arial Black", "Bahnschrift", "Calibri", "Calibri Light", "Cambria", "Cambria Math", "Candara", "Candara Light", "Comic Sans MS", "Consolas", "Constantia", "Corbel", "Corbel Light", "Courier New", "Ebrima", "Franklin Gothic Medium", "Gabriola", "Gadugi", "Georgia", "HoloLens MDL2 Assets", "Impact", "Ink Free", "Javanese Text", "Leelawadee UI", "Leelawadee UI Semilight", "Lucida Console", "Lucida Sans Unicode", "MS Gothic", "MS PGothic", "MS UI Gothic", "MV Boli", "Malgun Gothic", "Malgun Gothic Semilight", "Marlett", "Microsoft Himalaya", "Microsoft JhengHei", "Microsoft JhengHei Light", "Microsoft JhengHei UI", "Microsoft JhengHei UI Light", "Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Sans Serif", "Microsoft Tai Le", "Microsoft YaHei", "Microsoft YaHei Light", "Microsoft YaHei UI", "Microsoft YaHei UI Light", "Microsoft Yi Baiti", "MingLiU-ExtB", "MingLiU_HKSCS-ExtB", "Mongolian Baiti", "Myanmar Text", "NSimSun", "Nirmala UI", "Nirmala UI Semilight", "PMingLiU-ExtB", "Palatino Linotype", "Segoe Fluent Icons", "Segoe MDL2 Assets", "Segoe Print", "Segoe Script", "Segoe UI", "Segoe UI Black", "Segoe UI Emoji", "Segoe UI Historic", "Segoe UI Light", "Segoe UI Semibold", "Segoe UI Semilight", "Segoe UI Symbol", "Segoe UI Variable", "SimSun", "SimSun-ExtB", "Sitka", "Sitka Text", "Sylfaen", "Symbol", "Tahoma", "Times New Roman", "Trebuchet MS", "Twemoji Mozilla", "Verdana", "Webdings", "Wingdings", "Yu Gothic", "Yu Gothic Light", "Yu Gothic Medium", "Yu Gothic UI", "Yu Gothic UI Light", "Yu Gothic UI Semibold", "Yu Gothic UI Semilight", "\u5b8b\u4f53", "\u5fae\u8edf\u6b63\u9ed1\u9ad4", "\u5fae\u8edf\u6b63\u9ed1\u9ad4 Light", "\u5fae\u8f6f\u96c5\u9ed1", "\u5fae\u8f6f\u96c5\u9ed1 Light", "\u65b0\u5b8b\u4f53", "\u65b0\u7d30\u660e\u9ad4-ExtB", "\u6e38\u30b4\u30b7\u30c3\u30af", "\u6e38\u30b4\u30b7\u30c3\u30af Light", "\u6e38\u30b4\u30b7\u30c3\u30af Medium", "\u7d30\u660e\u9ad4-ExtB", "\u7d30\u660e\u9ad4_HKSCS-ExtB", "\ub9d1\uc740 \uace0\ub515", "\ub9d1\uc740 \uace0\ub515 Semilight", "\uff2d\uff33 \u30b4\u30b7\u30c3\u30af", "\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af", - }, - - "macos": { - ".Al Bayan PUA", ".Al Nile PUA", ".Al Tarikh PUA", ".Apple Color Emoji UI", ".Apple SD Gothic NeoI", ".Aqua Kana", ".Aqua Kana Bold", ".Aqua \u304b\u306a", ".Aqua \u304b\u306a \u30dc\u30fc\u30eb\u30c9", ".Arial Hebrew Desk Interface", ".Baghdad PUA", ".Beirut PUA", ".Damascus PUA", ".DecoType Naskh PUA", ".Diwan Kufi PUA", ".Farah PUA", ".Geeza Pro Interface", ".Geeza Pro PUA", ".Helvetica LT MM", ".Hiragino Kaku Gothic Interface", ".Hiragino Sans GB Interface", ".Keyboard", ".KufiStandardGK PUA", ".LastResort", ".Lucida Grande UI", ".Muna PUA", ".Nadeem PUA", ".New York", ".Noto Nastaliq Urdu UI", ".PingFang HK", ".PingFang SC", ".PingFang TC", ".SF Arabic", ".SF Arabic Rounded", ".SF Compact", ".SF Compact Rounded", ".SF NS", ".SF NS Mono", ".SF NS Rounded", ".Sana PUA", ".Savoye LET CC.", ".ThonburiUI", ".ThonburiUIWatch", ".\u82f9\u65b9-\u6e2f", ".\u82f9\u65b9-\u7b80", ".\u82f9\u65b9-\u7e41", ".\u860b\u65b9-\u6e2f", ".\u860b\u65b9-\u7c21", ".\u860b\u65b9-\u7e41", "Academy Engraved LET", "Al Bayan", "Al Nile", "Al Tarikh", "American Typewriter", "Andale Mono", "Apple Braille", "Apple Chancery", "Apple Color Emoji", "Apple SD Gothic Neo", "Apple SD \uc0b0\ub3cc\uace0\ub515 Neo", "Apple Symbols", "AppleGothic", "AppleMyungjo", "Arial", "Arial Black", "Arial Hebrew", "Arial Hebrew Scholar", "Arial Narrow", "Arial Rounded MT Bold", "Arial Unicode MS", "Athelas", "Avenir", "Avenir Black", "Avenir Black Oblique", "Avenir Book", "Avenir Heavy", "Avenir Light", "Avenir Medium", "Avenir Next", "Avenir Next Condensed", "Avenir Next Condensed Demi Bold", "Avenir Next Condensed Heavy", "Avenir Next Condensed Medium", "Avenir Next Condensed Ultra Light", "Avenir Next Demi Bold", "Avenir Next Heavy", "Avenir Next Medium", "Avenir Next Ultra Light", "Ayuthaya", "Baghdad", "Bangla MN", "Bangla Sangam MN", "Baskerville", "Beirut", "Big Caslon", "Bodoni 72", "Bodoni 72 Oldstyle", "Bodoni 72 Smallcaps", "Bodoni Ornaments", "Bradley Hand", "Brush Script MT", "Chalkboard", "Chalkboard SE", "Chalkduster", "Charter", "Charter Black", "Cochin", "Comic Sans MS", "Copperplate", "Corsiva Hebrew", "Courier", "Courier New", "Czcionka systemowa", "DIN Alternate", "DIN Condensed", "Damascus", "DecoType Naskh", "Devanagari MT", "Devanagari Sangam MN", "Didot", "Diwan Kufi", "Diwan Thuluth", "Euphemia UCAS", "Farah", "Farisi", "Font Sistem", "Font de sistem", "Font di sistema", "Font sustava", "Fonte do Sistema", "Futura", "GB18030 Bitmap", "Galvji", "Geeza Pro", "Geneva", "Georgia", "Gill Sans", "Grantha Sangam MN", "Gujarati MT", "Gujarati Sangam MN", "Gurmukhi MN", "Gurmukhi MT", "Gurmukhi Sangam MN", "Heiti SC", "Heiti TC", "Heiti-\uac04\uccb4", "Heiti-\ubc88\uccb4", "Helvetica", "Helvetica Neue", "Herculanum", "Hiragino Kaku Gothic Pro", "Hiragino Kaku Gothic Pro W3", "Hiragino Kaku Gothic Pro W6", "Hiragino Kaku Gothic ProN", "Hiragino Kaku Gothic ProN W3", "Hiragino Kaku Gothic ProN W6", "Hiragino Kaku Gothic Std", "Hiragino Kaku Gothic Std W8", "Hiragino Kaku Gothic StdN", "Hiragino Kaku Gothic StdN W8", "Hiragino Maru Gothic Pro", "Hiragino Maru Gothic Pro W4", "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic ProN W4", "Hiragino Mincho Pro", "Hiragino Mincho Pro W3", "Hiragino Mincho Pro W6", "Hiragino Mincho ProN", "Hiragino Mincho ProN W3", "Hiragino Mincho ProN W6", "Hiragino Sans", "Hiragino Sans GB", "Hiragino Sans GB W3", "Hiragino Sans GB W6", "Hiragino Sans W0", "Hiragino Sans W1", "Hiragino Sans W2", "Hiragino Sans W3", "Hiragino Sans W4", "Hiragino Sans W5", "Hiragino Sans W6", "Hiragino Sans W7", "Hiragino Sans W8", "Hiragino Sans W9", "Hoefler Text", "Hoefler Text Ornaments", "ITF Devanagari", "ITF Devanagari Marathi", "Impact", "InaiMathi", "Iowan Old Style", "Iowan Old Style Black", "J\u00e4rjestelm\u00e4fontti", "Kailasa", "Kannada MN", "Kannada Sangam MN", "Kefa", "Khmer MN", "Khmer Sangam MN", "Kohinoor Bangla", "Kohinoor Devanagari", "Kohinoor Gujarati", "Kohinoor Telugu", "Kokonor", "Krungthep", "KufiStandardGK", "Lao MN", "Lao Sangam MN", "Lucida Grande", "Luminari", "Malayalam MN", "Malayalam Sangam MN", "Marion", "Marker Felt", "Menlo", "Microsoft Sans Serif", "Mishafi", "Mishafi Gold", "Monaco", "Mshtakan", "Mukta Mahee", "MuktaMahee Bold", "MuktaMahee ExtraBold", "MuktaMahee ExtraLight", "MuktaMahee Light", "MuktaMahee Medium", "MuktaMahee Regular", "MuktaMahee SemiBold", "Muna", "Myanmar MN", "Myanmar Sangam MN", "Nadeem", "New Peninim MT", "Noteworthy", "Noto Nastaliq Urdu", "Noto Sans Adlam", "Noto Sans Armenian", "Noto Sans Armenian Blk", "Noto Sans Armenian ExtBd", "Noto Sans Armenian ExtLt", "Noto Sans Armenian Light", "Noto Sans Armenian Med", "Noto Sans Armenian SemBd", "Noto Sans Armenian Thin", "Noto Sans Avestan", "Noto Sans Bamum", "Noto Sans Bassa Vah", "Noto Sans Batak", "Noto Sans Bhaiksuki", "Noto Sans Brahmi", "Noto Sans Buginese", "Noto Sans Buhid", "Noto Sans CanAborig", "Noto Sans Canadian Aboriginal", "Noto Sans Carian", "Noto Sans CaucAlban", "Noto Sans Caucasian Albanian", "Noto Sans Chakma", "Noto Sans Cham", "Noto Sans Coptic", "Noto Sans Cuneiform", "Noto Sans Cypriot", "Noto Sans Duployan", "Noto Sans EgyptHiero", "Noto Sans Egyptian Hieroglyphs", "Noto Sans Elbasan", "Noto Sans Glagolitic", "Noto Sans Gothic", "Noto Sans Gunjala Gondi", "Noto Sans Hanifi Rohingya", "Noto Sans HanifiRohg", "Noto Sans Hanunoo", "Noto Sans Hatran", "Noto Sans ImpAramaic", "Noto Sans Imperial Aramaic", "Noto Sans InsPahlavi", "Noto Sans InsParthi", "Noto Sans Inscriptional Pahlavi", "Noto Sans Inscriptional Parthian", "Noto Sans Javanese", "Noto Sans Kaithi", "Noto Sans Kannada", "Noto Sans Kannada Black", "Noto Sans Kannada ExtraBold", "Noto Sans Kannada ExtraLight", "Noto Sans Kannada Light", "Noto Sans Kannada Medium", "Noto Sans Kannada SemiBold", "Noto Sans Kannada Thin", "Noto Sans Kayah Li", "Noto Sans Kharoshthi", "Noto Sans Khojki", "Noto Sans Khudawadi", "Noto Sans Lepcha", "Noto Sans Limbu", "Noto Sans Linear A", "Noto Sans Linear B", "Noto Sans Lisu", "Noto Sans Lycian", "Noto Sans Lydian", "Noto Sans Mahajani", "Noto Sans Mandaic", "Noto Sans Manichaean", "Noto Sans Marchen", "Noto Sans Masaram Gondi", "Noto Sans Meetei Mayek", "Noto Sans Mende Kikakui", "Noto Sans Meroitic", "Noto Sans Miao", "Noto Sans Modi", "Noto Sans Mongolian", "Noto Sans Mro", "Noto Sans Multani", "Noto Sans Myanmar", "Noto Sans Myanmar Blk", "Noto Sans Myanmar ExtBd", "Noto Sans Myanmar ExtLt", "Noto Sans Myanmar Light", "Noto Sans Myanmar Med", "Noto Sans Myanmar SemBd", "Noto Sans Myanmar Thin", "Noto Sans NKo", "Noto Sans Nabataean", "Noto Sans New Tai Lue", "Noto Sans Newa", "Noto Sans Ol Chiki", "Noto Sans Old Hungarian", "Noto Sans Old Italic", "Noto Sans Old North Arabian", "Noto Sans Old Permic", "Noto Sans Old Persian", "Noto Sans Old South Arabian", "Noto Sans Old Turkic", "Noto Sans OldHung", "Noto Sans OldNorArab", "Noto Sans OldSouArab", "Noto Sans Oriya", "Noto Sans Osage", "Noto Sans Osmanya", "Noto Sans Pahawh Hmong", "Noto Sans Palmyrene", "Noto Sans Pau Cin Hau", "Noto Sans PhagsPa", "Noto Sans Phoenician", "Noto Sans PsaPahlavi", "Noto Sans Psalter Pahlavi", "Noto Sans Rejang", "Noto Sans Samaritan", "Noto Sans Saurashtra", "Noto Sans Sharada", "Noto Sans Siddham", "Noto Sans Sora Sompeng", "Noto Sans SoraSomp", "Noto Sans Sundanese", "Noto Sans Syloti Nagri", "Noto Sans Syriac", "Noto Sans Tagalog", "Noto Sans Tagbanwa", "Noto Sans Tai Le", "Noto Sans Tai Tham", "Noto Sans Tai Viet", "Noto Sans Takri", "Noto Sans Thaana", "Noto Sans Tifinagh", "Noto Sans Tirhuta", "Noto Sans Ugaritic", "Noto Sans Vai", "Noto Sans Wancho", "Noto Sans Warang Citi", "Noto Sans Yi", "Noto Sans Zawgyi", "Noto Sans Zawgyi Blk", "Noto Sans Zawgyi ExtBd", "Noto Sans Zawgyi ExtLt", "Noto Sans Zawgyi Light", "Noto Sans Zawgyi Med", "Noto Sans Zawgyi SemBd", "Noto Sans Zawgyi Thin", "Noto Serif Ahom", "Noto Serif Balinese", "Noto Serif Hmong Nyiakeng", "Noto Serif Myanmar", "Noto Serif Myanmar Blk", "Noto Serif Myanmar ExtBd", "Noto Serif Myanmar ExtLt", "Noto Serif Myanmar Light", "Noto Serif Myanmar Med", "Noto Serif Myanmar SemBd", "Noto Serif Myanmar Thin", "Noto Serif Yezidi", "Optima", "Oriya MN", "Oriya Sangam MN", "PT Mono", "PT Sans", "PT Sans Caption", "PT Sans Narrow", "PT Serif", "PT Serif Caption", "Palatino", "Papyrus", "Party LET", "Phosphate", "Ph\u00f4ng ch\u1eef H\u1ec7 th\u1ed1ng", "PingFang HK", "PingFang SC", "PingFang TC", "Plantagenet Cherokee", "Police syst\u00e8me", "Raanana", "Rendszerbet\u0171t\u00edpus", "Rockwell", "STIX Two Math", "STIX Two Text", "STIXGeneral", "STIXIntegralsD", "STIXIntegralsSm", "STIXIntegralsUp", "STIXIntegralsUpD", "STIXIntegralsUpSm", "STIXNonUnicode", "STIXSizeFiveSym", "STIXSizeFourSym", "STIXSizeOneSym", "STIXSizeThreeSym", "STIXSizeTwoSym", "STIXVariants", "STSong", "Sana", "Sathu", "Savoye LET", "Seravek", "Seravek ExtraLight", "Seravek Light", "Seravek Medium", "Shree Devanagari 714", "SignPainter", "SignPainter-HouseScript", "Silom", "Sinhala MN", "Sinhala Sangam MN", "Sistem Fontu", "Skia", "Snell Roundhand", "Songti SC", "Songti TC", "Sukhumvit Set", "Superclarendon", "Symbol", "Systeemlettertype", "System Font", "Systemschrift", "Systemskrift", "Systemtypsnitt", "Syst\u00e9mov\u00e9 p\u00edsmo", "Tahoma", "Tamil MN", "Tamil Sangam MN", "Telugu MN", "Telugu Sangam MN", "Thonburi", "Times", "Times New Roman", "Tipo de letra del sistema", "Tipo de letra do sistema", "Tipus de lletra del sistema", "Trattatello", "Trebuchet MS", "Verdana", "Waseem", "Webdings", "Wingdings", "Wingdings 2", "Wingdings 3", "Zapf Dingbats", "Zapfino", "\u0393\u03c1\u03b1\u03bc\u03bc\u03b1\u03c4\u03bf\u03c3\u03b5\u03b9\u03c1\u03ac \u03c3\u03c5\u03c3\u03c4\u03ae\u03bc\u03b1\u03c4\u03bf\u03c2", "\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u0438\u0439 \u0448\u0440\u0438\u0444\u0442", "\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442", "\u05d2\u05d5\u05e4\u05df \u05de\u05e2\u05e8\u05db\u05ea", "\u0627\u0644\u0628\u064a\u0627\u0646", "\u0627\u0644\u062a\u0627\u0631\u064a\u062e", "\u0627\u0644\u0646\u064a\u0644", "\u0628\u063a\u062f\u0627\u062f", "\u0628\u064a\u0631\u0648\u062a", "\u062c\u064a\u0632\u0629", "\u062e\u0637 \u0627\u0644\u0646\u0638\u0627\u0645", "\u062f\u0645\u0634\u0642", "\u062f\u064a\u0648\u0627\u0646 \u062b\u0644\u062b", "\u062f\u064a\u0648\u0627\u0646 \u0643\u0648\u0641\u064a", "\u0635\u0646\u0639\u0627\u0621", "\u0641\u0627\u0631\u0633\u064a", "\u0641\u0631\u062d", "\u0643\u0648\u0641\u064a", "\u0645\u0646\u0649", "\u0645\u0650\u0635\u062d\u0641\u064a", "\u0645\u0650\u0635\u062d\u0641\u064a \u0630\u0647\u0628\u064a", "\u0646\u062f\u064a\u0645", "\u0646\u0633\u062e", "\u0648\u0633\u064a\u0645", "\u0906\u0908\u0970\u091f\u0940\u0970\u090f\u092b\u093c\u0970 \u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940", "\u0906\u0908\u0970\u091f\u0940\u0970\u090f\u092b\u093c\u0970 \u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940 \u092e\u0930\u093e\u0920\u0940", "\u0915\u094b\u0939\u093f\u0928\u0942\u0930 \u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940", "\u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940 \u090f\u092e\u0970\u091f\u0940\u0970", "\u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940 \u0938\u0902\u0917\u092e \u090f\u092e\u0970\u090f\u0928\u0970", "\u0936\u094d\u0930\u0940 \u0926\u0947\u0935\u0928\u093e\u0917\u0930\u0940 \u096d\u0967\u096a", "\u0e41\u0e1a\u0e1a\u0e2d\u0e31\u0e01\u0e29\u0e23\u0e23\u0e30\u0e1a\u0e1a", "\u2e41\u7175\u6120\u82a9\u82c8", "\u30b7\u30b9\u30c6\u30e0\u30d5\u30a9\u30f3\u30c8", "\u30d2\u30e9\u30ae\u30ce\u4e38\u30b4 Pro", "\u30d2\u30e9\u30ae\u30ce\u4e38\u30b4 Pro W4", "\u30d2\u30e9\u30ae\u30ce\u4e38\u30b4 ProN", "\u30d2\u30e9\u30ae\u30ce\u4e38\u30b4 ProN W4", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro W3", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d Pro W6", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d ProN", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d ProN W3", "\u30d2\u30e9\u30ae\u30ce\u660e\u671d ProN W6", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W3", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Pro W6", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 ProN", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 ProN W3", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 ProN W6", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Std", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 Std W8", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 StdN", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 StdN W8", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 \u7c21\u4f53\u4e2d\u6587", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 \u7c21\u4f53\u4e2d\u6587 W3", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4 \u7c21\u4f53\u4e2d\u6587 W6", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W0", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W1", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W2", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W3", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W4", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W5", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W6", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W7", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W8", "\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af W9", "\u51ac\u9752\u9ed1\u4f53\u7b80\u4f53\u4e2d\u6587", "\u51ac\u9752\u9ed1\u4f53\u7b80\u4f53\u4e2d\u6587 W3", "\u51ac\u9752\u9ed1\u4f53\u7b80\u4f53\u4e2d\u6587 W6", "\u51ac\u9752\u9ed1\u9ad4\u7c21\u9ad4\u4e2d\u6587", "\u51ac\u9752\u9ed1\u9ad4\u7c21\u9ad4\u4e2d\u6587 W3", "\u51ac\u9752\u9ed1\u9ad4\u7c21\u9ad4\u4e2d\u6587 W6", "\u5b8b\u4f53-\u7b80", "\u5b8b\u4f53-\u7e41", "\u5b8b\u9ad4-\u7c21", "\u5b8b\u9ad4-\u7e41", "\u7cfb\u7d71\u5b57\u9ad4", "\u7cfb\u7edf\u5b57\u4f53", "\u82f9\u65b9-\u6e2f", "\u82f9\u65b9-\u7b80", "\u82f9\u65b9-\u7e41", "\u8371\u8389\u834d\u836d\u8a70\u8353\u2050\u726f", "\u8371\u8389\u834d\u836d\u8a70\u8353\u2053\u7464", "\u8371\u8389\u834d\u836d\u8a70\u8353\u8356\u8362\u834e", "\u8371\u8389\u834d\u836d\u8adb\u8353\u2050\u726f", "\u8371\u8389\u834d\u836d\u96be\u92a9\u2050\u726f", "\u860b\u65b9-\u6e2f", "\u860b\u65b9-\u7c21", "\u860b\u65b9-\u7e41", "\u9ed1\u4f53-\u7b80", "\u9ed1\u4f53-\u7e41", "\u9ed1\u9ad4-\u7c21", "\u9ed1\u9ad4-\u7e41", "\u9ed2\u4f53-\u7c21", "\u9ed2\u4f53-\u7e41", "\uc2dc\uc2a4\ud15c \uc11c\uccb4", - }, - - "linux": { - "Arimo", "Cousine", "Noto Naskh Arabic", "Noto Sans Adlam", "Noto Sans Armenian", "Noto Sans Balinese", "Noto Sans Bamum", "Noto Sans Bassa Vah", "Noto Sans Batak", "Noto Sans Bengali", "Noto Sans Buginese", "Noto Sans Buhid", "Noto Sans Canadian Aboriginal", "Noto Sans Chakma", "Noto Sans Cham", "Noto Sans Cherokee", "Noto Sans Coptic", "Noto Sans Deseret", "Noto Sans Devanagari", "Noto Sans Elbasan", "Noto Sans Ethiopic", "Noto Sans Georgian", "Noto Sans Grantha", "Noto Sans Gujarati", "Noto Sans Gunjala Gondi", "Noto Sans Gurmukhi", "Noto Sans Hanifi Rohingya", "Noto Sans Hanunoo", "Noto Sans Hebrew", "Noto Sans JP", "Noto Sans Javanese", "Noto Sans KR", "Noto Sans Kannada", "Noto Sans Kayah Li", "Noto Sans Khmer", "Noto Sans Khojki", "Noto Sans Khudawadi", "Noto Sans Lao", "Noto Sans Lepcha", "Noto Sans Limbu", "Noto Sans Lisu", "Noto Sans Mahajani", "Noto Sans Malayalam", "Noto Sans Mandaic", "Noto Sans Masaram Gondi", "Noto Sans Medefaidrin", "Noto Sans Meetei Mayek", "Noto Sans Mende Kikakui", "Noto Sans Miao", "Noto Sans Modi", "Noto Sans Mongolian", "Noto Sans Mro", "Noto Sans Multani", "Noto Sans Myanmar", "Noto Sans NKo", "Noto Sans New Tai Lue", "Noto Sans Newa", "Noto Sans Ol Chiki", "Noto Sans Oriya", "Noto Sans Osage", "Noto Sans Osmanya", "Noto Sans Pahawh Hmong", "Noto Sans Pau Cin Hau", "Noto Sans Rejang", "Noto Sans Runic", "Noto Sans SC", "Noto Sans Samaritan", "Noto Sans Saurashtra", "Noto Sans Sharada", "Noto Sans Shavian", "Noto Sans Sinhala", "Noto Sans Sora Sompeng", "Noto Sans Soyombo", "Noto Sans Sundanese", "Noto Sans Syloti Nagri", "Noto Sans Symbols", "Noto Sans Symbols 2", "Noto Sans Syriac", "Noto Sans TC", "Noto Sans Tagalog", "Noto Sans Tagbanwa", "Noto Sans Tai Le", "Noto Sans Tai Tham", "Noto Sans Tai Viet", "Noto Sans Takri", "Noto Sans Tamil", "Noto Sans Telugu", "Noto Sans Thaana", "Noto Sans Thai", "Noto Sans Tifinagh", "Noto Sans Tifinagh APT", "Noto Sans Tifinagh Adrar", "Noto Sans Tifinagh Agraw Imazighen", "Noto Sans Tifinagh Ahaggar", "Noto Sans Tifinagh Air", "Noto Sans Tifinagh Azawagh", "Noto Sans Tifinagh Ghat", "Noto Sans Tifinagh Hawad", "Noto Sans Tifinagh Rhissa Ixa", "Noto Sans Tifinagh SIL", "Noto Sans Tifinagh Tawellemmet", "Noto Sans Tirhuta", "Noto Sans Vai", "Noto Sans Wancho", "Noto Sans Warang Citi", "Noto Sans Yi", "Noto Sans Zanabazar Square", "Noto Serif Armenian", "Noto Serif Balinese", "Noto Serif Bengali", "Noto Serif Devanagari", "Noto Serif Dogra", "Noto Serif Ethiopic", "Noto Serif Georgian", "Noto Serif Grantha", "Noto Serif Gujarati", "Noto Serif Gurmukhi", "Noto Serif Hebrew", "Noto Serif Kannada", "Noto Serif Khmer", "Noto Serif Khojki", "Noto Serif Lao", "Noto Serif Malayalam", "Noto Serif Myanmar", "Noto Serif NP Hmong", "Noto Serif Sinhala", "Noto Serif Tamil", "Noto Serif Telugu", "Noto Serif Thai", "Noto Serif Tibetan", "Noto Serif Yezidi", "STIX Two Math", "Tinos", "Twemoji Mozilla", - }, -} diff --git a/legacy/launcher/exec.go b/legacy/launcher/exec.go deleted file mode 100644 index 9fde13c..0000000 --- a/legacy/launcher/exec.go +++ /dev/null @@ -1,166 +0,0 @@ -package main - -import ( - "bufio" - "fmt" - "io" - "os" - "os/exec" - "os/signal" - "path/filepath" - "runtime" - "syscall" -) - -func getExecutableName() string { - // Get the executable name based on the OS - switch normalizeOS(runtime.GOOS) { - case "linux": - return getPath("camoufox-bin") - case "macos": - return getPath("Camoufox.app") - case "windows": - return getPath("camoufox.exe") - default: - // This should never be reached due to the check in normalizeOS - return "" - } -} - -func setExecutablePermissions(execPath string) error { - // Set executable permissions if needed - switch normalizeOS(runtime.GOOS) { - case "macos": - return filepath.Walk(execPath, func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - return maybeSetPermission(path, 0755) - }) - case "linux": - return maybeSetPermission(execPath, 0755) - } - return nil -} - -func maybeSetPermission(path string, mode os.FileMode) error { - info, err := os.Stat(path) - if err != nil { - return err - } - - currentMode := info.Mode().Perm() - if currentMode != mode { - return os.Chmod(path, mode) - } - return nil -} - -func filterOutput(r io.Reader, w io.Writer) { - scanner := bufio.NewScanner(r) - for scanner.Scan() { - line := scanner.Text() - if !ExclusionRegex.MatchString(line) { - fmt.Fprintln(w, line) - } - } -} - -// Run Camoufox -func runCamoufox(execName string, args []string, addonsList []string, stderrPath string) { - // If addons are specified, get the debug port - var debugPortInt int - if len(addonsList) > 0 { - debugPortInt = getDebugPort(&args) - } - - // For macOS, use "open" command to launch the app - if normalizeOS(runtime.GOOS) == "macos" { - args = append([]string{"-a", execName}, args...) - execName = "open" - } - - // Print args - cmd := exec.Command(execName, args...) - - setProcessGroupID(cmd) - - stdout, err := cmd.StdoutPipe() - if err != nil { - fmt.Printf("Error creating stdout pipe: %v\n", err) - os.Exit(1) - } - stderr, err := cmd.StderrPipe() - if err != nil { - fmt.Printf("Error creating stderr pipe: %v\n", err) - os.Exit(1) - } - - // Set up signal handling - sigChan := make(chan os.Signal, 1) - signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) - - if err := cmd.Start(); err != nil { - fmt.Printf("Error starting %s: %v\n", execName, err) - os.Exit(1) - } - - if len(addonsList) > 0 { - go tryLoadAddons(debugPortInt, addonsList) - } - - // Channel to signal when the subprocess has finished - subprocessDone := make(chan struct{}) - - // Start a goroutine to handle signals - go func() { - select { - case <-sigChan: - killProcessGroup(cmd) - case <-subprocessDone: - // Subprocess has finished, exit the Go process - os.Exit(0) - } - }() - - done := make(chan bool) - - go func() { - filterOutput(stdout, os.Stdout) - done <- true - }() - go func() { - // If stderrPath is not empty, write to the file - fmt.Printf("Setting stderr to file: %s\n", stderrPath) - if stderrPath != "" { - file, err := os.Create(stderrPath) - if err != nil { - fmt.Printf("Error creating stderr file: %v\n", err) - os.Exit(1) - } - defer file.Close() - filterOutput(stderr, file) - } - filterOutput(stderr, os.Stderr) - }() - - <-done - <-done - - // Wait for the command to finish - if err := cmd.Wait(); err != nil { - if exitErr, ok := err.(*exec.ExitError); ok { - // If the subprocess exited with an error, use its exit code - os.Exit(exitErr.ExitCode()) - } else { - fmt.Printf("Error running %s: %v\n", execName, err) - os.Exit(1) - } - } - - // Signal that the subprocess has finished - close(subprocessDone) - - // Wait here to allow the signal handling goroutine to exit the process - select {} -} diff --git a/legacy/launcher/go.mod b/legacy/launcher/go.mod deleted file mode 100644 index b8109c8..0000000 --- a/legacy/launcher/go.mod +++ /dev/null @@ -1,7 +0,0 @@ -module launch - -go 1.23.0 - -require github.com/mileusna/useragent v1.3.4 - -require github.com/goccy/go-json v0.10.3 diff --git a/legacy/launcher/go.sum b/legacy/launcher/go.sum deleted file mode 100644 index c82eb6f..0000000 --- a/legacy/launcher/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= -github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/mileusna/useragent v1.3.4 h1:MiuRRuvGjEie1+yZHO88UBYg8YBC/ddF6T7F56i3PCk= -github.com/mileusna/useragent v1.3.4/go.mod h1:3d8TOmwL/5I8pJjyVDteHtgDGcefrFUX4ccGOMKNYYc= diff --git a/legacy/launcher/load-addons.go b/legacy/launcher/load-addons.go deleted file mode 100644 index c8450e1..0000000 --- a/legacy/launcher/load-addons.go +++ /dev/null @@ -1,157 +0,0 @@ -package main - -import ( - "bufio" - "encoding/json" - "fmt" - "net" - "os" - "strconv" - "strings" - "time" -) - -// Gets the debug port from the args, or creates a new one if not provided -func getDebugPort(args *[]string) int { - debugPort := parseArgs("-start-debugger-server", "", args, false) - - var debugPortInt int - var err error - if debugPort == "" { - // Create new debugger server port - debugPortInt = getOpenPort() - // Add -start-debugger-server {debugPort} to args - *args = append(*args, "-start-debugger-server", strconv.Itoa(debugPortInt)) - } else { - debugPortInt, err = strconv.Atoi(debugPort) - if err != nil { - fmt.Printf("Error parsing debug port. Must be an integer: %v\n", err) - os.Exit(1) - } - } - return debugPortInt -} - -// Confirm paths are valid -func confirmPaths(paths []string) { - for _, path := range paths { - if _, err := os.Stat(path); err != nil { - fmt.Printf("Error: %s is not a valid addon path.\n", path) - os.Exit(1) - } - } -} - -// Generate an open port -func getOpenPort() int { - ln, err := net.Listen("tcp", ":0") // listen on a random port - if err != nil { - return 0 - } - defer ln.Close() - - addr := ln.Addr().(*net.TCPAddr) // type assert to *net.TCPAddr to get the Port - return addr.Port -} - -// Waits for the server to start, then loads the addons -func tryLoadAddons(debugPortInt int, addonsList []string) { - // Wait for the server to be open - for { - conn, err := net.Dial("tcp", fmt.Sprintf("localhost:%d", debugPortInt)) - if err == nil { - conn.Close() - break - } - time.Sleep(10 * time.Millisecond) - } - - // Load addons - for _, addon := range addonsList { - go loadFirefoxAddon(debugPortInt, addon) - } -} - -// Firefox addon loader -// Ported from this Nodejs implementation: -// https://github.com/microsoft/playwright/issues/7297#issuecomment-1211763085 -func loadFirefoxAddon(port int, addonPath string) bool { - conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", "localhost", port)) - if err != nil { - return false - } - defer conn.Close() - - success := false - - send := func(data map[string]string) error { - jsonData, err := json.Marshal(data) - if err != nil { - return err - } - _, err = fmt.Fprintf(conn, "%d:%s", len(jsonData), jsonData) - return err - } - - err = send(map[string]string{ - "to": "root", - "type": "getRoot", - }) - if err != nil { - return false - } - - onMessage := func(message map[string]interface{}) bool { - if addonsActor, ok := message["addonsActor"].(string); ok { - err := send(map[string]string{ - "to": addonsActor, - "type": "installTemporaryAddon", - "addonPath": addonPath, - }) - if err != nil { - return true - } - } - - if _, ok := message["addon"]; ok { - success = true - return true - } - - if _, ok := message["error"]; ok { - return true - } - - return false - } - - reader := bufio.NewReader(conn) - for { - lengthStr, err := reader.ReadString(':') - if err != nil { - break - } - length, err := strconv.Atoi(strings.TrimSuffix(lengthStr, ":")) - if err != nil { - break - } - - jsonData := make([]byte, length) - _, err = reader.Read(jsonData) - if err != nil { - break - } - - var message map[string]interface{} - err = json.Unmarshal(jsonData, &message) - if err != nil { - break - } - - if onMessage(message) { - break - } - } - - return success -} diff --git a/legacy/launcher/main.go b/legacy/launcher/main.go deleted file mode 100644 index 4a4c76f..0000000 --- a/legacy/launcher/main.go +++ /dev/null @@ -1,219 +0,0 @@ -package main - -import ( - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - "unicode/utf8" - - json "github.com/goccy/go-json" - "github.com/mileusna/useragent" -) - -func main() { - args := os.Args[1:] - - configPath := parseArgs("--config", "{}", &args, true) - addons := parseArgs("--addons", "[]", &args, true) - excludeAddons := parseArgs("--exclude-addons", "[]", &args, true) - stderrPath := parseArgs("--stderr", "", &args, true) - - //*** PARSE CONFIG ***// - - // Read and parse the config file - var configMap map[string]interface{} - parseJson(configPath, &configMap) - validateConfig(configMap) - - // Add "debug: True" to the config - if stderrPath != "" { - configMap["debug"] = true - } - - //*** PARSE ADDONS ***// - - // If addons are passed, handle them - var addonsList []string - parseJson(addons, &addonsList) - - // Confirm addon paths are valid - confirmPaths(addonsList) - - // Add the default addons, excluding the ones specified in --exclude-addons - var excludeAddonsList []string - parseJson(excludeAddons, &excludeAddonsList) - - addDefaultAddons(excludeAddonsList, &addonsList) - - //*** FONTS ***// - - // Determine the target OS - userAgentOS := determineUserAgentOS(configMap) - // Add OS specific fonts - updateFonts(configMap, userAgentOS) - - //*** LAUNCH ***// - - setEnvironmentVariables(configMap, userAgentOS) - - // Run the Camoufox executable - execName := getExecutableName() - if err := setExecutablePermissions(execName); err != nil { - fmt.Printf("Error setting executable permissions: %v\n", err) - os.Exit(1) - } - runCamoufox(execName, args, addonsList, stderrPath) -} - -// Returns the absolute path relative to the launcher -func getPath(path string) string { - execPath, err := os.Executable() - if err != nil { - fmt.Printf("Error getting executable path: %v\n", err) - os.Exit(1) - } - execDir := filepath.Dir(execPath) - - addonPath := filepath.Join(execDir, path) - return addonPath -} - -// Parses & removes an argument from the args list -func parseArgs(param string, defaultValue string, args *[]string, removeFromArgs bool) string { - for i := 0; i < len(*args); i++ { - if (*args)[i] != param { - continue - } - if i+1 < len(*args) { - value := (*args)[i+1] - if removeFromArgs { - *args = append((*args)[:i], (*args)[i+2:]...) - } - return value - } - fmt.Printf("Error: %s flag requires a value\n", param) - os.Exit(1) - } - return defaultValue -} - -// fileExists checks if a file exists -func fileExists(path string) bool { - _, err := os.Stat(path) - return err == nil -} - -// Parses a JSON string or file into a map -func parseJson(argv string, target interface{}) { - // Unmarshal the config input into a map - var data []byte - var err error - - // Check if the input is a file path or inline JSON - if fileExists(argv) { - data, err = os.ReadFile(argv) - if err != nil { - fmt.Printf("Error reading JSON file: %v\n", err) - os.Exit(1) - } - } else { - // Assume it's inline JSON - data = []byte(argv) - } - - if err := json.Unmarshal(data, target); err != nil { - fmt.Printf("Invalid JSON: %v\n", err) - os.Exit(1) - } -} - -// Determines the target OS from the user agent string if provided -func determineUserAgentOS(configMap map[string]interface{}) string { - // Determine the OS from the user agent string if provided - defaultOS := normalizeOS(runtime.GOOS) - if ua, ok := configMap["navigator.userAgent"].(string); ok { - parsedUA := useragent.Parse(ua) - if parsedUA.OS != "" { - return normalizeOS(parsedUA.OS) - } - } - return defaultOS -} - -// Get the OS name as {macos, windows, linux} -func normalizeOS(osName string) string { - osName = strings.ToLower(osName) - switch { - case osName == "darwin" || strings.Contains(osName, "mac"): - return "macos" - case strings.Contains(osName, "win"): - return "windows" - default: - return "linux" - } -} - -// Add fonts associated with the OS to the config map -func updateFonts(configMap map[string]interface{}, userAgentOS string) { - fonts, ok := configMap["fonts"].([]interface{}) - if !ok { - fonts = []interface{}{} - } - existingFonts := make(map[string]bool) - for _, font := range fonts { - if f, ok := font.(string); ok { - existingFonts[f] = true - } - } - for _, font := range FontsByOS[userAgentOS] { - if !existingFonts[font] { - fonts = append(fonts, font) - } - } - configMap["fonts"] = fonts -} - -// Update the config map with the fonts and environment variables -func setEnvironmentVariables(configMap map[string]interface{}, userAgentOS string) { - updatedConfigData, err := json.Marshal(configMap) - if err != nil { - fmt.Printf("Error updating config: %v\n", err) - os.Exit(1) - } - - // Validate utf8 - if !utf8.Valid(updatedConfigData) { - fmt.Println("Config is not valid UTF-8") - os.Exit(1) - } - - // Split the config into chunks of 2047 characters if the OS is Windows, - // otherwise split into 32767 characters - var chunkSize int - if normalizeOS(runtime.GOOS) == "windows" { - chunkSize = 2047 - } else { - chunkSize = 32767 - } - - configStr := string(updatedConfigData) - for i := 0; i < len(configStr); i += chunkSize { - end := i + chunkSize - if end > len(configStr) { - end = len(configStr) - } - chunk := configStr[i:end] - envName := fmt.Sprintf("CAMOU_CONFIG_%d", (i/chunkSize)+1) - if err := os.Setenv(envName, chunk); err != nil { - fmt.Printf("Error setting %s: %v\n", envName, err) - os.Exit(1) - } - } - - if normalizeOS(runtime.GOOS) == "linux" { - fontconfigPath := getPath(filepath.Join("fontconfig", userAgentOS)) - os.Setenv("FONTCONFIG_PATH", fontconfigPath) - } -} diff --git a/legacy/launcher/procgroup-unix.go b/legacy/launcher/procgroup-unix.go deleted file mode 100644 index d85a0fc..0000000 --- a/legacy/launcher/procgroup-unix.go +++ /dev/null @@ -1,17 +0,0 @@ -//go:build !windows -// +build !windows - -package main - -import ( - "os/exec" - "syscall" -) - -func setProcessGroupID(cmd *exec.Cmd) { - cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} -} - -func killProcessGroup(cmd *exec.Cmd) { - syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) -} diff --git a/legacy/launcher/procgroup-win.go b/legacy/launcher/procgroup-win.go deleted file mode 100644 index 2bf68d3..0000000 --- a/legacy/launcher/procgroup-win.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build windows -// +build windows - -package main - -import ( - "os/exec" -) - -func setProcessGroupID(cmd *exec.Cmd) { - // Windows doesn't support process groups in the same way -} - -func killProcessGroup(cmd *exec.Cmd) { - cmd.Process.Kill() -} diff --git a/legacy/launcher/validate.go b/legacy/launcher/validate.go deleted file mode 100644 index 44dc7db..0000000 --- a/legacy/launcher/validate.go +++ /dev/null @@ -1,75 +0,0 @@ -package main - -import ( - "fmt" - "math" - "os" - "reflect" - "runtime" -) - -type Property struct { - Property string `json:"property"` - Type string `json:"type"` -} - -func validateConfig(configMap map[string]interface{}) { - properties := loadProperties() - - // Create a map for quick lookup of property types - propertyTypes := make(map[string]string) - for _, prop := range properties { - propertyTypes[prop.Property] = prop.Type - } - - for key, value := range configMap { - expectedType, exists := propertyTypes[key] - if !exists { - fmt.Printf("Warning: Unknown property %s in config\n", key) - continue - } - - if !validateType(value, expectedType) { - fmt.Printf("Invalid type for property %s. Expected %s, got %T\n", key, expectedType, value) - os.Exit(1) - } - } -} - -func loadProperties() []Property { - // Get the path to the properties.json file - var propertiesPath string - if normalizeOS(runtime.GOOS) == "macos" { - propertiesPath = getPath("Camoufox.app/Contents/Resources/properties.json") - } else { - propertiesPath = getPath("properties.json") - } - var properties []Property - // Parse the JSON file - parseJson(propertiesPath, &properties) - return properties -} - -func validateType(value interface{}, expectedType string) bool { - switch expectedType { - case "str": - _, ok := value.(string) - return ok - case "int": - v, ok := value.(float64) - return ok && v == math.Trunc(v) - case "uint": - v, ok := value.(float64) - return ok && v == math.Trunc(v) && v >= 0 - case "double": - _, ok := value.(float64) - return ok - case "bool": - _, ok := value.(bool) - return ok - case "array": - return reflect.TypeOf(value).Kind() == reflect.Slice - default: - return false - } -} diff --git a/legacy/launcher/xpi-dl.go b/legacy/launcher/xpi-dl.go deleted file mode 100644 index 66d74b9..0000000 --- a/legacy/launcher/xpi-dl.go +++ /dev/null @@ -1,146 +0,0 @@ -package main - -import ( - "archive/zip" - "fmt" - "io" - "net/http" - "os" - "path/filepath" -) - -// Downloads and extracts the default addons -func addDefaultAddons(excludeList []string, addonsList *[]string) { - // Build a map from DefaultAddons, excluding keys found in excludeAddonsList - addonsMap := make(map[string]string) - for name, url := range DefaultAddons { - if len(excludeList) == 0 || !contains(excludeList, name) { - addonsMap[name] = url - } - } - - // Download if not already downloaded - maybeDownloadAddons(addonsMap, addonsList) -} - -// Downloads and extracts the addon -func downloadAndExtract(url, extractPath string) error { - // Create a temporary file to store the downloaded zip - tempFile, err := os.CreateTemp("", "camoufox-addon-*.zip") - if err != nil { - return fmt.Errorf("failed to create temp file: %w", err) - } - defer os.Remove(tempFile.Name()) // Clean up the temp file when done - - // Download the zip file - resp, err := http.Get(url) - if err != nil { - return fmt.Errorf("failed to download addon: %w", err) - } - defer resp.Body.Close() - - // Write the body to the temp file - _, err = io.Copy(tempFile, resp.Body) - if err != nil { - return fmt.Errorf("failed to write addon to temp file: %w", err) - } - - // Close the file before unzipping - tempFile.Close() - - // Extract the zip file - err = unzip(tempFile.Name(), extractPath) - if err != nil { - return fmt.Errorf("failed to extract addon: %w", err) - } - - return nil -} - -// Extracts the zip file -func unzip(src, dest string) error { - r, err := zip.OpenReader(src) - if err != nil { - return err - } - defer r.Close() - - for _, f := range r.File { - fpath := filepath.Join(dest, f.Name) - - if f.FileInfo().IsDir() { - os.MkdirAll(fpath, os.ModePerm) - continue - } - - if err = os.MkdirAll(filepath.Dir(fpath), os.ModePerm); err != nil { - return err - } - - outFile, err := os.OpenFile(fpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) - if err != nil { - return err - } - - rc, err := f.Open() - if err != nil { - outFile.Close() - return err - } - - _, err = io.Copy(outFile, rc) - outFile.Close() - rc.Close() - - if err != nil { - return err - } - } - return nil -} - -// Checks if a slice contains a string -func contains(slice []string, item string) bool { - for _, s := range slice { - if s == item { - return true - } - } - return false -} - -// Returns the absolute path to the target addon location -func getAddonPath(addonName string) string { - return getPath(filepath.Join("addons", addonName)) -} - -// Downloads and extracts the addons -func maybeDownloadAddons(addons map[string]string, addonsList *[]string) { - for addonName, url := range addons { - // Get the addon path - addonPath := getAddonPath(addonName) - - // Check if the addon is already extracted - if _, err := os.Stat(addonPath); !os.IsNotExist(err) { - // Add the existing addon path to addonsList - *addonsList = append(*addonsList, addonPath) - continue - } - - // Addon doesn't exist, create directory and download - err := os.MkdirAll(addonPath, 0755) - if err != nil { - fmt.Printf("Failed to create directory for %s: %v\n", addonName, err) - continue - } - - err = downloadAndExtract(url, addonPath) - if err != nil { - fmt.Printf("Failed to download and extract %s: %v\n", addonName, err) - } else { - fmt.Printf("Successfully downloaded and extracted %s\n", addonName) - // Add the new addon directory path to addonsList - *addonsList = append(*addonsList, addonPath) - } - } -} diff --git a/legacy/scripts/generate-locales.sh b/legacy/scripts/generate-locales.sh deleted file mode 100644 index e5fa3bb..0000000 --- a/legacy/scripts/generate-locales.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/bash - -if [ ! -f browser/locales/shipped-locales ]; then - echo "ERROR: Run this script from the root of the Camoufox source code" - exit 1 -fi - -rm -rf browser/locales/l10n -mkdir browser/locales/l10n - -N=8 -for i in $(seq $N); do echo; done -total=$(wc -l < browser/locales/shipped-locales) - -echo_status() { - printf "\033[$((($N - $n) + 1))A$@ %40s\r\033[$((($N - $n) + 1))B" -} - -generate_locale() { - if echo " en-US ca ja " | grep -q " $1 "; then - echo_status "Skipping locale \"$1\"" - sleep 1 - echo_status - return - fi - echo_status "Downloading locale \"$1\"" - wget -q -O browser/locales/l10n/$1.zip https://hg.mozilla.org/l10n-central/$1/archive/tip.zip - echo_status "Extracting locale \"$1\"" - 7z x -y -obrowser/locales/l10n browser/locales/l10n/$1.zip > /dev/null - mv browser/locales/l10n/$1-*/ browser/locales/l10n/$1/ - rm -f browser/locales/l10n/$1.zip - echo_status "Generating locale \"$1\"" - mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/camoufox - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/Camoufox/g' {} \; - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/Camoufox/g' {} \; - find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/Camoufox/g' {} \; - echo_status "Done" - sleep 0.3 - echo_status -} - -while read in; do - ((n=n%N)); ((n++==0)) && wait - generate_locale $in & -done < browser/locales/shipped-locales - -wait - -printf "\033[$(($N))A\rGenerated $total locales %-40s\n" \ No newline at end of file diff --git a/settings/camoufox.cfg b/settings/camoufox.cfg index 5a7e184..1493b9b 100644 --- a/settings/camoufox.cfg +++ b/settings/camoufox.cfg @@ -668,11 +668,11 @@ defaultPref("dom.ipc.keepProcessesAlive.web", 0); defaultPref("javascript.options.wasm_shared_memory", false); // Disable TLS 1.0 and 1.1 -user_pref("security.tls.version.min", 3); // 3 = TLS 1.2 -user_pref("security.tls.version.max", 4); // 4 = TLS 1.3 +defaultPref("security.tls.version.min", 3); // 3 = TLS 1.2 +defaultPref("security.tls.version.max", 4); // 4 = TLS 1.3 // Disable weak ciphers -user_pref("security.ssl3.rsa_rc4_128_sha", false); -user_pref("security.ssl3.rsa_des_ede3_sha", false); -user_pref("security.ssl3.dhe_rsa_aes_128_sha", false); -user_pref("security.ssl3.dhe_rsa_aes_256_sha", false); \ No newline at end of file +defaultPref("security.ssl3.rsa_rc4_128_sha", false); +defaultPref("security.ssl3.rsa_des_ede3_sha", false); +defaultPref("security.ssl3.dhe_rsa_aes_128_sha", false); +defaultPref("security.ssl3.dhe_rsa_aes_256_sha", false); \ No newline at end of file