Fossil

Check-in [0c1de587f9]
Login

Check-in [0c1de587f9]

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

Overview
Comment:Enable cache of the CSS style sheet.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | cache-style-sheet
Files: files | file ages | folders
SHA3-256: 0c1de587f974534c1b9bb348eb72a6d5f0322bd71402cf30545a33476e76e75e
User & Date: drh 2025-09-16 10:47:31.679
Context
2025-09-16
10:47
Enable cache of the CSS style sheet. ... (Leaf check-in: 0c1de587f9 user: drh tags: cache-style-sheet)
2025-09-11
21:44
Fix the "Download" submenu item on the /artifact page such that the at= query parameter is the actual basename of the file being downloaded, when available. ... (check-in: b1e811c3e7 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/style.c.
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286


1287
1288







1289
1290
1291
1292
1293
1294
1295
**
** The output from TH1 becomes the style sheet.  Fossil always reports
** that the style sheet is cacheable.
*/
void page_style_css(void){
  Blob css = empty_blob;
  int i;
  const char * zDefaults;
  const char *zSkin;



  cgi_set_content_type("text/css");
  etag_check(0, 0);







  /* Emit all default rules... */
  zDefaults = (const char*)builtin_file("default.css", &i);
  blob_append(&css, zDefaults, i);
  /* Page-specific CSS, if any... */
  page_style_css_append_page_style(&css);
  zSkin = skin_in_use();
  if( zSkin==0 ) zSkin = "this repository";







|

|
>
>


>
>
>
>
>
>
>







1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
**
** The output from TH1 becomes the style sheet.  Fossil always reports
** that the style sheet is cacheable.
*/
void page_style_css(void){
  Blob css = empty_blob;
  int i;
  const char *zDefaults;
  const char *zSkin;
  const char *zRequestUri = P("REQUEST_URI");
  const char *zScriptName = P("SCRIPT_NAME");
  const char *zKey = 0;
  cgi_set_content_type("text/css");
  etag_check(0, 0);
  if( zRequestUri && zScriptName && strlen(zScriptName)<strlen(zRequestUri) ){
    zKey = zRequestUri + strlen(zScriptName);
  }
  if( zKey && cache_read(cgi_output_blob(), zKey) ){
    g.isConst = 1;
    return;
  }
  /* Emit all default rules... */
  zDefaults = (const char*)builtin_file("default.css", &i);
  blob_append(&css, zDefaults, i);
  /* Page-specific CSS, if any... */
  page_style_css_append_page_style(&css);
  zSkin = skin_in_use();
  if( zSkin==0 ) zSkin = "this repository";
1304
1305
1306
1307
1308
1309
1310

1311
1312
1313
1314
1315
1316
1317
  */
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL);
  Th_Store("home", g.zTop);
  image_url_var("logo");
  image_url_var("background");
  Th_Render(blob_str(&css));

  blob_reset(&css);

  /* Tell CGI that the content returned by this page is considered cacheable */
  g.isConst = 1;
}

/*







>







1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
  */
  Th_Store("baseurl", g.zBaseURL);
  Th_Store("secureurl", fossil_wants_https(1)? g.zHttpsURL: g.zBaseURL);
  Th_Store("home", g.zTop);
  image_url_var("logo");
  image_url_var("background");
  Th_Render(blob_str(&css));
  if( zKey ) cache_write(cgi_output_blob(), zKey);
  blob_reset(&css);

  /* Tell CGI that the content returned by this page is considered cacheable */
  g.isConst = 1;
}

/*