Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix issues identified by Billy G using github co-pilot. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
6124df6290e93e6d5c1898b25da58c37 |
| User & Date: | cmacleod 2025-09-03 19:51:46.019 |
Context
|
2025-09-04
| ||
| 09:31 | Brace all conditions. check-in: 5b986491bd user: cmacleod tags: trunk | |
|
2025-09-03
| ||
| 19:51 | Fix issues identified by Billy G using github co-pilot. check-in: 6124df6290 user: cmacleod tags: trunk | |
| 19:49 | Fixes to finding an article by message-id. check-in: 1188b7b747 user: cmacleod tags: trunk | |
Changes
Changes to server/news_code.tcl.
| ︙ | ︙ | |||
765 766 767 768 769 770 771 |
set threadinfo [cacheThreadinfo $urec $group $upto]
dict with threadinfo {}
set first [lindex $hdrs 0]
set last [lindex $hdrs end-1]
| | | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
set threadinfo [cacheThreadinfo $urec $group $upto]
dict with threadinfo {}
set first [lindex $hdrs 0]
set last [lindex $hdrs end-1]
update_last $user $group $last
html {
<table style='table-layout: fixed; width:100%;' >
<colgroup>
<col style='width: 60%;' />
<col style='width: 20%;' />
<col style='width: 10%;' />
|
| ︙ | ︙ | |||
846 847 848 849 850 851 852 |
}
html "</form>\n"
return $html
}
| | | | < | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
}
html "</form>\n"
return $html
}
# Update number of the last article when user previously read this group
proc update_last {user group last} {
# Article numbers after the ugrp old_last value will be considered new.
# If the ugrp record does not already have a new_last value, set it.
set ugrp [redis hget "ugrp $user" $group]
lassign $ugrp old_last new_last
if {$new_last eq {} && $last ne {}} {
redis hset "ugrp $user" $group [list $old_last $last]
}
}
# Reverse the display order of threads in a group
proc reverse_group {sock urec group} {
lassign $urec user can_post params
set reverse [dict get $params rev]
|
| ︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 |
<table style='table-layout: fixed; width:100%; border-collapse:collapse' >
}
set indent 0
set prev_ind $indent
foreach {num indent} $thread {
if {$indent < $prev_ind} {
html {<tr style='height:6px'>} \
| | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 |
<table style='table-layout: fixed; width:100%; border-collapse:collapse' >
}
set indent 0
set prev_ind $indent
foreach {num indent} $thread {
if {$indent < $prev_ind} {
html {<tr style='height:6px'>} \
"<td colspan='[expr {max(30-1-$indent,1)}]' class='rb'></td>" \
[string repeat {<td class='r'></td>} [expr {$indent+1}]] "</tr>\n"
}
set frag " id='a$num'"
set clas rbl
if {$num == $target} {
append clas { sel}
|
| ︙ | ︙ | |||
1259 1260 1261 1262 1263 1264 1265 |
if {$rot13} {
set line [rot13 $line]
}
if {$markup} {
html "[markup_art_line $line]\n"
} else {
# make URLs clickable, encode <>
| | | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 |
if {$rot13} {
set line [rot13 $line]
}
if {$markup} {
html "[markup_art_line $line]\n"
} else {
# make URLs clickable, encode <>
set url_re {https?://[[:alnum:]\-;,/?:@&=+$_.!~*()#%]+}
set line [regsub -all $url_re $line "\x01&\x02"]
set line [enpre $line]
set line [regsub -all {\x01([[:graph:]]+)\x02} $line {<a href='\1' target='_blank'>\1</a>}]
html "$line\n"
}
if {$reflow} {
html "<br/>"
}
}
if {! $reflow} {html "</pre>\n"}
return $html
}
# Convert one article line to html
# (might I be overthinking this?)
proc markup_art_line line {
# First tokenise line into a list of triples:
# text before the token, token type, text of the token.
# Token types are url, begin-emphasis, end-emphasis.
set url_re {(https?://[[:alnum:]\-;,/?:@&=+$_.!~*()#%]+)}
set begin_emp_re {(?:(?:\A|\s)([*/_]+)[[:alnum:]])}
set end_emp_re {(?:[[:alnum:]]([*/_]+)(?:\Z|\s))}
set re "$url_re|$begin_emp_re|$end_emp_re"
set indices [regexp -indices -all -inline -- $re $line]
set start 0
set ::tokens {}
foreach {all url be ee} $indices {
|
| ︙ | ︙ | |||
1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 |
}
# Save user's preferences
proc save_prefs {urec sock} {
lassign $urec user can_post
upvar #0 Httpd$sock data
set query [Url_DecodeQuery $data(query)]
foreach field {blocks groups} {
if {! [dict exists $query $field]} {
return "<br/><em>Save failed: '$field' missing.</em>"
}
set $field [string trim [dict get $query $field]]
dict unset query $field
}
| > > > > > > | 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 |
}
# Save user's preferences
proc save_prefs {urec sock} {
lassign $urec user can_post
upvar #0 Httpd$sock data
set query [Url_DecodeQuery $data(query)]
# Check colour settings are not something dodgy
foreach field {gen_bg gen_fg new_bg new_fg rep_bg rep_fg sel_bg sel_fg quo_bg quo_fg} {
if {[regexp {[^[:alnum:]#]} [dict getdef $query $field {}]]} {
return "<br/><em>Save failed: bad data in '$field'.</em>"
}
}
foreach field {blocks groups} {
if {! [dict exists $query $field]} {
return "<br/><em>Save failed: '$field' missing.</em>"
}
set $field [string trim [dict get $query $field]]
dict unset query $field
}
|
| ︙ | ︙ |