Permalink
Browse files

allow pinkyurl fallback

  • Loading branch information...
1 parent ce417e9 commit f7ee1887321080991bfb8eb306ad7e5a8d53f4e5 Visnu Pitiyanuvath committed Nov 13, 2012
Showing with 14 additions and 9 deletions.
  1. +14 −9 models/team.coffee
View
@@ -30,6 +30,7 @@ TeamSchema = module.exports = new mongoose.Schema
technical: Boolean
alert: Boolean
videoURL: String
+ pinkyurl: Boolean
emails:
type: [ mongoose.SchemaTypes.Email ]
validate: [ ((v) -> v.length <= 4), 'max' ]
@@ -216,15 +217,19 @@ TeamSchema.method 'prettifyURL', ->
TeamSchema.virtual('screenshot').get ->
return unless url = @entry.url
- qs = querystring.stringify
- url: url
- viewport: '1024x595'
- thumbnail_max_width: '320'
- md5 = crypto.createHash 'md5'
- md5.update qs.toString(), 'ascii'
- md5.update env.secrets.url2png, 'ascii'
- token = md5.digest 'hex'
- "//alpha.url2png.com/v6/P50A14826D8629/#{token}/png/?#{qs}"
+ if @entry.pinkyurl
+ qs = querystring.stringify url: url, resize: '320x186', 'out-format': 'png'
+ "http://pinkyurl.com/i?#{qs}"
+ else
+ qs = querystring.stringify
+ url: url
+ viewport: '1024x595'
+ thumbnail_max_width: '320'
+ md5 = crypto.createHash 'md5'
+ md5.update qs.toString(), 'ascii'
+ md5.update env.secrets.url2png, 'ascii'
+ token = md5.digest 'hex'
+ "http://alpha.url2png.com/v6/P50A14826D8629/#{token}/png/?#{qs}"
TeamSchema.method 'updateScreenshot', (callback) ->
return unless @entry.url

0 comments on commit f7ee188

Please sign in to comment.