Fossil

Check-in [09ee2c8e71]
Login

Check-in [09ee2c8e71]

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

Overview
Comment:Extend test-chat-formatter to be able to render both wiki and markdown.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fts5-chat-search
Files: files | file ages | folders
SHA3-256: 09ee2c8e718a8a05e767442841c0feffce621511d6a374c71ff5931b6c928de8
User & Date: stephan 2024-06-30 09:59:57.626
Context
2024-06-30
10:47
Ensure that that the chatfts1 table and triggers are created in the repository db, rather than the main db, else it breaks when running via the ui command (where the checkout is the main db). ... (check-in: cdbdaee642 user: stephan tags: fts5-chat-search)
09:59
Extend test-chat-formatter to be able to render both wiki and markdown. ... (check-in: 09ee2c8e71 user: stephan tags: fts5-chat-search)
09:25
Elide the chat-timeline-user's entries from /chat-search results. We would ideally elide those from the fts index altogether, but that name can be changed at any time and such a change would leave the fts update trigger out of sync. ... (check-in: 1d64640ec7 user: stephan tags: fts5-chat-search)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/chat.c.
504
505
506
507
508
509
510
511
512
513
514
515
516




517
518
519
520

521
522
523
524
525
526
527
528
529
530
531
532
  }
  return blob_str(&out);
}

/*
** COMMAND: test-chat-formatter
**
** Usage: %fossil test-chat-formatter STRING ...
**
** Transform each argument string into HTML that will display the
** chat message.  This is used to test the formatter and to verify
** that a malicious message text will not cause HTML or JS injection
** into the chat display in a browser.




*/
void chat_test_formatter_cmd(void){
  int i;
  char *zOut;

  db_find_and_open_repository(0,0);
  g.perm.Hyperlink = 1;
  for(i=0; i<g.argc; i++){
    zOut = chat_format_to_html(g.argv[i], 0);
    fossil_print("[%d]: %s\n", i, zOut);
    fossil_free(zOut);
  }
}

/*
**
*/







|





>
>
>
>




>


|
|
|







504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
  }
  return blob_str(&out);
}

/*
** COMMAND: test-chat-formatter
**
** Usage: %fossil test-chat-formatter ?OPTIONS? STRING ...
**
** Transform each argument string into HTML that will display the
** chat message.  This is used to test the formatter and to verify
** that a malicious message text will not cause HTML or JS injection
** into the chat display in a browser.
**
** Options:
**
**     -w|--wiki     Assume fossil wiki format instead of markdown
*/
void chat_test_formatter_cmd(void){
  int i;
  char *zOut;
  int const isWiki = find_option("w","wiki",0)!=0;
  db_find_and_open_repository(0,0);
  g.perm.Hyperlink = 1;
  for(i=2; i<g.argc; i++){
    zOut = chat_format_to_html(g.argv[i], isWiki);
    fossil_print("[%d]: %s\n", i-1, zOut);
    fossil_free(zOut);
  }
}

/*
**
*/