mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-15 18:12:54 +00:00
[fenix] Add mozcn safebrowsing
This commit is contained in:
parent
c481d0504b
commit
3ec2a3d971
@ -14,9 +14,14 @@ import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.geckoview.GeckoRuntime
|
||||
import org.mozilla.geckoview.GeckoRuntimeSettings
|
||||
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
||||
|
||||
object GeckoProvider {
|
||||
private var runtime: GeckoRuntime? = null
|
||||
const val CN_UPDATE_URL =
|
||||
"https://sb.firefox.com.cn/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
const val CN_GET_HASH_URL =
|
||||
"https://sb.firefox.com.cn/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
|
||||
@Synchronized
|
||||
fun getOrCreateRuntime(
|
||||
@ -53,6 +58,28 @@ object GeckoProvider {
|
||||
runtimeSettings.fontSizeFactor = fontSize
|
||||
}
|
||||
|
||||
// Add safebrowsing providers for China
|
||||
if (Config.channel.isMozillaOnline) {
|
||||
val mozcn = SafeBrowsingProvider
|
||||
.withName("mozcn")
|
||||
.version("2.2")
|
||||
.lists("m6eb-phish-shavar", "m6ib-phish-shavar")
|
||||
.updateUrl(CN_UPDATE_URL)
|
||||
.getHashUrl(CN_GET_HASH_URL)
|
||||
.build()
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingProviders(mozcn,
|
||||
// Keep the existing configuration
|
||||
ContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDER,
|
||||
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER)
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingPhishingTable(
|
||||
"m6eb-phish-shavar",
|
||||
"m6ib-phish-shavar",
|
||||
// Existing configuration
|
||||
"goog-phish-proto")
|
||||
}
|
||||
|
||||
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
||||
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
|
||||
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
||||
|
@ -14,9 +14,15 @@ import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.geckoview.GeckoRuntime
|
||||
import org.mozilla.geckoview.GeckoRuntimeSettings
|
||||
import org.mozilla.geckoview.ContentBlocking
|
||||
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
||||
|
||||
object GeckoProvider {
|
||||
private var runtime: GeckoRuntime? = null
|
||||
const val CN_UPDATE_URL =
|
||||
"https://sb.firefox.com.cn/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
const val CN_GET_HASH_URL =
|
||||
"https://sb.firefox.com.cn/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
|
||||
@Synchronized
|
||||
fun getOrCreateRuntime(
|
||||
@ -53,6 +59,28 @@ object GeckoProvider {
|
||||
runtimeSettings.fontSizeFactor = fontSize
|
||||
}
|
||||
|
||||
// Add safebrowsing providers for China
|
||||
if (Config.channel.isMozillaOnline) {
|
||||
val mozcn = SafeBrowsingProvider
|
||||
.withName("mozcn")
|
||||
.version("2.2")
|
||||
.lists("m6eb-phish-shavar", "m6ib-phish-shavar")
|
||||
.updateUrl(CN_UPDATE_URL)
|
||||
.getHashUrl(CN_GET_HASH_URL)
|
||||
.build()
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingProviders(mozcn,
|
||||
// Keep the existing configuration
|
||||
ContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDER,
|
||||
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER)
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingPhishingTable(
|
||||
"m6eb-phish-shavar",
|
||||
"m6ib-phish-shavar",
|
||||
// Existing configuration
|
||||
"goog-phish-proto")
|
||||
}
|
||||
|
||||
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
||||
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
|
||||
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
||||
|
@ -15,10 +15,15 @@ import org.mozilla.fenix.Config
|
||||
import org.mozilla.fenix.ext.components
|
||||
import org.mozilla.geckoview.GeckoRuntime
|
||||
import org.mozilla.geckoview.GeckoRuntimeSettings
|
||||
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
||||
|
||||
object GeckoProvider {
|
||||
var testConfig: Bundle? = null
|
||||
private var runtime: GeckoRuntime? = null
|
||||
const val CN_UPDATE_URL =
|
||||
"https://sb.firefox.com.cn/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
const val CN_GET_HASH_URL =
|
||||
"https://sb.firefox.com.cn/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
||||
|
||||
@Synchronized
|
||||
fun getOrCreateRuntime(
|
||||
@ -63,6 +68,28 @@ object GeckoProvider {
|
||||
runtimeSettings.fontSizeFactor = fontSize
|
||||
}
|
||||
|
||||
// Add safebrowsing providers for China
|
||||
if (Config.channel.isMozillaOnline) {
|
||||
val mozcn = SafeBrowsingProvider
|
||||
.withName("mozcn")
|
||||
.version("2.2")
|
||||
.lists("m6eb-phish-shavar", "m6ib-phish-shavar")
|
||||
.updateUrl(CN_UPDATE_URL)
|
||||
.getHashUrl(CN_GET_HASH_URL)
|
||||
.build()
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingProviders(mozcn,
|
||||
// Keep the existing configuration
|
||||
ContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDER,
|
||||
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER)
|
||||
|
||||
runtimeSettings.contentBlocking.setSafeBrowsingPhishingTable(
|
||||
"m6eb-phish-shavar",
|
||||
"m6ib-phish-shavar",
|
||||
// Existing configuration
|
||||
"goog-phish-proto")
|
||||
}
|
||||
|
||||
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
||||
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
|
||||
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
||||
|
Loading…
Reference in New Issue
Block a user