firefly 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -12
- data/VERSION +1 -1
- data/firefly.gemspec +1 -1
- data/lib/firefly/server.rb +7 -4
- data/spec/firefly/api_spec.rb +5 -0
- metadata +3 -3
data/HISTORY
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
= 0.4.3 / 2010-06-06
|
2
|
+
|
3
|
+
* 2010-06-06 - Handle invalid API keys correctly.
|
4
|
+
|
1
5
|
= 0.4.2 / 2010-06-06
|
2
6
|
|
3
7
|
* 2010-06-06 - Added a fix for MySQL users to update the `code` column to use the correct collation. Fixes #9 [ariejan]
|
@@ -5,11 +9,8 @@
|
|
5
9
|
= 0.4.1 / 2010-04-30
|
6
10
|
|
7
11
|
* 2010-04-30 - Normalize URLs before shortening them. This prevents false duplicates. [ariejan]
|
8
|
-
|
9
12
|
* 2010-04-30 - Validate URLs to be valid HTTP or HTTPS, don't accept others. [ariejan]
|
10
|
-
|
11
13
|
* 2010-04-30 - Don't ask for the API key after shortening a URL with the bookmarklet. [ariejan]
|
12
|
-
|
13
14
|
* 2010-04-15 - Show the highlighted URL separately. Closes #7. [ariejan]
|
14
15
|
|
15
16
|
= 0.4.0.1 / 2010-04-14
|
@@ -19,13 +20,9 @@
|
|
19
20
|
= 0.4.0 / 2010-04-14
|
20
21
|
|
21
22
|
* 2010-04-14 - Added button to quickly tweet a URL. Closes #3 [ariejan]
|
22
|
-
|
23
23
|
* 2010-04-14 - Disable autocomplete and spellcheck for the big url input field. Closes #6 [ariejan]
|
24
|
-
|
25
24
|
* 2010-04-14 - After shortening an URL highlight the url that was added in the overview. [ariejan]
|
26
|
-
|
27
25
|
* 2010-04-14 - Made it easy to copy a short url from the overview. Closes #4 [ariejan]
|
28
|
-
|
29
26
|
* 2010-04-13 - Added links to source and issues in footer. [ariejan]
|
30
27
|
- Include domain name in page title. [ariejan]
|
31
28
|
|
@@ -38,19 +35,14 @@
|
|
38
35
|
* 2010-04-13 - Added recent urls to dashboard [ariejan]
|
39
36
|
- Added bookmarklet [ariejan]
|
40
37
|
- Split up Firefly codebase for better testing and maintainability [ariejan]
|
41
|
-
|
42
38
|
* 2010-04-02 - Added Ruby 1.9.x compatibility. [ariejan]
|
43
39
|
|
44
40
|
= 0.2.0 / 2010-03-29
|
45
41
|
|
46
42
|
* 2010-03-29 - Added some GUI sugar at '/'. [ariejan]
|
47
|
-
|
48
43
|
* 2010-03-29 - Added /api/info/:code for basic stats on the specified URL. [ariejan]
|
49
|
-
|
50
44
|
* 2010-03-29 - Keep count of the number of visits to a given URL. [ariejan]
|
51
|
-
|
52
45
|
* 2010-03-29 - Fill in `created_at` for Firefly::Url. [ariejan]
|
53
|
-
|
54
46
|
* 2010-03-29 - Changed Firefly::Url String properties to a length of 255 instead of the default of 50. [ariejan]
|
55
47
|
|
56
48
|
= 0.1 / 2010-03-28
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
data/firefly.gemspec
CHANGED
data/lib/firefly/server.rb
CHANGED
@@ -40,7 +40,9 @@ module Firefly
|
|
40
40
|
def validate_api_permission
|
41
41
|
if !has_valid_api_cookie? && params[:api_key] != config[:api_key]
|
42
42
|
status 401
|
43
|
-
return
|
43
|
+
return false
|
44
|
+
else
|
45
|
+
return true
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
@@ -106,7 +108,8 @@ module Firefly
|
|
106
108
|
#
|
107
109
|
# Returns the shortened URL
|
108
110
|
api_add = lambda {
|
109
|
-
validate_api_permission
|
111
|
+
validate_api_permission or return "Permission denied: Invalid API key"
|
112
|
+
|
110
113
|
@url = params[:url]
|
111
114
|
@code, @result = generate_short_url(@url)
|
112
115
|
@result ||= "Invalid URL specified."
|
@@ -127,8 +130,8 @@ module Firefly
|
|
127
130
|
#
|
128
131
|
# Show info on the URL
|
129
132
|
get '/api/info/:code' do
|
130
|
-
validate_api_permission
|
131
|
-
|
133
|
+
validate_api_permission or return "Permission denied: Invalid API key"
|
134
|
+
|
132
135
|
@url = Firefly::Url.first(:code => params[:code])
|
133
136
|
|
134
137
|
if @url.nil?
|
data/spec/firefly/api_spec.rb
CHANGED
@@ -62,6 +62,11 @@ describe "API" do
|
|
62
62
|
last_response.status.should eql(401)
|
63
63
|
end
|
64
64
|
|
65
|
+
it "should not return a shortened URL on 401" do
|
66
|
+
self.send verb, '/api/add', :url => 'http://example.org', :api_key => 'false'
|
67
|
+
last_response.body.should match(/Permission denied: Invalid API key/)
|
68
|
+
end
|
69
|
+
|
65
70
|
it "should create a new Firefly::Url" do
|
66
71
|
lambda {
|
67
72
|
self.send verb, '/api/add', :url => 'http://example.org', :api_key => 'test'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firefly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 3
|
10
|
+
version: 0.4.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ariejan de Vroom
|