Git Product home page Git Product logo

mozilla-services / screenshots Goto Github PK

View Code? Open in Web Editor NEW
618.0 47.0 128.0 20.46 MB

Firefox Screenshots: the best way to take screenshots on the web.

Home Page: https://screenshots.firefox.com

License: Mozilla Public License 2.0

Shell 0.75% CSS 0.09% HTML 0.20% JavaScript 22.38% Makefile 0.41% Python 9.09% FreeMarker 64.14% Dockerfile 0.01% SCSS 2.92%
javascript firefox firefox-screenshots

screenshots's Introduction

CircleCI Build Status

Screenshots server status page

Clarifying the Future of Firefox Screenshots


Important Note

The frontend for screenshots is now maintianed in mozilla-central. Bugs should now be filed in bugzilla under Firefox::screenshots. This repo currently contains server code that has been disabled. We are archiving this repo, and all future bugs should be directed to bugzilla.


This is a screenshot tool for Firefox. It is available in Firefox 56 and later versions, as part of the default Firefox distribution.

The project was initially launched through Test Pilot as Page Shot.

It is made up of both an add-on (using WebExtensions) and a website using Node.js. The add-on is in webextension/, and the website is in server/

Ian has been blogging about the design, definition, and development process.

(This project used to include general page freezing; this functionality has been forked off into pagearchive.)

You can find more information about Firefox Screenshots at the Mozilla Wiki page: https://wiki.mozilla.org/Firefox/Screenshots

Installation and Setup

Install Nightly or Developer Edition.

(Skip this step if you do not want to run a local server.) Install Postgres. And do one of the following:

Install Node.js. Version 8.x is required.

Clone the repository. Navigate to the project directory and run npm install.

There are two scripts to run the server locally and develop the add-on:

  • ./bin/run-server will run the server on http://localhost:10080 and automatically restart if there are changes.
    • If nodemon crashes you can try to start the server with ./bin/run-server --restart
    • Take a look at and/or source .env.dev for some of the options available through environment variables.
  • ./bin/run-addon will build a few parts of the addon (into addon/webextension/build/) and start Firefox with the add-on installed. The add-on will be refreshed automatically as you change files. We recommend you open about:debugging to help debug the extension.
  • ./bin/run-addon --setup-profile will setup a Firefox profile for your development; this way you can make persistent changes to the profile that you will use just for Screenshots development. (note: this will only look for the firefox command or Nightly, Developer Edition, Aurora editions on OSX)

If you want to develop the add-on but not the server you can run ./bin/run-addon -s https://screenshots.dev.mozaws.net

By default, Screenshots will connect to a Postgres database on localhost:5432. To change which database and user it connects to set/export the environmental variables: RDS_USERNAME, RDS_PASSWORD, and RDS_HOSTNAME

The server will automatically setup the tables in your database, and keep them up to date over time (using pg-patcher).

If you have growl and growlnotify installed on Mac OS X, you will get growl notifications when the server build has started and completed.

We apologize but we have no story for development on Windows (though the add-on runs on Windows). We welcome feedback.

Linting and Testing

npm run test will run tests as well as eslint. You can control the tests with the following shell/environment variables:

  • MOZ_HEADLESS - when this variable is set, the Selenium tests will run in headless mode.
  • SCREENSHOTS_BACKEND - the server where the addon will try to save shots if the default http://localhost:10080 is not available or desirable.

For example, MOZ_HEADLESS=1 SCREENSHOTS_BACKEND=https://screenshots.dev.mozaws.net npm run test will run the tests headlessly against https://screenshots.dev.mozaws.net.

npm run test:server will run the server tests. This require Python and the local server running on http://localhost:10080.

Getting to know the code

There is documentation in webextension/, webextension/background/, and webextension/selector/ that talks about the code layout and architecture of the webextension.

server/view-docs.md talks about how the server React pages are setup, along with the server-side rendering of pages.

There is also documentation in docs/.

Participation

There is an IRC channel #screenshots on irc.mozilla.org (you can use this link for chat access via the web if you do not otherwise use IRC). There are IRC logs available.

If you'd like to contribute code, start with our good-first-issue bugs. If there aren't many of them, or they don't seem too interesting, the Stretch milestone contains things we'd like to get to, but aren't a high priority. If you're interested in working on an issue, it's a good idea to comment in the issue on github, or say hello on IRC, so that we can double-check that the issue is still good, provide any context you might need, and assign it to you.

Planning and ideation is happening in the issue tracker. We have several milestones:

Issue tags otherwise aren't very structured. Research is primarily analysis of other products that do something interesting, or some source material that could provide insight. Input on these (things like "I like this product because...") is very helpful!

We do some research on other projects, collecting the results in this Google Drive folder.

Localization

Firefox Screenshots localization is managed via Pontoon, not direct pull requests to the repository. If you want to fix a typo, add a new language, or simply know more about localization, please get in touch with the existing localization team for your language, or Mozilla’s l10n-drivers for guidance.

screenshots's People

Contributors

abelardo-py avatar ag12r avatar andy-moz avatar chenba avatar crayxt avatar dannycoates avatar fjoerfoks avatar flodolo avatar fzzzy avatar ianb avatar jaredhirsch avatar johngruen avatar jsyanis avatar jurajcigan avatar karm46 avatar koehlermichael avatar kyoshino avatar manxmensch avatar mikkcz avatar milupo avatar mozilla-pontoon avatar petercpg avatar piotrdrag avatar punamdahiya avatar renovate-bot avatar rodrigommc avatar selimsumlu avatar stoyandimitrov avatar theochevalier avatar zerdo90 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

screenshots's Issues

iframes don't get serialized

Because of addon permission issues we can't access the content of iframes when serializing pages. This is discussed some in the addon docs.

I'm not sure what the best resolution here is (especially taking into account e10s)

Comments with one tag aren't that interesting

Having the comments show up containing only the hashtag that puts that item into the present collection is not that interesting. Maybe we should not show that part of the comment (the present hashtag specifically). Though sometimes inline hashtags are part of the narrative, like look at this great #artisantoast #recipe!

Implement blackout/fuzz tool

Sometimes there is private stuff on the page. There should be a tool to fuzz it out.

My thought was that you'd draw a rectangle, and "fuzz" it. This would replace the text with similar-length garbled text, and use a CSS transform to fuzz the text. Images would be fuzzed via some canvas routing. If we could fuzz just sections of images that'd be cool.

Find best anchor for original link

If you are scrolled to a particular part of the shot, when you click on the link to go to the original page we should find the closest anchor (not #psid-# of course), and link to that – then you will get close to where you were in the copied page.

Make readable/regular view sticky

Right now when you load a shot you'll always get the normal mode. We should make it sticky if that was the last thing viewed (by the owner presumably, but we don't have that)

Copy entire tag page to clipboard

As a form of export, you should be able to copy the tag page to the clipboard, and get a nicely formatted version of the all the articles, suitable for pasting into some document tool (Word, an email, etc).

Handle cross-domain fonts

Fonts often can't be loaded cross-domain, which makes custom fonts frequently break. I think we'll need to proxy those, or something.

Add compact tag view

It's hard to see more than one item at a time on the tag page. Maybe some kind of list view would be appropriate.

Add live/local search to tag pages

We should have a quick search on tag pages, that just searches the text in the page itself (titles, excerpts, URLs). We'd immediately filter down the collection inline.

Fix styling of comment dropdown

The comment dropdown is wonky in its styling, I wanted it to appear to be continuous with the content above, but this seems hard to maintain. Maybe some Javascript is necessary to get the top position just right.

Allow pages in tag page to be reordered

We'd want to add a sort order to the individual tags (in PageTags), probably a float, so we can flop them around on reorder. We'd need some kind of dragging, though it's hard because you can only see a couple items on a single screen.

"Zoom" into snap or live view of page

From the tag page, you should be able to zoom into a page, the shot or live page. This would open an inline iframe onto the page.

Unfortunately some live pages might try to break out.

Not filed: Look into Annotator

Annotator is a drop-in Javascript file for saving annotations. Could be an easy way to add these features to the shot. Could also make it easy to opt in to too much complexity all at once.

Support Markdown subset where text is input

In comments I'd like to support a little bit of Markdown, as it's relatively unintrusive. We'd still autolink hashtags. No HTML should be allowed, mostly I want inline styles and links.

Change favicon on shot page

Right now we try to use the exact icon as the favicon. This can be confusing. I think we should use a modified form, so it's clear it's a copy of the page.

Making a shot of a pageshot page shouldn't just "shoot"

If you try to make a shot of a pageshot page, it should make a proper copy, not a DOM-based freeze.

Implied in this is that we have a copy technique, but that's just a matter of copying the PageData and PageTags records.

Add "all my items" pseudo-tag

The tag page is good for collections, we should have one for all your items. It won't scale to large collections, but that's okay for now.

Sharing pages on the web isn't reliable and expressive enough

When we share things on the web, we don't know if the other person will see what we see, we rely on website owners to create stable and direct URLs, we have to understand the difference between permalinks and index pages, we can't share experiences that happen inside sophisticated web applications, and we can't share sets of related items.

We can do better

Allow "text snippets"

Right now you can select one visual part of a page that is saved and marked.

I'd like to also include text selections. When you select text on the page, a control would pop up that would allow you to "save" the selection. That saved selection would be like a kind of comment, and also could be used as a replacement for the excerpt (similar to how you can select an image as the summary image). First attempt at this would be text-only, not trying to capture any other parts of the selection.

Probably these would be displayed not inline, but as a list, and if you click on them then it will scroll to that context.

Show when a page has been updated

We should do a HEAD... If-Modified-Since request on pages, to check if they have been changed since saved.

I don't know what to expect... I would expect some pages will not be using expiry times, but I'm not sure. It'll be an experiment.

The request has to happen in privileged code of course.

Add user accounts

Maybe login required. Hashtags would become user-account-specific.

Addon doesn't work with e10s

The screenshot code is not e10s compatible, because it tries to access the contentWindow directly in process (in lib/screenshot.js) – we get an obscure error under e10s because we get a fake/proxy contentWindow. I haven't figured out how to do this in a Jetpack addon (the porting docs I've found refer to frame workers, but only tell how to make those from XUL addons).

Use React.js

I like React.js, we should use it. Requires build steps and stuff, but such is life.

Try to find captions for images

We should look into ways to find associated captions from images. Like look for a sibling element with some indication that it is a caption.

Add search

After #11 we'll have a "personal" archive of saved items of some sort. Quick-and-dirty search would be interesting to try. There's an Appengine API so it shouldn't require much investment.

We might want to move the body out of the /data/<path> JSON blob.

Share "plain view" of page

The framed toolbar maybe isn't the right thing to be sharing, instead as a viewer you should just see the page, perhaps with some inline stuff.

Your logged-in state could determine which view you get, though ideally the framed version would have a different URL, and if you aren't logged in you'd be directed back to the plain view.

This should make sharing work better, as framed content isn't treated well by sharing services.

Allow (suggest?) icons/stickies for hashtags

Once we have #12 we'll be showing the hashtags in various places, and iconography would help make them easier to track.

Entering icons is hard, but we could instead just let you associate them – then whenever a hashtag was used we'd also add the icon. Maybe we'd do it via a dynamically generated user-specific stylesheet (so no real updates have to be done to content). All hashtag links would become like <a class="tag tag-recipes">recipes</a>

Use consistent terminology

A proposed description of what we have now:

Shot or Shot Page: what you make when you shoot a page, the web page that is created

Full Page: the frozen page, as framed in the full view

Source page: the page from which the shot was taken

Clip: an image clip or a text clip; an image click is a rectangle taken from the page.

Viewer: the person viewing the shot, who did not create the shot.

Creator: the person who made the shot

Navigation bar: the bar at the top of the page (that has the title, etc)

Top bar: the bar you get when you click the PageShot button, that lets you save the shot.

My Shots: the shot index page, where you can see all your devices.

AND hash tags

There should be a tag page for two tags, where both are present

Ephemeral groupings

While tags are good to group items, they aren't very task-oriented. For instance, I want to ask you to look at a couple product alternatives for a purchase: that task doesn't really have a name, and won't be long lived. Some other approach (still with the tag collection view) would be appropriate. Maybe with a "parent" page that is effectively the name of the tag?

Add metrics

We should be understanding how people use this as early as possible.

Google Analytics might be a simple option to start with. Right now we don't know what questions we want to ask, but if we can collect some data then we'll have the infrastructure once we actually figure out some questions.

Make views look good on mobile

The addon is tightly bound to desktop Firefox, so no option there for mobile, but viewing shots is very accessible to mobile. We should make sure those portions (the viewer mode generally, the tag view specifically) work well on mobile. #18 would be helpful.

Save group of tabs

There should be a way to save a group of tabs all at once, to a tag (similar to the direct-to-tag dropdown, only you'd select several tabs instead of just the active one). The current tab should default to selected.

Allow no image on an excerpt

You can choose which image for an excerpt, but not no image. Also no excerpt text. We also need a way to get it back.

Use resolution-independent locations

Right now we're using pixel locations for things like the snippet. This doesn't work well on other resolutions, especially with responsive design.

We should borrow the resolution-independent code from TogetherJS (that uses selectors).

Allow tag pages to have title/description

A simple title and description could be nice, when you want to explain why this tag exists. The title could include a non-normalized tag form (like #HotOrNot or #hot-or-not instead of just #hotornot, even though those all mean the same thing)

We could just search the title for something that normalizes to the tag, and if so not show the tag elsewhere.

Save to recalled hashtag

It would be nice to be able to really quickly save the current page to a recently used hashtag. This might be a separate dropdown where you can select the tag. This might open an invisible tab instead of a visible one.

User accounts (#11) would be useful so it's more certain you can recall the page later.

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.