├── .gitignore ├── bin └── fxa-dev-launcher ├── index.js ├── package.json ├── README.md └── profile.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /bin/fxa-dev-launcher: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../index'); 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('foxfire')({ 4 | args: [ 5 | !! process.env.FIREFOX_DEBUGGER ? '-jsdebugger' : '' 6 | ], 7 | profileOptions: require('./profile') 8 | }); 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fxa-dev-launcher", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "bin/fxa-dev-launcher" 8 | }, 9 | "bin": { 10 | "fxa-dev-launcher": "./bin/fxa-dev-launcher" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/vladikoff/fxa-dev-launcher" 15 | }, 16 | "author": "Mozilla (https://mozilla.org/)", 17 | "license": "MPL-2.0", 18 | "dependencies": { 19 | "chalk": "^1.1.3", 20 | "foxfire": "^1.1.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # fxa-dev-launcher 2 | 3 | ### Firefox Accounts Custom Profiles for Firefox 4 | 5 | **Use `npm start` to start Firefox with local server configurations.** 6 | Available options: 7 | 8 | * `FXA_ENV=local` or `latest` or `stable` or `stage` or `content` (NOTE: `local` is default). 9 | * `FXA_E10S=true` - add this flag to turn on E10S. (NOTE: `false` by default). 10 | * `FXA_DESKTOP_CONTEXT` - `context=` value. (NOTE: `fx_desktop_v2` is default). 11 | * `FIREFOX_BIN=/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin npm start` 12 | * `FIREFOX_DEBUGGER=true` - open [Browser Toolbox](https://developer.mozilla.org/en-US/docs/Tools/Browser_Toolbox) on start (NOTE: `false` by default for speed). 13 | 14 | ### Basic Usage Example in OS X 15 | 16 | * Download node.js 4: https://nodejs.org/dist/v4.6.0/node-v4.6.0.pkg 17 | * install it by following the steps in the `.pkg` installer. 18 | * Open Terminal and Run commands: 19 | * `git clone https://github.com/vladikoff/fxa-dev-launcher.git` 20 | * `cd fxa-dev-launcher` 21 | * `npm install` 22 | * `FXA_ENV=latest npm start` 23 | 24 | The above will start a firefox talking to `latest.dev.lcip.org` 25 | -------------------------------------------------------------------------------- /profile.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var chalk = require('chalk'); 3 | 4 | var CONFIGS = { 5 | 'local': { 6 | auth: 'http://127.0.0.1:9000/v1', 7 | content: 'http://127.0.0.1:3030/', 8 | token: 'http://localhost:5000/token/1.0/sync/1.5', 9 | loop: 'http://localhost:10222', 10 | oauth: 'http://127.0.0.1:9010/v1', 11 | profile: 'http://localhost:1111/v1' 12 | }, 13 | 'latest': { 14 | auth: 'https://latest.dev.lcip.org/auth/v1', 15 | content: 'https://latest.dev.lcip.org/', 16 | token: 'https://latest.dev.lcip.org/syncserver/token/1.0/sync/1.5', 17 | oauth: 'https://oauth-latest.dev.lcip.org/v1', 18 | profile: 'https://latest.dev.lcip.org/profile/v1' 19 | }, 20 | 'content': { 21 | auth: 'https://content.dev.lcip.org/auth/v1', 22 | content: 'http://127.0.0.1:3030/', 23 | token: 'https://content.dev.lcip.org/syncserver/token/1.0/sync/1.5', 24 | oauth: 'https://oauth-content.dev.lcip.org/v1', 25 | profile: 'https://content.dev.lcip.org/profile/v1' 26 | }, 27 | 'stable': { 28 | auth: 'https://stable.dev.lcip.org/auth/v1', 29 | content: 'https://stable.dev.lcip.org/', 30 | token: 'https://stable.dev.lcip.org/syncserver/token/1.0/sync/1.5', 31 | oauth: 'https://oauth-stable.dev.lcip.org/v1', 32 | profile: 'https://stable.dev.lcip.org/profile/v1' 33 | }, 34 | 'stage': { 35 | auth: 'https://api-accounts.stage.mozaws.net/v1', 36 | content: 'https://accounts.stage.mozaws.net/', 37 | token: 'https://token.stage.mozaws.net/1.0/sync/1.5', 38 | oauth: 'https://oauth.stage.mozaws.net/v1', 39 | profile: 'https://profile.stage.mozaws.net/v1' 40 | }, 41 | 'prod': { 42 | auth: 'https://api.accounts.firefox.com/v1', 43 | content: 'https://accounts.firefox.com/', 44 | token: 'https://token.services.mozilla.com/1.0/sync/1.5', 45 | oauth: 'https://oauth.accounts.firefox.com/v1', 46 | profile: 'https://profile.accounts.firefox.com/v1' 47 | } 48 | }; 49 | 50 | var env = process.env.FXA_ENV || 'local'; 51 | var FXA_DESKTOP_CONTEXT = process.env.FXA_DESKTOP_CONTEXT || 'fx_desktop_v3'; 52 | var e10s = process.env.FXA_E10S === 'true'; 53 | var fxaEnv = CONFIGS[env]; 54 | 55 | var fxaProfile = { 56 | // enable debugger and toolbox 57 | 'devtools.chrome.enabled': true, 58 | 'devtools.debugger.remote-enabled': true, 59 | 'devtools.debugger.prompt-connection': false, 60 | // disable signed extensions 61 | // the WebDriver extension will not work in Nightly because signed extensions are forced 62 | 'xpinstall.signatures.required': false, 63 | 'xpinstall.whitelist.required': false, 64 | 'services.sync.prefs.sync.xpinstall.whitelist.required': false, 65 | 'extensions.checkCompatibility.nightly': false, 66 | // enable pocket 67 | 'browser.pocket.enabled': true, 68 | // identity logs 69 | 'identity.fxaccounts.log.appender.dump': 'Debug', 70 | 'identity.fxaccounts.loglevel': 'Debug', 71 | 'services.sync.log.appender.file.logOnSuccess': true, 72 | 'services.sync.log.appender.console': 'Debug', 73 | 'services.sync.log.appender.dump': 'Debug', 74 | 'identity.fxaccounts.auth.uri': fxaEnv.auth, 75 | 'identity.fxaccounts.allowHttp': true, 76 | 'identity.fxaccounts.remote.force_auth.uri': fxaEnv.content + 'force_auth?service=sync&context=' + FXA_DESKTOP_CONTEXT, 77 | 'identity.fxaccounts.remote.signin.uri': fxaEnv.content + 'signin?service=sync&context=' + FXA_DESKTOP_CONTEXT, 78 | 'identity.fxaccounts.remote.signup.uri': fxaEnv.content + 'signup?service=sync&context=' + FXA_DESKTOP_CONTEXT, 79 | 'identity.fxaccounts.remote.webchannel.uri': fxaEnv.content, 80 | 'identity.fxaccounts.remote.oauth.uri': fxaEnv.oauth, 81 | 'identity.fxaccounts.remote.profile.uri': fxaEnv.profile, 82 | 'identity.fxaccounts.settings.uri': fxaEnv.content + 'settings?service=sync&context=' + FXA_DESKTOP_CONTEXT, 83 | // for some reason there are 2 settings for the token server 84 | 'identity.sync.tokenserver.uri': fxaEnv.token, 85 | 'services.sync.tokenServerURI': fxaEnv.token, 86 | // disable auto update 87 | 'app.update.auto': false, 88 | 'app.update.enabled': false, 89 | 'app.update.silent': false, 90 | 'app.update.staging.enabled': false, 91 | // allow webchannel url, strips slash from content-server origin. 92 | 'webchannel.allowObject.urlWhitelist': fxaEnv.content.slice(0, -1) 93 | }; 94 | 95 | 96 | // Configuration for local sync development 97 | 98 | // The loop server is either production or local, nothing on stable or latest 99 | if (fxaEnv.loop) { 100 | fxaProfile['loop.server'] = fxaEnv.loop; 101 | } 102 | 103 | if (! e10s) { 104 | // disable e10s 105 | fxaProfile['browser.tabs.remote.autostart'] = false; 106 | fxaProfile['browser.tabs.remote.autostart.1'] = false; 107 | fxaProfile['browser.tabs.remote.autostart.2'] = false; 108 | } 109 | 110 | console.log(chalk.yellow('Configuration:', JSON.stringify(fxaEnv, null, 2))); 111 | console.log(chalk.yellow('E10S Status:', e10s)); 112 | console.log(chalk.yellow('FXA_ENV:', env)); 113 | console.log(chalk.yellow('FIREFOX_BIN Binary:', process.env.FIREFOX_BIN || 'Default System Firefox binary')); 114 | console.log(chalk.yellow('FXA_DESKTOP_CONTEXT:', FXA_DESKTOP_CONTEXT)); 115 | console.log(chalk.yellow('FIREFOX_DEBUGGER:', !! process.env.FIREFOX_DEBUGGER)); 116 | 117 | module.exports = fxaProfile; 118 | --------------------------------------------------------------------------------