flnews_post_proc 2.0 → 2.04
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/bin/flnews_post_proc +83 -17
- data/changes.txt +46 -0
- data/doc/html/flnews_post_proc.html +73 -49
- data/doc/man/flnews_post_proc.1.gz +0 -0
- data/doc/pdf/flnews_post_proc.pdf +0 -0
- data/doc/rst/flnews_post_proc.rst +42 -21
- data/lib/basic_logging.rb +5 -4
- data/lib/body.rb +9 -45
- data/lib/color_output.rb +3 -3
- data/lib/configuration.rb +15 -14
- data/lib/flnews_post_proc.conf +21 -12
- data/lib/flnews_post_proc.rb +22 -20
- data/lib/headers.rb +12 -17
- data/lib/newsgroups.rb +12 -12
- data/lib/override.rb +23 -52
- data/lib/ruby_dlg +59 -55
- data/lib/version.rb +12 -12
- metadata +114 -81
- data/changelog.txt +0 -13
- data/lib/whiptail_dlg +0 -84
data/lib/configuration.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see
|
|
7
|
+
http://www.wtfpl.net/about/
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
require_relative 'basic_logging'
|
|
@@ -66,6 +66,7 @@ class Configuration
|
|
|
66
66
|
if @conf
|
|
67
67
|
@conf[key] = value
|
|
68
68
|
if key == 'DEBUG_LOG'
|
|
69
|
+
debug ' setting DEBUG_LOG to ' << value.to_s
|
|
69
70
|
set_target value
|
|
70
71
|
end
|
|
71
72
|
end
|
|
@@ -122,15 +123,15 @@ class Configuration
|
|
|
122
123
|
clevel = @conf[:LOG_LEVEL]
|
|
123
124
|
set_level clevel
|
|
124
125
|
target_string = @conf[:DEBUG_LOG]
|
|
125
|
-
set_target (target_string == 'STDOUT' ? STDOUT : target_string)
|
|
126
|
+
set_target (target_string == 'STDOUT' ? STDOUT : target_string) if target_string
|
|
127
|
+
set_target nil if !target_string || target_string.empty?
|
|
126
128
|
# clear the log file.
|
|
127
129
|
clear_log
|
|
128
130
|
debug('log target and -level set: ' << @@log_level.to_s << ', ' << target_string)
|
|
129
131
|
rescue Exception => ex
|
|
130
132
|
msg = "Cannot use the configuration-file (" << @config_file << ")"
|
|
131
133
|
msg << "\n\t" << ex.message
|
|
132
|
-
# No log.
|
|
133
|
-
# error msg
|
|
134
|
+
# No log. Use STDERR.
|
|
134
135
|
STDERR.puts(msg << "\nAborting, bye\n")
|
|
135
136
|
exit false
|
|
136
137
|
end
|
data/lib/flnews_post_proc.conf
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
1
|
+
# ***************************************************************************
|
|
2
|
+
# 2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
3
|
+
#
|
|
4
|
+
# This program is free software; you can redistribute it and/or modify
|
|
5
|
+
# it under the terms of the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
|
6
|
+
#
|
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
10
|
+
#
|
|
11
|
+
# ***************************************************************************
|
|
12
12
|
# This is a YAML file. Keep intact these three dashes.
|
|
13
13
|
---
|
|
14
14
|
# CONFIG_VERSION – DO NOT MODIFY
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# the process, if they are still valid.
|
|
18
18
|
# ATTN! COMMENTS WILL BE REMOVED but a copy of your previous configuration
|
|
19
19
|
# will be saved in a file with a version suffix.
|
|
20
|
-
CONFIG_VERSION:
|
|
20
|
+
CONFIG_VERSION: 2.02
|
|
21
21
|
|
|
22
22
|
# FUP_NAME
|
|
23
23
|
# A Regular Expression, describing the string which contains the name of
|
|
@@ -183,5 +183,14 @@ OVERRIDE_CONFIG: YES
|
|
|
183
183
|
# DEFAULT: No
|
|
184
184
|
USE_OLD: false
|
|
185
185
|
|
|
186
|
+
# Draft_DIR
|
|
187
|
+
# The path to a directory for draft messages.
|
|
188
|
+
# ONLY if OVERRIDE_CONFIG, above, is active, you can choose to *not send* but only
|
|
189
|
+
# to save the current message to a file in this directory.
|
|
190
|
+
# If left empty, the temporary directory from the environment variable $TEMP will
|
|
191
|
+
# be used to store draft messages.
|
|
192
|
+
# DEFAULT: empty
|
|
193
|
+
DRAFT_DIR:
|
|
194
|
+
|
|
186
195
|
# EOF
|
|
187
196
|
|
data/lib/flnews_post_proc.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
+
This program is free software; you can redistribute it and/or modify *
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see *
|
|
7
|
+
http://www.wtfpl.net/about/ *
|
|
8
|
+
*
|
|
9
|
+
This program is distributed in the hope that it will be useful, *
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
12
|
+
*
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
require 'yaml'
|
|
@@ -39,41 +39,43 @@ class PostProcessor
|
|
|
39
39
|
debug ' initializing headers'
|
|
40
40
|
headers = Headers.new(article_text)
|
|
41
41
|
debug('headers is ' << headers.inspect)
|
|
42
|
-
body = Body.new(article_text)
|
|
42
|
+
@body = Body.new(article_text)
|
|
43
43
|
|
|
44
44
|
debug('calling headers.update')
|
|
45
45
|
headers.update()
|
|
46
46
|
|
|
47
47
|
debug 'getting newsgroups'
|
|
48
48
|
begin
|
|
49
|
-
newsgroups = headers.newsgroups
|
|
50
|
-
debug "\thave newsgroups " << newsgroups.to_s
|
|
49
|
+
@newsgroups = headers.newsgroups
|
|
50
|
+
debug "\thave newsgroups " << @newsgroups.to_s
|
|
51
51
|
rescue Exception => ex
|
|
52
52
|
error "Cannot get Newsgroups: " << ex.message
|
|
53
|
+
error "Aborting, bye"
|
|
54
|
+
exit false
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
# Order matters. These actions work on a
|
|
56
58
|
# preliminary version of the article, each
|
|
57
59
|
# one on the result of the previous !
|
|
58
|
-
body.set_intro(newsgroups.intro)
|
|
60
|
+
@body.set_intro(@newsgroups.intro)
|
|
59
61
|
|
|
60
62
|
# if need be, extract references and footnotes.
|
|
61
|
-
body.handle_references
|
|
63
|
+
@body.handle_references
|
|
62
64
|
# signatures are ignored in Supersedes
|
|
63
|
-
body.set_signature(newsgroups.signature)
|
|
65
|
+
@body.set_signature(@newsgroups.signature)
|
|
64
66
|
|
|
65
67
|
# verify and eventually correct URIs.
|
|
66
68
|
# Will only handle http(s) for the time.
|
|
67
|
-
body.handle_uris
|
|
69
|
+
@body.handle_uris
|
|
68
70
|
|
|
69
71
|
# get the headers and the body as a string.
|
|
70
72
|
# Assemble.
|
|
71
|
-
@article = headers.join << $LN << body.join
|
|
73
|
+
@article = headers.join.force_encoding('utf-8') << $LN << @body.join
|
|
72
74
|
|
|
73
75
|
diff = Diffy::Diff.new(article_text, @article, :context => 2).to_s
|
|
74
76
|
info("\n" << "–" * 20 << "\nDiffs\n" << "–" * 20 << "\n" << diff)
|
|
75
77
|
end
|
|
76
78
|
|
|
77
|
-
attr_reader :article
|
|
79
|
+
attr_reader :article, :body, :newsgroups
|
|
78
80
|
end
|
|
79
81
|
# EOF
|
data/lib/headers.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
+
This program is free software; you can redistribute it and/or modify *
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see *
|
|
7
|
+
http://www.wtfpl.net/about/ *
|
|
8
|
+
*
|
|
9
|
+
This program is distributed in the hope that it will be useful, *
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
12
|
+
*
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
require 'rfc_2047'
|
|
@@ -64,10 +64,6 @@ class Headers
|
|
|
64
64
|
rescue Exception => ex
|
|
65
65
|
exit false;
|
|
66
66
|
end
|
|
67
|
-
# Consider the two following fixes as preliminary until proven.
|
|
68
|
-
# Getting older, this kind of problem occupies me a lot more than
|
|
69
|
-
# it should.
|
|
70
|
-
#
|
|
71
67
|
# value is all after the first colon
|
|
72
68
|
val = l.match(/:(.*)/)[1].lstrip
|
|
73
69
|
else # start_with?(' ')
|
|
@@ -196,7 +192,6 @@ class Headers
|
|
|
196
192
|
hv = @headers[:Subject]
|
|
197
193
|
if hv
|
|
198
194
|
debug 'checking for altered Subject'
|
|
199
|
-
|
|
200
195
|
|
|
201
196
|
# Our own very first article with an altered subject line, uses:
|
|
202
197
|
# (old:
|
|
@@ -220,7 +215,7 @@ class Headers
|
|
|
220
215
|
olds << /\s*\(etait\s?:.*/i
|
|
221
216
|
|
|
222
217
|
#decode subject from header value
|
|
223
|
-
subj = Rfc2047.decode(hv)
|
|
218
|
+
subj = Rfc2047.decode(hv.force_encoding('utf-8') )
|
|
224
219
|
debug 'subject encoding: ' << hv.encoding.to_s
|
|
225
220
|
debug 'decoded subject: ' << subj
|
|
226
221
|
# check for each of those regexps
|
data/lib/newsgroups.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2026, Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see
|
|
7
|
+
http://www.wtfpl.net/about/
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
# An object of this class concentrates the specificities of chosen
|
|
@@ -174,7 +174,7 @@ class Newsgroups
|
|
|
174
174
|
|
|
175
175
|
# write a new rearranged version of the signature file for
|
|
176
176
|
# better hazard.
|
|
177
|
-
#
|
|
177
|
+
# UNUSED
|
|
178
178
|
def rearrange_sigs(sigfile, all_sigs)
|
|
179
179
|
if File.writable?(sigfile)
|
|
180
180
|
new_sigs = Array.new(all_sigs.length)
|
data/lib/override.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu> *
|
|
5
|
+
This program is free software; you can redistribute it and/or modify *
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see *
|
|
7
|
+
http://www.wtfpl.net/about/ *
|
|
8
|
+
*
|
|
9
|
+
This program is distributed in the hope that it will be useful, *
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
12
|
+
*
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
# This class manages a dialog to alter the behavior of the
|
|
@@ -29,12 +29,10 @@ class OverrideDlg
|
|
|
29
29
|
|
|
30
30
|
XTERM = 'xterm'
|
|
31
31
|
# TERMINAL = 'x-terminal-emulator'
|
|
32
|
-
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# necessitate that xterm be found, too.
|
|
37
|
-
@@Executables = [WHIPTAIL, XTERM]
|
|
32
|
+
|
|
33
|
+
# There used to be others, but only xterm remained.
|
|
34
|
+
@@Executables = [XTERM]
|
|
35
|
+
|
|
38
36
|
@@LIBDIR = File::dirname(__FILE__)
|
|
39
37
|
# The configuration variables that can be unset.
|
|
40
38
|
# This class instance variable is exposed via a getter.
|
|
@@ -68,12 +66,7 @@ class OverrideDlg
|
|
|
68
66
|
opts = nil
|
|
69
67
|
begin
|
|
70
68
|
if has? XTERM
|
|
71
|
-
|
|
72
|
-
return whiptail_dlg.split.collect {|o| o.to_s}.join(' ')
|
|
73
|
-
else
|
|
74
|
-
debug 'using naked xterm'
|
|
75
|
-
return ruby_dlg.split.collect {|o| o.to_s}.join(' ')
|
|
76
|
-
end
|
|
69
|
+
return ruby_dlg
|
|
77
70
|
end
|
|
78
71
|
rescue SystemExit
|
|
79
72
|
msg = 'Process is cancelled (SystemExit)'
|
|
@@ -116,31 +109,7 @@ class OverrideDlg
|
|
|
116
109
|
@executables.include? ex_name
|
|
117
110
|
end
|
|
118
111
|
|
|
119
|
-
###### The following methods call a script, each, in an external process.
|
|
120
|
-
# There appears to be some Exception handling missing, but it does not
|
|
121
|
-
# hurt for the time being. Anyway, I do not care.
|
|
122
|
-
|
|
123
|
-
# creates a whiptail dialog in xterm.
|
|
124
|
-
def whiptail_dlg
|
|
125
|
-
debug('whiptail dialog')
|
|
126
|
-
tf = Tempfile.new
|
|
127
|
-
# dlg = @config.BINDIR << File::Separator << 'whiptail_dlg'
|
|
128
|
-
dlg = @@LIBDIR << File::Separator << 'whiptail_dlg'
|
|
129
|
-
dialog = XTERM.dup << ' -e ' << dlg << ' ' << tf.path
|
|
130
|
-
io = IO::popen(dialog)
|
|
131
|
-
Process.wait(io.pid )
|
|
132
|
-
nopts = tf.read
|
|
133
|
-
exit true if('exit' == nopts.strip)
|
|
134
|
-
tf.unlink
|
|
135
|
-
return nopts
|
|
136
|
-
end
|
|
137
|
-
|
|
138
112
|
# Creates a textual dialog in xterm.
|
|
139
|
-
# Some duplicate code, here, but I am afraid to oversee
|
|
140
|
-
# unique requirements of the external programs. It had
|
|
141
|
-
# not been necessary to correct the global behavior,
|
|
142
|
-
# but adaptations in each single method should be
|
|
143
|
-
# possible.
|
|
144
113
|
def ruby_dlg
|
|
145
114
|
debug('xterm dialog')
|
|
146
115
|
tf = Tempfile.new
|
|
@@ -149,16 +118,18 @@ class OverrideDlg
|
|
|
149
118
|
begin
|
|
150
119
|
dialog = XTERM.dup << ' -e ' << dlg << ' ' << tf.path
|
|
151
120
|
debug('dialog will be ' << dialog)
|
|
121
|
+
io = IO::popen(dialog)
|
|
122
|
+
debug('wait for ' << io.pid.to_s)
|
|
123
|
+
Process.wait(io.pid )
|
|
152
124
|
rescue Exception => ex
|
|
153
125
|
error ex.message
|
|
126
|
+
puts 'error'
|
|
154
127
|
wait_for_user
|
|
155
128
|
exit false
|
|
156
129
|
end
|
|
157
|
-
|
|
158
|
-
debug
|
|
159
|
-
|
|
160
|
-
nopts = tf.read
|
|
161
|
-
exit true if('exit' == nopts.strip)
|
|
130
|
+
nopts = tf.readlines
|
|
131
|
+
debug 'nopts is ' << nopts.to_s
|
|
132
|
+
exit true if(nopts && !nopts.empty? && 'exit' == nopts[0].strip)
|
|
162
133
|
tf.unlink
|
|
163
134
|
return nopts
|
|
164
135
|
end
|
data/lib/ruby_dlg
CHANGED
|
@@ -1,40 +1,23 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
=begin
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
***************************************************************************
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see
|
|
7
|
+
http://www.wtfpl.net/about/
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
require 'readline'
|
|
17
|
-
require_relative '
|
|
17
|
+
require_relative 'color_output'
|
|
18
18
|
require 'io/wait'
|
|
19
19
|
require 'io/console'
|
|
20
20
|
|
|
21
|
-
def wait_for_user()
|
|
22
|
-
char = nil
|
|
23
|
-
# There is a difference which makes me prefer the below code from STDIN.raw(args)
|
|
24
|
-
# You can try
|
|
25
|
-
# char = STDIN.raw(&:getc)
|
|
26
|
-
# .., which does *not* work the same way and it won't for me.
|
|
27
|
-
|
|
28
|
-
STDIN.raw do
|
|
29
|
-
STDIN.noecho do
|
|
30
|
-
until (STDIN.ready?)
|
|
31
|
-
sleep(0.1)
|
|
32
|
-
end
|
|
33
|
-
char = (STDIN.read_nonblock(1).ord rescue nil)
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
return char
|
|
37
|
-
end
|
|
38
21
|
if !ARGV.empty? && ARGV.length > 0
|
|
39
22
|
ofl = nil
|
|
40
23
|
begin
|
|
@@ -44,32 +27,40 @@ if !ARGV.empty? && ARGV.length > 0
|
|
|
44
27
|
puts red ('cannot open ' << ARGV[1])
|
|
45
28
|
puts ex.message
|
|
46
29
|
puts 'hit any key to exit'
|
|
47
|
-
|
|
30
|
+
$stdin.getch
|
|
48
31
|
exit false
|
|
49
32
|
end
|
|
50
33
|
|
|
51
|
-
|
|
34
|
+
disable_array = []
|
|
35
|
+
enable_array = []
|
|
52
36
|
message = ''
|
|
53
|
-
menu
|
|
37
|
+
menu = %=
|
|
38
|
+
––––– Configured options –––––––––––––
|
|
39
|
+
|
|
54
40
|
1 Unset Signature GROUP_SIGS
|
|
55
41
|
2 Unset Custom headers CUSTOM_HEADERS
|
|
56
42
|
3 Unset No Archive NO_ARCHIVE_GROUPS
|
|
57
43
|
4 Do not correct URLs VFY_URLS
|
|
58
44
|
5 Disable log DEBUG_LOG
|
|
45
|
+
|
|
46
|
+
––––– Add options ––––––––––––––––––––––––––––
|
|
47
|
+
|
|
48
|
+
6 Draft only DRAFT_ONLY
|
|
49
|
+
|
|
59
50
|
––––––––––––––––––––––––––––––––––––––––––––––
|
|
60
|
-
|
|
51
|
+
7 Summary, so far
|
|
61
52
|
––––––––––––––––––––––––––––––––––––––––––––––
|
|
62
53
|
0 Okay, use settings.
|
|
63
54
|
––––––––––––––––––––––––––––––––––––––––––––––––
|
|
64
|
-
{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
|
55
|
+
#{bold("Esc, Ctrl+C and 'q'")} terminate the Post-processor
|
|
65
56
|
and no changes will be applied.
|
|
66
|
-
=
|
|
57
|
+
=
|
|
67
58
|
|
|
68
59
|
loop do
|
|
69
60
|
system 'clear'
|
|
70
61
|
puts yellow(menu)
|
|
71
62
|
puts cyan(message)
|
|
72
|
-
option =
|
|
63
|
+
option = $stdin.getch.to_i
|
|
73
64
|
case option
|
|
74
65
|
# Esc, Ctrl+C, 'q'
|
|
75
66
|
when -21, -45, 65
|
|
@@ -78,9 +69,12 @@ and no changes will be applied.
|
|
|
78
69
|
ofl.close
|
|
79
70
|
exit true
|
|
80
71
|
when 0
|
|
81
|
-
|
|
72
|
+
if !disable_array.empty? || !enable_array.empty?
|
|
73
|
+
puts green('Applying changes.')
|
|
74
|
+
end
|
|
82
75
|
# write the list of variables to unset (others remain)
|
|
83
|
-
ofl.write
|
|
76
|
+
ofl.write disable_array.join(' ')
|
|
77
|
+
ofl.write "\n" << enable_array.join(' ')
|
|
84
78
|
ofl.close
|
|
85
79
|
exit true
|
|
86
80
|
|
|
@@ -88,47 +82,57 @@ and no changes will be applied.
|
|
|
88
82
|
# ADD option to the option array, if it should be *removed*
|
|
89
83
|
# from the configuration, else remove it from the array.
|
|
90
84
|
when 1
|
|
91
|
-
active = !
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
active = !disable_array.include?(:GROUP_SIGS)
|
|
86
|
+
disable_array << :GROUP_SIGS if active
|
|
87
|
+
disable_array.delete(:GROUP_SIGS) if !active
|
|
94
88
|
|
|
95
89
|
message = "Signature #{active ? 'unset' : 'as configured'}!"
|
|
96
90
|
menu.sub!("Unset Signature", "Set Signature ") if active
|
|
97
91
|
menu.sub!("Set Signature ", "Unset Signature") if !active
|
|
98
92
|
when 2
|
|
99
|
-
active = !
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
active = !disable_array.include?(:CUSTOM_HEADERS)
|
|
94
|
+
disable_array << :CUSTOM_HEADERS if active
|
|
95
|
+
disable_array.delete(:CUSTOM_HEADERS) if !active
|
|
102
96
|
|
|
103
97
|
message = "Custom headers #{active ? 'removed' : 'are added'}!"
|
|
104
98
|
menu.sub!("Unset Custom headers", "Add Custom headers ") if active
|
|
105
99
|
menu.sub!("Add Custom headers ", "Unset Custom headers") if !active
|
|
106
100
|
when 3
|
|
107
|
-
active = !
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
active = !disable_array.include?(:NO_ARCHIVE_GROUPS)
|
|
102
|
+
disable_array << :NO_ARCHIVE_GROUPS if active
|
|
103
|
+
disable_array.delete(:NO_ARCHIVE_GROUPS) if !active
|
|
110
104
|
|
|
111
105
|
message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
|
|
112
|
-
menu.sub!("Unset
|
|
113
|
-
menu.sub!("Add
|
|
106
|
+
menu.sub!("Unset No Archive", "Add No Archive ") if active
|
|
107
|
+
menu.sub!("Add No Archive ", "Unset No Archive") if !active
|
|
114
108
|
when 4
|
|
115
|
-
active = !
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
active = !disable_array.include?(:VFY_URLS)
|
|
110
|
+
disable_array << :VFY_URLS if active
|
|
111
|
+
disable_array.delete(:VFY_URLS) if !active
|
|
118
112
|
|
|
119
113
|
message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
|
|
120
114
|
menu.sub!("Do not correct URLs", "Correct URLs ") if active
|
|
121
115
|
menu.sub!("Correct URLs ", "Do not correct URLs") if !active
|
|
122
116
|
when 5
|
|
123
|
-
active = !
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
active = !disable_array.include?(:DEBUG_LOG)
|
|
118
|
+
disable_array << :DEBUG_LOG if active
|
|
119
|
+
disable_array.delete(:DEBUG_LOG) if !active
|
|
126
120
|
|
|
127
121
|
message = "Log is #{ active ? 'not ' : ''} " << "written!"
|
|
128
122
|
menu.sub!("Disable log", "Enable log ") if active
|
|
129
123
|
menu.sub!("Enable log ", "Disable log") if !active
|
|
130
124
|
when 6
|
|
131
|
-
|
|
125
|
+
active = !enable_array.include?(:DRAFT_ONLY)
|
|
126
|
+
enable_array << :DRAFT_ONLY if active
|
|
127
|
+
enable_array.delete(:DRAFT_ONLY) if !active
|
|
128
|
+
|
|
129
|
+
message = "Post is #{ active ? '' : 'not '}" << "saved as a draft!"
|
|
130
|
+
menu.sub!("Draft only", "No Draft") if active
|
|
131
|
+
menu.sub!("No Draft", "Draft only") if !active
|
|
132
|
+
when 7
|
|
133
|
+
message = "Summary:"
|
|
134
|
+
message << bold(cyan("\n\tdisabled")) << " options: " << disable_array.join(' ') if !disable_array.empty?
|
|
135
|
+
message << bold(cyan("\n\tenabled") )<< " options: " << enable_array.join(' ') if !enable_array.empty?
|
|
132
136
|
end
|
|
133
137
|
end
|
|
134
138
|
else # ARGV
|
data/lib/version.rb
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#encoding: UTF-8
|
|
2
2
|
=begin
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
***************************************************************************
|
|
4
|
+
2023-2025, Michael Uplawski <michael.uplawski@uplawski.eu>
|
|
5
|
+
This program is free software; you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the WTFPL 2.0 or later, see
|
|
7
|
+
http://www.wtfpl.net/about/
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
|
|
13
|
+
***************************************************************************
|
|
14
14
|
=end
|
|
15
15
|
|
|
16
16
|
PROGNAME = 'flnews_post_proc'
|
|
17
|
-
PROGVERSION = "2.
|
|
17
|
+
PROGVERSION = "2.04"
|
|
18
18
|
AUTHORS = "Michael Uplawski"
|
|
19
19
|
EMAIL = "michael.uplawski@uplawski.eu"
|
|
20
20
|
YEARS = "2023 - 2026"
|