osa 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 257c4fb16627c69c705da1ca2c95fe5b120f7706cbbacec3cb5b54cec8aa4e97
4
- data.tar.gz: 003041712c82eeb6d9e686de02a36372517dfda89c5d1b4ca58920efc1a06cfd
3
+ metadata.gz: c0fbdd1dceb350e48a1d593ec7590e5c1caba49136ae6c6a1afb3a41a86683d8
4
+ data.tar.gz: 962578a1b23e0879a5175f21a6c617812cec82e3f6577b58f401dc0cd78becc8
5
5
  SHA512:
6
- metadata.gz: 904c9b9e2db9f64c0bdab038a3fce8cb5f294ed7c38f1a25ad50f4df769456880ac7e3a17df7dcf6a101f332c836f821edf7e992a07a6ce1ec4b6c1604862407
7
- data.tar.gz: 8ee576b4dcb8c7e78742328fbc3921ac7f17a7d56b85bf2474feb251cdcc8d6a5deda969d2219a40815d8f14075d4fdae5fcd9c400abbcc1b0974ee8ba7eb782
6
+ metadata.gz: aabca2784a303f54c43eda8ef7f1491438c65658184eebc6821574785057b2b3ced909787cd66dca29b8db38aa85fdf60959041884373eb84c6bbeb72204d99e
7
+ data.tar.gz: befb3a9c9ac8ca252c5e23c84bb7fdb709be6765e092d2315472baccfda59736949d4bfcb1fa6e78b3216e09d638798c344150b18af26147c7eddd2a2307dd73
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- osa (0.1.2)
4
+ osa (0.1.3)
5
5
  activerecord (~> 6.0)
6
6
  faraday (~> 1.1)
7
7
  public_suffix (~> 4.0)
@@ -11,23 +11,25 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activemodel (6.0.3.4)
15
- activesupport (= 6.0.3.4)
16
- activerecord (6.0.3.4)
17
- activemodel (= 6.0.3.4)
18
- activesupport (= 6.0.3.4)
19
- activesupport (6.0.3.4)
14
+ activemodel (6.1.0)
15
+ activesupport (= 6.1.0)
16
+ activerecord (6.1.0)
17
+ activemodel (= 6.1.0)
18
+ activesupport (= 6.1.0)
19
+ activesupport (6.1.0)
20
20
  concurrent-ruby (~> 1.0, >= 1.0.2)
21
- i18n (>= 0.7, < 2)
22
- minitest (~> 5.1)
23
- tzinfo (~> 1.1)
24
- zeitwerk (~> 2.2, >= 2.2.2)
21
+ i18n (>= 1.6, < 2)
22
+ minitest (>= 5.1)
23
+ tzinfo (~> 2.0)
24
+ zeitwerk (~> 2.3)
25
25
  ast (2.4.1)
26
26
  concurrent-ruby (1.1.7)
27
- faraday (1.1.0)
27
+ faraday (1.3.0)
28
+ faraday-net_http (~> 1.0)
28
29
  multipart-post (>= 1.2, < 3)
29
30
  ruby2_keywords
30
- i18n (1.8.5)
31
+ faraday-net_http (1.0.0)
32
+ i18n (1.8.6)
31
33
  concurrent-ruby (~> 1.0)
32
34
  minitest (5.14.2)
33
35
  multipart-post (2.1.1)
@@ -57,22 +59,21 @@ GEM
57
59
  ruby-progressbar (1.10.1)
58
60
  ruby2_keywords (0.0.2)
59
61
  sqlite3 (1.4.2)
60
- thread_safe (0.3.6)
61
62
  tty-color (0.6.0)
62
63
  tty-cursor (0.7.1)
63
- tty-prompt (0.22.0)
64
+ tty-prompt (0.23.0)
64
65
  pastel (~> 0.8)
65
66
  tty-reader (~> 0.8)
66
- tty-reader (0.8.0)
67
+ tty-reader (0.9.0)
67
68
  tty-cursor (~> 0.7)
68
69
  tty-screen (~> 0.8)
69
70
  wisper (~> 2.0)
70
71
  tty-screen (0.8.1)
71
- tzinfo (1.2.8)
72
- thread_safe (~> 0.1)
72
+ tzinfo (2.0.4)
73
+ concurrent-ruby (~> 1.0)
73
74
  unicode-display_width (1.7.0)
74
75
  wisper (2.0.1)
75
- zeitwerk (2.4.1)
76
+ zeitwerk (2.4.2)
76
77
 
77
78
  PLATFORMS
78
79
  ruby
@@ -48,6 +48,9 @@ module OSA
48
48
  raw_mail = self.raw_mail(mail_id)
49
49
  forward_message = create_forward_message(mail_id)
50
50
  update = {
51
+ body: {
52
+ content: ''
53
+ },
51
54
  toRecipients: [
52
55
  {
53
56
  emailAddress: {
@@ -3,6 +3,7 @@ require 'osa/util/constants'
3
3
  require 'public_suffix'
4
4
  require 'osa/util/db'
5
5
  require 'osa/util/context'
6
+ require 'public_suffix'
6
7
 
7
8
  context = OSA::Context.new
8
9
 
@@ -37,6 +38,19 @@ while continue
37
38
  context.graph_client.forward_mail_as_attachment(mail['id'], context.config.spamcop_report_email)
38
39
  puts "deleting spam from #{email_address}"
39
40
  context.graph_client.delete_mail(mail['id'])
41
+
42
+ if flagged
43
+ domain = PublicSuffix.domain(email_address.split('@', 2)[1])
44
+
45
+ is_free_provider = OSA::EmailProvider.where(value: domain).exists?
46
+ if is_free_provider
47
+ puts "#{email_address} is using a free provider, blacklisting full address"
48
+ OSA::Blacklist.find_or_create_by(value: email_address).save!
49
+ else
50
+ puts "Adding #{domain} to blacklist"
51
+ OSA::Blacklist.find_or_create_by(value: domain).save!
52
+ end
53
+ end
40
54
  end
41
55
  mails = mails.next
42
56
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module OSA
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.3'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moray Baruh
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-30 00:00:00.000000000 Z
11
+ date: 2021-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord