murlsh 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.htaccess +4 -2
- data/README.textile +21 -2
- data/Rakefile +15 -11
- data/VERSION +1 -1
- data/bin/murlsh +3 -2
- data/config.ru +1 -1
- data/config.yaml +6 -2
- data/lib/murlsh/build_md5.rb +12 -0
- data/lib/murlsh/dispatch.rb +3 -3
- data/lib/murlsh/far_future_expires.rb +5 -1
- data/lib/murlsh/json_body.rb +41 -0
- data/lib/murlsh/json_server.rb +39 -0
- data/lib/murlsh/jsonp_body.rb +17 -0
- data/lib/murlsh/search_conditions.rb +22 -0
- data/lib/murlsh/url.rb +2 -0
- data/lib/murlsh/url_body.rb +93 -102
- data/lib/murlsh/url_result_set.rb +35 -0
- data/lib/murlsh/url_server.rb +30 -15
- data/lib/murlsh.rb +6 -1
- data/murlsh.gemspec +13 -8
- data/plugins/add_pre_45_supplied_thumbnail.rb +32 -0
- data/plugins/add_pre_50_lookup_content_type_title.rb +4 -1
- data/plugins/add_pre_50_open_graph_image.rb +8 -2
- data/plugins/add_pre_60_flickr.rb +1 -1
- data/plugins/add_pre_60_github_title.rb +1 -1
- data/plugins/add_pre_60_google_code_title.rb +2 -1
- data/plugins/add_pre_60_imgur.rb +1 -1
- data/plugins/add_pre_60_s3_image.rb +1 -1
- data/plugins/add_pre_60_twitter.rb +1 -1
- data/plugins/add_pre_60_vimeo.rb +3 -1
- data/plugins/add_pre_65_html_thumb.rb +1 -1
- data/public/css/screen.css +1 -3
- data/public/js/js.js +46 -46
- data/spec/uri_ask_spec.rb +0 -2
- metadata +18 -12
- data/lib/murlsh/config_server.rb +0 -32
data/lib/murlsh/url_server.rb
CHANGED
@@ -8,43 +8,58 @@ module Murlsh
|
|
8
8
|
|
9
9
|
include HeadFromGet
|
10
10
|
|
11
|
-
def initialize(config)
|
12
|
-
@config = config
|
13
|
-
end
|
11
|
+
def initialize(config); @config = config; end
|
14
12
|
|
15
13
|
# Respond to a GET request. Return a page of urls based on the query
|
16
14
|
# string parameters.
|
17
15
|
def get(req)
|
18
|
-
|
16
|
+
conditions = Murlsh::SearchConditions.new(req['q']).conditions
|
17
|
+
page = [req['p'].to_i, 1].max
|
18
|
+
per_page = req['pp'] ? req['pp'].to_i :
|
19
|
+
@config.fetch('num_posts_page', 25)
|
20
|
+
|
21
|
+
result_set = Murlsh::UrlResultSet.new(conditions, page, per_page)
|
19
22
|
|
20
23
|
resp = Rack::Response.new
|
21
24
|
|
22
|
-
resp['Cache-Control'] = 'must-revalidate, max-age=0'
|
23
25
|
resp['Content-Type'] = 'text/html; charset=utf-8'
|
24
|
-
resp
|
25
|
-
|
26
|
+
resp.body = Murlsh::UrlBody.new(@config, req, result_set,
|
27
|
+
resp['Content-Type'])
|
26
28
|
|
27
|
-
resp
|
29
|
+
resp['Cache-Control'] = 'must-revalidate, max-age=0'
|
30
|
+
resp['ETag'] = "\"#{resp.body.md5}\""
|
28
31
|
|
29
32
|
resp
|
30
33
|
end
|
31
34
|
|
32
35
|
# Respond to a POST request. Add the new url and return json.
|
33
36
|
def post(req)
|
34
|
-
auth = req
|
37
|
+
auth = req['auth']
|
35
38
|
if user = auth.empty? ? nil : Murlsh::Auth.new(
|
36
39
|
@config.fetch('auth_file')).auth(auth)
|
37
40
|
|
38
41
|
mu = Murlsh::Url.new do |u|
|
39
|
-
u.
|
40
|
-
|
42
|
+
u.url = req['url']
|
43
|
+
u.email = user[:email]
|
44
|
+
u.name = user[:name]
|
45
|
+
|
46
|
+
# optional parameters
|
47
|
+
unless req['thumbnail'].to_s.empty?
|
48
|
+
u.thumbnail_url = req['thumbnail']
|
49
|
+
end
|
50
|
+
|
51
|
+
u.time = if req['time']
|
52
|
+
Time.at(req['time'].to_f).utc
|
41
53
|
else
|
42
54
|
Time.now.utc
|
43
55
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
56
|
+
|
57
|
+
unless req['title'].to_s.empty?
|
58
|
+
u.title = req['title']
|
59
|
+
u.user_supplied_title = true
|
60
|
+
end
|
61
|
+
|
62
|
+
u.via = req['via'] unless req['via'].to_s.empty?
|
48
63
|
end
|
49
64
|
|
50
65
|
begin
|
data/lib/murlsh.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'murlsh/head_from_get'
|
2
|
+
require 'murlsh/search_conditions'
|
2
3
|
|
3
4
|
require 'murlsh/auth'
|
5
|
+
require 'murlsh/build_md5'
|
4
6
|
require 'murlsh/build_query'
|
5
|
-
require 'murlsh/config_server'
|
6
7
|
require 'murlsh/delicious_parse'
|
7
8
|
require 'murlsh/dispatch'
|
8
9
|
require 'murlsh/doc'
|
@@ -11,6 +12,9 @@ require 'murlsh/failproof'
|
|
11
12
|
require 'murlsh/far_future_expires'
|
12
13
|
require 'murlsh/image_list'
|
13
14
|
require 'murlsh/img_store'
|
15
|
+
require 'murlsh/json_body'
|
16
|
+
require 'murlsh/json_server'
|
17
|
+
require 'murlsh/jsonp_body'
|
14
18
|
require 'murlsh/markup'
|
15
19
|
require 'murlsh/must_revalidate'
|
16
20
|
require 'murlsh/openlock'
|
@@ -22,5 +26,6 @@ require 'murlsh/uri_domain'
|
|
22
26
|
require 'murlsh/uri_get_path_query'
|
23
27
|
require 'murlsh/url_body'
|
24
28
|
require 'murlsh/url'
|
29
|
+
require 'murlsh/url_result_set'
|
25
30
|
require 'murlsh/url_server'
|
26
31
|
require 'murlsh/yaml_ordered_hash'
|
data/murlsh.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{murlsh}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matthew M. Boedicker"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-15}
|
13
13
|
s.default_executable = %q{murlsh}
|
14
14
|
s.description = %q{url sharing site framework with easy adding, title lookup, atom feed, thumbnails and embedding}
|
15
15
|
s.email = %q{matthewm@boedicker.org}
|
@@ -28,8 +28,8 @@ Gem::Specification.new do |s|
|
|
28
28
|
"config.yaml",
|
29
29
|
"lib/murlsh.rb",
|
30
30
|
"lib/murlsh/auth.rb",
|
31
|
+
"lib/murlsh/build_md5.rb",
|
31
32
|
"lib/murlsh/build_query.rb",
|
32
|
-
"lib/murlsh/config_server.rb",
|
33
33
|
"lib/murlsh/delicious_parse.rb",
|
34
34
|
"lib/murlsh/dispatch.rb",
|
35
35
|
"lib/murlsh/doc.rb",
|
@@ -39,10 +39,14 @@ Gem::Specification.new do |s|
|
|
39
39
|
"lib/murlsh/head_from_get.rb",
|
40
40
|
"lib/murlsh/image_list.rb",
|
41
41
|
"lib/murlsh/img_store.rb",
|
42
|
+
"lib/murlsh/json_body.rb",
|
43
|
+
"lib/murlsh/json_server.rb",
|
44
|
+
"lib/murlsh/jsonp_body.rb",
|
42
45
|
"lib/murlsh/markup.rb",
|
43
46
|
"lib/murlsh/must_revalidate.rb",
|
44
47
|
"lib/murlsh/openlock.rb",
|
45
48
|
"lib/murlsh/plugin.rb",
|
49
|
+
"lib/murlsh/search_conditions.rb",
|
46
50
|
"lib/murlsh/sqlite3_adapter.rb",
|
47
51
|
"lib/murlsh/time_ago.rb",
|
48
52
|
"lib/murlsh/uri_ask.rb",
|
@@ -50,6 +54,7 @@ Gem::Specification.new do |s|
|
|
50
54
|
"lib/murlsh/uri_get_path_query.rb",
|
51
55
|
"lib/murlsh/url.rb",
|
52
56
|
"lib/murlsh/url_body.rb",
|
57
|
+
"lib/murlsh/url_result_set.rb",
|
53
58
|
"lib/murlsh/url_server.rb",
|
54
59
|
"lib/murlsh/yaml_ordered_hash.rb",
|
55
60
|
"murlsh.gemspec",
|
@@ -59,6 +64,7 @@ Gem::Specification.new do |s|
|
|
59
64
|
"plugins/add_post_60_notify_hubs.rb",
|
60
65
|
"plugins/add_pre_40_convert_mobile.rb",
|
61
66
|
"plugins/add_pre_41_unajax_twitter.rb",
|
67
|
+
"plugins/add_pre_45_supplied_thumbnail.rb",
|
62
68
|
"plugins/add_pre_50_lookup_content_type_title.rb",
|
63
69
|
"plugins/add_pre_50_media_thumbnail.rb",
|
64
70
|
"plugins/add_pre_50_open_graph_image.rb",
|
@@ -98,7 +104,7 @@ Gem::Specification.new do |s|
|
|
98
104
|
]
|
99
105
|
s.homepage = %q{http://github.com/mmb/murlsh}
|
100
106
|
s.require_paths = ["lib"]
|
101
|
-
s.rubygems_version = %q{1.
|
107
|
+
s.rubygems_version = %q{1.4.2}
|
102
108
|
s.summary = %q{url sharing site framework}
|
103
109
|
s.test_files = [
|
104
110
|
"spec/auth_spec.rb",
|
@@ -113,7 +119,6 @@ Gem::Specification.new do |s|
|
|
113
119
|
]
|
114
120
|
|
115
121
|
if s.respond_to? :specification_version then
|
116
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
117
122
|
s.specification_version = 3
|
118
123
|
|
119
124
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -138,7 +143,7 @@ Gem::Specification.new do |s|
|
|
138
143
|
s.add_runtime_dependency(%q<vimeo>, [">= 1.2.2"])
|
139
144
|
s.add_development_dependency(%q<flog>, [">= 2.5.0"])
|
140
145
|
s.add_development_dependency(%q<rack-test>, ["~> 0.5"])
|
141
|
-
s.add_development_dependency(%q<rspec>, ["~>
|
146
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0"])
|
142
147
|
else
|
143
148
|
s.add_dependency(%q<activerecord>, [">= 2.3.4"])
|
144
149
|
s.add_dependency(%q<bcrypt-ruby>, [">= 2.1.2"])
|
@@ -161,7 +166,7 @@ Gem::Specification.new do |s|
|
|
161
166
|
s.add_dependency(%q<vimeo>, [">= 1.2.2"])
|
162
167
|
s.add_dependency(%q<flog>, [">= 2.5.0"])
|
163
168
|
s.add_dependency(%q<rack-test>, ["~> 0.5"])
|
164
|
-
s.add_dependency(%q<rspec>, ["~>
|
169
|
+
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
165
170
|
end
|
166
171
|
else
|
167
172
|
s.add_dependency(%q<activerecord>, [">= 2.3.4"])
|
@@ -185,7 +190,7 @@ Gem::Specification.new do |s|
|
|
185
190
|
s.add_dependency(%q<vimeo>, [">= 1.2.2"])
|
186
191
|
s.add_dependency(%q<flog>, [">= 2.5.0"])
|
187
192
|
s.add_dependency(%q<rack-test>, ["~> 0.5"])
|
188
|
-
s.add_dependency(%q<rspec>, ["~>
|
193
|
+
s.add_dependency(%q<rspec>, ["~> 2.0"])
|
189
194
|
end
|
190
195
|
end
|
191
196
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'cgi'
|
2
|
+
|
3
|
+
require 'murlsh'
|
4
|
+
|
5
|
+
module Murlsh
|
6
|
+
|
7
|
+
# If the user has supplied a thumbnail url, adjust size and store it locally.
|
8
|
+
class AddPre45SuppliedThumbnail < Plugin
|
9
|
+
|
10
|
+
@hook = 'add_pre'
|
11
|
+
|
12
|
+
StorageDir = File.join(File.dirname(__FILE__), '..', 'public', 'img',
|
13
|
+
'thumb')
|
14
|
+
|
15
|
+
def self.run(url, config)
|
16
|
+
if url.thumbnail_url
|
17
|
+
Murlsh::failproof do
|
18
|
+
thumb_storage = Murlsh::ImgStore.new(StorageDir,
|
19
|
+
:user_agent => config['user_agent'])
|
20
|
+
|
21
|
+
stored_filename = thumb_storage.store_url(url.thumbnail_url) do |i|
|
22
|
+
max_side = config.fetch('thumbnail_max_side', 90)
|
23
|
+
i.extend(Murlsh::ImageList).resize_down!(max_side)
|
24
|
+
end
|
25
|
+
url.thumbnail_url = "img/thumb/#{CGI.escape(stored_filename)}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'cgi'
|
2
|
+
require 'uri'
|
2
3
|
|
3
4
|
require 'murlsh'
|
4
5
|
|
@@ -15,12 +16,17 @@ module Murlsh
|
|
15
16
|
def self.run(url, config)
|
16
17
|
if not url.thumbnail_url and url.ask.doc
|
17
18
|
url.ask.doc.xpath_search("//meta[@property='og:image']") do |node|
|
18
|
-
if node and
|
19
|
+
if node and not node['content'].to_s.empty?
|
20
|
+
og_image_url = node['content']
|
19
21
|
Murlsh::failproof do
|
22
|
+
# youtube leaves out scheme: for some reason
|
23
|
+
if og_image_url[%r{^//}]
|
24
|
+
og_image_url = "#{URI(url.url).scheme}:#{og_image_url}"
|
25
|
+
end
|
20
26
|
thumb_storage = Murlsh::ImgStore.new(StorageDir,
|
21
27
|
:user_agent => config['user_agent'])
|
22
28
|
|
23
|
-
stored_filename = thumb_storage.store_url(
|
29
|
+
stored_filename = thumb_storage.store_url(og_image_url) do |i|
|
24
30
|
max_side = config.fetch('thumbnail_max_side', 90)
|
25
31
|
i.extend(Murlsh::ImageList).resize_down!(max_side)
|
26
32
|
end
|
@@ -12,7 +12,7 @@ module Murlsh
|
|
12
12
|
FlickrRe = %r{^http://(?:www\.)?flickr\.com/photos/[@\w\-]+?/([\d]+)}i
|
13
13
|
|
14
14
|
def self.run(url, config)
|
15
|
-
|
15
|
+
unless url.user_supplied_title? or config['flickr_api_key'].to_s.empty?
|
16
16
|
if photo_id = url.url[FlickrRe, 1]
|
17
17
|
FlickRaw.api_key = config['flickr_api_key']
|
18
18
|
info = flickr.photos.getInfo(:photo_id => photo_id)
|
@@ -13,7 +13,7 @@ module Murlsh
|
|
13
13
|
GithubRe = %r{^https?://github\.com/\w+/[\w.-]+$}i
|
14
14
|
|
15
15
|
def self.run(url, config)
|
16
|
-
if url.url[GithubRe]
|
16
|
+
if not url.user_supplied_title? and url.url.to_s[GithubRe]
|
17
17
|
unless url.ask.description.empty?
|
18
18
|
url.title << " - #{url.ask.description}"
|
19
19
|
end
|
@@ -13,7 +13,8 @@ module Murlsh
|
|
13
13
|
GoogleCodeRe = %r{^http://code\.google\.com/p/[\w-]+/$}i
|
14
14
|
|
15
15
|
def self.run(url, config)
|
16
|
-
if url.url[GoogleCodeRe] and
|
16
|
+
if (not url.user_supplied_title? and url.url.to_s[GoogleCodeRe] and
|
17
|
+
url.ask.doc)
|
17
18
|
url.ask.doc.xpath_search("//a[@id='project_summary_link']") do |node|
|
18
19
|
summary = node ? node.inner_html : nil
|
19
20
|
url.title << " - #{url.ask.decode(summary)}" unless not summary or
|
data/plugins/add_pre_60_imgur.rb
CHANGED
@@ -10,7 +10,7 @@ module Murlsh
|
|
10
10
|
ImgurRe = %r{^http://(?:i\.)?imgur\.com/([a-z\d]+)(\.(?:jpe?g|gif|png))$}i
|
11
11
|
|
12
12
|
def self.run(url, config)
|
13
|
-
if match = ImgurRe.match(url.url)
|
13
|
+
if not url.user_supplied_title? and match = ImgurRe.match(url.url)
|
14
14
|
url.title = "imgur/#{match[1]}s#{match[2]}"
|
15
15
|
end
|
16
16
|
end
|
@@ -12,7 +12,7 @@ module Murlsh
|
|
12
12
|
TwitterRe = %r{^https?://twitter\.com/\w+/status(?:es)?/(\d+)$}i
|
13
13
|
|
14
14
|
def self.run(url, config)
|
15
|
-
if tweet_id = url.url[TwitterRe, 1]
|
15
|
+
if not url.user_supplied_title? and tweet_id = url.url[TwitterRe, 1]
|
16
16
|
tweet = Twitter.status(tweet_id)
|
17
17
|
|
18
18
|
url.title = "@#{tweet.user.screen_name}: #{tweet.text}"
|
data/plugins/add_pre_60_vimeo.rb
CHANGED
@@ -19,7 +19,9 @@ module Murlsh
|
|
19
19
|
if id = url.url[VimeoRe, 1]
|
20
20
|
info = Vimeo::Simple::Video.info(id)[0]
|
21
21
|
|
22
|
-
url.
|
22
|
+
unless url.user_supplied_title?
|
23
|
+
url.title = "#{info['title']} by #{info['user_name']}"
|
24
|
+
end
|
23
25
|
|
24
26
|
thumb_storage = Murlsh::ImgStore.new(StorageDir,
|
25
27
|
:user_agent => config['user_agent'])
|
@@ -23,7 +23,7 @@ module Murlsh
|
|
23
23
|
chooser = Plumnailer::Chooser.new
|
24
24
|
choice = chooser.choose(url.url)
|
25
25
|
|
26
|
-
if choice
|
26
|
+
if choice and choice.columns > 31 and choice.rows > 31
|
27
27
|
max_side = config.fetch('thumbnail_max_side', 90)
|
28
28
|
choice.extend(Murlsh::ImageList).resize_down!(max_side)
|
29
29
|
|
data/public/css/screen.css
CHANGED
@@ -103,8 +103,6 @@ div.jGrowl div.jGrowl-closer {
|
|
103
103
|
@media screen and (max-device-width : 480px) {
|
104
104
|
|
105
105
|
body {
|
106
|
-
margin : 0;
|
107
|
-
padding : 0;
|
108
106
|
font-size : 1.25em;
|
109
107
|
line-height : normal;
|
110
108
|
}
|
@@ -112,7 +110,7 @@ div.jGrowl div.jGrowl-closer {
|
|
112
110
|
#urls {
|
113
111
|
margin : 0;
|
114
112
|
padding-left : 0;
|
115
|
-
width :
|
113
|
+
width : 282px;
|
116
114
|
}
|
117
115
|
|
118
116
|
#urls>li {
|
data/public/js/js.js
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
/*global $, document, navigator, window, twttr*/
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
var Murlsh = function (config, $, navigator, window, twtter) {
|
3
|
+
var Murlsh = function ($, navigator, window, twtter) {
|
4
|
+
"use strict";
|
6
5
|
|
7
6
|
var my = {},
|
8
7
|
hrefRes = {
|
@@ -37,7 +36,7 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
37
36
|
}
|
38
37
|
|
39
38
|
function makeIframe(src) {
|
40
|
-
return $('<iframe />'
|
39
|
+
return $('<iframe />', {
|
41
40
|
src: src,
|
42
41
|
width: 640,
|
43
42
|
height: 385,
|
@@ -111,7 +110,7 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
111
110
|
comment,
|
112
111
|
commentElement,
|
113
112
|
i,
|
114
|
-
ul = $('<ul />'
|
113
|
+
ul = $('<ul />', { className : 'comments' }).appendTo(link.parent());
|
115
114
|
|
116
115
|
for (i = 0; i < comments.length; i += 1) {
|
117
116
|
comment = comments[i];
|
@@ -119,7 +118,7 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
119
118
|
if (comment.authorAvatar.length > 0) {
|
120
119
|
avatar = img(comment.authorAvatar).appendTo(commentElement);
|
121
120
|
if (comment.authorUrl.length > 0) {
|
122
|
-
avatar.wrapAll($('<a />'
|
121
|
+
avatar.wrapAll($('<a />', { href : comment.authorUrl }));
|
123
122
|
}
|
124
123
|
commentElement.append(' ');
|
125
124
|
}
|
@@ -161,7 +160,7 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
161
160
|
text : tweetMatch[1]
|
162
161
|
});
|
163
162
|
|
164
|
-
formattedTweet = $('<span />'
|
163
|
+
formattedTweet = $('<span />', { className : 'tweet' }).append(
|
165
164
|
tweetLink).append(': ').append(
|
166
165
|
twttr.txt.autoLink(tweetMatch[2]));
|
167
166
|
|
@@ -184,11 +183,14 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
184
183
|
}));
|
185
184
|
|
186
185
|
if (d.name) {
|
187
|
-
li.prepend($('<div />', {
|
186
|
+
li.prepend($('<div />', {
|
187
|
+
className : 'name',
|
188
|
+
text : d.name
|
189
|
+
}));
|
188
190
|
}
|
189
191
|
|
190
192
|
if (d.email) {
|
191
|
-
li.prepend($('<div />'
|
193
|
+
li.prepend($('<div />', { className : 'icon' }).append(
|
192
194
|
img('http://www.gravatar.com/avatar/' + d.email + '?s=' +
|
193
195
|
iconSize, d.name).attr({
|
194
196
|
width : iconSize,
|
@@ -201,9 +203,9 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
201
203
|
|
202
204
|
my.iphoneInit = function () {
|
203
205
|
window.onorientationchange = function () {
|
204
|
-
var width =
|
206
|
+
var width = 442;
|
205
207
|
if (window.orientation === 0 || window.orientation === 180) {
|
206
|
-
width =
|
208
|
+
width = 282;
|
207
209
|
}
|
208
210
|
$('#urls').width(width);
|
209
211
|
};
|
@@ -223,46 +225,44 @@ var Murlsh = function (config, $, navigator, window, twtter) {
|
|
223
225
|
return my;
|
224
226
|
};
|
225
227
|
|
226
|
-
$(
|
227
|
-
|
228
|
-
|
229
|
-
urls;
|
228
|
+
$(function () {
|
229
|
+
"use strict";
|
230
|
+
var murlsh = new Murlsh($, navigator, window, twttr), urls;
|
230
231
|
|
231
|
-
|
232
|
-
|
233
|
-
|
232
|
+
if (murlsh.isIphone()) {
|
233
|
+
murlsh.iphoneInit();
|
234
|
+
}
|
234
235
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
236
|
+
$('#submit').click(function () {
|
237
|
+
$.post('url', {
|
238
|
+
url : $('#url').val(),
|
239
|
+
via : $('#via').val(),
|
240
|
+
auth : $('#auth').val()
|
241
|
+
}, function (d) {
|
242
|
+
$.each(d, function (i, v) {
|
243
|
+
var li = murlsh.formatLi(v);
|
244
|
+
$('#urls > li:first').after(li);
|
245
|
+
$(li).children('a:first').each(murlsh.addExtra);
|
246
|
+
});
|
247
|
+
$('#url').val('');
|
248
|
+
$('#via').val('');
|
249
|
+
}, 'json');
|
250
|
+
});
|
250
251
|
|
251
|
-
|
252
|
+
urls = $('a.m');
|
252
253
|
|
253
|
-
|
254
|
+
urls.each(murlsh.addExtra);
|
254
255
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
});
|
256
|
+
/*
|
257
|
+
// experimental comment support, to enable uncomment and edit
|
258
|
+
// comments.json
|
259
|
+
$.getJSON('/js/comments.json', function (data) {
|
260
|
+
urls.each(function () {
|
261
|
+
var href = $(this).attr('href');
|
262
|
+
if (href in data) {
|
263
|
+
murlsh.addComments($(this), data[href]);
|
264
|
+
}
|
265
265
|
});
|
266
|
-
*/
|
267
266
|
});
|
267
|
+
*/
|
268
268
|
});
|
data/spec/uri_ask_spec.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: murlsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew M. Boedicker
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-15 00:00:00 -05:00
|
19
19
|
default_executable: murlsh
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -359,11 +359,11 @@ dependencies:
|
|
359
359
|
requirements:
|
360
360
|
- - ~>
|
361
361
|
- !ruby/object:Gem::Version
|
362
|
-
hash:
|
362
|
+
hash: 3
|
363
363
|
segments:
|
364
|
-
-
|
365
|
-
-
|
366
|
-
version: "
|
364
|
+
- 2
|
365
|
+
- 0
|
366
|
+
version: "2.0"
|
367
367
|
type: :development
|
368
368
|
version_requirements: *id022
|
369
369
|
description: url sharing site framework with easy adding, title lookup, atom feed, thumbnails and embedding
|
@@ -385,8 +385,8 @@ files:
|
|
385
385
|
- config.yaml
|
386
386
|
- lib/murlsh.rb
|
387
387
|
- lib/murlsh/auth.rb
|
388
|
+
- lib/murlsh/build_md5.rb
|
388
389
|
- lib/murlsh/build_query.rb
|
389
|
-
- lib/murlsh/config_server.rb
|
390
390
|
- lib/murlsh/delicious_parse.rb
|
391
391
|
- lib/murlsh/dispatch.rb
|
392
392
|
- lib/murlsh/doc.rb
|
@@ -396,10 +396,14 @@ files:
|
|
396
396
|
- lib/murlsh/head_from_get.rb
|
397
397
|
- lib/murlsh/image_list.rb
|
398
398
|
- lib/murlsh/img_store.rb
|
399
|
+
- lib/murlsh/json_body.rb
|
400
|
+
- lib/murlsh/json_server.rb
|
401
|
+
- lib/murlsh/jsonp_body.rb
|
399
402
|
- lib/murlsh/markup.rb
|
400
403
|
- lib/murlsh/must_revalidate.rb
|
401
404
|
- lib/murlsh/openlock.rb
|
402
405
|
- lib/murlsh/plugin.rb
|
406
|
+
- lib/murlsh/search_conditions.rb
|
403
407
|
- lib/murlsh/sqlite3_adapter.rb
|
404
408
|
- lib/murlsh/time_ago.rb
|
405
409
|
- lib/murlsh/uri_ask.rb
|
@@ -407,6 +411,7 @@ files:
|
|
407
411
|
- lib/murlsh/uri_get_path_query.rb
|
408
412
|
- lib/murlsh/url.rb
|
409
413
|
- lib/murlsh/url_body.rb
|
414
|
+
- lib/murlsh/url_result_set.rb
|
410
415
|
- lib/murlsh/url_server.rb
|
411
416
|
- lib/murlsh/yaml_ordered_hash.rb
|
412
417
|
- murlsh.gemspec
|
@@ -416,6 +421,7 @@ files:
|
|
416
421
|
- plugins/add_post_60_notify_hubs.rb
|
417
422
|
- plugins/add_pre_40_convert_mobile.rb
|
418
423
|
- plugins/add_pre_41_unajax_twitter.rb
|
424
|
+
- plugins/add_pre_45_supplied_thumbnail.rb
|
419
425
|
- plugins/add_pre_50_lookup_content_type_title.rb
|
420
426
|
- plugins/add_pre_50_media_thumbnail.rb
|
421
427
|
- plugins/add_pre_50_open_graph_image.rb
|
@@ -482,7 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
482
488
|
requirements: []
|
483
489
|
|
484
490
|
rubyforge_project:
|
485
|
-
rubygems_version: 1.
|
491
|
+
rubygems_version: 1.4.2
|
486
492
|
signing_key:
|
487
493
|
specification_version: 3
|
488
494
|
summary: url sharing site framework
|
data/lib/murlsh/config_server.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'digest/sha1'
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'rack'
|
5
|
-
|
6
|
-
module Murlsh
|
7
|
-
|
8
|
-
# Serve a JSON subset of the configuration.
|
9
|
-
#
|
10
|
-
# Will include all config keys contained in the config key named config_js.
|
11
|
-
class ConfigServer
|
12
|
-
|
13
|
-
include HeadFromGet
|
14
|
-
|
15
|
-
def initialize(config)
|
16
|
-
@config_json =
|
17
|
-
config.reject { |k,v| !config.fetch('config_js', []).
|
18
|
-
include?(k) }.to_json
|
19
|
-
|
20
|
-
@headers = {
|
21
|
-
'Content-Type' => 'application/json',
|
22
|
-
'ETag' => "\"#{Digest::SHA1.hexdigest(@config_json)}\"",
|
23
|
-
'Last-Modified' => Time.now.httpdate
|
24
|
-
}
|
25
|
-
end
|
26
|
-
|
27
|
-
# Serve a JSON subset of the configuration.
|
28
|
-
def get(req); Rack::Response.new @config_json, 200, @headers; end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|