Newsgrouper

Check-in [f506195be1]
Login

Check-in [f506195be1]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make tops page accessible without login, etc.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f506195be1d2b9609544b8564437c0de892cc363
User & Date: cmacleod 2025-09-27 14:33:07.809
Context
2025-09-27
14:47
Check in scripts used in migration from sequential to timestamp numbering within groups. check-in: 2b48af5c9d user: cmacleod tags: trunk
14:33
Make tops page accessible without login, etc. check-in: f506195be1 user: cmacleod tags: trunk
2025-09-26
01:39
Switch numbering of posts within a group to dat timestamps instead of sequential numbering. check-in: 0221292f43 user: cmacleod tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to scripts/newshub.
385
386
387
388
389
390
391

392
393
394
395
396
397
398
    return [join [distcl::get redis na mid $msgid] \n]
}

proc get_hdrs {grpid upto} {
    set ::msgid2num [dict create]
    set ::missing_ref 0
    set hdrs {}

    set limit 500

    set sql {SELECT sub,frm,dat,msgid,prev,num FROM over WHERE grpid==$grpid }
    #if {$sub ne {}} {set sub %$sub%; append sql {AND sub LIKE $sub }}
    #if {$frm ne {}} {set frm %$frm%; append sql {AND frm LIKE $frm }}
    if {$upto} {append sql {AND dat <= $upto }}
    append sql {ORDER BY dat DESC}







>







385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
    return [join [distcl::get redis na mid $msgid] \n]
}

proc get_hdrs {grpid upto} {
    set ::msgid2num [dict create]
    set ::missing_ref 0
    set hdrs {}
    set rev_hdrs {}
    set limit 500

    set sql {SELECT sub,frm,dat,msgid,prev,num FROM over WHERE grpid==$grpid }
    #if {$sub ne {}} {set sub %$sub%; append sql {AND sub LIKE $sub }}
    #if {$frm ne {}} {set frm %$frm%; append sql {AND frm LIKE $frm }}
    if {$upto} {append sql {AND dat <= $upto }}
    append sql {ORDER BY dat DESC}
Changes to server/news_code.tcl.
80
81
82
83
84
85
86


87
88
89
90
91
92
93
    # If user is not logged in, show the login page
    set urec [get_user_record $sock]
    lassign $urec user can_post params

    if {[regexp {^%3C[[:graph:]]+@[[:graph:]]+%3E$} $suffix]} {
        tailcall do_msgid_art $urec $sock $suffix
    }


    if {$user == 0} {
        if {[hack_attack $sock $suffix]} return
        tailcall show_login $sock $suffix
    }

    if {[dict getdef $params banned 0]} {
        Httpd_Error $sock 403 BANNED







>
>







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
    # If user is not logged in, show the login page
    set urec [get_user_record $sock]
    lassign $urec user can_post params

    if {[regexp {^%3C[[:graph:]]+@[[:graph:]]+%3E$} $suffix]} {
        tailcall do_msgid_art $urec $sock $suffix
    }
    if {$suffix == {tops}} {tailcall do_tops $urec $sock}

    if {$user == 0} {
        if {[hack_attack $sock $suffix]} return
        tailcall show_login $sock $suffix
    }

    if {[dict getdef $params banned 0]} {
        Httpd_Error $sock 403 BANNED
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    switch -regexp -matchvar matches $suffix {
    {^$} {
        html [general_info $urec]
        html [show_groups_read $urec $sock]
        html [show_group_search]
        html [show_msgid_search]
        html [other_info] }
    {^tops$} {
        html [top_groups_read]
        html [top_groups_posted]
        html [big8_active_list] }
    {^post$} {
        html [do_post $urec $sock] }
    {^block$} {
        tailcall save_block $urec $sock }
    {^login$} {
        tailcall show_login $sock $suffix }
    {^logout$} {







<
<
<
<







106
107
108
109
110
111
112




113
114
115
116
117
118
119
    switch -regexp -matchvar matches $suffix {
    {^$} {
        html [general_info $urec]
        html [show_groups_read $urec $sock]
        html [show_group_search]
        html [show_msgid_search]
        html [other_info] }




    {^post$} {
        html [do_post $urec $sock] }
    {^block$} {
        tailcall save_block $urec $sock }
    {^login$} {
        tailcall show_login $sock $suffix }
    {^logout$} {
629
630
631
632
633
634
635










636
637
638
639
640
641
642

    if {[catch {get nh mid $msgid} art]} {
        html "<h4>Article Not Found.</h4>"
    } else {
        lassign [parse_article $art] headers body
        html [show_article $urec $headers $body]
    }










    html {</body>}
    Httpd_ReturnData $sock {text/html; charset=utf-8} [encoding convertto $html]
}

proc other_info {} {
    html {<h3><a href='/tops'>Guide to the most active groups</a></h3>}
    html {<h3>Support Group for this site: 







>
>
>
>
>
>
>
>
>
>







627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650

    if {[catch {get nh mid $msgid} art]} {
        html "<h4>Article Not Found.</h4>"
    } else {
        lassign [parse_article $art] headers body
        html [show_article $urec $headers $body]
    }
    html {</body>}
    Httpd_ReturnData $sock {text/html; charset=utf-8} [encoding convertto $html]
}

proc do_tops {urec sock} {
    lassign $urec user can_post params
    html [heading $params]
    html [top_groups_read]
    html [top_groups_posted]
    html [big8_active_list]
    html {</body>}
    Httpd_ReturnData $sock {text/html; charset=utf-8} [encoding convertto $html]
}

proc other_info {} {
    html {<h3><a href='/tops'>Guide to the most active groups</a></h3>}
    html {<h3>Support Group for this site: 
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
        }
    }
    foreach hdr {From Newsgroups Subject Date} {
        set field($hdr) [dict getdef $headers $hdr {}]
        catch {set field($hdr) [::mime::field_decode $field($hdr)]}
        html "<em>${hdr}: [enpre $field($hdr)]</em><br/>\n"
    }
    html "<br/>\n"
    if {! $reflow} {html "<pre>\n"}
    set in_quote 0
    foreach line $body {
        if {[string index $line 0] eq {>}} {
	    if {! $in_quote} {html {<div class='quot'>}} 
	    set in_quote 1
	} else {







|







1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
        }
    }
    foreach hdr {From Newsgroups Subject Date} {
        set field($hdr) [dict getdef $headers $hdr {}]
        catch {set field($hdr) [::mime::field_decode $field($hdr)]}
        html "<em>${hdr}: [enpre $field($hdr)]</em><br/>\n"
    }
    #html "<br/>\n"
    if {! $reflow} {html "<pre>\n"}
    set in_quote 0
    foreach line $body {
        if {[string index $line 0] eq {>}} {
	    if {! $in_quote} {html {<div class='quot'>}} 
	    set in_quote 1
	} else {