Skip to content

Commit aa9666e

Browse files
committed
merge master
2 parents a676020 + 6b00a69 commit aa9666e

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

index.coffee

+14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
express = require 'express'
22
bodyParser = require 'body-parser'
3+
cors = require 'cors'
4+
35
app = express()
46

7+
app.use(cors(
8+
origin: (origin, callback) ->
9+
if origin
10+
allow = origin.match(/\.kosendj-bu\.in\//) != null
11+
if app.get('env') == "development"
12+
allow = allow || origin.match(/localhost/) != null
13+
14+
callback(null, allow)
15+
else
16+
callback(null, false)
17+
))
18+
519
http = require('http').Server app
620
io = require('socket.io')(http)
721

lib/gif.coffee

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ request = require 'request'
44
io = process.globals.io
55

66
check = (url, callback)->
7-
if url.match(/^http:\/\/sorah-gif/)
7+
if url.match(/\.kosendj-bu\.in\//)
88
callback(null, true)
99
return
1010

lib/twitter.coffee

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ Twit = require 'twit'
22

33
io = process.globals.io
44

5-
twitter = new Twit
6-
consumer_key: process.env.CONSUMER_KEY
7-
consumer_secret: process.env.CONSUMER_SECRET
8-
access_token: process.env.ACCESS_TOKEN
9-
access_token_secret: process.env.ACCESS_TOKEN_SECRET
5+
unless process.env.DISABLE_TWITTER == '1'
6+
twitter = new Twit
7+
consumer_key: process.env.CONSUMER_KEY
8+
consumer_secret: process.env.CONSUMER_SECRET
9+
access_token: process.env.ACCESS_TOKEN
10+
access_token_secret: process.env.ACCESS_TOKEN_SECRET
1011

11-
replaceHashtag = new RegExp process.env.HASH_TAG, 'g'
12+
replaceHashtag = new RegExp "##{process.env.HASH_TAG}", 'g'
1213

13-
unless process.env.DISABLE_TWITTER == '1'
1414
stream = twitter.stream 'statuses/filter',
1515
track: "##{process.env.HASH_TAG}"
1616

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"body-parser": "^1.13.1",
1414
"coffee-script": "^1.9.3",
15+
"cors": "^2.7.1",
1516
"express": "^4.12.4",
1617
"jade": "^1.11.0",
1718
"livescript": "^1.4.0",

src/screen.ls

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ change = ->
4444
setTimeout change, (main.$data.bpm / 60) * 1000
4545

4646
processUrls = (urls) ->
47-
for x in urls
48-
url = x.replace /^https?:\/\/img\.sorah\.jp/, \http://sorah-pub.s3.amazonaws.com
49-
if url.match /^https?:\/\/(?:sorah-pub\.s3\.amazonaws\.com|192\.168|10\.|sorah-gif)/
47+
for url in urls
48+
if url.match /\.kosendj-bu\.in\//
5049
url
5150
else
5251
"/gifs/retrieve/#{url}"

0 commit comments

Comments
 (0)