Fossil

Check-in [bc407074]
Login

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

Overview
Comment:Replaced style.css?page=xxx with style.css/page, like the [style-css-revamp] branch does.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fileedit-ajaxify
Files: files | file ages | folders
SHA3-256: bc40707425060bdad3bf2c4dea9a9ae5dcc9a562ab9f982e33845107c4a1a6d8
User & Date: stephan 2020-05-18 03:41:00
Context
2020-05-18
05:19
Added optional fossil.fetch() beforesend/aftersend callbacks to allow us to... /efilepage now disables all input elements while AJAX requests are in-flight and updates the page with a 'wait' cursor. check-in: 7e197260 user: stephan tags: fileedit-ajaxify
03:41
Replaced style.css?page=xxx with style.css/page, like the [style-css-revamp] branch does. check-in: bc407074 user: stephan tags: fileedit-ajaxify
03:24
All /fileedit/ajax requests now do a CSRF check and fail with 403 if CSRF seems likely. check-in: 88a69253 user: stephan tags: fileedit-ajaxify
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/style.c.

368
369
370
371
372
373
374
375
376


377
378
379
380
381
382
383
384
385
386
387
388
389

390
391
392
393
394
395
396
397
398
399
400
....
1080
1081
1082
1083
1084
1085
1086
1087








1088
1089
1090
1091
1092
1093
1094
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){
  char *zVarName = mprintf("%s_url", zVarPrefix);
  char *zExtra = 0;
  char *zUrl = 0;


  if(0==strcmp("css",zConfigName)){
    /* Account for page-specific CSS, appending a page=NAME url flag
    ** only if we have a corresponding built-in page-specific CSS
    ** file. Do not append it to all pages because we would
    ** effectively cache-bust all pages which do not have
    ** page-specific CSS. */
    char * zBuiltin = mprintf("style.%s.css", g.zPath);
    if(builtin_file(zBuiltin,0)!=0){
      zExtra = mprintf("&page=%s", g.zPath);
    }
    fossil_free(zBuiltin);
  }
  zUrl = mprintf("%R/%s?id=%x%s", zPageName,

                 skin_id(zConfigName),
                 zExtra ? zExtra : "");
  Th_Store(zVarName, zUrl);
  fossil_free(zExtra);
  fossil_free(zUrl);
  fossil_free(zVarName);
}

/*
** Create a TH1 variable containing the URL for the specified config image.
** The resulting variable name will be of the form $[zImageName]_image_url.
................................................................................
**
** Return the style sheet.
*/
void page_style_css(void){
  Blob css = empty_blob;
  int i;
  int isInit = 0;
  const char * zPage = P("page");









  cgi_set_content_type("text/css");
  if(zPage!=0 && zPage[0]!=0
     && strlen(zPage)<30/*marginal safety measure vs malicious input*/){
    /* Check for page-specific CSS. The placement of this CSS is kinda
    ** tricky. It "very probably needs" to come before any
    ** skin-supplied CSS, but if it does then a system-level skin







<
|
>
>

|
|




|
<
<


|
>
|
<

<







 







|
>
>
>
>
>
>
>
>







368
369
370
371
372
373
374

375
376
377
378
379
380
381
382
383
384
385


386
387
388
389
390

391

392
393
394
395
396
397
398
....
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
*/
static void url_var(
  const char *zVarPrefix,
  const char *zConfigName,
  const char *zPageName
){
  char *zVarName = mprintf("%s_url", zVarPrefix);

  char *zUrl = 0;              /* stylesheet URL */
  int hasBuiltin = 0;          /* true for built-in page-specific CSS */

  if(0==strcmp("css",zConfigName)){
    /* Account for page-specific CSS, appending a /{{g.zPath}} to the
    ** url only if we have a corresponding built-in page-specific CSS
    ** file. Do not append it to all pages because we would
    ** effectively cache-bust all pages which do not have
    ** page-specific CSS. */
    char * zBuiltin = mprintf("style.%s.css", g.zPath);
    hasBuiltin = builtin_file(zBuiltin,0)!=0;


    fossil_free(zBuiltin);
  }
  zUrl = mprintf("%R/%s%s%s?id=%x", zPageName,
                 hasBuiltin ? "/" : "", hasBuiltin ? g.zPath : "",
                 skin_id(zConfigName));

  Th_Store(zVarName, zUrl);

  fossil_free(zUrl);
  fossil_free(zVarName);
}

/*
** Create a TH1 variable containing the URL for the specified config image.
** The resulting variable name will be of the form $[zImageName]_image_url.
................................................................................
**
** Return the style sheet.
*/
void page_style_css(void){
  Blob css = empty_blob;
  int i;
  int isInit = 0;
  const char * zPage = P("name")
    /* FIXME: our reliance on P("name") will merge-conflict with the
       [style-css-revamp] branch, at which time we need to adopt its
       version of this function. The problem with doing that *now* is
       that it requires new functionality in cgi.c and url.c which was
       added for that purposes, which we don't dare merge into here
       until that branch is vetted and merged. That branch's whole
       approach to the ordering of CSS is different than this one
       (which is based on the current trunk). */;

  cgi_set_content_type("text/css");
  if(zPage!=0 && zPage[0]!=0
     && strlen(zPage)<30/*marginal safety measure vs malicious input*/){
    /* Check for page-specific CSS. The placement of this CSS is kinda
    ** tricky. It "very probably needs" to come before any
    ** skin-supplied CSS, but if it does then a system-level skin