ayadn 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/ayadn/action.rb +3 -1
- data/lib/ayadn/cnx.rb +17 -16
- data/lib/ayadn/errors.rb +3 -4
- data/lib/ayadn/post.rb +1 -1
- data/lib/ayadn/version.rb +1 -1
- data/lib/ayadn/workers.rb +8 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06f225381b151b3aff0052e1a18a51ca69c7d56c
|
4
|
+
data.tar.gz: 95679ba480b2a43a510ea02d1e0c4782aaa899b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bbf0b6b7a279928cd39de44514475919335a1467428bbbc96035de702e54c3b2f3285a5c823936c69c370498168d2858cc27bd298a49271fad6ab677270dddf
|
7
|
+
data.tar.gz: 751f7ea8bb9e6c0b3f02f1768b3a3908b5c3cb44b51f5c92fdceec2621cfc3a52bb81347f23879820344294b6198c6327d733543428b40a26bfe4758db605f2f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# 1.0.8
|
2
|
+
|
3
|
+
- Better error messages/logs (specifically when HTTP errors)
|
4
|
+
- Token is anonymized if in error logs
|
5
|
+
- No more database error when canceling a 'nowplaying' post
|
6
|
+
- Better mentions colorization
|
7
|
+
|
1
8
|
# 1.0.7
|
2
9
|
|
3
10
|
- Machine-only messages in channels are now viewable
|
data/lib/ayadn/action.rb
CHANGED
@@ -791,7 +791,7 @@ module Ayadn
|
|
791
791
|
|
792
792
|
def nowplaying
|
793
793
|
begin
|
794
|
-
|
794
|
+
abort(Status.error_only_osx) unless Settings.config[:platform] =~ /darwin/
|
795
795
|
itunes = get_track_infos
|
796
796
|
itunes.each do |el|
|
797
797
|
abort(Status.empty_fields) if el.length == 0
|
@@ -805,6 +805,8 @@ module Ayadn
|
|
805
805
|
rescue => e
|
806
806
|
puts Status.wtf
|
807
807
|
Errors.global_error("action/nowplaying", itunes, e)
|
808
|
+
ensure
|
809
|
+
Databases.close_all
|
808
810
|
end
|
809
811
|
end
|
810
812
|
|
data/lib/ayadn/cnx.rb
CHANGED
@@ -19,34 +19,35 @@ module Ayadn
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.check(response)
|
22
|
+
message = JSON.parse(response)['meta']['error_message']
|
22
23
|
case response.code
|
23
24
|
when 200
|
24
25
|
response
|
25
26
|
when 204
|
26
|
-
puts "\n
|
27
|
-
Errors.global_error("cnx.rb", response.headers, "NO CONTENT")
|
27
|
+
puts "\n#{message}".color(:red)
|
28
|
+
Errors.global_error("cnx.rb", [message, response.headers], "NO CONTENT")
|
28
29
|
when 400
|
29
|
-
puts "\n
|
30
|
-
Errors.global_error("cnx.rb", response.headers, "BAD REQUEST")
|
30
|
+
puts "\n#{message}".color(:red)
|
31
|
+
Errors.global_error("cnx.rb", [message, response.headers], "BAD REQUEST")
|
31
32
|
when 401
|
32
|
-
puts "\n
|
33
|
-
Errors.global_error("cnx.rb", response.headers, "UNAUTHORIZED")
|
33
|
+
puts "\n#{message}".color(:red)
|
34
|
+
Errors.global_error("cnx.rb", [message, response.headers], "UNAUTHORIZED")
|
34
35
|
when 403
|
35
|
-
puts "\n
|
36
|
-
Errors.global_error("cnx.rb", response.headers, "FORBIDDEN")
|
36
|
+
puts "\n#{message}".color(:red)
|
37
|
+
Errors.global_error("cnx.rb", [message, response.headers], "FORBIDDEN")
|
37
38
|
when 405
|
38
|
-
puts "\n
|
39
|
-
Errors.global_error("cnx.rb", response.headers, "METHOD NOT ALLOWED")
|
39
|
+
puts "\n#{message}".color(:red)
|
40
|
+
Errors.global_error("cnx.rb", [message, response.headers], "METHOD NOT ALLOWED")
|
40
41
|
when 429
|
41
|
-
puts "\n
|
42
|
+
puts "\n#{message}".color(:red)
|
42
43
|
puts "\n\nAyadn made too many requests to the App.net API. You should wait at least ".color(:cyan) + "#{response.headers[:retry_after]} ".color(:red) + "seconds before trying again. Maybe you launched a lot of Ayadn instances at the same time? That's no problem, but in this case you should increase the value of the scroll timer (with `ayadn set scroll timer 5` for example). App.net allows 5000 requests per hour per account maximum.".color(:cyan)
|
43
|
-
Errors.global_error("cnx.rb", response.headers, "TOO MANY REQUESTS")
|
44
|
+
Errors.global_error("cnx.rb", [message, response.headers], "TOO MANY REQUESTS")
|
44
45
|
when 500
|
45
|
-
puts "\n
|
46
|
-
Errors.global_error("cnx.rb", response.headers, "APP.NET SERVER ERROR")
|
46
|
+
puts "\n#{message}".color(:red)
|
47
|
+
Errors.global_error("cnx.rb", [message, response.headers], "APP.NET SERVER ERROR")
|
47
48
|
when 507
|
48
|
-
puts "\n
|
49
|
-
Errors.global_error("cnx.rb", response.headers, "INSUFFICIENT STORAGE")
|
49
|
+
puts "\n#{message}".color(:red)
|
50
|
+
Errors.global_error("cnx.rb", [message, response.headers], "INSUFFICIENT STORAGE")
|
50
51
|
else
|
51
52
|
response
|
52
53
|
end
|
data/lib/ayadn/errors.rb
CHANGED
@@ -2,13 +2,12 @@
|
|
2
2
|
module Ayadn
|
3
3
|
class Errors
|
4
4
|
def self.global_error(where, args, error)
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
elems = []
|
6
|
+
args.each {|arg| elems << self.detokenize(arg)}
|
8
7
|
Logs.rec.error "--BEGIN--"
|
9
8
|
Logs.rec.error "#{error}"
|
10
9
|
Logs.rec.debug "LOCATION: #{where}"
|
11
|
-
Logs.rec.debug "DATA: #{
|
10
|
+
Logs.rec.debug "DATA: #{elems}" unless elems.nil?
|
12
11
|
Logs.rec.debug "STACK: #{caller}"
|
13
12
|
Logs.rec.error "--END--"
|
14
13
|
puts "\n(error logged in #{Settings.config[:paths][:log]}/ayadn.log)\n".color(:blue)
|
data/lib/ayadn/post.rb
CHANGED
data/lib/ayadn/version.rb
CHANGED
data/lib/ayadn/workers.rb
CHANGED
@@ -277,18 +277,22 @@ module Ayadn
|
|
277
277
|
end
|
278
278
|
|
279
279
|
def colorize_text(text, mentions)
|
280
|
+
reg_split = '[:\-;,?!\'&`^=+<>*%()\/"“”’°£$€.]'
|
281
|
+
reg_tag = '#([A-Za-z0-9_]{1,255})(?![\w+])'
|
282
|
+
reg_mention = '@([A-Za-z0-9_]{1,20})(?![\w+])'
|
283
|
+
reg_sentence = '^.+[\r\n]*'
|
280
284
|
handles = Array.new
|
281
285
|
mentions.each {|username| handles << "@#{username}"}
|
282
286
|
words = Array.new
|
283
287
|
sentences = Array.new
|
284
288
|
hashtag_color = Settings.options[:colors][:hashtags]
|
285
289
|
mention_color = Settings.options[:colors][:mentions]
|
286
|
-
text.scan(
|
290
|
+
text.scan(/#{reg_sentence}/) do |sentence|
|
287
291
|
sentence.split(' ').each do |word|
|
288
292
|
if word =~ /#\w+/
|
289
|
-
words << word.gsub(/#
|
293
|
+
words << word.gsub(/#{reg_tag}/, '#\1'.color(hashtag_color))
|
290
294
|
elsif word =~ /@\w+/
|
291
|
-
splitted = word.split(/
|
295
|
+
splitted = word.split(/#{reg_split}/) if word =~ /#{reg_split}/
|
292
296
|
if splitted
|
293
297
|
splitted.each {|d| @str = d if d =~ /@\w+/}
|
294
298
|
@str = word if @str.nil?
|
@@ -296,7 +300,7 @@ module Ayadn
|
|
296
300
|
@str = word
|
297
301
|
end
|
298
302
|
if handles.include?(@str.downcase)
|
299
|
-
words << word.gsub(
|
303
|
+
words << word.gsub(/#{reg_mention}/, '@\1'.color(mention_color))
|
300
304
|
else
|
301
305
|
words << word
|
302
306
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ayadn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|