├── .gitignore ├── README.markdown ├── Rakefile ├── bin └── firelinks ├── firelinks.gemspec ├── lib ├── firelinks.rb └── firelinks │ └── version.rb └── screens ├── firelinks1.png ├── firelinks1b.png └── firelinks1c.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | pkg/ 3 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | # Firelinks 2 | 3 | Firelinks automatically mirrors your Firefox browsing session in elinks. 4 | 5 | 6 | 7 | Benefits: 8 | 9 | * Use Firefox's graphical interface to navigate the web visually 10 | * Use elinks' austere textual interface to read content with more concentration and less distraction 11 | * Save clean plain text versions of webpages with elinks' "Save formatted document" command 12 | 13 | 14 | ## Prerequisites 15 | 16 | * Supported platforms: Linux and OS X 17 | * [elinks][elinks] 18 | * Firefox 3 or higher (tested on Firefox 5) 19 | * sqlite3 version 3.7.4 or higher 20 | * Ruby (tested on 1.9.2) 21 | 22 | [elinks]:http://elinks.or.cz/ 23 | 24 | ## Install 25 | 26 | gem install firelinks 27 | 28 | Try running it by typing `firelinks` on the command line. If you get an error 29 | message saying that `firelinks` is missing, then you probably have a `PATH` 30 | issue. Try one of these workarounds: 31 | 32 | * Try installing with `sudo gem install firelinks` 33 | * Put the directory where Rubygems installs executables on your `PATH` 34 | 35 | To upgrade `firelinks` to a newer version, just repeat the installation procedure. 36 | 37 | ## How to use it 38 | 39 | Start Firefox. Then start Firelinks by opening a terminal and typing 40 | 41 | firelinks 42 | 43 | Firelinks starts Ruby process in your Terminal window, which in turn starts and 44 | manages an `elinks` session that displays the current webpage. 45 | 46 | As you visit pages in Firefox, you should see them load 47 | automatically in the elinks session. 48 | 49 | To quit Firelinks, just press `CTRL-C` (instead of the normal quit key sequence for elinks). 50 | 51 | ## Troubleshooting 52 | 53 | If Firelinks starts an elinks session but doesn't seem to be updating it as 54 | you hit new pages in Firefox, you may be missing sqlite3 or in need of a newer version. 55 | 56 | Run `sqlite3 -version` to make sure you have a recent version of sqlite3 (3.7.4 or later). 57 | 58 | Also, note that elinks keeps its own cookies and session data separately from 59 | Firefox. So if you're logged into nytimes.com in Firefox, you'll need to log in 60 | at nytimes.com in elinks to ensure that you can access the same content in 61 | both browsers. 62 | 63 | 64 | ## Bug reports and feature requests 65 | 66 | Please submit here: 67 | 68 | * 69 | 70 | 71 | ## About the developer 72 | 73 | My name is Daniel Choi. I specialize in Ruby, Rails, MySQL, PostgreSQL, and iOS 74 | development. I am based in Cambridge, Massachusetts, USA, and the little 75 | software company I run with Hoony Youn is called [Kaja Software](http://kajasoftware.com). 76 | 77 | * Company Email: info@kajasoftware.com 78 | * Twitter: [@danchoi][twitter] 79 | * Personal Email: dhchoi@gmail.com 80 | * My Homepage: 81 | 82 | [twitter]:http://twitter.com/#!/danchoi 83 | 84 | 85 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'rake/testtask' 3 | require 'bundler' 4 | Bundler::GemHelper.install_tasks 5 | 6 | $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib') 7 | 8 | desc "release and build and push new website" 9 | task :push => [:release, :web] 10 | 11 | desc "Bumps version number up one and git commits" 12 | task :bump do 13 | basefile = "lib/firelinks/version.rb" 14 | file = File.read(basefile) 15 | oldver = file[/VERSION = '(\d.\d.\d)'/, 1] 16 | newver_i = oldver.gsub(".", '').to_i + 1 17 | newver = ("%.3d" % newver_i).split(//).join('.') 18 | puts oldver 19 | puts newver 20 | puts "Bumping version: #{oldver} => #{newver}" 21 | newfile = file.gsub("VERSION = '#{oldver}'", "VERSION = '#{newver}'") 22 | File.open(basefile, 'w') {|f| f.write newfile} 23 | `git commit -am 'Bump'` 24 | end 25 | 26 | desc "build and push website" 27 | task :web => :build_webpage do 28 | puts "Building and pushing website" 29 | Dir.chdir "../project-webpages" do 30 | `scp out/firelinks.html zoe2@instantwatcher.com:~/danielchoi.com/public/software/` 31 | #`rsync -avz out/images-firelinks zoe2@instantwatcher.com:~/danielchoi.com/public/software/` 32 | #`rsync -avz out/stylesheets zoe2@instantwatcher.com:~/danielchoi.com/public/software/` 33 | #`rsync -avz out/lightbox2 zoe2@instantwatcher.com:~/danielchoi.com/public/software/` 34 | end 35 | #`open http://danielchoi.com/software/firelinks.html` 36 | end 37 | 38 | desc "build webpage" 39 | task :build_webpage do 40 | `cp README.markdown ../project-webpages/src/firelinks.README.markdown` 41 | #`cp coverage.markdown ../project-webpages/src/firelinks.coverage.markdown` 42 | Dir.chdir "../project-webpages" do 43 | puts `ruby gen.rb firelinks #{Firelinks::VERSION}` 44 | `open out/firelinks.html` 45 | end 46 | end 47 | 48 | 49 | desc "git push and rake release bumped version" 50 | task :bumped do 51 | puts `git push && rake release` 52 | Rake::Task["web"].execute 53 | end 54 | 55 | task :default => :web 56 | 57 | -------------------------------------------------------------------------------- /bin/firelinks: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | require 'firelinks' 4 | rescue LoadError 5 | require 'rubygems' 6 | require 'firelinks' 7 | end 8 | 9 | -------------------------------------------------------------------------------- /firelinks.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | $:.push File.expand_path("../lib", __FILE__) 3 | require "firelinks/version" 4 | 5 | Gem::Specification.new do |s| 6 | s.name = "firelinks" 7 | s.version = Firelinks::VERSION 8 | s.platform = Gem::Platform::RUBY 9 | s.required_ruby_version = '>= 1.8.6' 10 | 11 | s.authors = ["Daniel Choi"] 12 | s.email = ["dhchoi@gmail.com"] 13 | s.homepage = "http://danielchoi.com/software/firelinks.html" 14 | s.summary = %q{Mirror Firefox in elinks} 15 | s.description = %q{Mirror Firefox in elinks} 16 | 17 | s.rubyforge_project = "firelinks" 18 | 19 | s.files = `git ls-files`.split("\n") 20 | s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") 21 | s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } 22 | s.require_paths = ["lib"] 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /lib/firelinks.rb: -------------------------------------------------------------------------------- 1 | 2 | puts "Starting firelinks" 3 | puts "Press CTRL-C to stop" 4 | sleep 1 5 | 6 | if `which elinks` !~ /\w/ 7 | abort "Missing elinks! Please install it." 8 | end 9 | 10 | `killall elinks` 11 | 12 | paths = ["#{ENV['HOME']}/.mozilla/firefox", "#{ENV['HOME']}/Library/Application Support"] 13 | history_path = `find #{paths.map {|p| "'#{p}'"}.join(' ')} -mmin -20 -name places.sqlite`.split("\n")[0].chomp 14 | 15 | puts "Using Firefox database: #{history_path.inspect}" 16 | 17 | if history_path == '' 18 | abort "You're missing your Firefox browser history database. Are you sure you have a recent version of Firefox installed?" 19 | end 20 | 21 | command = %Q{sqlite3 -line '#{history_path}' 'select url, title, last_visit_date from moz_places order by last_visit_date desc limit 2'} 22 | 23 | use_remote = nil 24 | 25 | url = nil 26 | 27 | trap("INT") { 28 | puts "Goodbye" 29 | exit 30 | } 31 | 32 | loop do 33 | res = %x{ #{command} } 34 | current_url = res[/^\s+url = (.*)/, 1] 35 | if current_url != url 36 | url = current_url 37 | cmd = if use_remote 38 | %Q|elinks -remote 'openURL("#{url}")'| 39 | else 40 | "elinks '#{url}'" 41 | end 42 | use_remote ||= true 43 | 44 | spawn(cmd) 45 | end 46 | sleep 0.5 47 | end 48 | -------------------------------------------------------------------------------- /lib/firelinks/version.rb: -------------------------------------------------------------------------------- 1 | module Firelinks 2 | VERSION = '0.0.6' 3 | end 4 | -------------------------------------------------------------------------------- /screens/firelinks1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danchoi/firelinks/c8caeb050fb8634e7b6a8778a42d490f69a1ff18/screens/firelinks1.png -------------------------------------------------------------------------------- /screens/firelinks1b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danchoi/firelinks/c8caeb050fb8634e7b6a8778a42d490f69a1ff18/screens/firelinks1b.png -------------------------------------------------------------------------------- /screens/firelinks1c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/danchoi/firelinks/c8caeb050fb8634e7b6a8778a42d490f69a1ff18/screens/firelinks1c.png --------------------------------------------------------------------------------