gecko-dev/browser/components/newtab/content-src/asrouter
2018-10-30 19:36:22 +00:00
..
components Bug 1500540 - Add end-of-year snippet, contextual-feature-recommender preference and bug fixes to Activity Stream r=k88hudson 2018-10-19 22:59:47 +00:00
docs Bug 1500540 - Add end-of-year snippet, contextual-feature-recommender preference and bug fixes to Activity Stream r=k88hudson 2018-10-19 22:59:47 +00:00
schemas Bug 1496457 - Add Newsletter template, addon install telemetry, remove legacy onboarding code, and bug fixes to Activity Stream r=Mardak 2018-10-05 19:16:25 +00:00
templates Bug 1503288 - Use 'args' in button_action params to fix busted simplified onboarding actions r=k88hudson 2018-10-30 19:36:22 +00:00
asrouter-content.jsx Bug 1500540 - Add end-of-year snippet, contextual-feature-recommender preference and bug fixes to Activity Stream r=k88hudson 2018-10-19 22:59:47 +00:00
README.md Bug 1486631 - Add CFR, search shortcut fixes, and bug fixes to Activity Stream r=Mardak,ursula 2018-08-29 14:08:31 +00:00
rich-text-strings.js Bug 1499886 - Add send-to-device snippet, right-to-left robustness and bug fixes to Activity Stream r=k88hudson 2018-10-18 05:00:47 +00:00
template-utils.js Bug 1489962 - Add snippets targeting, Pocket tagging and bug fixes to Activity Stream r=Mardak 2018-09-20 18:36:20 +00:00

Activity Stream Router

Preferences browser.newtab.activity-stream.asrouter.*

Name Used for Type Example value
whitelistHosts Whitelist a host in order to fetch messages from its endpoint [String] ["gist.github.com", "gist.githubusercontent.com", "localhost:8000"]
messageProviders Message provider options Object see below

Message providers

[
   {
      "id" : "onboarding",
      "type" : "local",
      "localProvider" : "OnboardingMessageProvider"
   },
   {
      "type" : "remote",
      "url" : "https://snippets.cdn.mozilla.net/us-west/bundles/bundle_d6d90fb9098ce8b45e60acf601bcb91b68322309.json",
      "updateCycleInMs" : 14400000,
      "id" : "snippets"
   }
]

Admin Interface

  • Navigate to about:newtab#asrouter
    • See all available messages and message providers
    • Block, unblock or force show a specific message

Snippet Preview

  • Whitelist the provider host that will serve the messages
    • In about:config, browser.newtab.activity-stream.asrouter.whitelistHosts can contain a array of hosts
    • Example value ["gist.github.com", "gist.githubusercontent.com", "localhost:8000"]
    • Errors are surfaced in the Console tab of the Browser Toolbox (read how to enable)
  • Navigate to about:newtab?endpoint=<URL>
    • Example https://gist.githubusercontent.com/piatra/70234f08696c0a0509d7ba5568cd830f/raw/68370f34abc134142c64b6f0a9b9258a06de7aa3/messages.json
    • URL should be from an endpoint that was just whitelisted
    • The snippet preview should imediately load
    • The endpoint must be HTTPS, the host must be whitelisted
    • Errors are surfaced in the Console tab of the Browser Toolbox

Snippet message format documentation