Skip to main content

Development

Downloading the source code

The SmartCookieWeb source code is available for download at https://github.com/CookieJarApps/SmartCookieWeb.

VideoDL

SmartCookieWeb has intergration with VideoDL for video downloading. It shows a download icon in the navigation bar when you navigate to a site with a downloadable video and have VideoDL installed. If you fork the browser, you can keep the intergration in, or, by editing the package name in the strings file ("ytdl_package_name"), you can make it redirect to a different app. You can disable this entirely by removing the following lines from "SmartCookieWebClient" and "SmartCookieChromeClient"

if(isPackageInstalled(activity.resources.getString(R.string.ytdl_package_name), activity.packageManager)){
    activity.findViewById<FrameLayout>(R.id.download_button).visibility = View.VISIBLE
}
if(isPackageInstalled(activity.resources.getString(R.string.ytdl_package_name), activity.packageManager) && stringContainsItemFromList(url, knownUndetectedVideoUrls)){
    activity.findViewById<FrameLayout>(R.id.download_button).visibility = View.VISIBLE
}

Web services

SmartCookieWeb uses web services to provide translation and news.

While using the app, you can edit the API endpoints for these services in Advanced Settings.

If you're developing, you can edit the default endpoints in the UserPreferences.kt file.

Translations

The translation service is fairly simple - the app sends two GET requests to the API, "text" and "lang". "Text" is HTML code in a different language, and "lang" is the language to translate into. Then the API returns JSON with a single key "text" with the content being the returned translated HTML.

News

The news API uses the same format as NewsAPI for sending and receiving data. You can even swap out the default API for a NewsAPI link and it will work as usual.