GithubHelp home page GithubHelp logo

mozilla / newnewtab Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 5.0 638 KB

New Tab page: content server and recommendation service

Home Page: https://wiki.mozilla.org/Apps/newnewtab

JavaScript 87.62% Makefile 0.17% HTML 3.56% CSS 8.64%

newnewtab's Introduction

newnewtab

newnewtab is a project to enhance Firefox users' apps experience. When opening a new tab, they are offered their own (currently installed) tabs, along with one or more recommended apps.

It is planned for recommendations to be targeted, yet privacy-preserving.

You may find development wiki valuable.

Install

  • install node and redis
  • clone the repository
  • install dependencies using npm npm install -d
  • run application node app

mozApps Whitelist

In order to get this to work at all, you'll need to whitelist the address newnewtab is running from in your about:config in Firefox (tested in version 15+ -- i.e. Nightly). Basically, open up your about:config and add the key: dom.mozApps.whitelist. Make sure localhost:3000 (or wherever newnewtab is running from) is there so it can access your installed apps!

You'll need Firefox 15+ for things to work.

Settings

By default, settings are in config-default.js. You can override settings in there with environment variables (PORT will override express:port), but if you want to customize lots of settings locally (either for development or deployment), you can create config-local.json and that file will augment or add to settings read by default.

config-local.json is not version-controlled; feel free to edit it to your heart's content.

Fetching recommendations

Use node script/fetch_recommendations.

newnewtab's People

Contributors

mardak avatar tofumatt avatar zalun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

newnewtab's Issues

Implement marketplace category recomendation based on user interests

This will be implemented via integrating addaon/example code into public/javascript/main.js
The idea is to assign percentages to marketplace categories, then the caller can request a sudo-random marketplace category.
Whereby, the category is returned according to its percentage.
This code will parked in public/javascript/main.js for the time being

Show warning if the app is not whitelisted for access to apps API

If we're not on the whitelist for the apps API, we can't show any installed apps. Try to detect this and show an error message.

Even if the add-on does it for us in the future, until then we don't have to baby everyone through the process of "I think newnewtab is broken"!

Provide an API to get recent categorization

Might be useful to allow the recommendations to play around with recent vs long-term categories. When implementing this, it would be good to see how long it takes to calculate it and perhaps it might not need any caching.

Use the most recent 7 days of history for the categorization?

Create basic JSON recommendation backend

Hook up a URL that serves a JSON blob. Determine what this format should look like (probably a content string (contains HTML), a time-to-live for each blob). Anything else?

Respect if-modified-since header, do not serve JSON unless necessary.

Create frontend JS updating recommendations

The initial page should be served with generic recommendations to start off with. On a schedule, ask the server for new updates. Take the JSON, store it locally and rotate the recommendations on a schedule, unless their TTL has run out. Ask the server for updates, if-modified-since, and replace the recommendations if the server gives you new ones, otherwise keep showing the existing ones. If you're out of recommendations to show, fall back to the generic ones the page shipped with.

``make test`` is throwing as well as ``node app.js``

different errors, maybe my installation faults, but please help.

make test

/home/zalun/Projects/newnewtab/node_modules/mocha/lib/runner.js:382
if ('failed' == runnable.state) return;
^
TypeError: Cannot read property 'state' of undefined
at Runner.uncaught (/home/zalun/Projects/newnewtab/node_modules/mocha/lib/runner.js:382:27)
at process. (/home/zalun/Projects/newnewtab/node_modules/mocha/lib/runner.js:429:10)
at process.emit (events.js:115:20)
make: *** [test] Error 1

node app.js
LOADING /home/zalun/Projects/newnewtab/config-default.json
LOADING /home/zalun/Projects/newnewtab/config-development.json
IGNORED /home/zalun/Projects/newnewtab/config-local.json (file doesn't exist)
path.existsSync is deprecated. It is now called fs.existsSync.
Bad locale=[en_US] file(s) do not exist [/home/zalun/Projects/newnewtab/locale/en_US/LC_MESSAGES/messages.mo]. See locale/README
Express server listening on port 3000 in development mode
Database ( 7 ) connection status: undefined

events.js:66
throw arguments[1]; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
at RedisClient.on_error (/home/zalun/Projects/newnewtab/node_modules/redis/index.js:140:24)
at Socket. (/home/zalun/Projects/newnewtab/node_modules/redis/index.js:74:14)
at Socket.emit (events.js:88:17)
at net.js:336:14
at process._tickCallback (node.js:244:9)

Choose documentation system

We need some documentation next to the code.
I've got no experience in documenting except of python stuff (Sphinx is the king IMO, it's got some JS hooks)
We might just use the wiki, but it could be nicer to have it with the code.

Fill some/most boxes with your own apps

Most of the boxes should point to your own apps (I think). Only one-or-so should be a recommendation.

To access your installed apps, hook into the mozApps API: https://developer.mozilla.org/en/Apps/Apps_JavaScript_API

Note that this is a whitelisted API (plus one that I think needs you to install the Apps browser extension), so you might have to fiddle a little. Make sure to note what help we might need from the newnewtab add-on to make this happen.

Make clicks on recommendations countable

We need to be able to count clicks. (Note, that does not mean we actually have to count them ourselves in our own database. Generating Apache logs could suffice).

One option is to link the recommendations to a URL on the server and when you click on it, the server redirects you to your real target URL.

Another option would be to count clicks via AJAX (i.e. capture the click event and issue a count query via AJAX).

Opinions?

Auto-build extension

In pdf.js's readme file, there's a link to a xpi built off of trunk. I think we should do the same (probably on the dev server)?

@tofumatt do you run an update script on there?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.