flnews_post_proc 1.40 → 1.43

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f76e4432bd460f49ef15abd469ac4f79e1c4887c99229620b0a79ec9cb8ad836
4
- data.tar.gz: a6416c6b5f53bdfb9995e1b64accadf97a18fbb2b2dc69b36f4aff86e38f35e3
3
+ metadata.gz: a84f5336c8383ef6fb884ac87a9ec3d0af44ab8acc03796746abae3046058b1f
4
+ data.tar.gz: 17fa345dc7971716a337ad79870850ec9746dc14bc6220eac513f923b33d1898
5
5
  SHA512:
6
- metadata.gz: 4f331c0092c7ffeb7ac6b8ee485de68a8ad30534166b65b6be049d6b1d16a3a0a7754396da615dc397a6dd17ffdbf555363e4d41576a604963d09b21c4834031
7
- data.tar.gz: 057cf2f67069ac2708d8b2444a6339b4671415bd55e86662f23d2ced0d95e5a7e80b69c3514123dab71a1edceab3717f346de7c876119c7c68bb6f31179dc3bb
6
+ metadata.gz: 2b893868b1eabb86ede03c8bdaa7c8c1f78fc456932f17f491703db310e94d8902bcd19f45e6751fb7738a855415e69df1938fedb258078c43029d03048f809d
7
+ data.tar.gz: 9661e25f26f573839cba32f2eef2032577e37e710357af202e6fa9e863f863c41c336ffa9e6e904f5a9a14314cd7decedcaf18a44c3847ee686a71d9e0e4f955
data/README.md CHANGED
@@ -93,14 +93,14 @@ some users may not always agree with the result and for arbitrary reasons:
93
93
  Custom headers may be defined in the configuration file for the program
94
94
  and will then be added to each outgoing post.
95
95
 
96
- * The X-No-Archive header is sometimes set to avoid that an article be
97
- saved and stays available to search-engines (Google, notably). Test-
98
- postings, for example, do probably not justify at all that they would be
99
- referenced in search results.
100
- The post-processor program can impose the X-No-Archive header for all
101
- posts to certain newsgroups.
96
+ * The Archive- and X-No-Archive headers are sometimes set to avoid that an
97
+ article be saved and stays available to search-engines (Google, notably).
98
+ Test- postings, for example, do probably not justify at all that they would
99
+ be referenced in search results. The post-processor program can impose the
100
+ Archive- and X-No-Archive header for all posts to certain newsgroups.
102
101
 
103
- **ATTN** As of 2024, this header might serve no purpose any more.
102
+ **ATTN** As of 2024, the X-No-Archive has lost most of its utility and it
103
+ is the decision of server operators to honor it or not.
104
104
 
105
105
  * If a news post contains many references to either other posts or Web
106
106
  pages, the text can be cluttered with URLs.
@@ -129,7 +129,7 @@ have not yet been set in the configuration.
129
129
  * Signatures, as set in the configuration **can be ignored**. Either
130
130
  a default signature will appear as set in flnews or none.
131
131
  * Custom Headers, if configured, can be **omitted**.
132
- * The X-No-Archive header, if set for the current newsgroup, **can be
132
+ * Archive- and X-No-Archive headers, if set for the current newsgroup, **can be
133
133
  ignored**.
134
134
  * The verification & correction of references **can be disabled**.
135
135
  * Logging can be **switched off**, if set.
@@ -225,9 +225,10 @@ intact.
225
225
  _\- 'X-My-Header: nothing fancy'_
226
226
  _\- 'X-Another-Header: care not!'_
227
227
 
228
- **XNAY_GROUPS**
229
- The newsgroups, where a header X-No-Archive: YES shall be set.
230
- **ATTN** As of 2024, this header might serve no purpose any more.
228
+ **NO_ARCHIVE_GROUPS**
229
+
230
+ The newsgroups, where the headers “Archive: no and “X-No-Archive: YES” shall
231
+ be set.
231
232
 
232
233
  CONTENT: a dash and space, then a String, containing the name of the group or
233
234
  a regexp.
@@ -390,38 +390,33 @@ own creations.</p>
390
390
  <h2>The limits of a basic newsreader — what the program can do</h2>
391
391
  <p>While the articles that flnews creates, are complete and ready to be posted,
392
392
  some users may not always agree with the result and for arbitrary reasons:</p>
393
- <ul>
394
- <li><p class="first">There may be inconveniences when you post to different newsgroups in
393
+ <ul class="simple">
394
+ <li>There may be inconveniences when you post to different newsgroups in
395
395
  different languages, as an introductory line which refers to a previous
396
396
  post can only be set once in the flnews-configuration. The consequence
397
397
  can be that your post to a french newsgroup begins with an introduction
398
398
  in English.
399
399
  My post-processor program can set an introductory line specifically
400
- chosen for one or several newsgroups.</p>
401
- </li>
402
- <li><p class="first">The same conflict arises, when you have set a standard signature-text and
400
+ chosen for one or several newsgroups.</li>
401
+ <li>The same conflict arises, when you have set a standard signature-text and
403
402
  would like to replace it against another, based on the newsgroup you are
404
403
  about to post to.
405
404
  The post-processor program sets specific signatures as configured for one
406
- or several newsgroups.</p>
407
- </li>
408
- <li><p class="first">Some custom headers may serve to convey additional information to
405
+ or several newsgroups.</li>
406
+ <li>Some custom headers may serve to convey additional information to
409
407
  interested readers of your post, like GnuPG key IDs, your language skills
410
408
  or the like. The signature may be a better choice than custom headers.
411
409
  You are free. I just mention face and x-face but prefer that you do not
412
410
  remember I did.
413
411
  Custom-headers may be defined in the configuration file for the program
414
- and will then be added to each outgoing post.</p>
415
- </li>
416
- <li><p class="first">The X-No-Archive header is sometimes set to avoid that an article be
417
- saved and stays available to search-engines (Google, notably). Test-
418
- postings, for example, do probably not justify at all that they would be
419
- referenced in search-results.
420
- The post-processor program can impose the X-No-Archive header for all
421
- posts to certain newsgroups.</p>
422
- <p><strong>ATTN</strong> Since 2024, this header might no longer serve any purpose.</p>
423
- </li>
424
- <li><p class="first">If a news post contains many references to either other posts or Web
412
+ and will then be added to each outgoing post.</li>
413
+ <li>The Archive- and the X-No-Archive header are sometimes set to avoid that an
414
+ article be saved and stays available to search-engines (Google, notably).
415
+ Test- postings, for example, do probably not justify at all that they would
416
+ be referenced in search-results.
417
+ The post-processor program can impose both headers for all posts to certain
418
+ newsgroups.</li>
419
+ <li>If a news post contains many references to either other posts or Web
425
420
  pages, the text can be cluttered with URLs.
426
421
  The post-processor can identify marked text fragments and transform them
427
422
  into footnotes, which will be attached as a list at the bottom of the
@@ -430,8 +425,7 @@ This works almost like the &lt;ref/&gt; link in Wikipedia, but the delimiter
430
425
  can be determined in the configuration file.
431
426
  Example (with %=):
432
427
  This is an object %=and this becomes the footnote, describing the object
433
- further=%</p>
434
- </li>
428
+ further=%</li>
435
429
  </ul>
436
430
  </div>
437
431
  <div class="section" id="dialog-to-override-settings">
@@ -445,8 +439,8 @@ have not yet been set in the configuration.</p>
445
439
  <li>Signatures, as set in the configuration <strong>can be ignored</strong>. Either
446
440
  a default signature will appear as set in flnews or none.</li>
447
441
  <li>Custom Headers, if configured, can be <strong>omitted</strong>.</li>
448
- <li>The X-No-Archive header, if set for the current newsgroup, <strong>can be
449
- ignored</strong>.</li>
442
+ <li>The Archive- and X-No-Archive headers, if set for the current newsgroup,
443
+ <strong>can be ignored</strong>.</li>
450
444
  <li>Logging can be <strong>switched off</strong>, if set.</li>
451
445
  </ul>
452
446
  <p>Pushing Esc or the cancle-button of the dialog interrupts the process, flnews
@@ -523,9 +517,9 @@ name of the header, ending in a colon and the value of the header.</p>
523
517
  <div class="line">- 'X-Another-Header: care not!'</div>
524
518
  </div>
525
519
  </dd>
526
- <dt><strong>XNAY_GROUPS</strong></dt>
527
- <dd><p class="first">The newsgroups, where a header X-No-Archive: YES shall be set.
528
- <strong>ATTN</strong> Since 2024, this header might no longer serve any purpose.</p>
520
+ <dt><strong>NO_ARCHIVE_GROUPS</strong></dt>
521
+ <dd><p class="first">The newsgroups, where the headers “Archive: no” and “X-No-Archive: YES shall
522
+ be set.</p>
529
523
  <p>CONTENT: a dash and space, then a String, containing the name of the group or a regexp.</p>
530
524
  <p>DEFAULT: empty</p>
531
525
  <div class="last line-block">
@@ -421,14 +421,14 @@ ne vous en souvenez pas.</p>
421
421
  <p>Ces entêtes, – Custom-Headers – peuvent être définis dans la configuration
422
422
  du logiciel et vont être utilisées dans chaque article sortant.</p>
423
423
  </li>
424
- <li><p class="first">L'entête « X-No-Archive » est parfois utilisé afin d'éviter l'archivage
425
- d'un article. Il ne devrait par conséquence pas être trouvé par les moteurs
426
- de recherche ( Google notamment ). Les articles dans les groupes de test, par
427
- exemple, ne valent probablement pas qu'on les trouve parmi les résultats des
428
- recherches.</p>
424
+ <li><p class="first">Les entêtes « Archive » et « X-No-Archive » sont parfois utilisés afin
425
+ d'éviter l'archivage d'un article. Il ne devrait par conséquence pas être
426
+ trouvé par les moteurs de recherche ( Google notamment ). Les articles dans
427
+ les groupes de test, par exemple, ne valent probablement pas qu'on les trouve
428
+ parmi les résultats des recherches.</p>
429
429
  <p>Avec flnews_post_proc vous pouvez décider et imposer que vos articles dans
430
- certains newsgroups contiendront d'office une entête <strong>X-No-Archive: Yes</strong>.</p>
431
- <p><strong>ATTN</strong> Depuis l'année 2024, cet entête n'a probablement plus de fonction.</p>
430
+ certains newsgroups contiendront d'office les deux entêtes <strong>Archive: no</strong> et
431
+ <strong>X-No-Archive: Yes</strong>.</p>
432
432
  </li>
433
433
  <li><p class="first">Certains messages mentionnent d'autres articles ou des URLs de pages Web.
434
434
  S'ils sont nombreux, ces références peuvent déranger la lecture à cause de
@@ -456,7 +456,8 @@ des options, qui ne l'ont pas été auparavant :</p>
456
456
  <li>Signatures, comme définis dans la configuration <strong>peuvent être ignorées</strong>.
457
457
  Soit une signature par défaut sera appliquée, si prévue, ou aucune.</li>
458
458
  <li>Entêtes supplémentaires, si définis, peuvent rester absentes de l'article.</li>
459
- <li>L'entête X-No-Archive, si prévu pour le newsgroup choisi, peut être ignoré.</li>
459
+ <li>Les entêtes Archive et X-No-Archive, si prévus pour le newsgroup choisi,
460
+ peuvent être ignorés.</li>
460
461
  <li>L'auto correction de URLs et références à d'autres articles peut être
461
462
  désactivé.</li>
462
463
  <li>L'écriture d'un protocole peut être arrêtée.</li>
@@ -550,9 +551,9 @@ l'entête.</p>
550
551
  <div class="line">- 'X-Another-Header: care not!'</div>
551
552
  </div>
552
553
  </dd>
553
- <dt><strong>XNAY_GROUPS</strong></dt>
554
- <dd><p class="first">Les newsgroups, où une entête X-No-Arcive: YES doit être présent.
555
- <strong>ATTN</strong> Depuis l'année 2024, cet entête n'a probablement plus de fonction.</p>
554
+ <dt><strong>NO_ARCHIVE_GROUPS</strong></dt>
555
+ <dd><p class="first">Les newsgroups, où les entêtes « Archive: no » et « X-No-Archive: yes »
556
+ doivent être présents.</p>
556
557
  <p>CONTENU : Un trait d'union et un espace, puis une chaîne de caractères,
557
558
  contenant le nom du groupe ou une expression.</p>
558
559
  <p>PAR DÉFAUT : Vide</p>
Binary file
Binary file
Binary file
Binary file
@@ -60,14 +60,12 @@ some users may not always agree with the result and for arbitrary reasons:
60
60
  Custom-headers may be defined in the configuration file for the program
61
61
  and will then be added to each outgoing post.
62
62
 
63
- * The X-No-Archive header is sometimes set to avoid that an article be
64
- saved and stays available to search-engines (Google, notably). Test-
65
- postings, for example, do probably not justify at all that they would be
66
- referenced in search-results.
67
- The post-processor program can impose the X-No-Archive header for all
68
- posts to certain newsgroups.
69
-
70
- **ATTN** Since 2024, this header might no longer serve any purpose.
63
+ * The Archive- and the X-No-Archive header are sometimes set to avoid that an
64
+ article be saved and stays available to search-engines (Google, notably).
65
+ Test- postings, for example, do probably not justify at all that they would
66
+ be referenced in search-results.
67
+ The post-processor program can impose both headers for all posts to certain
68
+ newsgroups.
71
69
 
72
70
  * If a news post contains many references to either other posts or Web
73
71
  pages, the text can be cluttered with URLs.
@@ -91,8 +89,8 @@ have not yet been set in the configuration.
91
89
  * Signatures, as set in the configuration **can be ignored**. Either
92
90
  a default signature will appear as set in flnews or none.
93
91
  * Custom Headers, if configured, can be **omitted**.
94
- * The X-No-Archive header, if set for the current newsgroup, **can be
95
- ignored**.
92
+ * The Archive- and X-No-Archive headers, if set for the current newsgroup,
93
+ **can be ignored**.
96
94
  * Logging can be **switched off**, if set.
97
95
 
98
96
  Pushing Esc or the cancle-button of the dialog interrupts the process, flnews
@@ -187,9 +185,9 @@ categories:
187
185
  | - 'X-My-Header: nothing fancy'
188
186
  | - 'X-Another-Header: care not!'
189
187
 
190
- **XNAY_GROUPS**
191
- The newsgroups, where a header X-No-Archive: YES shall be set.
192
- **ATTN** Since 2024, this header might no longer serve any purpose.
188
+ **NO_ARCHIVE_GROUPS**
189
+ The newsgroups, where the headers “Archive: no” and “X-No-Archive: YES shall
190
+ be set.
193
191
 
194
192
  CONTENT: a dash and space, then a String, containing the name of the group or a regexp.
195
193
 
@@ -73,16 +73,15 @@ et ce pour des raisons arbitraires :
73
73
  Ces entêtes, – Custom-Headers – peuvent être définis dans la configuration
74
74
  du logiciel et vont être utilisées dans chaque article sortant.
75
75
 
76
- * L'entête « X-No-Archive » est parfois utilisé afin d'éviter l'archivage
77
- d'un article. Il ne devrait par conséquence pas être trouvé par les moteurs
78
- de recherche ( Google notamment ). Les articles dans les groupes de test, par
79
- exemple, ne valent probablement pas qu'on les trouve parmi les résultats des
80
- recherches.
76
+ * Les entêtes « Archive » et « X-No-Archive » sont parfois utilisés afin
77
+ d'éviter l'archivage d'un article. Il ne devrait par conséquence pas être
78
+ trouvé par les moteurs de recherche ( Google notamment ). Les articles dans
79
+ les groupes de test, par exemple, ne valent probablement pas qu'on les trouve
80
+ parmi les résultats des recherches.
81
81
 
82
82
  Avec flnews_post_proc vous pouvez décider et imposer que vos articles dans
83
- certains newsgroups contiendront d'office une entête **X-No-Archive: Yes**.
84
-
85
- **ATTN** Depuis l'année 2024, cet entête n'a probablement plus de fonction.
83
+ certains newsgroups contiendront d'office les deux entêtes **Archive: no** et
84
+ **X-No-Archive: Yes**.
86
85
 
87
86
  * Certains messages mentionnent d'autres articles ou des URLs de pages Web.
88
87
  S'ils sont nombreux, ces références peuvent déranger la lecture à cause de
@@ -112,7 +111,8 @@ des options, qui ne l'ont pas été auparavant :
112
111
 
113
112
  * Entêtes supplémentaires, si définis, peuvent rester absentes de l'article.
114
113
 
115
- * L'entête X-No-Archive, si prévu pour le newsgroup choisi, peut être ignoré.
114
+ * Les entêtes Archive et X-No-Archive, si prévus pour le newsgroup choisi,
115
+ peuvent être ignorés.
116
116
 
117
117
  * L'auto correction de URLs et références à d'autres articles peut être
118
118
  désactivé.
@@ -218,9 +218,9 @@ variables définis dans ce fichier peuvent être classées en deux catégories :
218
218
  | - 'X-My-Header: nothing fancy'
219
219
  | - 'X-Another-Header: care not!'
220
220
 
221
- **XNAY_GROUPS**
222
- Les newsgroups, où une entête X-No-Arcive: YES doit être présent.
223
- **ATTN** Depuis l'année 2024, cet entête n'a probablement plus de fonction.
221
+ **NO_ARCHIVE_GROUPS**
222
+ Les newsgroups, où les entêtes « Archive: no » et « X-No-Archive: yes »
223
+ doivent être présents.
224
224
 
225
225
  CONTENU : Un trait d'union et un espace, puis une chaîne de caractères,
226
226
  contenant le nom du groupe ou une expression.
data/lib/body.rb CHANGED
@@ -203,19 +203,23 @@ class Body
203
203
  # handle <news:..@...>
204
204
  def handle_news(l)
205
205
  # ... “Do not trust nobody!”
206
- if l.include?('@') && ! l.include?('http:')
206
+ if l.include?('@') && ! l.include?('http:') && ! l.include?('https:')
207
207
  # And I forgot how this works. It does.
208
208
  l.split.collect do |ele|
209
209
  # angular brackets are there alright. Hurra.
210
210
  url = ele.match(/\<(.*)\>/)
211
211
  unless !url
212
212
  debug(' with angular brackets: ' << url.inspect)
213
- l = l.sub(url[1], 'news:' << url[1]) if !url[1].include?('mailto')
213
+ l = l.sub(url[1], 'news:' << url[1]) if !url[1].start_with?('mailto') && !url[1].start_with?('news')
214
214
  else
215
215
  url = ele.match(/\S+@(\.|[^\p{P}]+)\S+/)
216
216
  if url
217
217
  debug(' withOUT angular brackets: ' << url.inspect)
218
- l = l.sub(url[0], '<news:' << url[0] << '>') if !url[0].include?('mailto')
218
+ if !url[0].start_with?('mailto') && !url[0].start_with?('news')
219
+ l.sub!(url[0], 'news:' << url[0] )
220
+ end
221
+ l.sub!('news:', '<news:')
222
+ l.sub!(url[0], url[0] << '>')
219
223
  end
220
224
  end
221
225
  end # url_strs = collect
@@ -235,13 +239,13 @@ class Body
235
239
  debug( 'try to match http-link')
236
240
  begin
237
241
  # missing slashes ?
238
- match = str.match(/(https?):(\/{2})/)
242
+ match = str.match(/(https?):(\/*)/)
239
243
  if (!match || match.length != 3 || match[2] != '//')
240
- debug 'cannot find slashes in the URL'
244
+ debug 'cannot find (enough) slashes in the URL'
241
245
  if str.match(/https:/)
242
- nstr = str.sub(/https:/, "https://")
246
+ nstr = str.sub(/https:\/*/, "https://")
243
247
  elsif str.match(/http:/)
244
- nstr = str.sub(/http:/, "http://")
248
+ nstr = str.sub(/http:\/*/, "http://")
245
249
  end
246
250
  debug ' with slashes: ' << nstr
247
251
  end
@@ -252,8 +256,8 @@ class Body
252
256
  match = nstr.match(/\<?(https?:\/\/[^\>]*)\>?/)
253
257
  # get the darned URL already!
254
258
  url = match[1] if match
255
- # nstr = with_angular_brackets(nstr, url)
256
- return l.sub(str, nstr)
259
+ # nstr = with_angular_brackets(nstr, url)
260
+ l.sub!(str, nstr)
257
261
  rescue Exception => ex
258
262
  # this had looked intelligent, once.
259
263
  line = __LINE__
@@ -264,6 +268,7 @@ class Body
264
268
  exit false
265
269
  end
266
270
  end
271
+ return l
267
272
  end
268
273
  end
269
274
  # Ω
@@ -86,13 +86,13 @@ GROUP_SIGS:
86
86
  CUSTOM_HEADERS:
87
87
  - "X-Post-Processor: flnews_post_proc"
88
88
 
89
- # XNAY_GROUPS:
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
- XNAY_GROUPS:
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
- xnay = @newsgroups.xnay
99
- debug('xnay should be set now : ' << xnay.to_s)
100
- if xnay
101
- @headers["X-No-Archive".to_sym] = xnay
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, xnay')
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
- set_xnay
34
+ set_no_archive
35
35
  end
36
36
  end
37
37
 
38
- def xnay
39
- debug('returning ' <<( @xnay ? @xnay : ' nil ') )
40
- return @xnay ? @xnay : nil
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 xnay header.
125
- def set_xnay
126
- @xnay = nil
127
- xgs = @@config.XNAY_GROUPS
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 XNAY")
130
- @xnay = 'YES'
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, :XNAY_GROUPS, :VFY_URLS, :DEBUG_LOG]
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
- ofl = nil
41
- begin
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 X-No-Archive XNAY_GROUPS
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
- system 'clear'
72
- puts yellow(menu)
73
- puts cyan(message)
74
- option = wait_for_user - 48
75
- case option
76
- # Esc, Ctrl+C, 'q'
77
- when -21, -45, 65
78
- puts red('Aborting. Bye.')
79
- ofl.write 'exit'
80
- ofl.close
81
- exit true
82
- when 0
83
- puts green('Applying changes.') if !opt_array.empty?
84
- # write the list of variables to unset (others remain)
85
- ofl.write opt_array.join(' ')
86
- ofl.close
87
- exit true
88
-
89
- # toggle options
90
- # ADD option to the option array, if it should be *removed*
91
- # from the configuration, else remove it from the array.
92
- when 1
93
- active = !opt_array.include?(:GROUP_SIGS)
94
- opt_array << :GROUP_SIGS if active
95
- opt_array.delete(:GROUP_SIGS) if !active
96
-
97
- message = "Signature #{active ? 'unset' : 'as configured'}!"
98
- menu.sub!("Unset Signature", "Set Signature ") if active
99
- menu.sub!("Set Signature ", "Unset Signature") if !active
100
- when 2
101
- active = !opt_array.include?(:CUSTOM_HEADERS)
102
- opt_array << :CUSTOM_HEADERS if active
103
- opt_array.delete(:CUSTOM_HEADERS) if !active
104
-
105
- message = "Custom headers #{active ? 'removed' : 'are added'}!"
106
- menu.sub!("Unset Custom headers", "Add Custom headers ") if active
107
- menu.sub!("Add Custom headers ", "Unset Custom headers") if !active
108
- when 3
109
- active = !opt_array.include?(:XNAY_GROUPS)
110
- opt_array << :XNAY_GROUPS if active
111
- opt_array.delete(:XNAY_GROUPS) if !active
112
-
113
- message = "X-No-Archive #{active ? 'removed' : 'is added'}!"
114
- menu.sub!("Unset X-No-Archive", "Add X-No-Archive ") if active
115
- menu.sub!("Add X-No-Archive ", "Unset X-No-Archive") if !active
116
- when 4
117
- active = !opt_array.include?(:VFY_URLS)
118
- opt_array << :VFY_URLS if active
119
- opt_array.delete(:VFY_URLS) if !active
120
-
121
- message = "URLS will #{active ? 'not ' : ''}" << "be verified!"
122
- menu.sub!("Do not correct URLs", "Correct URLs ") if active
123
- menu.sub!("Correct URLs ", "Do not correct URLs") if !active
124
- when 5
125
- active = !opt_array.include?(:DEBUG_LOG)
126
- opt_array << :DEBUG_LOG if active
127
- opt_array.delete(:DEBUG_LOG) if !active
128
-
129
- message = "Log is #{ active ? 'not ' : ''} " << "written!"
130
- menu.sub!("Disable log", "Enable log ") if active
131
- menu.sub!("Enable log ", "Disable log") if !active
132
- when 6
133
- message = "Summary of " << bold('disabled') << " options: " << opt_array.join(' ')
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.40"
17
+ PROGVERSION = "1.43"
18
18
  AUTHORS = "Michael Uplawski"
19
19
  EMAIL = "michael.uplawski@uplawski.eu"
20
20
  YEARS = "2023 - 2024"
21
- SUMMARY = "Moved the override-dialog scripts from the executables directory to lib"
21
+ SUMMARY = "Bugfix: reduce number of slashes in http: urls to 2"
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 XNAY_GROUPS VFY_URLS DEBUG_LOG)
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 XNAY_GROUPS 'X-No-Archive' ON VFY_URLS 'Correct URLs' ON DEBUG_LOG 'Log' 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
- XNAY_GROUPS=3
21
+ NO_ARCHIVE_GROUPS=3
22
22
  VFY_URLS=4
23
23
  DEBUG_LOG=5
24
- CONF=($(yad --item-separator=" " --title "$TITLE" --image="" --window-icon="" --form \
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="XNAY":CHK 'true' \
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 XNAY_GROUPS VFY_URLS DEBUG_LOG
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 XNAY_GROUPS "X-No-Archive"\
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 XNAY_GROUPS VFY_URLS DEBUG_LOG
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.40'
4
+ version: '1.43'
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-07 00:00:00.000000000 Z
11
+ date: 2024-04-27 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: Moved the override-dialog scripts from the executables directory to lib
87
+ summary: 'Bugfix: reduce number of slashes in http: urls to 2'
88
88
  test_files: []