flnews_post_proc 1.40 → 1.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flnews_post_proc.conf +2 -2
- data/lib/headers.rb +13 -8
- data/lib/newsgroups.rb +11 -11
- data/lib/override.rb +2 -2
- data/lib/ruby_dlg +87 -84
- data/lib/version.rb +2 -2
- data/lib/whiptail_dlg +7 -2
- data/lib/yad_dlg +5 -5
- data/lib/zenity_dlg +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d1a635207d4ca4d8fa516c00b23716f0446fa015bd26527483686895a4d37a8
|
4
|
+
data.tar.gz: 99a27fa42f530982a3854fb783f69146fdf62a4910f0145dc7551a4e6d7ec4b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef0f0e4c3e3b04cb1c3c1b3213ec4ef2d7c5ec8909bd7d22d581269953c4a1283c5263680990d0ff5a085077f01ddbc8b2808f90b0052c8bbbb169bae8d9622a
|
7
|
+
data.tar.gz: 387191fb0c3bdc9c434c970ee2b72de669dbd9d66791eb8a65c987e7ef3b6d523e39d56ebbdf2c2471bcd9897060f151c3c710bd6d03f6eeb7694e621c03e1b6
|
data/lib/flnews_post_proc.conf
CHANGED
@@ -86,13 +86,13 @@ GROUP_SIGS:
|
|
86
86
|
CUSTOM_HEADERS:
|
87
87
|
- "X-Post-Processor: flnews_post_proc"
|
88
88
|
|
89
|
-
#
|
89
|
+
# NO_ARCHIVE_GROUPS:
|
90
90
|
# The newsgroups, where a header X-No-Archive: YES shall be set.
|
91
91
|
# CONTENT: a dash and space, then a String, containing the name of the group
|
92
92
|
# or a regexp.
|
93
93
|
# DEFAULT: empty
|
94
94
|
# EXAMPLE: - "alt.test"
|
95
|
-
|
95
|
+
NO_ARCHIVE_GROUPS:
|
96
96
|
- ".*.test"
|
97
97
|
|
98
98
|
# DEBUG_LOG:
|
data/lib/headers.rb
CHANGED
@@ -55,9 +55,13 @@ class Headers
|
|
55
55
|
error ("Cannot match a header in line " << l << "(" << ex.message << ")")
|
56
56
|
exit false;
|
57
57
|
end
|
58
|
+
# Consider the two following fixes as preliminary until proven.
|
59
|
+
# Getting older, this kind of problem occupies me a lot more than
|
60
|
+
# it should.
|
61
|
+
#
|
58
62
|
# value is all after the first colon
|
59
63
|
# BUGGY: val = l.match(/:(.*)/)[1].strip
|
60
|
-
# BUGFIX 3/2024
|
64
|
+
# BUGFIX 3/2024, use lstrip
|
61
65
|
val = l.match(/:(.*)/)[1].lstrip
|
62
66
|
else # start_with?(' ')
|
63
67
|
# a wrapped value is not devided
|
@@ -95,14 +99,15 @@ class Headers
|
|
95
99
|
|
96
100
|
# Modify headers, if need be.
|
97
101
|
def update()
|
98
|
-
|
99
|
-
debug('
|
100
|
-
if
|
101
|
-
@headers["X-No-Archive".to_sym] =
|
102
|
+
no_archive = @newsgroups.no_archive
|
103
|
+
debug('no_archive should be set now : ' << no_archive.to_s)
|
104
|
+
if no_archive
|
105
|
+
@headers["X-No-Archive".to_sym] = no_archive
|
106
|
+
@headers["Archive".to_sym] = 'no'
|
102
107
|
end
|
103
|
-
ch = @@config.CUSTOM_HEADERS
|
104
|
-
debug('setting custom headers : ' << ch.inspect)
|
105
108
|
if @@config.CUSTOM_HEADERS
|
109
|
+
ch = @@config.CUSTOM_HEADERS
|
110
|
+
debug('setting custom headers : ' << ch.inspect)
|
106
111
|
@@config.CUSTOM_HEADERS.each do |pair|
|
107
112
|
ch = pair.split(':')
|
108
113
|
hn = ch[0].strip
|
@@ -143,6 +148,6 @@ class Headers
|
|
143
148
|
end
|
144
149
|
|
145
150
|
attr_reader :lines, :newsgroups
|
146
|
-
|
151
|
+
|
147
152
|
end
|
148
153
|
# EOF
|
data/lib/newsgroups.rb
CHANGED
@@ -26,18 +26,18 @@ class Newsgroups
|
|
26
26
|
|
27
27
|
def initialize(groups)
|
28
28
|
@groups = groups.split(',')
|
29
|
-
debug('set signature, intro,
|
29
|
+
debug('set signature, intro, no_archive')
|
30
30
|
# set details for this post
|
31
31
|
if @groups.size == 1
|
32
32
|
set_signature
|
33
33
|
set_intro
|
34
|
-
|
34
|
+
set_no_archive
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
def
|
39
|
-
debug('returning ' <<( @
|
40
|
-
return @
|
38
|
+
def no_archive
|
39
|
+
debug('returning ' <<( @no_archive ? @no_archive : ' nil ') )
|
40
|
+
return @no_archive ? @no_archive : nil
|
41
41
|
end
|
42
42
|
attr_reader :signature, :intro, :groups
|
43
43
|
|
@@ -121,13 +121,13 @@ class Newsgroups
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
# define the
|
125
|
-
def
|
126
|
-
@
|
127
|
-
xgs = @@config.
|
124
|
+
# define the no_archive header.
|
125
|
+
def set_no_archive
|
126
|
+
@no_archive = nil
|
127
|
+
xgs = @@config.NO_ARCHIVE_GROUPS
|
128
128
|
if xgs && !xgs.empty? && xgs.detect {|g| @groups[0].match(g) }
|
129
|
-
debug("setting
|
130
|
-
@
|
129
|
+
debug("setting no_archive")
|
130
|
+
@no_archive = 'yes'
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
data/lib/override.rb
CHANGED
@@ -40,7 +40,7 @@ class OverrideDlg
|
|
40
40
|
@@LIBDIR = File::dirname(__FILE__)
|
41
41
|
# The configuration variables that can be unset.
|
42
42
|
# This class instance variable is exposed via a getter.
|
43
|
-
@cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :
|
43
|
+
@cvars = [:GROUP_SIGS, :CUSTOM_HEADERS, :NO_ARCHIVE_GROUPS, :VFY_URLS, :DEBUG_LOG]
|
44
44
|
|
45
45
|
# ... here
|
46
46
|
# For the record: this is rather cool.
|
@@ -66,7 +66,7 @@ class OverrideDlg
|
|
66
66
|
# display a dialog and return the new options.
|
67
67
|
def show
|
68
68
|
if(@executables && !@executables.empty?)
|
69
|
-
debug('found executables ' << @executables.join(', ')
|
69
|
+
debug('found executables ' << @executables.join(', '))
|
70
70
|
opts = nil
|
71
71
|
begin
|
72
72
|
if has?(YAD)
|
data/lib/ruby_dlg
CHANGED
@@ -35,27 +35,25 @@ def wait_for_user()
|
|
35
35
|
end
|
36
36
|
return char
|
37
37
|
end
|
38
|
+
if !ARGV.empty? && ARGV.length > 0
|
39
|
+
ofl = nil
|
40
|
+
begin
|
41
|
+
ofl = File.open(ARGV[0], 'w+')
|
42
|
+
puts 'writing to ' << ARGV[0]
|
43
|
+
rescue Exception => ex
|
44
|
+
puts red ('cannot open ' << ARGV[1])
|
45
|
+
puts ex.message
|
46
|
+
puts 'hit any key to exit'
|
47
|
+
wait_for_user
|
48
|
+
exit false
|
49
|
+
end
|
38
50
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
ofl = File.open(ARGV[0], 'w+') if ARGV.length > 0
|
43
|
-
puts 'writing to ' << ARGV[0]
|
44
|
-
rescue Exception => ex
|
45
|
-
puts red ('cannot open ' << ARGV[1])
|
46
|
-
puts 'hit any key to exit'
|
47
|
-
wait_for_user
|
48
|
-
exit false
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
opt_array = []
|
54
|
-
message = ''
|
55
|
-
menu ||= %=
|
51
|
+
opt_array = []
|
52
|
+
message = ''
|
53
|
+
menu ||= %=
|
56
54
|
1 Unset Signature GROUP_SIGS
|
57
55
|
2 Unset Custom headers CUSTOM_HEADERS
|
58
|
-
3 Unset
|
56
|
+
3 Unset No Archive NO_ARCHIVE_GROUPS
|
59
57
|
4 Do not correct URLs VFY_URLS
|
60
58
|
5 Disable log DEBUG_LOG
|
61
59
|
––––––––––––––––––––––––––––––––––––––––––––––
|
@@ -65,72 +63,77 @@ menu ||= %=
|
|
65
63
|
––––––––––––––––––––––––––––––––––––––––––––––––
|
66
64
|
#{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
67
65
|
and no changes will be applied.
|
68
|
-
=
|
69
|
-
|
70
|
-
loop do
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
# toggle options
|
90
|
-
# ADD option to the option array, if it should be *removed*
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
66
|
+
=
|
67
|
+
|
68
|
+
loop do
|
69
|
+
system 'clear'
|
70
|
+
puts yellow(menu)
|
71
|
+
puts cyan(message)
|
72
|
+
option = wait_for_user - 48
|
73
|
+
case option
|
74
|
+
# Esc, Ctrl+C, 'q'
|
75
|
+
when -21, -45, 65
|
76
|
+
puts red('Aborting. Bye.')
|
77
|
+
ofl.write 'exit'
|
78
|
+
ofl.close
|
79
|
+
exit true
|
80
|
+
when 0
|
81
|
+
puts green('Applying changes.') if !opt_array.empty?
|
82
|
+
# write the list of variables to unset (others remain)
|
83
|
+
ofl.write opt_array.join(' ')
|
84
|
+
ofl.close
|
85
|
+
exit true
|
86
|
+
|
87
|
+
# toggle options
|
88
|
+
# ADD option to the option array, if it should be *removed*
|
89
|
+
# from the configuration, else remove it from the array.
|
90
|
+
when 1
|
91
|
+
active = !opt_array.include?(:GROUP_SIGS)
|
92
|
+
opt_array << :GROUP_SIGS if active
|
93
|
+
opt_array.delete(:GROUP_SIGS) if !active
|
94
|
+
|
95
|
+
message = "Signature #{active ? 'unset' : 'as configured'}!"
|
96
|
+
menu.sub!("Unset Signature", "Set Signature ") if active
|
97
|
+
menu.sub!("Set Signature ", "Unset Signature") if !active
|
98
|
+
when 2
|
99
|
+
active = !opt_array.include?(:CUSTOM_HEADERS)
|
100
|
+
opt_array << :CUSTOM_HEADERS if active
|
101
|
+
opt_array.delete(:CUSTOM_HEADERS) if !active
|
102
|
+
|
103
|
+
message = "Custom headers #{active ? 'removed' : 'are added'}!"
|
104
|
+
menu.sub!("Unset Custom headers", "Add Custom headers ") if active
|
105
|
+
menu.sub!("Add Custom headers ", "Unset Custom headers") if !active
|
106
|
+
when 3
|
107
|
+
active = !opt_array.include?(:NO_ARCHIVE_GROUPS)
|
108
|
+
opt_array << :NO_ARCHIVE_GROUPS if active
|
109
|
+
opt_array.delete(:NO_ARCHIVE_GROUPS) if !active
|
110
|
+
|
111
|
+
message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
|
112
|
+
menu.sub!("Unset X-No-Archive", "Add X-No-Archive ") if active
|
113
|
+
menu.sub!("Add X-No-Archive ", "Unset X-No-Archive") if !active
|
114
|
+
when 4
|
115
|
+
active = !opt_array.include?(:VFY_URLS)
|
116
|
+
opt_array << :VFY_URLS if active
|
117
|
+
opt_array.delete(:VFY_URLS) if !active
|
118
|
+
|
119
|
+
message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
|
120
|
+
menu.sub!("Do not correct URLs", "Correct URLs ") if active
|
121
|
+
menu.sub!("Correct URLs ", "Do not correct URLs") if !active
|
122
|
+
when 5
|
123
|
+
active = !opt_array.include?(:DEBUG_LOG)
|
124
|
+
opt_array << :DEBUG_LOG if active
|
125
|
+
opt_array.delete(:DEBUG_LOG) if !active
|
126
|
+
|
127
|
+
message = "Log is #{ active ? 'not ' : ''} " << "written!"
|
128
|
+
menu.sub!("Disable log", "Enable log ") if active
|
129
|
+
menu.sub!("Enable log ", "Disable log") if !active
|
130
|
+
when 6
|
131
|
+
message = "Summary of " << bold('disabled') << " options: " << opt_array.join(' ')
|
132
|
+
end
|
134
133
|
end
|
134
|
+
else # ARGV
|
135
|
+
puts red('missing file argument')
|
136
|
+
exit false
|
135
137
|
end
|
136
138
|
|
139
|
+
|
data/lib/version.rb
CHANGED
@@ -14,8 +14,8 @@
|
|
14
14
|
=end
|
15
15
|
|
16
16
|
PROGNAME = 'flnews_post_proc'
|
17
|
-
PROGVERSION = "1.
|
17
|
+
PROGVERSION = "1.41"
|
18
18
|
AUTHORS = "Michael Uplawski"
|
19
19
|
EMAIL = "michael.uplawski@uplawski.eu"
|
20
20
|
YEARS = "2023 - 2024"
|
21
|
-
SUMMARY = "
|
21
|
+
SUMMARY = "Additional Header 'Archive: no', when No Archive is chosen."
|
data/lib/whiptail_dlg
CHANGED
@@ -16,6 +16,11 @@
|
|
16
16
|
# The main difficulty arises from the fact that positive defaults
|
17
17
|
# are negated, while a checklist wants to give positive results.
|
18
18
|
|
19
|
+
if [ $# -eq 0 ]
|
20
|
+
then
|
21
|
+
echo "ERROR: file-argument missing"
|
22
|
+
exit 1
|
23
|
+
fi
|
19
24
|
OUTFILE="$1"
|
20
25
|
|
21
26
|
# empty the file
|
@@ -25,10 +30,10 @@ TITLE="Override post-processor configuration"
|
|
25
30
|
CHECKTITLE="Deselect to disable. Esc or Cancel close the dialog and no changes will be applied."
|
26
31
|
|
27
32
|
# These are the configuration variables which can be unset.
|
28
|
-
VARS=(GROUP_SIGS CUSTOM_HEADERS
|
33
|
+
VARS=(GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG)
|
29
34
|
|
30
35
|
# Checklist options
|
31
|
-
options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS 'Custom headers' ON
|
36
|
+
options=(GROUP_SIGS 'Signatures' ON CUSTOM_HEADERS 'Custom headers' ON NO_ARCHIVE_GROUPS 'No Archive' ON VFY_URLS 'Correct URLs' ON DEBUG_LOG 'Log' ON)
|
32
37
|
|
33
38
|
# show dialog and store results
|
34
39
|
result=$(whiptail --title "$TITLE" --checklist "$CHECKTITLE" 13 55 5 "${options[@]}" 3>&1 1>&2 2>&3)
|
data/lib/yad_dlg
CHANGED
@@ -18,16 +18,16 @@ TITLE="Override post-processor configuration"
|
|
18
18
|
# unset.
|
19
19
|
GROUP_SIGS=1
|
20
20
|
CUSTOM_HEADERS=2
|
21
|
-
|
21
|
+
NO_ARCHIVE_GROUPS=3
|
22
22
|
VFY_URLS=4
|
23
23
|
DEBUG_LOG=5
|
24
|
-
CONF
|
24
|
+
CONF=$(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
|
25
25
|
--field="Uncheck to disable options\n<b>Esc and Cancel</b> terminate the post-processor.":LBL ""\
|
26
26
|
--field="Signature":CHK 'true' \
|
27
27
|
--field="Custom-headers":CHK 'true' \
|
28
|
-
--field="
|
28
|
+
--field="No Archive":CHK 'true' \
|
29
29
|
--field="URL Correction":CHK 'true' \
|
30
|
-
--field="Log":CHK 'true')
|
30
|
+
--field="Log":CHK 'true')
|
31
31
|
|
32
32
|
if [ $? == 0 ]
|
33
33
|
then
|
@@ -38,7 +38,7 @@ then
|
|
38
38
|
# echo ${C_ARR[@]}
|
39
39
|
# <-------------
|
40
40
|
|
41
|
-
for i in GROUP_SIGS CUSTOM_HEADERS
|
41
|
+
for i in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
42
42
|
do
|
43
43
|
if [ 'FALSE' == "${C_ARR[$i]}" ]
|
44
44
|
then
|
data/lib/zenity_dlg
CHANGED
@@ -20,7 +20,7 @@ CONF=$(zenity --title "$TITLE" --text "Deselect options to disable.\n<b>Esc and
|
|
20
20
|
--height 450 --list --checklist --column 'set' --column 'Option' --column '' \
|
21
21
|
TRUE GROUP_SIGS Signature\
|
22
22
|
TRUE CUSTOM_HEADERS "Custom Headers"\
|
23
|
-
TRUE
|
23
|
+
TRUE NO_ARCHIVE_GROUPS "No Archive"\
|
24
24
|
TRUE VFY_URLS "Correct URLs"\
|
25
25
|
TRUE DEBUG_LOG Log)
|
26
26
|
|
@@ -33,7 +33,7 @@ then
|
|
33
33
|
# echo ${C_ARR[@]}
|
34
34
|
# <-------------
|
35
35
|
|
36
|
-
for c in GROUP_SIGS CUSTOM_HEADERS
|
36
|
+
for c in GROUP_SIGS CUSTOM_HEADERS NO_ARCHIVE_GROUPS VFY_URLS DEBUG_LOG
|
37
37
|
do
|
38
38
|
# disable only the options which are missing in
|
39
39
|
# the Zenity return value
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flnews_post_proc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.41'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Uplawski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -84,5 +84,5 @@ requirements: []
|
|
84
84
|
rubygems_version: 3.4.20
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
|
-
summary:
|
87
|
+
summary: 'Additional Header ''Archive: no'', when No Archive is chosen.'
|
88
88
|
test_files: []
|