Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,68 @@ INSTAGRAM SERVERS CAN POST TO YOUR CALLBACK URL. RUNNING IT LOCALLY WON'T WORK
WITHOUT USING SOMETHING LIKE LOCALTUNNEL TO EXPOSE A PORT:
https://github.com/progrium/localtunnel/

1) Install Needed Resources (this is for debian, adapt as necessary for others)

1) Install Node.js
sudo apt-get install g++ curl libssl-dev apache2-utils git-core

curl -O http://nodejs.org/dist/node-v0.4.1.tar.gz
tar xvf node-v0.4.1.tar.gz
./configure
sudo make && sudo make install
2) Install Node.js

2) Install Redis
curl -O http://nodejs.org/dist/node-v0.4.2.tar.gz
tar xvf node-v0.4.2.tar.gz
cd node-v0.4.2

or:

git clone git://github.com/joyent/node.git
cd node

then:

curl -O http://redis.googlecode.com/files/redis-2.2.1.tar.gz
tar xvf redis-2.2.1.tar.giz
./configure
sudo make && sudo make install

3) Run Redis
3) Install Redis

redis-server conf/redis.conf
curl -O http://redis.googlecode.com/files/redis-2.2.2.tar.gz
tar xvf redis-2.2.2.tar.giz
cd redis-2.2.2
sudo make && sudo make install

3) Install NPM (Node package manager)
4) Install NPM (Node package manager)

curl http://npmjs.org/install.sh | sh

or:

git clone http://github.com/isaacs/npm.git
git clone git://github.com/isaacs/npm.git
cd npm
sudo make install

4) Install required node libraries
5) Install Required Node Libraries

sudo npm install redis
sudo npm install socket.io
sudo npm install express
sudo npm install jade

5) Add your client_id and client_secret to settings.js
6) Install this Demo App

git clone git://github.com/Instagram/Realtime-Demo.git
cd Realtime-Demo

6) Run the server
7) Run Redis from the Demo App

redis-server conf/redis.conf

8) Add your client_id and client_secret to settings.js

9) Run the Server

node server.js

Navigate to http://your-server:3000/ and you should see a blank page.

7) Create a geography subscription. Here's sample code for Las Vegas:
10) Create a Geography Subscription. Here's sample code for Las Vegas:

curl -F 'client_id=YOUR-CLIENT-ID' \
-F 'client_secret=YOUR-CLIENT-SECRET' \
Expand All @@ -65,6 +82,7 @@ curl -F 'client_id=YOUR-CLIENT-ID' \
-F 'callback_url=http://your-server:3000/callbacks/geo/las-vegas/' \
https://api.instagram.com/v1/subscriptions/


Make sure to replace client_id and client_secret with your own. Also, it's not required to run your server at port 3000, but that's the standard node port ;)

If you're lucky, someone will take a photo in Las Vegas, and it will pop up on your screen at the same moment they post the photo.
Expand Down
4 changes: 2 additions & 2 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ app.set('view engine', 'jade');

app.configure(function(){
app.use(express.methodOverride());
app.use(express.bodyDecoder());
app.use(express.bodyParser());
app.use(app.router);
app.use(express.staticProvider(__dirname + '/public/'));
app.use(express.static(__dirname + '/public/'));
});
app.configure('development', function(){
app.use(express.logger());
Expand Down
2 changes: 1 addition & 1 deletion views/geo.jade
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
h1
img(src="/static/images/logo.png")
div#wrapper
!= partial('image', images)
!= partial('./partials/image', images)
.cols
.col-1
h2 What is this page?
Expand Down
6 changes: 3 additions & 3 deletions views/layout.jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ html
script(src="/socket.io/socket.io.js", type="text/javascript")
script(src="/static/scripts/jquery-1.5.min.js", type="text/javascript")
script(src="/static/scripts/master.js", type="text/javascript")
:javascript
| socket.connect();
| $(document).ready(Media.positionAll);
script(type="text/javascript")
socket.connect();
$(document).ready(Media.positionAll);
body
#wrap
!{body}