Skip to content
Open

Dev #45

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
6 changes: 3 additions & 3 deletions assets/css/common.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
font-family: 'Droid Sans';
font-style: normal;
font-weight: 400;
src: local('Droid Sans'), local('DroidSans'), url(http://themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
src: local('Droid Sans'), local('DroidSans'), url(//themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciBsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
}
@font-face {
font-family: 'Droid Sans';
font-style: normal;
font-weight: 700;
src: local('Droid Sans Bold'), local('DroidSans-Bold'), url(http://themes.googleusercontent.com/static/fonts/droidsans/v3/EFpQQyG9GqCrobXxL-KRMQFhaRv2pGgT5Kf0An0s4MM.woff) format('woff');
src: local('Droid Sans Bold'), local('DroidSans-Bold'), url(//themes.googleusercontent.com/static/fonts/droidsans/v3/EFpQQyG9GqCrobXxL-KRMQFhaRv2pGgT5Kf0An0s4MM.woff) format('woff');
}

* {
Expand Down Expand Up @@ -455,4 +455,4 @@ footer {
opacity: 0.5;
}
66% {}
}
}
3 changes: 2 additions & 1 deletion assets/js/modules/socketconnection.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ socketConnection = (pasteboard) ->
getID: () -> return ID
init: () ->
return unless @isSupported()
connection = new WebSocket("ws://#{window.location.hostname}:#{SOCKET_PORT}")
protocol = if window.location.protocol == "http:" then "ws:" else "wss:"
connection = new WebSocket(protocol + "//#{window.location.hostname}:#{SOCKET_PORT}")
connection.onmessage = (e) ->
try
data = JSON.parse(e.data)
Expand Down
10 changes: 9 additions & 1 deletion config/environments.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Environment Configuration
###
auth = require "../auth"
url = require "url"

exports.init = (app, express) ->
# General
Expand All @@ -18,8 +19,15 @@ exports.init = (app, express) ->

# Set
app.set "localrun", process.env.LOCAL or false
# The port where the server listens
app.set "port", process.env.PORT or 3000
app.set "domain", "http://pasteboard.co"

if process.env.ORIGIN
app.set "domain", process.env.ORIGIN
app.set "externalPort", url.parse(process.env.ORIGIN).port or 443
else
app.set "domain", "http://pasteboard.co"
app.set "externalPort", app.get "port"

# Amazon S3 connection settings (using knox)
if auth.amazon
Expand Down
2 changes: 1 addition & 1 deletion controllers/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ post = {}
# The index page
get.index = (req, res) ->
viewData =
port: req.app.get "port"
port: req.app.get "externalPort"
redirected: false
useAnalytics: false
trackingCode: ""
Expand Down
2 changes: 1 addition & 1 deletion helpers/common.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exports.imageURL = (req, image) ->
base = auth.amazon.CDN_URL or "http://#{auth.amazon.S3_BUCKET}.s3.amazonaws.com"
return "#{base}#{req.app.get "amazonFilePath"}#{image}"
else
"http://#{req.headers.host}#{req.app.get "localStorageURL"}#{image}"
return "#{req.app.get "domain"}#{req.app.get "localStorageURL"}#{image}"

# Generate the image owner key
imageOwnerKey = (image) ->
Expand Down
6 changes: 3 additions & 3 deletions views/image.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<!-- Twitter Cards -->
<meta name="twitter:card" content="photo">
<meta name="twitter:url" content="http://pasteboard.co/<%= imageName %>">
<meta name="twitter:url" content="<%= longURL %>">
<meta name="twitter:title" content="Pasteboard &mdash; Uploaded Image">
<meta name="twitter:description" content="Super simple and lightning fast image sharing. Upload clipboard images with Copy &amp; Paste and image files with Drag &amp; Drop">
<meta name="twitter:image" content="<%= imageURL %>">
Expand Down Expand Up @@ -46,8 +46,8 @@
<span>Embed URL:</span>
<input type="text" value="<%= imageURL %>" readonly onClick="this.select();">
</div>
<a href="https://twitter.com/intent/tweet?text=I%20uploaded%20an%20image&url=http%3A%2F%2Fpasteboard.co/<%= imageName %>" class="twitter button social" target="__blank" data-track="Twitter Image" title="Share on Twitter"><span class="icon"></span></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fpasteboard.co/<%= imageName %>" class="facebook button social" target="__blank" data-track="Facebook Image" title="Share on Facebook"><span class="icon"></span></a>
<a href="https://twitter.com/intent/tweet?text=I%20uploaded%20an%20image&url=<%= longURL %>" class="twitter button social" target="__blank" data-track="Twitter Image" title="Share on Twitter"><span class="icon"></span></a>
<a href="https://www.facebook.com/sharer/sharer.php?u=<%= longURL %>" class="facebook button social" target="__blank" data-track="Facebook Image" title="Share on Facebook"><span class="icon"></span></a>
<a href="/images/<%= imageName %>/download" class="button" data-track="Download">Download image</a>
<% if (isImageOwner) { %>
<button class="cancel delete" data-track="Delete" data-image="<%= imageName %>">Delete image</button>
Expand Down