Fossil SCM

Further improvements to the artifact receipt log.

drh 2014-12-01 21:16 UTC DBP-workflow
Commit ca2f1e4e29994cd1645b204e36f7ee36bf6d721b
2 files changed +3 -3 +26 -8
+3 -3
--- src/setup.c
+++ src/setup.c
@@ -105,15 +105,15 @@
105105
"Edit HTML text for an ad unit inserted after the menu bar");
106106
setup_menu_entry("Logo", "setup_logo",
107107
"Change the logo and background images for the server");
108108
setup_menu_entry("Shunned", "shun",
109109
"Show artifacts that are shunned by this repository");
110
- setup_menu_entry("Log", "rcvfromlist",
110
+ setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
111111
"A record of received artifacts and their sources");
112
- setup_menu_entry("User-Log", "access_log",
112
+ setup_menu_entry("User Log", "access_log",
113113
"A record of login attempts");
114
- setup_menu_entry("Admin-Log", "admin_log",
114
+ setup_menu_entry("Administrative Log", "admin_log",
115115
"View the admin_log entries");
116116
setup_menu_entry("Stats", "stat",
117117
"Display repository statistics");
118118
setup_menu_entry("SQL", "admin_sql",
119119
"Enter raw SQL commands");
120120
--- src/setup.c
+++ src/setup.c
@@ -105,15 +105,15 @@
105 "Edit HTML text for an ad unit inserted after the menu bar");
106 setup_menu_entry("Logo", "setup_logo",
107 "Change the logo and background images for the server");
108 setup_menu_entry("Shunned", "shun",
109 "Show artifacts that are shunned by this repository");
110 setup_menu_entry("Log", "rcvfromlist",
111 "A record of received artifacts and their sources");
112 setup_menu_entry("User-Log", "access_log",
113 "A record of login attempts");
114 setup_menu_entry("Admin-Log", "admin_log",
115 "View the admin_log entries");
116 setup_menu_entry("Stats", "stat",
117 "Display repository statistics");
118 setup_menu_entry("SQL", "admin_sql",
119 "Enter raw SQL commands");
120
--- src/setup.c
+++ src/setup.c
@@ -105,15 +105,15 @@
105 "Edit HTML text for an ad unit inserted after the menu bar");
106 setup_menu_entry("Logo", "setup_logo",
107 "Change the logo and background images for the server");
108 setup_menu_entry("Shunned", "shun",
109 "Show artifacts that are shunned by this repository");
110 setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
111 "A record of received artifacts and their sources");
112 setup_menu_entry("User Log", "access_log",
113 "A record of login attempts");
114 setup_menu_entry("Administrative Log", "admin_log",
115 "View the admin_log entries");
116 setup_menu_entry("Stats", "stat",
117 "Display repository statistics");
118 setup_menu_entry("SQL", "admin_sql",
119 "Enter raw SQL commands");
120
+26 -8
--- src/shun.c
+++ src/shun.c
@@ -295,37 +295,50 @@
295295
**
296296
** Show a listing of RCVFROM table entries.
297297
*/
298298
void rcvfromlist_page(void){
299299
int ofst = atoi(PD("ofst","0"));
300
+ int showAll = P("all")!=0;
300301
int cnt;
301302
Stmt q;
302303
303304
login_check_credentials();
304305
if( !g.perm.Admin ){
305306
login_needed();
306307
}
307
- style_header("Content Sources");
308
+ style_header("Artifact Receipts");
309
+ if( showAll ){
310
+ ofst = 0;
311
+ }else{
312
+ style_submenu_element("All", "All", "rcvfromlist?all=1");
313
+ }
308314
if( ofst>0 ){
309315
style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
310316
ofst>30 ? ofst-30 : 0);
311317
}
318
+ db_multi_exec(
319
+ "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);"
320
+ "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;"
321
+ );
312322
db_prepare(&q,
313
- "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
323
+ "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr,"
324
+ " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)"
314325
" FROM rcvfrom LEFT JOIN user USING(uid)"
315
- " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
316
- ofst
326
+ " ORDER BY rcvid DESC LIMIT %d OFFSET %d",
327
+ showAll ? -1 : 31, ofst
317328
);
318329
@ <p>Whenever new artifacts are added to the repository, either by
319330
@ push or using the web interface, an entry is made in the RCVFROM table
320331
@ to record the source of that artifact. This log facilitates
321332
@ finding and fixing attempts to inject illicit content into the
322333
@ repository.</p>
323334
@
324335
@ <p>Click on the "rcvid" to show a list of specific artifacts received
325336
@ by a transaction. After identifying illicit artifacts, remove them
326
- @ using the "Shun" feature.</p>
337
+ @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means
338
+ @ all artifacts associated with that rcvid have already been shunned
339
+ @ or purged.</p>
327340
@
328341
@ <table cellpadding="0" cellspacing="0" border="0">
329342
@ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
330343
@ <th style="padding-right: 15px;text-align: left;">Date</th>
331344
@ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -334,17 +347,22 @@
334347
while( db_step(&q)==SQLITE_ROW ){
335348
int rcvid = db_column_int(&q, 0);
336349
const char *zUser = db_column_text(&q, 1);
337350
const char *zDate = db_column_text(&q, 2);
338351
const char *zIpAddr = db_column_text(&q, 3);
339
- if( cnt==30 ){
352
+ if( cnt==30 && !showAll ){
340353
style_submenu_element("Older", "Older",
341354
"rcvfromlist?ofst=%d", ofst+30);
342355
}else{
343356
cnt++;
344357
@ <tr>
345
- @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
358
+ if( db_column_int(&q,4) ){
359
+ @ <td style="padding-right: 15px;text-align: right;">
360
+ @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
361
+ }else{
362
+ @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td>
363
+ }
346364
@ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
347365
@ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
348366
@ <td style="text-align: left;">%s(zIpAddr)</td>
349367
@ </tr>
350368
}
@@ -365,11 +383,11 @@
365383
366384
login_check_credentials();
367385
if( !g.perm.Admin ){
368386
login_needed();
369387
}
370
- style_header("Content Source %d", rcvid);
388
+ style_header("Artifact Receipt %d", rcvid);
371389
if( db_exists(
372390
"SELECT 1 FROM blob WHERE rcvid=%d AND"
373391
" NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
374392
){
375393
style_submenu_element("Shun All", "Shun All",
376394
--- src/shun.c
+++ src/shun.c
@@ -295,37 +295,50 @@
295 **
296 ** Show a listing of RCVFROM table entries.
297 */
298 void rcvfromlist_page(void){
299 int ofst = atoi(PD("ofst","0"));
 
300 int cnt;
301 Stmt q;
302
303 login_check_credentials();
304 if( !g.perm.Admin ){
305 login_needed();
306 }
307 style_header("Content Sources");
 
 
 
 
 
308 if( ofst>0 ){
309 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
310 ofst>30 ? ofst-30 : 0);
311 }
 
 
 
 
312 db_prepare(&q,
313 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr"
 
314 " FROM rcvfrom LEFT JOIN user USING(uid)"
315 " ORDER BY rcvid DESC LIMIT 31 OFFSET %d",
316 ofst
317 );
318 @ <p>Whenever new artifacts are added to the repository, either by
319 @ push or using the web interface, an entry is made in the RCVFROM table
320 @ to record the source of that artifact. This log facilitates
321 @ finding and fixing attempts to inject illicit content into the
322 @ repository.</p>
323 @
324 @ <p>Click on the "rcvid" to show a list of specific artifacts received
325 @ by a transaction. After identifying illicit artifacts, remove them
326 @ using the "Shun" feature.</p>
 
 
327 @
328 @ <table cellpadding="0" cellspacing="0" border="0">
329 @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
330 @ <th style="padding-right: 15px;text-align: left;">Date</th>
331 @ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -334,17 +347,22 @@
334 while( db_step(&q)==SQLITE_ROW ){
335 int rcvid = db_column_int(&q, 0);
336 const char *zUser = db_column_text(&q, 1);
337 const char *zDate = db_column_text(&q, 2);
338 const char *zIpAddr = db_column_text(&q, 3);
339 if( cnt==30 ){
340 style_submenu_element("Older", "Older",
341 "rcvfromlist?ofst=%d", ofst+30);
342 }else{
343 cnt++;
344 @ <tr>
345 @ <td style="padding-right: 15px;text-align: right;"><a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
 
 
 
 
 
346 @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
347 @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
348 @ <td style="text-align: left;">%s(zIpAddr)</td>
349 @ </tr>
350 }
@@ -365,11 +383,11 @@
365
366 login_check_credentials();
367 if( !g.perm.Admin ){
368 login_needed();
369 }
370 style_header("Content Source %d", rcvid);
371 if( db_exists(
372 "SELECT 1 FROM blob WHERE rcvid=%d AND"
373 " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
374 ){
375 style_submenu_element("Shun All", "Shun All",
376
--- src/shun.c
+++ src/shun.c
@@ -295,37 +295,50 @@
295 **
296 ** Show a listing of RCVFROM table entries.
297 */
298 void rcvfromlist_page(void){
299 int ofst = atoi(PD("ofst","0"));
300 int showAll = P("all")!=0;
301 int cnt;
302 Stmt q;
303
304 login_check_credentials();
305 if( !g.perm.Admin ){
306 login_needed();
307 }
308 style_header("Artifact Receipts");
309 if( showAll ){
310 ofst = 0;
311 }else{
312 style_submenu_element("All", "All", "rcvfromlist?all=1");
313 }
314 if( ofst>0 ){
315 style_submenu_element("Newer", "Newer", "rcvfromlist?ofst=%d",
316 ofst>30 ? ofst-30 : 0);
317 }
318 db_multi_exec(
319 "CREATE TEMP TABLE rcvidUsed(x INTEGER PRIMARY KEY);"
320 "INSERT OR IGNORE INTO rcvidUsed(x) SELECT rcvid FROM blob;"
321 );
322 db_prepare(&q,
323 "SELECT rcvid, login, datetime(rcvfrom.mtime), rcvfrom.ipaddr,"
324 " EXISTS(SELECT 1 FROM rcvidUsed WHERE x=rcvfrom.rcvid)"
325 " FROM rcvfrom LEFT JOIN user USING(uid)"
326 " ORDER BY rcvid DESC LIMIT %d OFFSET %d",
327 showAll ? -1 : 31, ofst
328 );
329 @ <p>Whenever new artifacts are added to the repository, either by
330 @ push or using the web interface, an entry is made in the RCVFROM table
331 @ to record the source of that artifact. This log facilitates
332 @ finding and fixing attempts to inject illicit content into the
333 @ repository.</p>
334 @
335 @ <p>Click on the "rcvid" to show a list of specific artifacts received
336 @ by a transaction. After identifying illicit artifacts, remove them
337 @ using the "Shun" button. If an "rcvid" is not hyperlinked, that means
338 @ all artifacts associated with that rcvid have already been shunned
339 @ or purged.</p>
340 @
341 @ <table cellpadding="0" cellspacing="0" border="0">
342 @ <tr><th style="padding-right: 15px;text-align: right;">rcvid</th>
343 @ <th style="padding-right: 15px;text-align: left;">Date</th>
344 @ <th style="padding-right: 15px;text-align: left;">User</th>
@@ -334,17 +347,22 @@
347 while( db_step(&q)==SQLITE_ROW ){
348 int rcvid = db_column_int(&q, 0);
349 const char *zUser = db_column_text(&q, 1);
350 const char *zDate = db_column_text(&q, 2);
351 const char *zIpAddr = db_column_text(&q, 3);
352 if( cnt==30 && !showAll ){
353 style_submenu_element("Older", "Older",
354 "rcvfromlist?ofst=%d", ofst+30);
355 }else{
356 cnt++;
357 @ <tr>
358 if( db_column_int(&q,4) ){
359 @ <td style="padding-right: 15px;text-align: right;">
360 @ <a href="rcvfrom?rcvid=%d(rcvid)">%d(rcvid)</a></td>
361 }else{
362 @ <td style="padding-right: 15px;text-align: right;">%d(rcvid)</td>
363 }
364 @ <td style="padding-right: 15px;text-align: left;">%s(zDate)</td>
365 @ <td style="padding-right: 15px;text-align: left;">%h(zUser)</td>
366 @ <td style="text-align: left;">%s(zIpAddr)</td>
367 @ </tr>
368 }
@@ -365,11 +383,11 @@
383
384 login_check_credentials();
385 if( !g.perm.Admin ){
386 login_needed();
387 }
388 style_header("Artifact Receipt %d", rcvid);
389 if( db_exists(
390 "SELECT 1 FROM blob WHERE rcvid=%d AND"
391 " NOT EXISTS (SELECT 1 FROM shun WHERE shun.uuid=blob.uuid)", rcvid)
392 ){
393 style_submenu_element("Shun All", "Shun All",
394

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button