Skip to content

Commit

Permalink
Merge pull request mrdoob#46 from edne/master
Browse files Browse the repository at this point in the history
Changes to run the server locally
  • Loading branch information
mrdoob authored Jan 29, 2019
2 parents c89367a + ecd59ef commit ebdca75
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ source 'http://rubygems.org'
gem 'sinatra'
gem 'mongo'
gem 'bson_ext'
gem 'json'
gem 'json', '>= 1.8.2'
gem 'cloudinary'

52 changes: 34 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
GEM
remote: http://rubygems.org/
specs:
aws_cf_signer (0.1.1)
bson (1.4.0)
bson_ext (1.4.0)
cloudinary (1.0.37)
aws_cf_signer (0.1.3)
bson (1.12.5)
bson_ext (1.12.5)
bson (~> 1.12.5)
cloudinary (1.2.3)
aws_cf_signer
rest-client
json (1.6.1)
mime-types (1.19)
mongo (1.4.0)
bson (= 1.4.0)
rack (1.3.5)
rack-protection (1.1.4)
domain_name (0.5.20160826)
unf (>= 0.0.5, < 1.0.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
json (2.0.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mongo (1.12.5)
bson (= 1.12.5)
netrc (0.11.0)
rack (1.6.4)
rack-protection (1.5.3)
rack
rest-client (1.6.7)
mime-types (>= 1.16)
sinatra (1.3.1)
rack (~> 1.3, >= 1.3.4)
rack-protection (~> 1.1, >= 1.1.2)
tilt (~> 1.3, >= 1.3.3)
tilt (1.3.3)
rest-client (2.0.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
tilt (2.0.5)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.2)

PLATFORMS
ruby

DEPENDENCIES
bson_ext
cloudinary
json
json (>= 1.8.2)
mongo
sinatra

BUNDLED WITH
1.12.5
2 changes: 1 addition & 1 deletion server/assets/gallery.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<body>

<div id="header">
<h1><a href="http://glsl.heroku.com/">GLSL Sandbox</a></h1>
<h1><a href="/">GLSL Sandbox</a></h1>
<a href="/e">Create new effect!</a> &nbsp;&nbsp;/&nbsp;
<a href="https://github.com/mrdoob/glsl-sandbox">github</a> &nbsp;&nbsp;/&nbsp;
gallery by <a href="http://twitter.com/thevaw">@thevaw</a> and <a href="http://twitter.com/feiss">@feiss</a> &nbsp;/&nbsp; editor by <a href="http://twitter.com/mrdoob">@mrdoob</a>, <a href="http://twitter.com/mrkishi">@mrkishi</a>, <a href="http://twitter.com/p01">@p01</a>, <a href="http://twitter.com/alteredq">@alteredq</a>, <a href="http://twitter.com/kusmabite">@kusmabite</a> and <a href="http://twitter.com/emackey">@emackey</a>
Expand Down
18 changes: 10 additions & 8 deletions server/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,21 @@ def save_version(code_id, code)
:code => code_data['code']
}

res=Cloudinary::Uploader.upload(
code_data['image'],
:public_id => code_id.to_s)
begin
res=Cloudinary::Uploader.upload(
code_data['image'],
:public_id => code_id.to_s)

image_url=res['url']
image_data={ :image_url => res['url'] }

rescue CloudinaryException
image_data={ :image => code_data['image'] }
end

@code.find_and_modify({
:query => { :_id => code_id },
:update => {
'$set' => {
:modified_at => time,
:image_url => image_url
},
'$set' => image_data.merge({ :modified_at => time }),
'$push' => { :versions => data }
}
})
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@

var button = document.createElement( 'a' );
button.textContent = 'gallery';
button.href = 'http://glsl.heroku.com/';
button.href = '/';
rightside.appendChild( button );

var button = document.createElement( 'button' );
Expand Down

0 comments on commit ebdca75

Please sign in to comment.